From 07274513e984f0b5544586c74508ccd16e7dcafa Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Sun, 13 Jan 2013 17:29:19 +1000 Subject: Remove EFL, since it's been released now. --- libraries/ecore/src/lib/ecore_x/xlib/Makefile.am | 94 - libraries/ecore/src/lib/ecore_x/xlib/Makefile.in | 888 ------- libraries/ecore/src/lib/ecore_x/xlib/ecore_x.c | 2098 ----------------- .../ecore/src/lib/ecore_x/xlib/ecore_x_atoms.c | 367 --- .../ecore/src/lib/ecore_x/xlib/ecore_x_composite.c | 176 -- .../ecore/src/lib/ecore_x/xlib/ecore_x_cursor.c | 246 -- .../ecore/src/lib/ecore_x/xlib/ecore_x_damage.c | 71 - libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dnd.c | 706 ------ .../ecore/src/lib/ecore_x/xlib/ecore_x_dpms.c | 247 -- .../ecore/src/lib/ecore_x/xlib/ecore_x_drawable.c | 118 - libraries/ecore/src/lib/ecore_x/xlib/ecore_x_e.c | 1293 ---------- .../ecore/src/lib/ecore_x/xlib/ecore_x_error.c | 125 - .../ecore/src/lib/ecore_x/xlib/ecore_x_events.c | 2487 -------------------- .../ecore/src/lib/ecore_x/xlib/ecore_x_fixes.c | 365 --- libraries/ecore/src/lib/ecore_x/xlib/ecore_x_gc.c | 171 -- .../ecore/src/lib/ecore_x/xlib/ecore_x_gesture.c | 136 -- .../ecore/src/lib/ecore_x/xlib/ecore_x_icccm.c | 1214 ---------- .../ecore/src/lib/ecore_x/xlib/ecore_x_image.c | 600 ----- libraries/ecore/src/lib/ecore_x/xlib/ecore_x_mwm.c | 106 - .../ecore/src/lib/ecore_x/xlib/ecore_x_netwm.c | 2056 ---------------- .../ecore/src/lib/ecore_x/xlib/ecore_x_pixmap.c | 121 - .../ecore/src/lib/ecore_x/xlib/ecore_x_private.h | 385 --- .../ecore/src/lib/ecore_x/xlib/ecore_x_randr.c | 102 - .../ecore/src/lib/ecore_x/xlib/ecore_x_randr.h | 7 - .../ecore/src/lib/ecore_x/xlib/ecore_x_randr_11.c | 335 --- .../ecore/src/lib/ecore_x/xlib/ecore_x_randr_12.c | 2360 ------------------- .../src/lib/ecore_x/xlib/ecore_x_randr_12_edid.c | 463 ---- .../ecore/src/lib/ecore_x/xlib/ecore_x_randr_13.c | 68 - .../ecore/src/lib/ecore_x/xlib/ecore_x_region.c | 158 -- .../src/lib/ecore_x/xlib/ecore_x_screensaver.c | 173 -- .../ecore/src/lib/ecore_x/xlib/ecore_x_selection.c | 1002 -------- .../ecore/src/lib/ecore_x/xlib/ecore_x_sync.c | 159 -- .../ecore/src/lib/ecore_x/xlib/ecore_x_test.c | 167 -- .../ecore/src/lib/ecore_x/xlib/ecore_x_vsync.c | 351 --- .../ecore/src/lib/ecore_x/xlib/ecore_x_window.c | 1723 -------------- .../src/lib/ecore_x/xlib/ecore_x_window_prop.c | 752 ------ .../src/lib/ecore_x/xlib/ecore_x_window_shape.c | 658 ------ libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xi2.c | 283 --- .../ecore/src/lib/ecore_x/xlib/ecore_x_xinerama.c | 91 - 39 files changed, 22922 deletions(-) delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/Makefile.am delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/Makefile.in delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x.c delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_atoms.c delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_composite.c delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_cursor.c delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_damage.c delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dnd.c delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dpms.c delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_drawable.c delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_e.c delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_error.c delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_events.c delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_fixes.c delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_gc.c delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_gesture.c delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_icccm.c delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_image.c delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_mwm.c delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_netwm.c delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_pixmap.c delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_private.h delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr.c delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr.h delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_11.c delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12.c delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12_edid.c delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_13.c delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_region.c delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_screensaver.c delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_selection.c delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_sync.c delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_test.c delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_vsync.c delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window.c delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window_prop.c delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window_shape.c delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xi2.c delete mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xinerama.c (limited to 'libraries/ecore/src/lib/ecore_x/xlib') diff --git a/libraries/ecore/src/lib/ecore_x/xlib/Makefile.am b/libraries/ecore/src/lib/ecore_x/xlib/Makefile.am deleted file mode 100644 index 3c7364c..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/Makefile.am +++ /dev/null @@ -1,94 +0,0 @@ - -MAINTAINERCLEANFILES = Makefile.in - -if BUILD_ECORE_X_XLIB - -AM_CPPFLAGS = \ -@Xcursor_cflags@ \ -@XKB_CFLAGS@ \ -@XDAMAGE_CFLAGS@ \ -@XCOMPOSITE_CFLAGS@ \ -@XGESTURE_CFLAGS@ \ -@XDPMS_CFLAGS@ \ -@XFIXES_CFLAGS@ \ -@XI2_CFLAGS@ \ -@XINERAMA_CFLAGS@ \ -@XPRINT_CFLAGS@ \ -@XRANDR_CFLAGS@ \ -@XRENDER_CFLAGS@ \ -@XSS_CFLAGS@ \ -@XTEST_CFLAGS@ \ -@x_cflags@ \ --I$(top_srcdir)/src/lib/ecore \ --I$(top_srcdir)/src/lib/ecore_x \ --I$(top_srcdir)/src/lib/ecore_input \ --I$(top_builddir)/src/lib/ecore \ --I$(top_builddir)/src/lib/ecore_x \ --I$(top_builddir)/src/lib/ecore_input \ -@EVAS_CFLAGS@ \ -@EINA_CFLAGS@ - -noinst_LTLIBRARIES = libecore_x_xlib.la - -libecore_x_xlib_la_SOURCES = \ -ecore_x.c \ -ecore_x_dnd.c \ -ecore_x_sync.c \ -ecore_x_randr.c \ -ecore_x_randr_11.c \ -ecore_x_randr_12.c \ -ecore_x_randr_12_edid.c \ -ecore_x_randr_13.c \ -ecore_x_fixes.c \ -ecore_x_damage.c \ -ecore_x_composite.c \ -ecore_x_error.c \ -ecore_x_events.c \ -ecore_x_icccm.c \ -ecore_x_netwm.c \ -ecore_x_mwm.c \ -ecore_x_e.c \ -ecore_x_selection.c \ -ecore_x_window.c \ -ecore_x_window_prop.c \ -ecore_x_window_shape.c \ -ecore_x_pixmap.c \ -ecore_x_gc.c \ -ecore_x_xinerama.c \ -ecore_x_screensaver.c \ -ecore_x_dpms.c \ -ecore_x_drawable.c \ -ecore_x_cursor.c \ -ecore_x_test.c \ -ecore_x_atoms.c \ -ecore_x_region.c \ -ecore_x_image.c \ -ecore_x_xi2.c \ -ecore_x_vsync.c \ -ecore_x_randr.h \ -ecore_x_gesture.c - -libecore_x_xlib_la_LIBADD = \ -@Xcursor_libs@ \ -@XKB_LIBS@ \ -@XDAMAGE_LIBS@ \ -@XCOMPOSITE_LIBS@ \ -@XGESTURE_LIBS@ \ -@XDPMS_LIBS@ \ -@XFIXES_LIBS@ \ -@XI2_LIBS@ \ -@XINERAMA_LIBS@ \ -@XPRINT_LIBS@ \ -@XRANDR_LIBS@ \ -@XRENDER_LIBS@ \ -@XSS_LIBS@ \ -@XTEST_LIBS@ \ -@x_libs@ \ -$(top_builddir)/src/lib/ecore/libecore.la \ -$(top_builddir)/src/lib/ecore_input/libecore_input.la \ -@EINA_LIBS@ \ -@dlopen_libs@ - -endif - -EXTRA_DIST = ecore_x_private.h diff --git a/libraries/ecore/src/lib/ecore_x/xlib/Makefile.in b/libraries/ecore/src/lib/ecore_x/xlib/Makefile.in deleted file mode 100644 index cada69a..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/Makefile.in +++ /dev/null @@ -1,888 +0,0 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = src/lib/ecore_x/xlib -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ - $(top_srcdir)/m4/ac_path_generic.m4 \ - $(top_srcdir)/m4/check_x_extension.m4 \ - $(top_srcdir)/m4/ecore_check_module.m4 \ - $(top_srcdir)/m4/ecore_check_options.m4 \ - $(top_srcdir)/m4/efl_compiler_flag.m4 \ - $(top_srcdir)/m4/efl_doxygen.m4 \ - $(top_srcdir)/m4/efl_examples.m4 \ - $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ - $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) -@BUILD_ECORE_X_XLIB_TRUE@libecore_x_xlib_la_DEPENDENCIES = $(top_builddir)/src/lib/ecore/libecore.la \ -@BUILD_ECORE_X_XLIB_TRUE@ $(top_builddir)/src/lib/ecore_input/libecore_input.la -am__libecore_x_xlib_la_SOURCES_DIST = ecore_x.c ecore_x_dnd.c \ - ecore_x_sync.c ecore_x_randr.c ecore_x_randr_11.c \ - ecore_x_randr_12.c ecore_x_randr_12_edid.c ecore_x_randr_13.c \ - ecore_x_fixes.c ecore_x_damage.c ecore_x_composite.c \ - ecore_x_error.c ecore_x_events.c ecore_x_icccm.c \ - ecore_x_netwm.c ecore_x_mwm.c ecore_x_e.c ecore_x_selection.c \ - ecore_x_window.c ecore_x_window_prop.c ecore_x_window_shape.c \ - ecore_x_pixmap.c ecore_x_gc.c ecore_x_xinerama.c \ - ecore_x_screensaver.c ecore_x_dpms.c ecore_x_drawable.c \ - ecore_x_cursor.c ecore_x_test.c ecore_x_atoms.c \ - ecore_x_region.c ecore_x_image.c ecore_x_xi2.c ecore_x_vsync.c \ - ecore_x_randr.h ecore_x_gesture.c -@BUILD_ECORE_X_XLIB_TRUE@am_libecore_x_xlib_la_OBJECTS = ecore_x.lo \ -@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_dnd.lo ecore_x_sync.lo \ -@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_randr.lo ecore_x_randr_11.lo \ -@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_randr_12.lo \ -@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_randr_12_edid.lo \ -@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_randr_13.lo ecore_x_fixes.lo \ -@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_damage.lo \ -@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_composite.lo ecore_x_error.lo \ -@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_events.lo ecore_x_icccm.lo \ -@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_netwm.lo ecore_x_mwm.lo \ -@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_e.lo ecore_x_selection.lo \ -@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_window.lo \ -@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_window_prop.lo \ -@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_window_shape.lo \ -@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_pixmap.lo ecore_x_gc.lo \ -@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_xinerama.lo \ -@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_screensaver.lo \ -@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_dpms.lo ecore_x_drawable.lo \ -@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_cursor.lo ecore_x_test.lo \ -@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_atoms.lo ecore_x_region.lo \ -@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_image.lo ecore_x_xi2.lo \ -@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_vsync.lo ecore_x_gesture.lo -libecore_x_xlib_la_OBJECTS = $(am_libecore_x_xlib_la_OBJECTS) -AM_V_lt = $(am__v_lt_$(V)) -am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) -am__v_lt_0 = --silent -@BUILD_ECORE_X_XLIB_TRUE@am_libecore_x_xlib_la_rpath = -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_$(V)) -am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) -am__v_CC_0 = @echo " CC " $@; -AM_V_at = $(am__v_at_$(V)) -am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) -am__v_at_0 = @ -CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_$(V)) -am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) -am__v_CCLD_0 = @echo " CCLD " $@; -AM_V_GEN = $(am__v_GEN_$(V)) -am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) -am__v_GEN_0 = @echo " GEN " $@; -SOURCES = $(libecore_x_xlib_la_SOURCES) -DIST_SOURCES = $(am__libecore_x_xlib_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CARES_CFLAGS = @CARES_CFLAGS@ -CARES_LIBS = @CARES_LIBS@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CURL_CFLAGS = @CURL_CFLAGS@ -CURL_LIBS = @CURL_LIBS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ -DIRECTFB_LIBS = @DIRECTFB_LIBS@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ -ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ -EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ -EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ -EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ -EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ -EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ -EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ -EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ -EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ -EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ -EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ -EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ -EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ -EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ -EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ -EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ -EGREP = @EGREP@ -EINA_CFLAGS = @EINA_CFLAGS@ -EINA_LIBS = @EINA_LIBS@ -ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ -ESCAPE_LIBS = @ESCAPE_LIBS@ -EVAS_CFLAGS = @EVAS_CFLAGS@ -EVAS_LIBS = @EVAS_LIBS@ -EVIL_CFLAGS = @EVIL_CFLAGS@ -EVIL_LIBS = @EVIL_LIBS@ -EXEEXT = @EXEEXT@ -EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ -EXOTIC_LIBS = @EXOTIC_LIBS@ -FGREP = @FGREP@ -GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_LIBS = @GLIB_LIBS@ -GMSGFMT = @GMSGFMT@ -GMSGFMT_015 = @GMSGFMT_015@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTLLIBS = @INTLLIBS@ -INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ -KEYSYMDEFS = @KEYSYMDEFS@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ -LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ -LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -MSGFMT = @MSGFMT@ -MSGFMT_015 = @MSGFMT_015@ -MSGMERGE = @MSGMERGE@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJC = @OBJC@ -OBJCDEPMODE = @OBJCDEPMODE@ -OBJCFLAGS = @OBJCFLAGS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ -PIXMAN_LIBS = @PIXMAN_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -POSUB = @POSUB@ -RANLIB = @RANLIB@ -SCIM_CFLAGS = @SCIM_CFLAGS@ -SCIM_LIBS = @SCIM_LIBS@ -SDL_CFLAGS = @SDL_CFLAGS@ -SDL_CONFIG = @SDL_CONFIG@ -SDL_LIBS = @SDL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ -SSL_CFLAGS = @SSL_CFLAGS@ -SSL_LIBS = @SSL_LIBS@ -STRIP = @STRIP@ -TLS2_CFLAGS = @TLS2_CFLAGS@ -TLS2_LIBS = @TLS2_LIBS@ -TLS_CFLAGS = @TLS_CFLAGS@ -TLS_LIBS = @TLS_LIBS@ -TSLIB_CFLAGS = @TSLIB_CFLAGS@ -TSLIB_LIBS = @TSLIB_LIBS@ -USE_NLS = @USE_NLS@ -VERSION = @VERSION@ -VMAJ = @VMAJ@ -WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ -WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ -WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ -WAYLAND_LIBS = @WAYLAND_LIBS@ -WIN32_CFLAGS = @WIN32_CFLAGS@ -WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ -WIN32_LIBS = @WIN32_LIBS@ -XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ -XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ -XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ -XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ -XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ -XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ -XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ -XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ -XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ -XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ -XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ -XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ -XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ -XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ -XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ -XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ -XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ -XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ -XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ -XCB_X11_LIBS = @XCB_X11_LIBS@ -XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ -XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ -XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ -XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ -XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ -XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ -XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ -XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ -XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ -XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ -XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ -XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ -XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ -XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ -XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ -XDAMAGE_LIBS = @XDAMAGE_LIBS@ -XDPMS_CFLAGS = @XDPMS_CFLAGS@ -XDPMS_LIBS = @XDPMS_LIBS@ -XFIXES_CFLAGS = @XFIXES_CFLAGS@ -XFIXES_LIBS = @XFIXES_LIBS@ -XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ -XGESTURE_LIBS = @XGESTURE_LIBS@ -XGETTEXT = @XGETTEXT@ -XGETTEXT_015 = @XGETTEXT_015@ -XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ -XI2_CFLAGS = @XI2_CFLAGS@ -XI2_LIBS = @XI2_LIBS@ -XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ -XINERAMA_LIBS = @XINERAMA_LIBS@ -XKB_CFLAGS = @XKB_CFLAGS@ -XKB_LIBS = @XKB_LIBS@ -XMKMF = @XMKMF@ -XPRINT_CFLAGS = @XPRINT_CFLAGS@ -XPRINT_LIBS = @XPRINT_LIBS@ -XRANDR_CFLAGS = @XRANDR_CFLAGS@ -XRANDR_LIBS = @XRANDR_LIBS@ -XRENDER_CFLAGS = @XRENDER_CFLAGS@ -XRENDER_LIBS = @XRENDER_LIBS@ -XSS_CFLAGS = @XSS_CFLAGS@ -XSS_LIBS = @XSS_LIBS@ -XTEST_CFLAGS = @XTEST_CFLAGS@ -XTEST_LIBS = @XTEST_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -Xcursor_cflags = @Xcursor_cflags@ -Xcursor_libs = @Xcursor_libs@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -ac_ct_OBJC = @ac_ct_OBJC@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -cocoa_ldflags = @cocoa_ldflags@ -datadir = @datadir@ -datarootdir = @datarootdir@ -dlopen_libs = @dlopen_libs@ -docdir = @docdir@ -dvidir = @dvidir@ -ecore_cocoa_cflags = @ecore_cocoa_cflags@ -ecore_cocoa_libs = @ecore_cocoa_libs@ -ecore_con_cflags = @ecore_con_cflags@ -ecore_con_libs = @ecore_con_libs@ -ecore_directfb_cflags = @ecore_directfb_cflags@ -ecore_directfb_libs = @ecore_directfb_libs@ -ecore_evas_cflags = @ecore_evas_cflags@ -ecore_evas_libs = @ecore_evas_libs@ -ecore_fb_cflags = @ecore_fb_cflags@ -ecore_fb_libs = @ecore_fb_libs@ -ecore_file_cflags = @ecore_file_cflags@ -ecore_file_libs = @ecore_file_libs@ -ecore_imf_cflags = @ecore_imf_cflags@ -ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ -ecore_imf_evas_libs = @ecore_imf_evas_libs@ -ecore_imf_libs = @ecore_imf_libs@ -ecore_imf_scim_cflags = @ecore_imf_scim_cflags@ -ecore_imf_scim_libs = @ecore_imf_scim_libs@ -ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ -ecore_imf_xim_libs = @ecore_imf_xim_libs@ -ecore_input_cflags = @ecore_input_cflags@ -ecore_input_evas_cflags = @ecore_input_evas_cflags@ -ecore_input_evas_libs = @ecore_input_evas_libs@ -ecore_input_libs = @ecore_input_libs@ -ecore_ipc_cflags = @ecore_ipc_cflags@ -ecore_ipc_libs = @ecore_ipc_libs@ -ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ -ecore_psl1ght_libs = @ecore_psl1ght_libs@ -ecore_sdl_cflags = @ecore_sdl_cflags@ -ecore_sdl_libs = @ecore_sdl_libs@ -ecore_wayland_cflags = @ecore_wayland_cflags@ -ecore_wayland_libs = @ecore_wayland_libs@ -ecore_win32_cflags = @ecore_win32_cflags@ -ecore_win32_libs = @ecore_win32_libs@ -ecore_wince_cflags = @ecore_wince_cflags@ -ecore_wince_libs = @ecore_wince_libs@ -ecore_x_cflags = @ecore_x_cflags@ -ecore_x_libs = @ecore_x_libs@ -ecore_x_libs_private = @ecore_x_libs_private@ -efl_doxygen = @efl_doxygen@ -efl_have_doxygen = @efl_have_doxygen@ -exec_prefix = @exec_prefix@ -have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -lt_enable_auto_import = @lt_enable_auto_import@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -pkgconfig_requires_private = @pkgconfig_requires_private@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -release_info = @release_info@ -requirements_ecore = @requirements_ecore@ -requirements_ecore_cocoa = @requirements_ecore_cocoa@ -requirements_ecore_con = @requirements_ecore_con@ -requirements_ecore_directfb = @requirements_ecore_directfb@ -requirements_ecore_evas = @requirements_ecore_evas@ -requirements_ecore_fb = @requirements_ecore_fb@ -requirements_ecore_file = @requirements_ecore_file@ -requirements_ecore_imf = @requirements_ecore_imf@ -requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ -requirements_ecore_imf_scim = @requirements_ecore_imf_scim@ -requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ -requirements_ecore_input = @requirements_ecore_input@ -requirements_ecore_input_evas = @requirements_ecore_input_evas@ -requirements_ecore_ipc = @requirements_ecore_ipc@ -requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ -requirements_ecore_sdl = @requirements_ecore_sdl@ -requirements_ecore_wayland = @requirements_ecore_wayland@ -requirements_ecore_win32 = @requirements_ecore_win32@ -requirements_ecore_wince = @requirements_ecore_wince@ -requirements_ecore_x = @requirements_ecore_x@ -rt_libs = @rt_libs@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -version_info = @version_info@ -x_cflags = @x_cflags@ -x_includes = @x_includes@ -x_libs = @x_libs@ -MAINTAINERCLEANFILES = Makefile.in -@BUILD_ECORE_X_XLIB_TRUE@AM_CPPFLAGS = \ -@BUILD_ECORE_X_XLIB_TRUE@@Xcursor_cflags@ \ -@BUILD_ECORE_X_XLIB_TRUE@@XKB_CFLAGS@ \ -@BUILD_ECORE_X_XLIB_TRUE@@XDAMAGE_CFLAGS@ \ -@BUILD_ECORE_X_XLIB_TRUE@@XCOMPOSITE_CFLAGS@ \ -@BUILD_ECORE_X_XLIB_TRUE@@XGESTURE_CFLAGS@ \ -@BUILD_ECORE_X_XLIB_TRUE@@XDPMS_CFLAGS@ \ -@BUILD_ECORE_X_XLIB_TRUE@@XFIXES_CFLAGS@ \ -@BUILD_ECORE_X_XLIB_TRUE@@XI2_CFLAGS@ \ -@BUILD_ECORE_X_XLIB_TRUE@@XINERAMA_CFLAGS@ \ -@BUILD_ECORE_X_XLIB_TRUE@@XPRINT_CFLAGS@ \ -@BUILD_ECORE_X_XLIB_TRUE@@XRANDR_CFLAGS@ \ -@BUILD_ECORE_X_XLIB_TRUE@@XRENDER_CFLAGS@ \ -@BUILD_ECORE_X_XLIB_TRUE@@XSS_CFLAGS@ \ -@BUILD_ECORE_X_XLIB_TRUE@@XTEST_CFLAGS@ \ -@BUILD_ECORE_X_XLIB_TRUE@@x_cflags@ \ -@BUILD_ECORE_X_XLIB_TRUE@-I$(top_srcdir)/src/lib/ecore \ -@BUILD_ECORE_X_XLIB_TRUE@-I$(top_srcdir)/src/lib/ecore_x \ -@BUILD_ECORE_X_XLIB_TRUE@-I$(top_srcdir)/src/lib/ecore_input \ -@BUILD_ECORE_X_XLIB_TRUE@-I$(top_builddir)/src/lib/ecore \ -@BUILD_ECORE_X_XLIB_TRUE@-I$(top_builddir)/src/lib/ecore_x \ -@BUILD_ECORE_X_XLIB_TRUE@-I$(top_builddir)/src/lib/ecore_input \ -@BUILD_ECORE_X_XLIB_TRUE@@EVAS_CFLAGS@ \ -@BUILD_ECORE_X_XLIB_TRUE@@EINA_CFLAGS@ - -@BUILD_ECORE_X_XLIB_TRUE@noinst_LTLIBRARIES = libecore_x_xlib.la -@BUILD_ECORE_X_XLIB_TRUE@libecore_x_xlib_la_SOURCES = \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x.c \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x_dnd.c \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x_sync.c \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x_randr.c \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x_randr_11.c \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x_randr_12.c \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x_randr_12_edid.c \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x_randr_13.c \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x_fixes.c \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x_damage.c \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x_composite.c \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x_error.c \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x_events.c \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x_icccm.c \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x_netwm.c \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x_mwm.c \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x_e.c \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x_selection.c \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x_window.c \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x_window_prop.c \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x_window_shape.c \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x_pixmap.c \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x_gc.c \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x_xinerama.c \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x_screensaver.c \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x_dpms.c \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x_drawable.c \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x_cursor.c \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x_test.c \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x_atoms.c \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x_region.c \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x_image.c \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x_xi2.c \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x_vsync.c \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x_randr.h \ -@BUILD_ECORE_X_XLIB_TRUE@ecore_x_gesture.c - -@BUILD_ECORE_X_XLIB_TRUE@libecore_x_xlib_la_LIBADD = \ -@BUILD_ECORE_X_XLIB_TRUE@@Xcursor_libs@ \ -@BUILD_ECORE_X_XLIB_TRUE@@XKB_LIBS@ \ -@BUILD_ECORE_X_XLIB_TRUE@@XDAMAGE_LIBS@ \ -@BUILD_ECORE_X_XLIB_TRUE@@XCOMPOSITE_LIBS@ \ -@BUILD_ECORE_X_XLIB_TRUE@@XGESTURE_LIBS@ \ -@BUILD_ECORE_X_XLIB_TRUE@@XDPMS_LIBS@ \ -@BUILD_ECORE_X_XLIB_TRUE@@XFIXES_LIBS@ \ -@BUILD_ECORE_X_XLIB_TRUE@@XI2_LIBS@ \ -@BUILD_ECORE_X_XLIB_TRUE@@XINERAMA_LIBS@ \ -@BUILD_ECORE_X_XLIB_TRUE@@XPRINT_LIBS@ \ -@BUILD_ECORE_X_XLIB_TRUE@@XRANDR_LIBS@ \ -@BUILD_ECORE_X_XLIB_TRUE@@XRENDER_LIBS@ \ -@BUILD_ECORE_X_XLIB_TRUE@@XSS_LIBS@ \ -@BUILD_ECORE_X_XLIB_TRUE@@XTEST_LIBS@ \ -@BUILD_ECORE_X_XLIB_TRUE@@x_libs@ \ -@BUILD_ECORE_X_XLIB_TRUE@$(top_builddir)/src/lib/ecore/libecore.la \ -@BUILD_ECORE_X_XLIB_TRUE@$(top_builddir)/src/lib/ecore_input/libecore_input.la \ -@BUILD_ECORE_X_XLIB_TRUE@@EINA_LIBS@ \ -@BUILD_ECORE_X_XLIB_TRUE@@dlopen_libs@ - -EXTRA_DIST = ecore_x_private.h -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_x/xlib/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/lib/ecore_x/xlib/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libecore_x_xlib.la: $(libecore_x_xlib_la_OBJECTS) $(libecore_x_xlib_la_DEPENDENCIES) - $(AM_V_CCLD)$(LINK) $(am_libecore_x_xlib_la_rpath) $(libecore_x_xlib_la_OBJECTS) $(libecore_x_xlib_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_atoms.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_composite.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_cursor.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_damage.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_dnd.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_dpms.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_drawable.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_e.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_error.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_events.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_fixes.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_gc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_gesture.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_icccm.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_image.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_mwm.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_netwm.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_pixmap.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_randr.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_randr_11.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_randr_12.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_randr_12_edid.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_randr_13.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_region.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_screensaver.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_selection.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_sync.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_test.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_vsync.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_window.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_window_prop.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_window_shape.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_xi2.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_xinerama.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - set x; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x.c deleted file mode 100644 index 6d275bc..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x.c +++ /dev/null @@ -1,2098 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include -#endif /* ifdef HAVE_CONFIG_H */ - -#include -#include -#include - -//#define LOGRT 1 - -#ifdef LOGRT -#include -#endif /* ifdef LOGRT */ - -#include "Ecore.h" -#include "ecore_private.h" -#include "ecore_x_private.h" -#include "Ecore_X.h" -#include "Ecore_X_Atoms.h" -#include "Ecore_Input.h" - -static Eina_Bool _ecore_x_fd_handler(void *data, - Ecore_Fd_Handler *fd_handler); -static Eina_Bool _ecore_x_fd_handler_buf(void *data, - Ecore_Fd_Handler *fd_handler); -static int _ecore_x_key_mask_get(KeySym sym); -static int _ecore_x_event_modifier(unsigned int state); - -static Ecore_Fd_Handler *_ecore_x_fd_handler_handle = NULL; - -static const int AnyXEvent = 0; /* 0 can be used as there are no event types - * with index 0 and 1 as they are used for - * errors - */ - -static int _ecore_x_event_shape_id = 0; -static int _ecore_x_event_screensaver_id = 0; -static int _ecore_x_event_sync_id = 0; -int _ecore_xlib_log_dom = -1; - -#ifdef ECORE_XRANDR -static int _ecore_x_event_randr_id = 0; -#endif /* ifdef ECORE_XRANDR */ -#ifdef ECORE_XFIXES -static int _ecore_x_event_fixes_selection_id = 0; -#endif /* ifdef ECORE_XFIXES */ -#ifdef ECORE_XDAMAGE -static int _ecore_x_event_damage_id = 0; -#endif /* ifdef ECORE_XDAMAGE */ -#ifdef ECORE_XGESTURE -static int _ecore_x_event_gesture_id = 0; -#endif /* ifdef ECORE_XGESTURE */ -static int _ecore_x_event_handlers_num = 0; -static void (**_ecore_x_event_handlers) (XEvent * event) = NULL; - -static int _ecore_x_init_count = 0; -static int _ecore_x_grab_count = 0; - -Display *_ecore_x_disp = NULL; -double _ecore_x_double_click_time = 0.25; -Time _ecore_x_event_last_time = 0; -Window _ecore_x_event_last_win = 0; -int _ecore_x_event_last_root_x = 0; -int _ecore_x_event_last_root_y = 0; -Eina_Bool _ecore_x_xcursor = EINA_FALSE; - -Ecore_X_Window _ecore_x_private_win = 0; - -Ecore_X_Atom _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_NUM]; - -EAPI int ECORE_X_EVENT_ANY = 0; -EAPI int ECORE_X_EVENT_MOUSE_IN = 0; -EAPI int ECORE_X_EVENT_MOUSE_OUT = 0; -EAPI int ECORE_X_EVENT_WINDOW_FOCUS_IN = 0; -EAPI int ECORE_X_EVENT_WINDOW_FOCUS_OUT = 0; -EAPI int ECORE_X_EVENT_WINDOW_KEYMAP = 0; -EAPI int ECORE_X_EVENT_WINDOW_DAMAGE = 0; -EAPI int ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE = 0; -EAPI int ECORE_X_EVENT_WINDOW_CREATE = 0; -EAPI int ECORE_X_EVENT_WINDOW_DESTROY = 0; -EAPI int ECORE_X_EVENT_WINDOW_HIDE = 0; -EAPI int ECORE_X_EVENT_WINDOW_SHOW = 0; -EAPI int ECORE_X_EVENT_WINDOW_SHOW_REQUEST = 0; -EAPI int ECORE_X_EVENT_WINDOW_REPARENT = 0; -EAPI int ECORE_X_EVENT_WINDOW_CONFIGURE = 0; -EAPI int ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST = 0; -EAPI int ECORE_X_EVENT_WINDOW_GRAVITY = 0; -EAPI int ECORE_X_EVENT_WINDOW_RESIZE_REQUEST = 0; -EAPI int ECORE_X_EVENT_WINDOW_STACK = 0; -EAPI int ECORE_X_EVENT_WINDOW_STACK_REQUEST = 0; -EAPI int ECORE_X_EVENT_WINDOW_PROPERTY = 0; -EAPI int ECORE_X_EVENT_WINDOW_COLORMAP = 0; -EAPI int ECORE_X_EVENT_WINDOW_MAPPING = 0; -EAPI int ECORE_X_EVENT_MAPPING_CHANGE = 0; -EAPI int ECORE_X_EVENT_SELECTION_CLEAR = 0; -EAPI int ECORE_X_EVENT_SELECTION_REQUEST = 0; -EAPI int ECORE_X_EVENT_SELECTION_NOTIFY = 0; -EAPI int ECORE_X_EVENT_FIXES_SELECTION_NOTIFY = 0; -EAPI int ECORE_X_EVENT_CLIENT_MESSAGE = 0; -EAPI int ECORE_X_EVENT_WINDOW_SHAPE = 0; -EAPI int ECORE_X_EVENT_SCREENSAVER_NOTIFY = 0; -EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_FLICK; -EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_PAN; -EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_PINCHROTATION; -EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_TAP; -EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_TAPNHOLD; -EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_HOLD; -EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_GROUP; -EAPI int ECORE_X_EVENT_SYNC_COUNTER = 0; -EAPI int ECORE_X_EVENT_SYNC_ALARM = 0; -EAPI int ECORE_X_EVENT_SCREEN_CHANGE = 0; -EAPI int ECORE_X_EVENT_DAMAGE_NOTIFY = 0; -EAPI int ECORE_X_EVENT_RANDR_CRTC_CHANGE = 0; -EAPI int ECORE_X_EVENT_RANDR_OUTPUT_CHANGE = 0; -EAPI int ECORE_X_EVENT_RANDR_OUTPUT_PROPERTY_NOTIFY = 0; -EAPI int ECORE_X_EVENT_WINDOW_DELETE_REQUEST = 0; -EAPI int ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST = 0; -EAPI int ECORE_X_EVENT_WINDOW_STATE_REQUEST = 0; -EAPI int ECORE_X_EVENT_FRAME_EXTENTS_REQUEST = 0; -EAPI int ECORE_X_EVENT_PING = 0; -EAPI int ECORE_X_EVENT_DESKTOP_CHANGE = 0; - -EAPI int ECORE_X_EVENT_STARTUP_SEQUENCE_NEW = 0; -EAPI int ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE = 0; -EAPI int ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE = 0; - -EAPI int ECORE_X_EVENT_GENERIC = 0; - -int ECORE_X_MODIFIER_SHIFT = 0; -int ECORE_X_MODIFIER_CTRL = 0; -int ECORE_X_MODIFIER_ALT = 0; -int ECORE_X_MODIFIER_WIN = 0; - -EAPI int ECORE_X_LOCK_SCROLL = 0; -EAPI int ECORE_X_LOCK_NUM = 0; -EAPI int ECORE_X_LOCK_CAPS = 0; -EAPI int ECORE_X_LOCK_SHIFT = 0; - -#ifdef LOGRT -static double t0 = 0.0; -static Status (*_logrt_real_reply)(Display *disp, - void *rep, - int extra, - Bool discard) = NULL; -static void -_logrt_init(void) -{ - void *lib; - - lib = dlopen("libX11.so", RTLD_GLOBAL | RTLD_LAZY); - if (!lib) - lib = dlopen("libX11.so.6", RTLD_GLOBAL | RTLD_LAZY); - - if (!lib) - lib = dlopen("libX11.so.6.3", RTLD_GLOBAL | RTLD_LAZY); - - if (!lib) - lib = dlopen("libX11.so.6.3.0", RTLD_GLOBAL | RTLD_LAZY); - - _logrt_real_reply = dlsym(lib, "_XReply"); - t0 = ecore_time_get(); -} - -Status -_XReply(Display *disp, - void *rep, - int extra, - Bool discard) -{ - void *bt[128]; - int i, n; - char **sym; - - n = backtrace(bt, 128); - if (n > 0) - { - sym = backtrace_symbols(bt, n); - printf("ROUNDTRIP: %4.4f :", ecore_time_get() - t0); - if (sym) - { - for (i = n - 1; i > 0; i--) - { - char *fname = strchr(sym[i], '('); - if (fname) - { - char *tsym = alloca(strlen(fname) + 1); - char *end; - strcpy(tsym, fname + 1); - end = strchr(tsym, '+'); - if (end) - { - *end = 0; - printf("%s", tsym); - } - else - printf("???"); - } - else - printf("???"); - - if (i > 1) - printf(" > "); - } - printf("\n"); - } - } - - // fixme: logme - return _logrt_real_reply(disp, rep, extra, discard); -} - -#endif /* ifdef LOGRT */ - -void -_ecore_x_modifiers_get(void) -{ - /* everything has these... unless its like a pda... :) */ - ECORE_X_MODIFIER_SHIFT = _ecore_x_key_mask_get(XK_Shift_L); - ECORE_X_MODIFIER_CTRL = _ecore_x_key_mask_get(XK_Control_L); - - /* apple's xdarwin has no alt!!!! */ - ECORE_X_MODIFIER_ALT = _ecore_x_key_mask_get(XK_Alt_L); - if (!ECORE_X_MODIFIER_ALT) - ECORE_X_MODIFIER_ALT = _ecore_x_key_mask_get(XK_Meta_L); - - if (!ECORE_X_MODIFIER_ALT) - ECORE_X_MODIFIER_ALT = _ecore_x_key_mask_get(XK_Super_L); - - /* the windows key... a valid modifier :) */ - ECORE_X_MODIFIER_WIN = _ecore_x_key_mask_get(XK_Super_L); - if (!ECORE_X_MODIFIER_WIN) - ECORE_X_MODIFIER_WIN = _ecore_x_key_mask_get(XK_Mode_switch); - - if (!ECORE_X_MODIFIER_WIN) - ECORE_X_MODIFIER_WIN = _ecore_x_key_mask_get(XK_Meta_L); - - if (ECORE_X_MODIFIER_WIN == ECORE_X_MODIFIER_ALT) - ECORE_X_MODIFIER_WIN = 0; - - if (ECORE_X_MODIFIER_ALT == ECORE_X_MODIFIER_CTRL) - ECORE_X_MODIFIER_ALT = 0; - - ECORE_X_LOCK_SCROLL = _ecore_x_key_mask_get(XK_Scroll_Lock); - ECORE_X_LOCK_NUM = _ecore_x_key_mask_get(XK_Num_Lock); - ECORE_X_LOCK_CAPS = _ecore_x_key_mask_get(XK_Caps_Lock); - ECORE_X_LOCK_SHIFT = _ecore_x_key_mask_get(XK_Shift_Lock); -} - -/** - * @defgroup Ecore_X_Init_Group X Library Init and Shutdown Functions - * - * Functions that start and shut down the Ecore X Library. - */ - -/** - * Initialize the X display connection to the given display. - * - * @param name Display target name. If @c NULL, the default display is - * assumed. - * @return The number of times the library has been initialized without - * being shut down. 0 is returned if an error occurs. - * @ingroup Ecore_X_Init_Group - */ -EAPI int -ecore_x_init(const char *name) -{ - int shape_base = 0; - int shape_err_base = 0; -#ifdef ECORE_XSS - int screensaver_base = 0; - int screensaver_err_base = 0; -#endif /* ifdef ECORE_XSS */ - int sync_base = 0; - int sync_err_base = 0; -#ifdef ECORE_XRANDR - int randr_base = 0; - int randr_err_base = 0; -#endif /* ifdef ECORE_XRANDR */ -#ifdef ECORE_XFIXES - int fixes_base = 0; - int fixes_err_base = 0; -#endif /* ifdef ECORE_XFIXES */ -#ifdef ECORE_XDAMAGE - int damage_base = 0; - int damage_err_base = 0; -#endif /* ifdef ECORE_XDAMAGE */ -#ifdef ECORE_XGESTURE - int gesture_base = 0; - int gesture_err_base = 0; -#endif /* ifdef ECORE_XGESTURE */ - - if (++_ecore_x_init_count != 1) - return _ecore_x_init_count; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); -#ifdef LOGRT - _logrt_init(); -#endif /* ifdef LOGRT */ - - eina_init(); - _ecore_xlib_log_dom = eina_log_domain_register - ("ecore_x", ECORE_XLIB_DEFAULT_LOG_COLOR); - if (_ecore_xlib_log_dom < 0) - { - EINA_LOG_ERR( - "Impossible to create a log domain for the Ecore Xlib module."); - return --_ecore_x_init_count; - } - - if (!ecore_init()) - goto shutdown_eina; - if (!ecore_event_init()) - goto shutdown_ecore; - -#ifdef EVAS_FRAME_QUEUING - XInitThreads(); -#endif /* ifdef EVAS_FRAME_QUEUING */ - _ecore_x_disp = XOpenDisplay((char *)name); - if (!_ecore_x_disp) - goto shutdown_ecore_event; - - _ecore_x_error_handler_init(); - _ecore_x_event_handlers_num = LASTEvent; - -#define ECORE_X_EVENT_HANDLERS_GROW(ext_base, ext_num_events) \ - do { \ - if (_ecore_x_event_handlers_num < (ext_base + ext_num_events)) { \ - _ecore_x_event_handlers_num = (ext_base + ext_num_events); } \ - } while (0) - - if (XShapeQueryExtension(_ecore_x_disp, &shape_base, &shape_err_base)) - _ecore_x_event_shape_id = shape_base; - - ECORE_X_EVENT_HANDLERS_GROW(shape_base, ShapeNumberEvents); - -#ifdef ECORE_XSS - if (XScreenSaverQueryExtension(_ecore_x_disp, &screensaver_base, - &screensaver_err_base)) - _ecore_x_event_screensaver_id = screensaver_base; - - ECORE_X_EVENT_HANDLERS_GROW(screensaver_base, ScreenSaverNumberEvents); -#endif /* ifdef ECORE_XSS */ - - if (XSyncQueryExtension(_ecore_x_disp, &sync_base, &sync_err_base)) - { - int major, minor; - - _ecore_x_event_sync_id = sync_base; - if (!XSyncInitialize(_ecore_x_disp, &major, &minor)) - _ecore_x_event_sync_id = 0; - } - - ECORE_X_EVENT_HANDLERS_GROW(sync_base, XSyncNumberEvents); - -#ifdef ECORE_XRANDR - if (XRRQueryExtension(_ecore_x_disp, &randr_base, &randr_err_base)) - _ecore_x_event_randr_id = randr_base; - - ECORE_X_EVENT_HANDLERS_GROW(randr_base, RRNumberEvents); -#endif /* ifdef ECORE_XRANDR */ - -#ifdef ECORE_XFIXES - if (XFixesQueryExtension(_ecore_x_disp, &fixes_base, &fixes_err_base)) - _ecore_x_event_fixes_selection_id = fixes_base; - - ECORE_X_EVENT_HANDLERS_GROW(fixes_base, XFixesNumberEvents); -#endif /* ifdef ECORE_XFIXES */ - -#ifdef ECORE_XDAMAGE - if (XDamageQueryExtension(_ecore_x_disp, &damage_base, &damage_err_base)) - _ecore_x_event_damage_id = damage_base; - - ECORE_X_EVENT_HANDLERS_GROW(damage_base, XDamageNumberEvents); -#endif /* ifdef ECORE_XDAMAGE */ - -#ifdef ECORE_XGESTURE - if (XGestureQueryExtension(_ecore_x_disp, &gesture_base, &gesture_err_base)) - _ecore_x_event_gesture_id = gesture_base; - - ECORE_X_EVENT_HANDLERS_GROW(gesture_base, GestureNumberEvents); -#endif /* ifdef ECORE_XGESTURE */ - - _ecore_x_event_handlers = calloc(_ecore_x_event_handlers_num, sizeof(void *)); - if (!_ecore_x_event_handlers) - goto close_display; - -#ifdef ECORE_XCURSOR - _ecore_x_xcursor = XcursorSupportsARGB(_ecore_x_disp) ? EINA_TRUE : EINA_FALSE; -#endif /* ifdef ECORE_XCURSOR */ - _ecore_x_event_handlers[AnyXEvent] = _ecore_x_event_handle_any_event; - _ecore_x_event_handlers[KeyPress] = _ecore_x_event_handle_key_press; - _ecore_x_event_handlers[KeyRelease] = _ecore_x_event_handle_key_release; - _ecore_x_event_handlers[ButtonPress] = _ecore_x_event_handle_button_press; - _ecore_x_event_handlers[ButtonRelease] = - _ecore_x_event_handle_button_release; - _ecore_x_event_handlers[MotionNotify] = _ecore_x_event_handle_motion_notify; - _ecore_x_event_handlers[EnterNotify] = _ecore_x_event_handle_enter_notify; - _ecore_x_event_handlers[LeaveNotify] = _ecore_x_event_handle_leave_notify; - _ecore_x_event_handlers[FocusIn] = _ecore_x_event_handle_focus_in; - _ecore_x_event_handlers[FocusOut] = _ecore_x_event_handle_focus_out; - _ecore_x_event_handlers[KeymapNotify] = _ecore_x_event_handle_keymap_notify; - _ecore_x_event_handlers[Expose] = _ecore_x_event_handle_expose; - _ecore_x_event_handlers[GraphicsExpose] = - _ecore_x_event_handle_graphics_expose; - _ecore_x_event_handlers[VisibilityNotify] = - _ecore_x_event_handle_visibility_notify; - _ecore_x_event_handlers[CreateNotify] = _ecore_x_event_handle_create_notify; - _ecore_x_event_handlers[DestroyNotify] = - _ecore_x_event_handle_destroy_notify; - _ecore_x_event_handlers[UnmapNotify] = _ecore_x_event_handle_unmap_notify; - _ecore_x_event_handlers[MapNotify] = _ecore_x_event_handle_map_notify; - _ecore_x_event_handlers[MapRequest] = _ecore_x_event_handle_map_request; - _ecore_x_event_handlers[ReparentNotify] = - _ecore_x_event_handle_reparent_notify; - _ecore_x_event_handlers[ConfigureNotify] = - _ecore_x_event_handle_configure_notify; - _ecore_x_event_handlers[ConfigureRequest] = - _ecore_x_event_handle_configure_request; - _ecore_x_event_handlers[GravityNotify] = - _ecore_x_event_handle_gravity_notify; - _ecore_x_event_handlers[ResizeRequest] = - _ecore_x_event_handle_resize_request; - _ecore_x_event_handlers[CirculateNotify] = - _ecore_x_event_handle_circulate_notify; - _ecore_x_event_handlers[CirculateRequest] = - _ecore_x_event_handle_circulate_request; - _ecore_x_event_handlers[PropertyNotify] = - _ecore_x_event_handle_property_notify; - _ecore_x_event_handlers[SelectionClear] = - _ecore_x_event_handle_selection_clear; - _ecore_x_event_handlers[SelectionRequest] = - _ecore_x_event_handle_selection_request; - _ecore_x_event_handlers[SelectionNotify] = - _ecore_x_event_handle_selection_notify; - _ecore_x_event_handlers[ColormapNotify] = - _ecore_x_event_handle_colormap_notify; - _ecore_x_event_handlers[ClientMessage] = - _ecore_x_event_handle_client_message; - _ecore_x_event_handlers[MappingNotify] = - _ecore_x_event_handle_mapping_notify; -#ifdef GenericEvent - _ecore_x_event_handlers[GenericEvent] = _ecore_x_event_handle_generic_event; -#endif /* ifdef GenericEvent */ - - if (_ecore_x_event_shape_id) - _ecore_x_event_handlers[_ecore_x_event_shape_id] = - _ecore_x_event_handle_shape_change; - - if (_ecore_x_event_screensaver_id) - _ecore_x_event_handlers[_ecore_x_event_screensaver_id] = - _ecore_x_event_handle_screensaver_notify; - - if (_ecore_x_event_sync_id) - { - _ecore_x_event_handlers[_ecore_x_event_sync_id + XSyncCounterNotify] = - _ecore_x_event_handle_sync_counter; - _ecore_x_event_handlers[_ecore_x_event_sync_id + XSyncAlarmNotify] = - _ecore_x_event_handle_sync_alarm; - } - -#ifdef ECORE_XRANDR - if (_ecore_x_event_randr_id) - { - _ecore_x_event_handlers[_ecore_x_event_randr_id + - RRScreenChangeNotify] = - _ecore_x_event_handle_randr_change; - _ecore_x_event_handlers[_ecore_x_event_randr_id + - RRNotify] = _ecore_x_event_handle_randr_notify; - } - -#endif /* ifdef ECORE_XRANDR */ -#ifdef ECORE_XFIXES - if (_ecore_x_event_fixes_selection_id) - _ecore_x_event_handlers[_ecore_x_event_fixes_selection_id] = - _ecore_x_event_handle_fixes_selection_notify; - -#endif /* ifdef ECORE_XFIXES */ -#ifdef ECORE_XDAMAGE - if (_ecore_x_event_damage_id) - _ecore_x_event_handlers[_ecore_x_event_damage_id] = - _ecore_x_event_handle_damage_notify; - -#endif /* ifdef ECORE_XDAMAGE */ -#ifdef ECORE_XKB - // set x autorepeat detection to on. that means instead of - // press-release-press-release-press-release - // you get - // press-press-press-press-press-release - do - { - Bool works = 0; - XkbSetDetectableAutoRepeat(_ecore_x_disp, 1, &works); - } - while (0); -#endif /* ifdef ECORE_XKB */ - -#ifdef ECORE_XGESTURE - if (_ecore_x_event_gesture_id) - { - _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyFlick] = - _ecore_x_event_handle_gesture_notify_flick; - _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyPan] = - _ecore_x_event_handle_gesture_notify_pan; - _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyPinchRotation] = - _ecore_x_event_handle_gesture_notify_pinchrotation; - _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyTap] = - _ecore_x_event_handle_gesture_notify_tap; - _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyTapNHold] = - _ecore_x_event_handle_gesture_notify_tapnhold; - _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyHold] = - _ecore_x_event_handle_gesture_notify_hold; - _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyGroup] = - _ecore_x_event_handle_gesture_notify_group; - } - -#endif /* ifdef ECORE_XGESTURE */ - - if (!ECORE_X_EVENT_ANY) - { - ECORE_X_EVENT_ANY = ecore_event_type_new(); - ECORE_X_EVENT_MOUSE_IN = ecore_event_type_new(); - ECORE_X_EVENT_MOUSE_OUT = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_FOCUS_IN = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_FOCUS_OUT = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_KEYMAP = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_DAMAGE = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_CREATE = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_DESTROY = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_HIDE = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_SHOW = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_SHOW_REQUEST = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_REPARENT = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_CONFIGURE = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_GRAVITY = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_RESIZE_REQUEST = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_STACK = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_STACK_REQUEST = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_PROPERTY = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_COLORMAP = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_MAPPING = ecore_event_type_new(); - ECORE_X_EVENT_MAPPING_CHANGE = ecore_event_type_new(); - ECORE_X_EVENT_SELECTION_CLEAR = ecore_event_type_new(); - ECORE_X_EVENT_SELECTION_REQUEST = ecore_event_type_new(); - ECORE_X_EVENT_SELECTION_NOTIFY = ecore_event_type_new(); - ECORE_X_EVENT_CLIENT_MESSAGE = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_SHAPE = ecore_event_type_new(); - ECORE_X_EVENT_SCREENSAVER_NOTIFY = ecore_event_type_new(); - ECORE_X_EVENT_GESTURE_NOTIFY_FLICK = ecore_event_type_new(); - ECORE_X_EVENT_GESTURE_NOTIFY_PAN = ecore_event_type_new(); - ECORE_X_EVENT_GESTURE_NOTIFY_PINCHROTATION = ecore_event_type_new(); - ECORE_X_EVENT_GESTURE_NOTIFY_TAP = ecore_event_type_new(); - ECORE_X_EVENT_GESTURE_NOTIFY_TAPNHOLD = ecore_event_type_new(); - ECORE_X_EVENT_GESTURE_NOTIFY_HOLD = ecore_event_type_new(); - ECORE_X_EVENT_GESTURE_NOTIFY_GROUP = ecore_event_type_new(); - ECORE_X_EVENT_SYNC_COUNTER = ecore_event_type_new(); - ECORE_X_EVENT_SYNC_ALARM = ecore_event_type_new(); - ECORE_X_EVENT_SCREEN_CHANGE = ecore_event_type_new(); - ECORE_X_EVENT_RANDR_CRTC_CHANGE = ecore_event_type_new(); - ECORE_X_EVENT_RANDR_OUTPUT_CHANGE = ecore_event_type_new(); - ECORE_X_EVENT_RANDR_OUTPUT_PROPERTY_NOTIFY = ecore_event_type_new(); - ECORE_X_EVENT_DAMAGE_NOTIFY = ecore_event_type_new(); - - ECORE_X_EVENT_WINDOW_DELETE_REQUEST = ecore_event_type_new(); - - ECORE_X_EVENT_DESKTOP_CHANGE = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST = ecore_event_type_new(); - ECORE_X_EVENT_WINDOW_STATE_REQUEST = ecore_event_type_new(); - ECORE_X_EVENT_FRAME_EXTENTS_REQUEST = ecore_event_type_new(); - ECORE_X_EVENT_PING = ecore_event_type_new(); - - ECORE_X_EVENT_STARTUP_SEQUENCE_NEW = ecore_event_type_new(); - ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE = ecore_event_type_new(); - ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE = ecore_event_type_new(); - - ECORE_X_EVENT_GENERIC = ecore_event_type_new(); - } - - _ecore_x_modifiers_get(); - - _ecore_x_fd_handler_handle = - ecore_main_fd_handler_add(ConnectionNumber(_ecore_x_disp), - ECORE_FD_READ, - _ecore_x_fd_handler, _ecore_x_disp, - _ecore_x_fd_handler_buf, _ecore_x_disp); - if (!_ecore_x_fd_handler_handle) - goto free_event_handlers; - - _ecore_x_atoms_init(); - - /* Set up the ICCCM hints */ - ecore_x_icccm_init(); - - /* Set up the _NET_... hints */ - ecore_x_netwm_init(); - - /* old e hints init */ - ecore_x_e_init(); - - /* This is just to be anal about naming conventions */ - - _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_DELETE_REQUEST] = - ECORE_X_ATOM_WM_DELETE_WINDOW; - _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_TAKE_FOCUS] = - ECORE_X_ATOM_WM_TAKE_FOCUS; - _ecore_x_atoms_wm_protocols[ECORE_X_NET_WM_PROTOCOL_PING] = - ECORE_X_ATOM_NET_WM_PING; - _ecore_x_atoms_wm_protocols[ECORE_X_NET_WM_PROTOCOL_SYNC_REQUEST] = - ECORE_X_ATOM_NET_WM_SYNC_REQUEST; - - _ecore_x_selection_data_init(); - _ecore_x_dnd_init(); - _ecore_x_fixes_init(); - _ecore_x_damage_init(); - _ecore_x_composite_init(); - _ecore_x_dpms_init(); - _ecore_x_randr_init(); - _ecore_x_gesture_init(); - _ecore_x_input_init(); - _ecore_x_events_init(); - - _ecore_x_private_win = ecore_x_window_override_new(0, -77, -777, 123, 456); - - return _ecore_x_init_count; - -free_event_handlers: - free(_ecore_x_event_handlers); - _ecore_x_event_handlers = NULL; -close_display: - XCloseDisplay(_ecore_x_disp); - _ecore_x_fd_handler_handle = NULL; - _ecore_x_disp = NULL; -shutdown_ecore_event: - ecore_event_shutdown(); -shutdown_ecore: - ecore_shutdown(); -shutdown_eina: - eina_log_domain_unregister(_ecore_xlib_log_dom); - _ecore_xlib_log_dom = -1; - eina_shutdown(); - - return --_ecore_x_init_count; -} - -static int -_ecore_x_shutdown(int close_display) -{ - if (--_ecore_x_init_count != 0) - return _ecore_x_init_count; - - if (!_ecore_x_disp) - return _ecore_x_init_count; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ecore_main_fd_handler_del(_ecore_x_fd_handler_handle); - if (close_display) - XCloseDisplay(_ecore_x_disp); - else - { - close(ConnectionNumber(_ecore_x_disp)); - // FIXME: may have to clean up x display internal here -// getting segv here? hmmm. odd. disable -// XFree(_ecore_x_disp); - } - - free(_ecore_x_event_handlers); - _ecore_x_fd_handler_handle = NULL; - _ecore_x_disp = NULL; - _ecore_x_event_handlers = NULL; - _ecore_x_events_shutdown(); - _ecore_x_input_shutdown(); - _ecore_x_selection_shutdown(); - _ecore_x_dnd_shutdown(); - ecore_x_netwm_shutdown(); - - ecore_event_shutdown(); - ecore_shutdown(); - - eina_log_domain_unregister(_ecore_xlib_log_dom); - _ecore_xlib_log_dom = -1; - eina_shutdown(); - - return _ecore_x_init_count; -} - -/** - * Shuts down the Ecore X library. - * - * In shutting down the library, the X display connection is terminated - * and any event handlers for it are removed. - * - * @return The number of times the library has been initialized without - * being shut down. - * @ingroup Ecore_X_Init_Group - */ -EAPI int -ecore_x_shutdown(void) -{ - return _ecore_x_shutdown(1); -} - -/** - * Shuts down the Ecore X library. - * - * As ecore_x_shutdown, except do not close Display, only connection. - * - * @ingroup Ecore_X_Init_Group - */ -EAPI int -ecore_x_disconnect(void) -{ - return _ecore_x_shutdown(0); -} - -/** - * @defgroup Ecore_X_Display_Attr_Group X Display Attributes - * - * Functions that set and retrieve X display attributes. - */ - -/** - * Retrieves the Ecore_X_Display handle used for the current X connection. - * @return The current X display. - * @ingroup Ecore_X_Display_Attr_Group - */ -EAPI Ecore_X_Display * -ecore_x_display_get(void) -{ - return (Ecore_X_Display *)_ecore_x_disp; -} - -/** - * Retrieves the X display file descriptor. - * @return The current X display file descriptor. - * @ingroup Ecore_X_Display_Attr_Group - */ -EAPI int -ecore_x_fd_get(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return ConnectionNumber(_ecore_x_disp); -} - -/** - * Retrieves the Ecore_X_Screen handle used for the current X connection. - * @return The current default screen. - * @ingroup Ecore_X_Display_Attr_Group - */ -EAPI Ecore_X_Screen * -ecore_x_default_screen_get(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return (Ecore_X_Screen *)DefaultScreenOfDisplay(_ecore_x_disp); -} - -/** - * Retrieves the size of an Ecore_X_Screen. - * @param screen the handle to the screen to query. - * @param w where to return the width. May be NULL. Returns 0 on errors. - * @param h where to return the height. May be NULL. Returns 0 on errors. - * @ingroup Ecore_X_Display_Attr_Group - * @see ecore_x_default_screen_get() - * - * @since 1.1 - */ -EAPI void -ecore_x_screen_size_get(const Ecore_X_Screen *screen, - int *w, - int *h) -{ - Screen *s = (Screen *)screen; - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (w) *w = 0; - if (h) *h = 0; - if (!s) return; - if (w) *w = s->width; - if (h) *h = s->height; -} - -/** - * Retrieves the number of screens. - * - * @return The count of the number of screens. - * @ingroup Ecore_X_Display_Attr_Group - * - * @since 1.1 - */ -EAPI int -ecore_x_screen_count_get(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - return ScreenCount(_ecore_x_disp); -} - -/** - * Retrieves the index number of the given screen. - * - * @return The index number of the screen. - * @ingroup Ecore_X_Display_Attr_Group - * - * @since 1.1 - */ -EAPI int -ecore_x_screen_index_get(const Ecore_X_Screen *screen) -{ - return XScreenNumberOfScreen((Screen *)screen); -} - -/** - * Retrieves the screen based on index number. - * - * @return The Ecore_X_Screen at this index. - * @ingroup Ecore_X_Display_Attr_Group - * - * @since 1.1 - */ -EAPI Ecore_X_Screen * -ecore_x_screen_get(int idx) -{ - return XScreenOfDisplay(_ecore_x_disp, idx); -} - -/** - * Sets the timeout for a double and triple clicks to be flagged. - * - * This sets the time between clicks before the double_click flag is - * set in a button down event. If 3 clicks occur within double this - * time, the triple_click flag is also set. - * - * @param t The time in seconds - * @ingroup Ecore_X_Display_Attr_Group - */ -EAPI void -ecore_x_double_click_time_set(double t) -{ - if (t < 0.0) - t = 0.0; - - _ecore_x_double_click_time = t; -} - -/** - * Retrieves the double and triple click flag timeout. - * - * See @ref ecore_x_double_click_time_set for more information. - * - * @return The timeout for double clicks in seconds. - * @ingroup Ecore_X_Display_Attr_Group - */ -EAPI double -ecore_x_double_click_time_get(void) -{ - return _ecore_x_double_click_time; -} - -/** - * @defgroup Ecore_X_Flush_Group X Synchronization Functions - * - * Functions that ensure that all commands that have been issued by the - * Ecore X library have been sent to the server. - */ - -/** - * Sends all X commands in the X Display buffer. - * @ingroup Ecore_X_Flush_Group - */ -EAPI void -ecore_x_flush(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XFlush(_ecore_x_disp); -} - -/** - * Flushes the command buffer and waits until all requests have been - * processed by the server. - * @ingroup Ecore_X_Flush_Group - */ -EAPI void -ecore_x_sync(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XSync(_ecore_x_disp, False); -} - -/** - * Kill all clients with subwindows under a given window. - * - * You can kill all clients connected to the X server by using - * @ref ecore_x_window_root_list to get a list of root windows, and - * then passing each root window to this function. - * - * @param root The window whose children will be killed. - */ -EAPI void -ecore_x_killall(Ecore_X_Window root) -{ - unsigned int j; - Window root_r; - Window parent_r; - Window *children_r = NULL; - unsigned int num_children = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XGrabServer(_ecore_x_disp); - /* Tranverse window tree starting from root, and drag each - * before the firing squad */ - while (XQueryTree(_ecore_x_disp, root, &root_r, &parent_r, - &children_r, &num_children) && (num_children > 0)) - { - for (j = 0; j < num_children; ++j) - { - XKillClient(_ecore_x_disp, children_r[j]); - } - - XFree(children_r); - } - XUngrabServer(_ecore_x_disp); - XSync(_ecore_x_disp, False); -} - -/** - * Kill a specific client - * - * You can kill a specific client owning window @p win - * - * @param win Window of the client to be killed - */ -EAPI void -ecore_x_kill(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XKillClient(_ecore_x_disp, win); -} - -/** - * Return the last event time - */ -EAPI Ecore_X_Time -ecore_x_current_time_get(void) -{ - return _ecore_x_event_last_time; -} - -/** - * Return the screen DPI - * - * This is a simplistic call to get DPI. It does not account for differing - * DPI in the x amd y axes nor does it accoutn for multihead or xinerama and - * xrander where different parts of the screen may have differen DPI etc. - * - * @return the general screen DPI (dots/pixels per inch). - */ -EAPI int -ecore_x_dpi_get(void) -{ - Screen *s; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - s = DefaultScreenOfDisplay(_ecore_x_disp); - if (s->mwidth <= 0) - return 75; - - return (((s->width * 254) / s->mwidth) + 5) / 10; -} - -/** - * Invoke the standard system beep to alert users - * - * @param percent The volume at which the bell rings. Must be in the range - * [-100,+100]. If percent >= 0, the final volume will be: - * base - [(base * percent) / 100] + percent - * Otherwise, it's calculated as: - * base + [(base * percent) / 100] - * where @c base is the bell's base volume as set by XChangeKeyboardControl(3). - * - * @returns EINA_TRUE on success, EINA_FALSE otherwise. - */ -EAPI Eina_Bool -ecore_x_bell(int percent) -{ - int ret; - - ret = XBell(_ecore_x_disp, percent); - if (ret == BadValue) - return EINA_FALSE; - - return EINA_TRUE; -} - -static Eina_Bool -_ecore_x_fd_handler(void *data, - Ecore_Fd_Handler *fd_handler __UNUSED__) -{ - Display *d; - - d = data; - while (XPending(d)) - { - XEvent ev; - - XNextEvent(d, &ev); - -#ifdef ENABLE_XIM - /* Filter event for XIM */ - if (XFilterEvent(&ev, ev.xkey.window)) - continue; - -#endif /* ifdef ENABLE_XIM */ - - if ((ev.type >= 0) && (ev.type < _ecore_x_event_handlers_num)) - { - if (_ecore_x_event_handlers[AnyXEvent]) - _ecore_x_event_handlers[AnyXEvent] (&ev); - - if (_ecore_x_event_handlers[ev.type]) - _ecore_x_event_handlers[ev.type] (&ev); - } - } - return ECORE_CALLBACK_RENEW; -} - -static Eina_Bool -_ecore_x_fd_handler_buf(void *data, - Ecore_Fd_Handler *fd_handler __UNUSED__) -{ - Display *d; - - d = data; - if (XPending(d)) - return ECORE_CALLBACK_RENEW; - - return ECORE_CALLBACK_CANCEL; -} - -static int -_ecore_x_key_mask_get(KeySym sym) -{ - XModifierKeymap *mod; - KeySym sym2; - int i, j; - const int masks[8] = - { - ShiftMask, LockMask, ControlMask, - Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask - }; - - mod = XGetModifierMapping(_ecore_x_disp); - if ((mod) && (mod->max_keypermod > 0)) - for (i = 0; i < (8 * mod->max_keypermod); i++) - { - for (j = 0; j < 8; j++) - { - sym2 = XKeycodeToKeysym(_ecore_x_disp, mod->modifiermap[i], j); - if (sym2 != 0) - break; - } - if (sym2 == sym) - { - int mask; - - mask = masks[i / mod->max_keypermod]; - if (mod->modifiermap) - XFree(mod->modifiermap); - - XFree(mod); - return mask; - } - } - - if (mod) - { - if (mod->modifiermap) - XFree(mod->modifiermap); - - XFree(mod); - } - - return 0; -} - -/*****************************************************************************/ -/*****************************************************************************/ -/*****************************************************************************/ -/* FIXME: these funcs need categorising */ -/*****************************************************************************/ - -/** - * Get a list of all the root windows on the server. - * - * @note The returned array will need to be freed after use. - * @param num_ret Pointer to integer to put number of windows returned in. - * @return An array of all the root windows. @c NULL is returned if memory - * could not be allocated for the list, or if @p num_ret is @c NULL. - */ -EAPI Ecore_X_Window * -ecore_x_window_root_list(int *num_ret) -{ - int num, i; - Ecore_X_Window *roots; -#ifdef ECORE_XPRINT - int xp_base, xp_err_base; -#endif /* ifdef ECORE_XPRINT */ - - if (!num_ret) - return NULL; - - *num_ret = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); -#ifdef ECORE_XPRINT - num = ScreenCount(_ecore_x_disp); - if (XpQueryExtension(_ecore_x_disp, &xp_base, &xp_err_base)) - { - Screen **ps = NULL; - int psnum = 0; - - ps = XpQueryScreens(_ecore_x_disp, &psnum); - if (ps) - { - int overlap, j; - - overlap = 0; - for (i = 0; i < num; i++) - { - for (j = 0; j < psnum; j++) - { - if (ScreenOfDisplay(_ecore_x_disp, i) == ps[j]) - overlap++; - } - } - roots = malloc(MAX((num - overlap) * sizeof(Window), 1)); - if (roots) - { - int k; - - k = 0; - for (i = 0; i < num; i++) - { - int is_print; - - is_print = 0; - for (j = 0; j < psnum; j++) - { - if (ScreenOfDisplay(_ecore_x_disp, i) == ps[j]) - { - is_print = 1; - break; - } - } - if (!is_print) - { - roots[k] = RootWindow(_ecore_x_disp, i); - k++; - } - } - *num_ret = k; - } - - XFree(ps); - } - else - { - roots = malloc(num * sizeof(Window)); - if (!roots) - return NULL; - - *num_ret = num; - for (i = 0; i < num; i++) - roots[i] = RootWindow(_ecore_x_disp, i); - } - } - else - { - roots = malloc(num * sizeof(Window)); - if (!roots) - return NULL; - - *num_ret = num; - for (i = 0; i < num; i++) - roots[i] = RootWindow(_ecore_x_disp, i); - } - -#else /* ifdef ECORE_XPRINT */ - num = ScreenCount(_ecore_x_disp); - roots = malloc(num * sizeof(Window)); - if (!roots) - return NULL; - - *num_ret = num; - for (i = 0; i < num; i++) - roots[i] = RootWindow(_ecore_x_disp, i); -#endif /* ifdef ECORE_XPRINT */ - return roots; -} - -EAPI Ecore_X_Window -ecore_x_window_root_first_get(void) -{ - return RootWindow(_ecore_x_disp, 0); -/* - int num; - Ecore_X_Window root, *roots = NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - roots = ecore_x_window_root_list(&num); - if (!(roots)) return 0; - - if (num > 0) - root = roots[0]; - else - root = 0; - - free(roots); - return root; - */ -} - -static void _ecore_x_window_manage_error(void *data); - -static int _ecore_x_window_manage_failed = 0; -static void -_ecore_x_window_manage_error(void *data __UNUSED__) -{ - if ((ecore_x_error_request_get() == X_ChangeWindowAttributes) && - (ecore_x_error_code_get() == BadAccess)) - _ecore_x_window_manage_failed = 1; -} - -EAPI Eina_Bool -ecore_x_window_manage(Ecore_X_Window win) -{ - XWindowAttributes att; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (XGetWindowAttributes(_ecore_x_disp, win, &att) != True) - return EINA_FALSE; - - ecore_x_sync(); - _ecore_x_window_manage_failed = 0; - ecore_x_error_handler_set(_ecore_x_window_manage_error, NULL); - XSelectInput(_ecore_x_disp, win, - EnterWindowMask | - LeaveWindowMask | - PropertyChangeMask | - ResizeRedirectMask | - SubstructureRedirectMask | - SubstructureNotifyMask | - StructureNotifyMask | - KeyPressMask | - KeyReleaseMask | - att.your_event_mask); - ecore_x_sync(); - ecore_x_error_handler_set(NULL, NULL); - if (_ecore_x_window_manage_failed) - { - _ecore_x_window_manage_failed = 0; - return EINA_FALSE; - } - - return EINA_TRUE; -} - -EAPI void -ecore_x_window_container_manage(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XSelectInput(_ecore_x_disp, win, - SubstructureRedirectMask | - SubstructureNotifyMask); -} - -EAPI void -ecore_x_window_client_manage(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XSelectInput(_ecore_x_disp, win, - PropertyChangeMask | -// ResizeRedirectMask | - FocusChangeMask | - ColormapChangeMask | - VisibilityChangeMask | - StructureNotifyMask | - SubstructureNotifyMask - ); - XShapeSelectInput(_ecore_x_disp, win, ShapeNotifyMask); -} - -EAPI void -ecore_x_window_sniff(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XSelectInput(_ecore_x_disp, win, - PropertyChangeMask | - SubstructureNotifyMask); -} - -EAPI void -ecore_x_window_client_sniff(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XSelectInput(_ecore_x_disp, win, - PropertyChangeMask | - FocusChangeMask | - ColormapChangeMask | - VisibilityChangeMask | - StructureNotifyMask | - SubstructureNotifyMask); - XShapeSelectInput(_ecore_x_disp, win, ShapeNotifyMask); -} - -EAPI Eina_Bool -ecore_x_window_attributes_get(Ecore_X_Window win, - Ecore_X_Window_Attributes *att_ret) -{ - XWindowAttributes att; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!XGetWindowAttributes(_ecore_x_disp, win, &att)) - return EINA_FALSE; - - memset(att_ret, 0, sizeof(Ecore_X_Window_Attributes)); - att_ret->root = att.root; - att_ret->x = att.x; - att_ret->y = att.y; - att_ret->w = att.width; - att_ret->h = att.height; - att_ret->border = att.border_width; - att_ret->depth = att.depth; - if (att.map_state != IsUnmapped) - att_ret->visible = 1; - - if (att.map_state == IsViewable) - att_ret->viewable = 1; - - if (att.override_redirect) - att_ret->override = 1; - - if (att.class == InputOnly) - att_ret->input_only = 1; - - if (att.save_under) - att_ret->save_under = 1; - - att_ret->event_mask.mine = att.your_event_mask; - att_ret->event_mask.all = att.all_event_masks; - att_ret->event_mask.no_propagate = att.do_not_propagate_mask; - att_ret->window_gravity = att.win_gravity; - att_ret->pixel_gravity = att.bit_gravity; - att_ret->colormap = att.colormap; - att_ret->visual = att.visual; - return EINA_TRUE; -} - -EAPI void -ecore_x_window_save_set_add(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XAddToSaveSet(_ecore_x_disp, win); -} - -EAPI void -ecore_x_window_save_set_del(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XRemoveFromSaveSet(_ecore_x_disp, win); -} - -EAPI Ecore_X_Window * -ecore_x_window_children_get(Ecore_X_Window win, - int *num) -{ - Ecore_X_Window *windows = NULL; - Window root_ret = 0, parent_ret = 0, *children_ret = NULL; - unsigned int children_ret_num = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!XQueryTree(_ecore_x_disp, win, &root_ret, &parent_ret, &children_ret, - &children_ret_num)) - return NULL; - - if (children_ret) - { - windows = malloc(children_ret_num * sizeof(Ecore_X_Window)); - if (windows) - { - unsigned int i; - - for (i = 0; i < children_ret_num; i++) - windows[i] = children_ret[i]; - *num = children_ret_num; - } - - XFree(children_ret); - } - - return windows; -} - -EAPI Eina_Bool -ecore_x_pointer_control_set(int accel_num, - int accel_denom, - int threshold) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return XChangePointerControl(_ecore_x_disp, 1, 1, - accel_num, accel_denom, threshold) ? EINA_TRUE : EINA_FALSE; -} - -EAPI Eina_Bool -ecore_x_pointer_control_get(int *accel_num, - int *accel_denom, - int *threshold) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return XGetPointerControl(_ecore_x_disp, - accel_num, accel_denom, threshold) ? EINA_TRUE : EINA_FALSE; -} - -EAPI Eina_Bool -ecore_x_pointer_mapping_set(unsigned char *map, - int nmap) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return XSetPointerMapping(_ecore_x_disp, map, nmap) ? EINA_TRUE : EINA_FALSE; -} - -EAPI Eina_Bool -ecore_x_pointer_mapping_get(unsigned char *map, - int nmap) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return XGetPointerMapping(_ecore_x_disp, map, nmap) ? EINA_TRUE : EINA_FALSE; -} - -EAPI Eina_Bool -ecore_x_pointer_grab(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (XGrabPointer(_ecore_x_disp, win, False, - ButtonPressMask | ButtonReleaseMask | - EnterWindowMask | LeaveWindowMask | PointerMotionMask, - GrabModeAsync, GrabModeAsync, - None, None, CurrentTime) == GrabSuccess) - return EINA_TRUE; - - return EINA_FALSE; -} - -EAPI Eina_Bool -ecore_x_pointer_confine_grab(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (XGrabPointer(_ecore_x_disp, win, False, - ButtonPressMask | ButtonReleaseMask | - EnterWindowMask | LeaveWindowMask | PointerMotionMask, - GrabModeAsync, GrabModeAsync, - win, None, CurrentTime) == GrabSuccess) - return EINA_TRUE; - - return EINA_FALSE; -} - -EAPI void -ecore_x_pointer_ungrab(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XUngrabPointer(_ecore_x_disp, CurrentTime); -} - -EAPI Eina_Bool -ecore_x_pointer_warp(Ecore_X_Window win, - int x, - int y) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return XWarpPointer(_ecore_x_disp, None, win, 0, 0, 0, 0, x, y) ? EINA_TRUE : EINA_FALSE; -} - -EAPI Eina_Bool -ecore_x_keyboard_grab(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (XGrabKeyboard(_ecore_x_disp, win, False, - GrabModeAsync, GrabModeAsync, - CurrentTime) == GrabSuccess) - return EINA_TRUE; - - return EINA_FALSE; -} - -EAPI void -ecore_x_keyboard_ungrab(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XUngrabKeyboard(_ecore_x_disp, CurrentTime); -} - -EAPI void -ecore_x_grab(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - _ecore_x_grab_count++; - if (_ecore_x_grab_count == 1) - XGrabServer(_ecore_x_disp); -} - -EAPI void -ecore_x_ungrab(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - _ecore_x_grab_count--; - if (_ecore_x_grab_count < 0) - _ecore_x_grab_count = 0; - - if (_ecore_x_grab_count == 0) - XUngrabServer(_ecore_x_disp); -} - -int _ecore_window_grabs_num = 0; -Window *_ecore_window_grabs = NULL; -Eina_Bool (*_ecore_window_grab_replay_func)(void *data, - int event_type, - void *event); -void *_ecore_window_grab_replay_data; - -EAPI void -ecore_x_passive_grab_replay_func_set(Eina_Bool (*func)(void *data, - int event_type, - void *event), - void *data) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - _ecore_window_grab_replay_func = func; - _ecore_window_grab_replay_data = data; -} - -EAPI void -ecore_x_window_button_grab(Ecore_X_Window win, - int button, - Ecore_X_Event_Mask event_mask, - int mod, - int any_mod) -{ - unsigned int b; - unsigned int m; - unsigned int locks[8]; - int i, ev; - Window *t; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - b = button; - if (b == 0) - b = AnyButton; - - m = _ecore_x_event_modifier(mod); - if (any_mod) - m = AnyModifier; - - locks[0] = 0; - locks[1] = ECORE_X_LOCK_CAPS; - locks[2] = ECORE_X_LOCK_NUM; - locks[3] = ECORE_X_LOCK_SCROLL; - locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM; - locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL; - locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; - locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; - ev = event_mask; - for (i = 0; i < 8; i++) - XGrabButton(_ecore_x_disp, b, m | locks[i], - win, False, ev, GrabModeSync, GrabModeAsync, None, None); - _ecore_window_grabs_num++; - t = realloc(_ecore_window_grabs, - _ecore_window_grabs_num * sizeof(Window)); - if (!t) return; - _ecore_window_grabs = t; - _ecore_window_grabs[_ecore_window_grabs_num - 1] = win; -} - -void -_ecore_x_sync_magic_send(int val, - Ecore_X_Window swin) -{ - XEvent xev; - - xev.xclient.type = ClientMessage; - xev.xclient.serial = 0; - xev.xclient.send_event = True; - xev.xclient.display = _ecore_x_disp; - xev.xclient.window = _ecore_x_private_win; - xev.xclient.format = 32; - xev.xclient.message_type = 27777; - xev.xclient.data.l[0] = 0x7162534; - xev.xclient.data.l[1] = 0x10000000 + val; - xev.xclient.data.l[2] = swin; - XSendEvent(_ecore_x_disp, _ecore_x_private_win, False, NoEventMask, &xev); -} - -void -_ecore_x_window_grab_remove(Ecore_X_Window win) -{ - int i, shuffle = 0; - Window *t; - - if (_ecore_window_grabs_num > 0) - { - for (i = 0; i < _ecore_window_grabs_num; i++) - { - if (shuffle) - _ecore_window_grabs[i - 1] = _ecore_window_grabs[i]; - - if ((!shuffle) && (_ecore_window_grabs[i] == win)) - shuffle = 1; - } - if (shuffle) - { - _ecore_window_grabs_num--; - if (_ecore_window_grabs_num <= 0) - { - free(_ecore_window_grabs); - _ecore_window_grabs = NULL; - return; - } - t = realloc(_ecore_window_grabs, - _ecore_window_grabs_num * - sizeof(Window)); - if (!t) return; - _ecore_window_grabs = t; - } - } -} - -EAPI void -ecore_x_window_button_ungrab(Ecore_X_Window win, - int button, - int mod, - int any_mod) -{ - unsigned int b; - unsigned int m; - unsigned int locks[8]; - int i; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - b = button; - if (b == 0) - b = AnyButton; - - m = _ecore_x_event_modifier(mod); - if (any_mod) - m = AnyModifier; - - locks[0] = 0; - locks[1] = ECORE_X_LOCK_CAPS; - locks[2] = ECORE_X_LOCK_NUM; - locks[3] = ECORE_X_LOCK_SCROLL; - locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM; - locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL; - locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; - locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; - for (i = 0; i < 8; i++) - XUngrabButton(_ecore_x_disp, b, m | locks[i], win); - _ecore_x_sync_magic_send(1, win); -} - -int _ecore_key_grabs_num = 0; -Window *_ecore_key_grabs = NULL; - -EAPI void -ecore_x_window_key_grab(Ecore_X_Window win, - const char *key, - int mod, - int any_mod) -{ - KeyCode keycode = 0; - KeySym keysym; - unsigned int m; - unsigned int locks[8]; - int i; - Window *t; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!strncmp(key, "Keycode-", 8)) - keycode = atoi(key + 8); - else - { - keysym = XStringToKeysym(key); - if (keysym == NoSymbol) - return; - - keycode = XKeysymToKeycode(_ecore_x_disp, XStringToKeysym(key)); - } - - if (keycode == 0) - return; - - m = _ecore_x_event_modifier(mod); - if (any_mod) - m = AnyModifier; - - locks[0] = 0; - locks[1] = ECORE_X_LOCK_CAPS; - locks[2] = ECORE_X_LOCK_NUM; - locks[3] = ECORE_X_LOCK_SCROLL; - locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM; - locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL; - locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; - locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; - for (i = 0; i < 8; i++) - XGrabKey(_ecore_x_disp, keycode, m | locks[i], - win, False, GrabModeSync, GrabModeAsync); - _ecore_key_grabs_num++; - t = realloc(_ecore_key_grabs, - _ecore_key_grabs_num * sizeof(Window)); - if (!t) return; - _ecore_key_grabs = t; - _ecore_key_grabs[_ecore_key_grabs_num - 1] = win; -} - -void -_ecore_x_key_grab_remove(Ecore_X_Window win) -{ - int i, shuffle = 0; - Window *t; - - if (_ecore_key_grabs_num > 0) - { - for (i = 0; i < _ecore_key_grabs_num; i++) - { - if (shuffle) - _ecore_key_grabs[i - 1] = _ecore_key_grabs[i]; - - if ((!shuffle) && (_ecore_key_grabs[i] == win)) - shuffle = 1; - } - if (shuffle) - { - _ecore_key_grabs_num--; - if (_ecore_key_grabs_num <= 0) - { - free(_ecore_key_grabs); - _ecore_key_grabs = NULL; - return; - } - t = realloc(_ecore_key_grabs, - _ecore_key_grabs_num * sizeof(Window)); - if (!t) return; - _ecore_key_grabs = t; - } - } -} - -EAPI void -ecore_x_window_key_ungrab(Ecore_X_Window win, - const char *key, - int mod, - int any_mod) -{ - KeyCode keycode = 0; - KeySym keysym; - unsigned int m; - unsigned int locks[8]; - int i; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!strncmp(key, "Keycode-", 8)) - keycode = atoi(key + 8); - else - { - keysym = XStringToKeysym(key); - if (keysym == NoSymbol) - return; - - keycode = XKeysymToKeycode(_ecore_x_disp, XStringToKeysym(key)); - } - - if (keycode == 0) - return; - - m = _ecore_x_event_modifier(mod); - if (any_mod) - m = AnyModifier; - - locks[0] = 0; - locks[1] = ECORE_X_LOCK_CAPS; - locks[2] = ECORE_X_LOCK_NUM; - locks[3] = ECORE_X_LOCK_SCROLL; - locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM; - locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL; - locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; - locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; - for (i = 0; i < 8; i++) - XUngrabKey(_ecore_x_disp, keycode, m | locks[i], win); - _ecore_x_sync_magic_send(2, win); -} - -/** - * Send client message with given type and format 32. - * - * @param win The window the message is sent to. - * @param type The client message type. - * @param d0 The client message data item 1 - * @param d1 The client message data item 2 - * @param d2 The client message data item 3 - * @param d3 The client message data item 4 - * @param d4 The client message data item 5 - * - * @return EINA_TRUE on success EINA_FALSE otherwise. - */ -EAPI Eina_Bool -ecore_x_client_message32_send(Ecore_X_Window win, - Ecore_X_Atom type, - Ecore_X_Event_Mask mask, - long d0, - long d1, - long d2, - long d3, - long d4) -{ - XEvent xev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - xev.xclient.window = win; - xev.xclient.type = ClientMessage; - xev.xclient.message_type = type; - xev.xclient.format = 32; - xev.xclient.data.l[0] = d0; - xev.xclient.data.l[1] = d1; - xev.xclient.data.l[2] = d2; - xev.xclient.data.l[3] = d3; - xev.xclient.data.l[4] = d4; - - return XSendEvent(_ecore_x_disp, win, False, mask, &xev) ? EINA_TRUE : EINA_FALSE; -} - -/** - * Send client message with given type and format 8. - * - * @param win The window the message is sent to. - * @param type The client message type. - * @param data Data to be sent. - * @param len Number of data bytes, max 20. - * - * @return EINA_TRUE on success EINA_FALSE otherwise. - */ -EAPI Eina_Bool -ecore_x_client_message8_send(Ecore_X_Window win, - Ecore_X_Atom type, - const void *data, - int len) -{ - XEvent xev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - xev.xclient.window = win; - xev.xclient.type = ClientMessage; - xev.xclient.message_type = type; - xev.xclient.format = 8; - if (len > 20) - len = 20; - - memcpy(xev.xclient.data.b, data, len); - memset(xev.xclient.data.b + len, 0, 20 - len); - - return XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev) ? EINA_TRUE : EINA_FALSE; -} - -EAPI Eina_Bool -ecore_x_mouse_move_send(Ecore_X_Window win, - int x, - int y) -{ - XEvent xev; - XWindowAttributes att; - Window tw; - int rx, ry; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XGetWindowAttributes(_ecore_x_disp, win, &att); - XTranslateCoordinates(_ecore_x_disp, win, att.root, x, y, &rx, &ry, &tw); - xev.xmotion.type = MotionNotify; - xev.xmotion.window = win; - xev.xmotion.root = att.root; - xev.xmotion.subwindow = win; - xev.xmotion.time = _ecore_x_event_last_time; - xev.xmotion.x = x; - xev.xmotion.y = y; - xev.xmotion.x_root = rx; - xev.xmotion.y_root = ry; - xev.xmotion.state = 0; - xev.xmotion.is_hint = 0; - xev.xmotion.same_screen = 1; - return XSendEvent(_ecore_x_disp, win, True, PointerMotionMask, &xev) ? EINA_TRUE : EINA_FALSE; -} - -EAPI Eina_Bool -ecore_x_mouse_down_send(Ecore_X_Window win, - int x, - int y, - int b) -{ - XEvent xev; - XWindowAttributes att; - Window tw; - int rx, ry; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XGetWindowAttributes(_ecore_x_disp, win, &att); - XTranslateCoordinates(_ecore_x_disp, win, att.root, x, y, &rx, &ry, &tw); - xev.xbutton.type = ButtonPress; - xev.xbutton.window = win; - xev.xbutton.root = att.root; - xev.xbutton.subwindow = win; - xev.xbutton.time = _ecore_x_event_last_time; - xev.xbutton.x = x; - xev.xbutton.y = y; - xev.xbutton.x_root = rx; - xev.xbutton.y_root = ry; - xev.xbutton.state = 1 << b; - xev.xbutton.button = b; - xev.xbutton.same_screen = 1; - return XSendEvent(_ecore_x_disp, win, True, ButtonPressMask, &xev) ? EINA_TRUE : EINA_FALSE; -} - -EAPI Eina_Bool -ecore_x_mouse_up_send(Ecore_X_Window win, - int x, - int y, - int b) -{ - XEvent xev; - XWindowAttributes att; - Window tw; - int rx, ry; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XGetWindowAttributes(_ecore_x_disp, win, &att); - XTranslateCoordinates(_ecore_x_disp, win, att.root, x, y, &rx, &ry, &tw); - xev.xbutton.type = ButtonRelease; - xev.xbutton.window = win; - xev.xbutton.root = att.root; - xev.xbutton.subwindow = win; - xev.xbutton.time = _ecore_x_event_last_time; - xev.xbutton.x = x; - xev.xbutton.y = y; - xev.xbutton.x_root = rx; - xev.xbutton.y_root = ry; - xev.xbutton.state = 0; - xev.xbutton.button = b; - xev.xbutton.same_screen = 1; - return XSendEvent(_ecore_x_disp, win, True, ButtonReleaseMask, &xev) ? EINA_TRUE : EINA_FALSE; -} - -EAPI void -ecore_x_focus_reset(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XSetInputFocus(_ecore_x_disp, PointerRoot, RevertToPointerRoot, CurrentTime); -} - -EAPI void -ecore_x_events_allow_all(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XAllowEvents(_ecore_x_disp, AsyncBoth, CurrentTime); -} - -EAPI void -ecore_x_pointer_last_xy_get(int *x, - int *y) -{ - if (x) - *x = _ecore_x_event_last_root_x; - - if (y) - *y = _ecore_x_event_last_root_y; -} - -EAPI void -ecore_x_pointer_xy_get(Ecore_X_Window win, - int *x, - int *y) -{ - Window rwin, cwin; - int rx, ry, wx, wy, ret; - unsigned int mask; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ret = XQueryPointer(_ecore_x_disp, win, &rwin, &cwin, - &rx, &ry, &wx, &wy, &mask); - if (!ret) - wx = wy = -1; - - if (x) *x = wx; - if (y) *y = wy; -} - -/** - * Retrieve the Visual ID from a given Visual. - * - * @param visual The Visual to get the ID for. - * - * @return The visual id. - * @since 1.1.0 - */ -EAPI unsigned int -ecore_x_visual_id_get(Ecore_X_Visual visual) -{ - return XVisualIDFromVisual(visual); -} - -/** - * Retrieve the default Visual. - * - * @param disp The Display to get the Default Visual from - * @param screen The Screen. - * - * @return The default visual. - * @since 1.1.0 - */ -EAPI Ecore_X_Visual -ecore_x_default_visual_get(Ecore_X_Display *disp, - Ecore_X_Screen *screen) -{ - return DefaultVisual(disp, ecore_x_screen_index_get(screen)); -} - -/** - * Retrieve the default Colormap. - * - * @param disp The Display to get the Default Colormap from - * @param screen The Screen. - * - * @return The default colormap. - * @since 1.1.0 - */ -EAPI Ecore_X_Colormap -ecore_x_default_colormap_get(Ecore_X_Display *disp, - Ecore_X_Screen *screen) -{ - return DefaultColormap(disp, ecore_x_screen_index_get(screen)); -} - -/** - * Retrieve the default depth. - * - * @param disp The Display to get the Default Depth from - * @param screen The Screen. - * - * @return The default depth. - * @since 1.1.0 - */ -EAPI int -ecore_x_default_depth_get(Ecore_X_Display *disp, - Ecore_X_Screen *screen) -{ - return DefaultDepth(disp, ecore_x_screen_index_get(screen)); -} - -/*****************************************************************************/ -/*****************************************************************************/ -/*****************************************************************************/ - -static int -_ecore_x_event_modifier(unsigned int state) -{ - int xmodifiers = 0; - - if (state & ECORE_EVENT_MODIFIER_SHIFT) - xmodifiers |= ECORE_X_MODIFIER_SHIFT; - - if (state & ECORE_EVENT_MODIFIER_CTRL) - xmodifiers |= ECORE_X_MODIFIER_CTRL; - - if (state & ECORE_EVENT_MODIFIER_ALT) - xmodifiers |= ECORE_X_MODIFIER_ALT; - - if (state & ECORE_EVENT_MODIFIER_WIN) - xmodifiers |= ECORE_X_MODIFIER_WIN; - - if (state & ECORE_EVENT_LOCK_SCROLL) - xmodifiers |= ECORE_X_LOCK_SCROLL; - - if (state & ECORE_EVENT_LOCK_NUM) - xmodifiers |= ECORE_X_LOCK_NUM; - - if (state & ECORE_EVENT_LOCK_CAPS) - xmodifiers |= ECORE_X_LOCK_CAPS; - - if (state & ECORE_EVENT_LOCK_SHIFT) - xmodifiers |= ECORE_X_LOCK_SHIFT; - - return xmodifiers; -} - diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_atoms.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_atoms.c deleted file mode 100644 index 7a8bffa..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_atoms.c +++ /dev/null @@ -1,367 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include -#endif /* ifdef HAVE_CONFIG_H */ - -#ifdef HAVE_ALLOCA_H -# include -#elif defined __GNUC__ -# define alloca __builtin_alloca -#elif defined _AIX -# define alloca __alloca -#elif defined _MSC_VER -# include -# define alloca _alloca -#else /* ifdef HAVE_ALLOCA_H */ -# include -# ifdef __cplusplus -extern "C" -# endif /* ifdef __cplusplus */ -void *alloca(size_t); -#endif /* ifdef HAVE_ALLOCA_H */ - -#include - -#include "Ecore.h" -#include "ecore_x_private.h" -#include "Ecore_X.h" -#include "Ecore_X_Atoms.h" - -#include "ecore_x_atoms_decl.h" - -typedef struct -{ - const char *name; - Ecore_X_Atom *atom; -} Atom_Item; - -void -_ecore_x_atoms_init(void) -{ - const Atom_Item items[] = - { - { "ATOM", &ECORE_X_ATOM_ATOM }, - { "CARDINAL", &ECORE_X_ATOM_CARDINAL }, - { "COMPOUND_TEXT", &ECORE_X_ATOM_COMPOUND_TEXT }, - { "FILE_NAME", &ECORE_X_ATOM_FILE_NAME }, - { "STRING", &ECORE_X_ATOM_STRING }, - { "TEXT", &ECORE_X_ATOM_TEXT }, - { "UTF8_STRING", &ECORE_X_ATOM_UTF8_STRING }, - { "WINDOW", &ECORE_X_ATOM_WINDOW }, - { "PIXMAP", &ECORE_X_ATOM_PIXMAP }, - - { "JXSelectionWindowProperty", &ECORE_X_ATOM_SELECTION_PROP_XDND }, - { "XdndSelection", &ECORE_X_ATOM_SELECTION_XDND }, - { "XdndAware", &ECORE_X_ATOM_XDND_AWARE }, - { "XdndEnter", &ECORE_X_ATOM_XDND_ENTER }, - { "XdndTypeList", &ECORE_X_ATOM_XDND_TYPE_LIST }, - { "XdndPosition", &ECORE_X_ATOM_XDND_POSITION }, - { "XdndActionCopy", &ECORE_X_ATOM_XDND_ACTION_COPY }, - { "XdndActionMove", &ECORE_X_ATOM_XDND_ACTION_MOVE }, - { "XdndActionPrivate", &ECORE_X_ATOM_XDND_ACTION_PRIVATE }, - { "XdndActionAsk", &ECORE_X_ATOM_XDND_ACTION_ASK }, - { "XdndActionList", &ECORE_X_ATOM_XDND_ACTION_LIST }, - { "XdndActionLink", &ECORE_X_ATOM_XDND_ACTION_LINK }, - { "XdndActionDescription", &ECORE_X_ATOM_XDND_ACTION_DESCRIPTION }, - { "XdndProxy", &ECORE_X_ATOM_XDND_PROXY }, - { "XdndStatus", &ECORE_X_ATOM_XDND_STATUS }, - { "XdndLeave", &ECORE_X_ATOM_XDND_LEAVE }, - { "XdndDrop", &ECORE_X_ATOM_XDND_DROP }, - { "XdndFinished", &ECORE_X_ATOM_XDND_FINISHED }, - - { "XdndActionCopy", &ECORE_X_DND_ACTION_COPY }, - { "XdndActionMove", &ECORE_X_DND_ACTION_MOVE }, - { "XdndActionLink", &ECORE_X_DND_ACTION_LINK }, - { "XdndActionAsk", &ECORE_X_DND_ACTION_ASK }, - { "XdndActionPrivate", &ECORE_X_DND_ACTION_PRIVATE }, - - { "_E_FRAME_SIZE", &ECORE_X_ATOM_E_FRAME_SIZE }, - - { "_WIN_LAYER", &ECORE_X_ATOM_WIN_LAYER }, - - { "WM_NAME", &ECORE_X_ATOM_WM_NAME }, - { "WM_ICON_NAME", &ECORE_X_ATOM_WM_ICON_NAME }, - { "WM_NORMAL_HINTS", &ECORE_X_ATOM_WM_NORMAL_HINTS }, - { "WM_SIZE_HINTS", &ECORE_X_ATOM_WM_SIZE_HINTS }, - { "WM_HINTS", &ECORE_X_ATOM_WM_HINTS }, - { "WM_CLASS", &ECORE_X_ATOM_WM_CLASS }, - { "WM_TRANSIENT_FOR", &ECORE_X_ATOM_WM_TRANSIENT_FOR }, - { "WM_PROTOCOLS", &ECORE_X_ATOM_WM_PROTOCOLS }, - { "WM_COLORMAP_WINDOWS", &ECORE_X_ATOM_WM_COLORMAP_WINDOWS }, - { "WM_COMMAND", &ECORE_X_ATOM_WM_COMMAND }, - { "WM_CLIENT_MACHINE", &ECORE_X_ATOM_WM_CLIENT_MACHINE }, - - { "WM_STATE", &ECORE_X_ATOM_WM_STATE }, - { "WM_ICON_SIZE", &ECORE_X_ATOM_WM_ICON_SIZE }, - - { "WM_CHANGE_STATE", &ECORE_X_ATOM_WM_CHANGE_STATE }, - - { "WM_TAKE_FOCUS", &ECORE_X_ATOM_WM_TAKE_FOCUS }, - { "WM_SAVE_YOURSELF", &ECORE_X_ATOM_WM_SAVE_YOURSELF }, - { "WM_DELETE_WINDOW", &ECORE_X_ATOM_WM_DELETE_WINDOW }, - - { "WM_COLORMAP_NOTIFY", &ECORE_X_ATOM_WM_COLORMAP_NOTIFY }, - - { "SM_CLIENT_ID", &ECORE_X_ATOM_SM_CLIENT_ID }, - { "WM_CLIENT_LEADER", &ECORE_X_ATOM_WM_CLIENT_LEADER }, - { "WM_WINDOW_ROLE", &ECORE_X_ATOM_WM_WINDOW_ROLE }, - - { "_MOTIF_WM_HINTS", &ECORE_X_ATOM_MOTIF_WM_HINTS }, - - { "_NET_SUPPORTED", &ECORE_X_ATOM_NET_SUPPORTED }, - { "_NET_CLIENT_LIST", &ECORE_X_ATOM_NET_CLIENT_LIST }, - { "_NET_CLIENT_LIST_STACKING", &ECORE_X_ATOM_NET_CLIENT_LIST_STACKING }, - { "_NET_NUMBER_OF_DESKTOPS", &ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS }, - { "_NET_DESKTOP_GEOMETRY", &ECORE_X_ATOM_NET_DESKTOP_GEOMETRY }, - { "_NET_DESKTOP_VIEWPORT", &ECORE_X_ATOM_NET_DESKTOP_VIEWPORT }, - { "_NET_CURRENT_DESKTOP", &ECORE_X_ATOM_NET_CURRENT_DESKTOP }, - { "_NET_DESKTOP_NAMES", &ECORE_X_ATOM_NET_DESKTOP_NAMES }, - { "_NET_ACTIVE_WINDOW", &ECORE_X_ATOM_NET_ACTIVE_WINDOW }, - { "_NET_WORKAREA", &ECORE_X_ATOM_NET_WORKAREA }, - { "_NET_SUPPORTING_WM_CHECK", &ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK }, - { "_NET_VIRTUAL_ROOTS", &ECORE_X_ATOM_NET_VIRTUAL_ROOTS }, - { "_NET_DESKTOP_LAYOUT", &ECORE_X_ATOM_NET_DESKTOP_LAYOUT }, - { "_NET_SHOWING_DESKTOP", &ECORE_X_ATOM_NET_SHOWING_DESKTOP }, - - { "_NET_CLOSE_WINDOW", &ECORE_X_ATOM_NET_CLOSE_WINDOW }, - { "_NET_MOVERESIZE_WINDOW", &ECORE_X_ATOM_NET_MOVERESIZE_WINDOW }, - { "_NET_WM_MOVERESIZE", &ECORE_X_ATOM_NET_WM_MOVERESIZE }, - { "_NET_RESTACK_WINDOW", &ECORE_X_ATOM_NET_RESTACK_WINDOW }, - - { "_NET_REQUEST_FRAME_EXTENTS", &ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS }, - - { "_NET_WM_NAME", &ECORE_X_ATOM_NET_WM_NAME }, - { "_NET_WM_VISIBLE_NAME", &ECORE_X_ATOM_NET_WM_VISIBLE_NAME }, - { "_NET_WM_ICON_NAME", &ECORE_X_ATOM_NET_WM_ICON_NAME }, - { "_NET_WM_VISIBLE_ICON_NAME", &ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME }, - { "_NET_WM_DESKTOP", &ECORE_X_ATOM_NET_WM_DESKTOP }, - - { "_NET_WM_WINDOW_TYPE", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE }, - { "_NET_WM_WINDOW_TYPE_DESKTOP", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP }, - { "_NET_WM_WINDOW_TYPE_DOCK", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK }, - { "_NET_WM_WINDOW_TYPE_TOOLBAR", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR }, - { "_NET_WM_WINDOW_TYPE_MENU", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU }, - { "_NET_WM_WINDOW_TYPE_UTILITY", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY }, - { "_NET_WM_WINDOW_TYPE_SPLASH", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH }, - { "_NET_WM_WINDOW_TYPE_DIALOG", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG }, - { "_NET_WM_WINDOW_TYPE_NORMAL", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL }, - { "_NET_WM_WINDOW_TYPE_DROPDOWN_MENU", - &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DROPDOWN_MENU }, - { "_NET_WM_WINDOW_TYPE_POPUP_MENU", - &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_POPUP_MENU }, - { "_NET_WM_WINDOW_TYPE_TOOLTIP", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLTIP }, - { "_NET_WM_WINDOW_TYPE_NOTIFICATION", - &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NOTIFICATION }, - { "_NET_WM_WINDOW_TYPE_COMBO", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_COMBO }, - { "_NET_WM_WINDOW_TYPE_DND", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DND }, - - { "_NET_WM_STATE", &ECORE_X_ATOM_NET_WM_STATE }, - { "_NET_WM_STATE_MODAL", &ECORE_X_ATOM_NET_WM_STATE_MODAL }, - { "_NET_WM_STATE_STICKY", &ECORE_X_ATOM_NET_WM_STATE_STICKY }, - { "_NET_WM_STATE_MAXIMIZED_VERT", - &ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT }, - { "_NET_WM_STATE_MAXIMIZED_HORZ", - &ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ }, - { "_NET_WM_STATE_SHADED", &ECORE_X_ATOM_NET_WM_STATE_SHADED }, - { "_NET_WM_STATE_SKIP_TASKBAR", &ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR }, - { "_NET_WM_STATE_SKIP_PAGER", &ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER }, - { "_NET_WM_STATE_HIDDEN", &ECORE_X_ATOM_NET_WM_STATE_HIDDEN }, - { "_NET_WM_STATE_FULLSCREEN", &ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN }, - { "_NET_WM_STATE_ABOVE", &ECORE_X_ATOM_NET_WM_STATE_ABOVE }, - { "_NET_WM_STATE_BELOW", &ECORE_X_ATOM_NET_WM_STATE_BELOW }, - { "_NET_WM_STATE_DEMANDS_ATTENTION", - &ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION }, - - { "_NET_WM_ALLOWED_ACTIONS", &ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS }, - { "_NET_WM_ACTION_MOVE", &ECORE_X_ATOM_NET_WM_ACTION_MOVE }, - { "_NET_WM_ACTION_RESIZE", &ECORE_X_ATOM_NET_WM_ACTION_RESIZE }, - { "_NET_WM_ACTION_MINIMIZE", &ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE }, - { "_NET_WM_ACTION_SHADE", &ECORE_X_ATOM_NET_WM_ACTION_SHADE }, - { "_NET_WM_ACTION_STICK", &ECORE_X_ATOM_NET_WM_ACTION_STICK }, - { "_NET_WM_ACTION_MAXIMIZE_HORZ", - &ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ }, - { "_NET_WM_ACTION_MAXIMIZE_VERT", - &ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT }, - { "_NET_WM_ACTION_FULLSCREEN", &ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN }, - { "_NET_WM_ACTION_CHANGE_DESKTOP", - &ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP }, - { "_NET_WM_ACTION_CLOSE", &ECORE_X_ATOM_NET_WM_ACTION_CLOSE }, - { "_NET_WM_ACTION_ABOVE", &ECORE_X_ATOM_NET_WM_ACTION_ABOVE }, - { "_NET_WM_ACTION_BELOW", &ECORE_X_ATOM_NET_WM_ACTION_BELOW }, - - { "_NET_WM_STRUT", &ECORE_X_ATOM_NET_WM_STRUT }, - { "_NET_WM_STRUT_PARTIAL", &ECORE_X_ATOM_NET_WM_STRUT_PARTIAL }, - { "_NET_WM_ICON_GEOMETRY", &ECORE_X_ATOM_NET_WM_ICON_GEOMETRY }, - { "_NET_WM_ICON", &ECORE_X_ATOM_NET_WM_ICON }, - { "_NET_WM_PID", &ECORE_X_ATOM_NET_WM_PID }, - { "_NET_WM_HANDLED_ICONS", &ECORE_X_ATOM_NET_WM_HANDLED_ICONS }, - { "_NET_WM_USER_TIME", &ECORE_X_ATOM_NET_WM_USER_TIME }, - { "_NET_STARTUP_ID", &ECORE_X_ATOM_NET_STARTUP_ID }, - { "_NET_FRAME_EXTENTS", &ECORE_X_ATOM_NET_FRAME_EXTENTS }, - - { "_NET_WM_PING", &ECORE_X_ATOM_NET_WM_PING }, - { "_NET_WM_SYNC_REQUEST", &ECORE_X_ATOM_NET_WM_SYNC_REQUEST }, - { "_NET_WM_SYNC_REQUEST_COUNTER", - &ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER }, - - { "_NET_WM_WINDOW_OPACITY", &ECORE_X_ATOM_NET_WM_WINDOW_OPACITY }, - { "_NET_WM_WINDOW_SHADOW", &ECORE_X_ATOM_NET_WM_WINDOW_SHADOW }, - { "_NET_WM_WINDOW_SHADE", &ECORE_X_ATOM_NET_WM_WINDOW_SHADE }, - - { "TARGETS", &ECORE_X_ATOM_SELECTION_TARGETS }, - { "CLIPBOARD", &ECORE_X_ATOM_SELECTION_CLIPBOARD }, - { "PRIMARY", &ECORE_X_ATOM_SELECTION_PRIMARY }, - { "SECONDARY", &ECORE_X_ATOM_SELECTION_SECONDARY }, - { "_ECORE_SELECTION_PRIMARY", &ECORE_X_ATOM_SELECTION_PROP_PRIMARY }, - { "_ECORE_SELECTION_SECONDARY", &ECORE_X_ATOM_SELECTION_PROP_SECONDARY }, - { "_ECORE_SELECTION_CLIPBOARD", &ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD }, - - { "_E_VIRTUAL_KEYBOARD", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD }, - { "_E_VIRTUAL_KEYBOARD_STATE", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE }, - { "_E_VIRTUAL_KEYBOARD_ON", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON }, - { "_E_VIRTUAL_KEYBOARD_OFF", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF }, - { "_E_VIRTUAL_KEYBOARD_ALPHA", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ALPHA }, - { "_E_VIRTUAL_KEYBOARD_NUMERIC", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_NUMERIC }, - { "_E_VIRTUAL_KEYBOARD_PIN", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PIN }, - { "_E_VIRTUAL_KEYBOARD_PHONE_NUMBER", - &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PHONE_NUMBER }, - { "_E_VIRTUAL_KEYBOARD_HEX", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HEX }, - { "_E_VIRTUAL_KEYBOARD_TERMINAL", - &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_TERMINAL }, - { "_E_VIRTUAL_KEYBOARD_PASSWORD", - &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PASSWORD }, - { "_E_VIRTUAL_KEYBOARD_IP", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_IP }, - { "_E_VIRTUAL_KEYBOARD_HOST", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HOST }, - { "_E_VIRTUAL_KEYBOARD_FILE", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_FILE }, - { "_E_VIRTUAL_KEYBOARD_URL", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_URL }, - { "_E_VIRTUAL_KEYBOARD_KEYPAD", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_KEYPAD }, - { "_E_VIRTUAL_KEYBOARD_J2ME", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_J2ME }, - - { "_E_ILLUME_ZONE", &ECORE_X_ATOM_E_ILLUME_ZONE }, - { "_E_ILLUME_ZONE_LIST", &ECORE_X_ATOM_E_ILLUME_ZONE_LIST }, - { "_E_ILLUME_CONFORMANT", &ECORE_X_ATOM_E_ILLUME_CONFORMANT }, - { "_E_ILLUME_MODE", &ECORE_X_ATOM_E_ILLUME_MODE }, - { "_E_ILLUME_MODE_SINGLE", &ECORE_X_ATOM_E_ILLUME_MODE_SINGLE }, - { "_E_ILLUME_MODE_DUAL_TOP", &ECORE_X_ATOM_E_ILLUME_MODE_DUAL_TOP }, - { "_E_ILLUME_MODE_DUAL_LEFT", &ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT }, - { "_E_ILLUME_FOCUS_BACK", &ECORE_X_ATOM_E_ILLUME_FOCUS_BACK }, - { "_E_ILLUME_FOCUS_FORWARD", &ECORE_X_ATOM_E_ILLUME_FOCUS_FORWARD }, - { "_E_ILLUME_FOCUS_HOME", &ECORE_X_ATOM_E_ILLUME_FOCUS_HOME }, - { "_E_ILLUME_CLOSE", &ECORE_X_ATOM_E_ILLUME_CLOSE }, - { "_E_ILLUME_HOME_NEW", &ECORE_X_ATOM_E_ILLUME_HOME_NEW }, - { "_E_ILLUME_HOME_DEL", &ECORE_X_ATOM_E_ILLUME_HOME_DEL }, - { "_E_ILLUME_DRAG", &ECORE_X_ATOM_E_ILLUME_DRAG }, - { "_E_ILLUME_DRAG_LOCKED", &ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED }, - { "_E_ILLUME_DRAG_START", &ECORE_X_ATOM_E_ILLUME_DRAG_START }, - { "_E_ILLUME_DRAG_END", &ECORE_X_ATOM_E_ILLUME_DRAG_END }, - { "_E_ILLUME_INDICATOR_GEOMETRY", - &ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY }, - { "_E_ILLUME_SOFTKEY_GEOMETRY", &ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY }, - { "_E_ILLUME_KEYBOARD_GEOMETRY", &ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY }, - { "_E_ILLUME_QUICKPANEL", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL }, - { "_E_ILLUME_QUICKPANEL_STATE", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE }, - { "_E_ILLUME_QUICKPANEL_STATE_TOGGLE", - &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE_TOGGLE }, - { "_E_ILLUME_QUICKPANEL_ON", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON }, - { "_E_ILLUME_QUICKPANEL_OFF", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF }, - { "_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR", - &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR }, - { "_E_ILLUME_QUICKPANEL_PRIORITY_MINOR", - &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR }, - { "_E_ILLUME_QUICKPANEL_ZONE", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE }, - { "_E_ILLUME_QUICKPANEL_POSITION_UPDATE", - &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE }, - { "_E_ILLUME_INDICATOR_STATE", &ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE }, - { "_E_ILLUME_INDICATOR_ON", &ECORE_X_ATOM_E_ILLUME_INDICATOR_ON }, - { "_E_ILLUME_INDICATOR_OFF", &ECORE_X_ATOM_E_ILLUME_INDICATOR_OFF }, - { "_E_ILLUME_INDICATOR_OPACITY_MODE", &ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE }, - { "_E_ILLUME_INDICATOR_OPAQUE", &ECORE_X_ATOM_E_ILLUME_INDICATOR_OPAQUE }, - { "_E_ILLUME_INDICATOR_TRANSLUCENT", &ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSLUCENT }, - { "_E_ILLUME_INDICATOR_TRANSPARENT", &ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSPARENT }, - { "_E_ILLUME_ROTATE_WINDOW_AVAILABLE_ANGLES", &ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_AVAILABLE_ANGLE }, - { "_E_ILLUME_ROTATE_WINDOW_ANGLE", &ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE }, - { "_E_ILLUME_ROTATE_ROOT_ANGLE", &ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE }, - { "_E_ILLUME_CLIPBOARD_STATE", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE }, - { "_E_ILLUME_CLIPBOARD_ON", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_ON }, - { "_E_ILLUME_CLIPBOARD_OFF", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_OFF }, - { "_E_ILLUME_CLIPBOARD_GEOMETRY", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY }, - { "_E_COMP_SYNC_COUNTER", &ECORE_X_ATOM_E_COMP_SYNC_COUNTER }, - { "_E_COMP_SYNC_DRAW_DONE", &ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE }, - { "_E_COMP_SYNC_SUPPORTED", &ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED }, - { "_E_COMP_SYNC_BEGIN", &ECORE_X_ATOM_E_COMP_SYNC_BEGIN }, - { "_E_COMP_SYNC_END", &ECORE_X_ATOM_E_COMP_SYNC_END }, - { "_E_COMP_SYNC_CANCEL", &ECORE_X_ATOM_E_COMP_SYNC_CANCEL }, - - { "_E_COMP_FLUSH", &ECORE_X_ATOM_E_COMP_FLUSH }, - { "_E_COMP_DUMP", &ECORE_X_ATOM_E_COMP_DUMP }, - { "_E_COMP_PIXMAP", &ECORE_X_ATOM_E_COMP_PIXMAP }, - { "_E_VIDEO_PARENT", &ECORE_X_ATOM_E_VIDEO_PARENT }, - { "_E_VIDEO_POSITION", &ECORE_X_ATOM_E_VIDEO_POSITION } - }; - Atom *atoms; - char **names; - int i, num; - - num = sizeof(items) / sizeof(Atom_Item); - atoms = alloca(num * sizeof(Atom)); - names = alloca(num * sizeof(char *)); - for (i = 0; i < num; i++) - names[i] = (char *)items[i].name; - XInternAtoms(_ecore_x_disp, names, num, False, atoms); - for (i = 0; i < num; i++) - *(items[i].atom) = atoms[i]; -} - -/** - * Retrieves the atom value associated with the given name. - * @param name The given name. - * @return Associated atom value. - */ -EAPI Ecore_X_Atom -ecore_x_atom_get(const char *name) -{ - if (!_ecore_x_disp) - return 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return XInternAtom(_ecore_x_disp, name, False); -} - -EAPI void -ecore_x_atoms_get(const char **names, - int num, - Ecore_X_Atom *atoms) -{ - Atom *atoms_int; - int i; - - if (!_ecore_x_disp) - return; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - atoms_int = alloca(num * sizeof(Atom)); - XInternAtoms(_ecore_x_disp, (char **)names, num, False, atoms_int); - for (i = 0; i < num; i++) - atoms[i] = atoms_int[i]; -} - -EAPI char * -ecore_x_atom_name_get(Ecore_X_Atom atom) -{ - char *name; - char *xname; - - if (!_ecore_x_disp) - return NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - xname = XGetAtomName(_ecore_x_disp, atom); - if (!xname) - return NULL; - - name = strdup(xname); - XFree(xname); - - return name; -} - diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_composite.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_composite.c deleted file mode 100644 index b919db9..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_composite.c +++ /dev/null @@ -1,176 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include -#endif /* ifdef HAVE_CONFIG_H */ - -#include "ecore_x_private.h" -#include "Ecore_X.h" - -static Eina_Bool _composite_available = EINA_FALSE; - -void -_ecore_x_composite_init(void) -{ - _composite_available = EINA_FALSE; - -#ifdef ECORE_XCOMPOSITE - int major, minor; - - if (XCompositeQueryVersion(_ecore_x_disp, &major, &minor)) - { -# ifdef ECORE_XRENDER - if (XRenderQueryExtension(_ecore_x_disp, &major, &minor)) - { -# ifdef ECORE_XFIXES - if (XFixesQueryVersion(_ecore_x_disp, &major, &minor)) - { - _composite_available = EINA_TRUE; - } -# endif - } -# endif - } -#endif -} - -EAPI Eina_Bool -ecore_x_composite_query(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return _composite_available; -} - -EAPI void -ecore_x_composite_redirect_window(Ecore_X_Window win, - Ecore_X_Composite_Update_Type type) -{ -#ifdef ECORE_XCOMPOSITE - int update = CompositeRedirectAutomatic; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - switch (type) - { - case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC: - update = CompositeRedirectAutomatic; - break; - - case ECORE_X_COMPOSITE_UPDATE_MANUAL: - update = CompositeRedirectManual; - break; - } - XCompositeRedirectWindow(_ecore_x_disp, win, update); -#endif /* ifdef ECORE_XCOMPOSITE */ -} - -EAPI void -ecore_x_composite_redirect_subwindows(Ecore_X_Window win, - Ecore_X_Composite_Update_Type type) -{ -#ifdef ECORE_XCOMPOSITE - int update = CompositeRedirectAutomatic; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - switch (type) - { - case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC: - update = CompositeRedirectAutomatic; - break; - - case ECORE_X_COMPOSITE_UPDATE_MANUAL: - update = CompositeRedirectManual; - break; - } - XCompositeRedirectSubwindows(_ecore_x_disp, win, update); -#endif /* ifdef ECORE_XCOMPOSITE */ -} - -EAPI void -ecore_x_composite_unredirect_window(Ecore_X_Window win, - Ecore_X_Composite_Update_Type type) -{ -#ifdef ECORE_XCOMPOSITE - int update = CompositeRedirectAutomatic; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - switch (type) - { - case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC: - update = CompositeRedirectAutomatic; - break; - - case ECORE_X_COMPOSITE_UPDATE_MANUAL: - update = CompositeRedirectManual; - break; - } - XCompositeUnredirectWindow(_ecore_x_disp, win, update); -#endif /* ifdef ECORE_XCOMPOSITE */ -} - -EAPI void -ecore_x_composite_unredirect_subwindows(Ecore_X_Window win, - Ecore_X_Composite_Update_Type type) -{ -#ifdef ECORE_XCOMPOSITE - int update = CompositeRedirectAutomatic; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - switch (type) - { - case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC: - update = CompositeRedirectAutomatic; - break; - - case ECORE_X_COMPOSITE_UPDATE_MANUAL: - update = CompositeRedirectManual; - break; - } - XCompositeUnredirectSubwindows(_ecore_x_disp, win, update); -#endif /* ifdef ECORE_XCOMPOSITE */ -} - -EAPI Ecore_X_Pixmap -ecore_x_composite_name_window_pixmap_get(Ecore_X_Window win) -{ - Ecore_X_Pixmap pixmap = None; -#ifdef ECORE_XCOMPOSITE - LOGFN(__FILE__, __LINE__, __FUNCTION__); - pixmap = XCompositeNameWindowPixmap(_ecore_x_disp, win); -#endif /* ifdef ECORE_XCOMPOSITE */ - return pixmap; -} - -EAPI void -ecore_x_composite_window_events_disable(Ecore_X_Window win) -{ -#ifdef ECORE_XCOMPOSITE - ecore_x_window_shape_input_rectangle_set(win, -1, -1, 1, 1); -#endif /* ifdef ECORE_XCOMPOSITE */ -} - -EAPI void -ecore_x_composite_window_events_enable(Ecore_X_Window win) -{ -#ifdef ECORE_XCOMPOSITE - ecore_x_window_shape_input_rectangle_set(win, 0, 0, 65535, 65535); -#endif /* ifdef ECORE_XCOMPOSITE */ -} - -EAPI Ecore_X_Window -ecore_x_composite_render_window_enable(Ecore_X_Window root) -{ - Ecore_X_Window win = 0; -#ifdef ECORE_XCOMPOSITE - win = XCompositeGetOverlayWindow(_ecore_x_disp, root); - ecore_x_composite_window_events_disable(win); -#endif /* ifdef ECORE_XCOMPOSITE */ - return win; -} - -EAPI void -ecore_x_composite_render_window_disable(Ecore_X_Window root) -{ -#ifdef ECORE_XCOMPOSITE - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XCompositeReleaseOverlayWindow(_ecore_x_disp, root); -#endif /* ifdef ECORE_XCOMPOSITE */ -} - diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_cursor.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_cursor.c deleted file mode 100644 index a968c56..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_cursor.c +++ /dev/null @@ -1,246 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include -#endif /* ifdef HAVE_CONFIG_H */ - -#include - -#include "ecore_x_private.h" - -EAPI Eina_Bool -ecore_x_cursor_color_supported_get(void) -{ - return _ecore_x_xcursor; -} - -EAPI Ecore_X_Cursor -ecore_x_cursor_new(Ecore_X_Window win, - int *pixels, - int w, - int h, - int hot_x, - int hot_y) -{ -#ifdef ECORE_XCURSOR - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (_ecore_x_xcursor) - { - Cursor c; - XcursorImage *xci; - - xci = XcursorImageCreate(w, h); - if (xci) - { - int i; - - xci->xhot = hot_x; - xci->yhot = hot_y; - xci->delay = 0; - for (i = 0; i < (w * h); i++) - { -// int r, g, b, a; -// -// a = (pixels[i] >> 24) & 0xff; -// r = (((pixels[i] >> 16) & 0xff) * a) / 0xff; -// g = (((pixels[i] >> 8 ) & 0xff) * a) / 0xff; -// b = (((pixels[i] ) & 0xff) * a) / 0xff; - xci->pixels[i] = pixels[i]; -// (a << 24) | (r << 16) | (g << 8) | (b); - } - c = XcursorImageLoadCursor(_ecore_x_disp, xci); - XcursorImageDestroy(xci); - return c; - } - } - else -#endif /* ifdef ECORE_XCURSOR */ - { - XColor c1, c2; - Cursor c; - Pixmap pmap, mask; - GC gc; - XGCValues gcv; - XImage *xim; - unsigned int *pix; - int fr, fg, fb, br, bg, bb; - int brightest = 0; - int darkest = 255 * 3; - int x, y; - const int dither[2][2] = - { - {0, 2}, - {3, 1} - }; - - pmap = XCreatePixmap(_ecore_x_disp, win, w, h, 1); - mask = XCreatePixmap(_ecore_x_disp, win, w, h, 1); - xim = XCreateImage(_ecore_x_disp, - DefaultVisual(_ecore_x_disp, 0), - 1, ZPixmap, 0, NULL, w, h, 32, 0); - xim->data = malloc(xim->bytes_per_line * xim->height); - - fr = 0x00; fg = 0x00; fb = 0x00; - br = 0xff; bg = 0xff; bb = 0xff; - pix = (unsigned int *)pixels; - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - int r, g, b, a; - - a = (pix[0] >> 24) & 0xff; - r = (pix[0] >> 16) & 0xff; - g = (pix[0] >> 8) & 0xff; - b = (pix[0]) & 0xff; - if (a > 0) - { - if ((r + g + b) > brightest) - { - brightest = r + g + b; - br = r; - bg = g; - bb = b; - } - - if ((r + g + b) < darkest) - { - darkest = r + g + b; - fr = r; - fg = g; - fb = b; - } - } - - pix++; - } - } - - pix = (unsigned int *)pixels; - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - int v; - int r, g, b; - int d1, d2; - - r = (pix[0] >> 16) & 0xff; - g = (pix[0] >> 8) & 0xff; - b = (pix[0]) & 0xff; - d1 = - ((r - fr) * (r - fr)) + - ((g - fg) * (g - fg)) + - ((b - fb) * (b - fb)); - d2 = - ((r - br) * (r - br)) + - ((g - bg) * (g - bg)) + - ((b - bb) * (b - bb)); - if (d1 + d2) - { - v = (((d2 * 255) / (d1 + d2)) * 5) / 256; - if (v > dither[x & 0x1][y & 0x1]) - v = 1; - else - v = 0; - } - else - v = 0; - - XPutPixel(xim, x, y, v); - pix++; - } - } - gc = XCreateGC(_ecore_x_disp, pmap, 0, &gcv); - XPutImage(_ecore_x_disp, pmap, gc, xim, 0, 0, 0, 0, w, h); - XFreeGC(_ecore_x_disp, gc); - - pix = (unsigned int *)pixels; - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - int v; - - v = (((pix[0] >> 24) & 0xff) * 5) / 256; - if (v > dither[x & 0x1][y & 0x1]) - v = 1; - else - v = 0; - - XPutPixel(xim, x, y, v); - pix++; - } - } - gc = XCreateGC(_ecore_x_disp, mask, 0, &gcv); - XPutImage(_ecore_x_disp, mask, gc, xim, 0, 0, 0, 0, w, h); - XFreeGC(_ecore_x_disp, gc); - - free(xim->data); - xim->data = NULL; - XDestroyImage(xim); - - c1.pixel = 0; - c1.red = fr << 8 | fr; - c1.green = fg << 8 | fg; - c1.blue = fb << 8 | fb; - c1.flags = DoRed | DoGreen | DoBlue; - - c2.pixel = 0; - c2.red = br << 8 | br; - c2.green = bg << 8 | bg; - c2.blue = bb << 8 | bb; - c2.flags = DoRed | DoGreen | DoBlue; - - c = XCreatePixmapCursor(_ecore_x_disp, - pmap, mask, - &c1, &c2, - hot_x, hot_y); - XFreePixmap(_ecore_x_disp, pmap); - XFreePixmap(_ecore_x_disp, mask); - return c; - } - - return 0; -} - -EAPI void -ecore_x_cursor_free(Ecore_X_Cursor c) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XFreeCursor(_ecore_x_disp, 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) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - /* Shapes are defined in Ecore_X_Cursor.h */ - return XCreateFontCursor(_ecore_x_disp, shape); -} - -EAPI void -ecore_x_cursor_size_set(int size) -{ -#ifdef ECORE_XCURSOR - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XcursorSetDefaultSize(_ecore_x_disp, size); -#else /* ifdef ECORE_XCURSOR */ - size = 0; -#endif /* ifdef ECORE_XCURSOR */ -} - -EAPI int -ecore_x_cursor_size_get(void) -{ -#ifdef ECORE_XCURSOR - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return XcursorGetDefaultSize(_ecore_x_disp); -#else /* ifdef ECORE_XCURSOR */ - return 0; -#endif /* ifdef ECORE_XCURSOR */ -} - diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_damage.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_damage.c deleted file mode 100644 index b094f85..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_damage.c +++ /dev/null @@ -1,71 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include -#endif /* ifdef HAVE_CONFIG_H */ - -#include "ecore_x_private.h" -#include "Ecore_X.h" - -static Eina_Bool _damage_available = EINA_FALSE; -#ifdef ECORE_XDAMAGE -static int _damage_major, _damage_minor; -#endif /* ifdef ECORE_XDAMAGE */ - -void -_ecore_x_damage_init(void) -{ -#ifdef ECORE_XDAMAGE - _damage_major = 1; - _damage_minor = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (XDamageQueryVersion(_ecore_x_disp, &_damage_major, &_damage_minor)) - _damage_available = EINA_TRUE; - else - _damage_available = EINA_FALSE; - -#else /* ifdef ECORE_XDAMAGE */ - _damage_available = EINA_FALSE; -#endif /* ifdef ECORE_XDAMAGE */ -} - -EAPI Eina_Bool -ecore_x_damage_query(void) -{ - return _damage_available; -} - -EAPI Ecore_X_Damage -ecore_x_damage_new(Ecore_X_Drawable d, - Ecore_X_Damage_Report_Level level) -{ -#ifdef ECORE_XDAMAGE - Ecore_X_Damage damage; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - damage = XDamageCreate(_ecore_x_disp, d, level); - return damage; -#else /* ifdef ECORE_XDAMAGE */ - return 0; -#endif /* ifdef ECORE_XDAMAGE */ -} - -EAPI void -ecore_x_damage_free(Ecore_X_Damage damage) -{ -#ifdef ECORE_XDAMAGE - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XDamageDestroy(_ecore_x_disp, damage); -#endif /* ifdef ECORE_XDAMAGE */ -} - -EAPI void -ecore_x_damage_subtract(Ecore_X_Damage damage, - Ecore_X_Region repair, - Ecore_X_Region parts) -{ -#ifdef ECORE_XDAMAGE - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XDamageSubtract(_ecore_x_disp, damage, repair, parts); -#endif /* ifdef ECORE_XDAMAGE */ -} - diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dnd.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dnd.c deleted file mode 100644 index 372470a..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dnd.c +++ /dev/null @@ -1,706 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include -#endif /* ifdef HAVE_CONFIG_H */ - -#include -#include - -#include "Ecore.h" -#include "ecore_x_private.h" -#include "Ecore_X.h" -#include "Ecore_X_Atoms.h" - -EAPI int ECORE_X_EVENT_XDND_ENTER = 0; -EAPI int ECORE_X_EVENT_XDND_POSITION = 0; -EAPI int ECORE_X_EVENT_XDND_STATUS = 0; -EAPI int ECORE_X_EVENT_XDND_LEAVE = 0; -EAPI int ECORE_X_EVENT_XDND_DROP = 0; -EAPI int ECORE_X_EVENT_XDND_FINISHED = 0; - -static Ecore_X_DND_Source *_source = NULL; -static Ecore_X_DND_Target *_target = NULL; -static int _ecore_x_dnd_init_count = 0; - -typedef struct _Version_Cache_Item -{ - Ecore_X_Window win; - int ver; -} Version_Cache_Item; -static Version_Cache_Item *_version_cache = NULL; -static int _version_cache_num = 0, _version_cache_alloc = 0; -static void (*_posupdatecb)(void *, - Ecore_X_Xdnd_Position *); -static void *_posupdatedata; - -void -_ecore_x_dnd_init(void) -{ - if (!_ecore_x_dnd_init_count) - { - _source = calloc(1, sizeof(Ecore_X_DND_Source)); - if (!_source) return; - _source->version = ECORE_X_DND_VERSION; - _source->win = None; - _source->dest = None; - _source->state = ECORE_X_DND_SOURCE_IDLE; - _source->prev.window = 0; - - _target = calloc(1, sizeof(Ecore_X_DND_Target)); - if (!_target) - { - free(_source); - _source = NULL; - return; - } - _target->win = None; - _target->source = None; - _target->state = ECORE_X_DND_TARGET_IDLE; - - ECORE_X_EVENT_XDND_ENTER = ecore_event_type_new(); - ECORE_X_EVENT_XDND_POSITION = ecore_event_type_new(); - ECORE_X_EVENT_XDND_STATUS = ecore_event_type_new(); - ECORE_X_EVENT_XDND_LEAVE = ecore_event_type_new(); - ECORE_X_EVENT_XDND_DROP = ecore_event_type_new(); - ECORE_X_EVENT_XDND_FINISHED = ecore_event_type_new(); - } - - _ecore_x_dnd_init_count++; -} - -void -_ecore_x_dnd_shutdown(void) -{ - _ecore_x_dnd_init_count--; - if (_ecore_x_dnd_init_count > 0) - return; - - if (_source) - free(_source); - - _source = NULL; - - if (_target) - free(_target); - - _target = NULL; - - _ecore_x_dnd_init_count = 0; -} - -static Eina_Bool -_ecore_x_dnd_converter_copy(char *target __UNUSED__, - void *data, - int size, - void **data_ret, - int *size_ret, - Ecore_X_Atom *tprop __UNUSED__, - int *count __UNUSED__) -{ - XTextProperty text_prop; - char *mystr; - XICCEncodingStyle style = XTextStyle; - - if (!data || !size) - return EINA_FALSE; - - mystr = calloc(1, size + 1); - if (!mystr) - return EINA_FALSE; - - memcpy(mystr, data, size); - - if (XmbTextListToTextProperty(_ecore_x_disp, &mystr, 1, style, - &text_prop) == Success) - { - int bufsize = strlen((char *)text_prop.value) + 1; - *data_ret = malloc(bufsize); - if (!*data_ret) - { - free(mystr); - return EINA_FALSE; - } - memcpy(*data_ret, text_prop.value, bufsize); - *size_ret = bufsize; - XFree(text_prop.value); - free(mystr); - return EINA_TRUE; - } - else - { - free(mystr); - return EINA_FALSE; - } -} - -EAPI void -ecore_x_dnd_aware_set(Ecore_X_Window win, - Eina_Bool on) -{ - Ecore_X_Atom prop_data = ECORE_X_DND_VERSION; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (on) - ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_AWARE, - XA_ATOM, 32, &prop_data, 1); - else - ecore_x_window_prop_property_del(win, ECORE_X_ATOM_XDND_AWARE); -} - -EAPI int -ecore_x_dnd_version_get(Ecore_X_Window win) -{ - unsigned char *prop_data; - int num; - Version_Cache_Item *t; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - // this looks hacky - and it is, but we need a way of caching info about - // a window while dragging, because we literally query this every mouse - // move and going to and from x multiple times per move is EXPENSIVE - // and slows things down, puts lots of load on x etc. - if (_source->state == ECORE_X_DND_SOURCE_DRAGGING) - if (_version_cache) - { - int i; - - for (i = 0; i < _version_cache_num; i++) - { - if (_version_cache[i].win == win) - return _version_cache[i].ver; - } - } - - if (ecore_x_window_prop_property_get(win, ECORE_X_ATOM_XDND_AWARE, - XA_ATOM, 32, &prop_data, &num)) - { - int version = (int)*prop_data; - free(prop_data); - if (_source->state == ECORE_X_DND_SOURCE_DRAGGING) - { - _version_cache_num++; - if (_version_cache_num > _version_cache_alloc) - _version_cache_alloc += 16; - - t = realloc(_version_cache, - _version_cache_alloc * - sizeof(Version_Cache_Item)); - if (!t) return 0; - _version_cache = t; - _version_cache[_version_cache_num - 1].win = win; - _version_cache[_version_cache_num - 1].ver = version; - } - - return version; - } - - if (_source->state == ECORE_X_DND_SOURCE_DRAGGING) - { - _version_cache_num++; - if (_version_cache_num > _version_cache_alloc) - _version_cache_alloc += 16; - - t = realloc(_version_cache, _version_cache_alloc * - sizeof(Version_Cache_Item)); - if (!t) return 0; - _version_cache = t; - _version_cache[_version_cache_num - 1].win = win; - _version_cache[_version_cache_num - 1].ver = 0; - } - - return 0; -} - -EAPI Eina_Bool -ecore_x_dnd_type_isset(Ecore_X_Window win, - const char *type) -{ - int num, i, ret = EINA_FALSE; - unsigned char *data; - Ecore_X_Atom *atoms, atom; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!ecore_x_window_prop_property_get(win, ECORE_X_ATOM_XDND_TYPE_LIST, - XA_ATOM, 32, &data, &num)) - return ret; - - atom = ecore_x_atom_get(type); - atoms = (Ecore_X_Atom *)data; - - for (i = 0; i < num; ++i) - { - if (atom == atoms[i]) - { - ret = EINA_TRUE; - break; - } - } - - XFree(data); - return ret; -} - -EAPI void -ecore_x_dnd_type_set(Ecore_X_Window win, - const char *type, - Eina_Bool on) -{ - Ecore_X_Atom atom; - Ecore_X_Atom *oldset = NULL, *newset = NULL; - int i, j = 0, num = 0; - unsigned char *data = NULL; - unsigned char *old_data = NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - atom = ecore_x_atom_get(type); - ecore_x_window_prop_property_get(win, ECORE_X_ATOM_XDND_TYPE_LIST, - XA_ATOM, 32, &old_data, &num); - oldset = (Ecore_X_Atom *)old_data; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (on) - { - if (ecore_x_dnd_type_isset(win, type)) - { - XFree(old_data); - return; - } - - newset = calloc(num + 1, sizeof(Ecore_X_Atom)); - if (!newset) - return; - - data = (unsigned char *)newset; - - for (i = 0; i < num; i++) - newset[i + 1] = oldset[i]; - /* prepend the new type */ - newset[0] = atom; - - ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_TYPE_LIST, - XA_ATOM, 32, data, num + 1); - } - else - { - if (!ecore_x_dnd_type_isset(win, type)) - { - XFree(old_data); - return; - } - - newset = calloc(num - 1, sizeof(Ecore_X_Atom)); - if (!newset) - { - XFree(old_data); - return; - } - - data = (unsigned char *)newset; - for (i = 0; i < num; i++) - if (oldset[i] != atom) - newset[j++] = oldset[i]; - - ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_TYPE_LIST, - XA_ATOM, 32, data, num - 1); - } - - XFree(oldset); - free(newset); -} - -EAPI void -ecore_x_dnd_types_set(Ecore_X_Window win, - const char **types, - unsigned int num_types) -{ - Ecore_X_Atom *newset = NULL; - unsigned int i; - unsigned char *data = NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!num_types) - ecore_x_window_prop_property_del(win, ECORE_X_ATOM_XDND_TYPE_LIST); - else - { - newset = calloc(num_types, sizeof(Ecore_X_Atom)); - if (!newset) - return; - - data = (unsigned char *)newset; - for (i = 0; i < num_types; i++) - { - newset[i] = ecore_x_atom_get(types[i]); - ecore_x_selection_converter_atom_add(newset[i], - _ecore_x_dnd_converter_copy); - } - ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_TYPE_LIST, - XA_ATOM, 32, data, num_types); - free(newset); - } -} - -EAPI void -ecore_x_dnd_actions_set(Ecore_X_Window win, - Ecore_X_Atom *actions, - unsigned int num_actions) -{ - unsigned int i; - unsigned char *data = NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!num_actions) - ecore_x_window_prop_property_del(win, ECORE_X_ATOM_XDND_ACTION_LIST); - else - { - data = (unsigned char *)actions; - for (i = 0; i < num_actions; i++) - { - ecore_x_selection_converter_atom_add(actions[i], - _ecore_x_dnd_converter_copy); - } - ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_ACTION_LIST, - XA_ATOM, 32, data, num_actions); - } -} - -/** - * The DND position update cb is called Ecore_X sends a DND position to a - * client. - * - * It essentially mirrors some of the data sent in the position message. - * Generally this cb should be set just before position update is called. - * Please note well you need to look after your own data pointer if someone - * trashes you position update cb set. - * - * It is considered good form to clear this when the dnd event finishes. - * - * @param cb Callback to updated each time ecore_x sends a position update. - * @param data User data. - */ -EAPI void -ecore_x_dnd_callback_pos_update_set( - void (*cb)(void *, - Ecore_X_Xdnd_Position *data), - const void *data) -{ - _posupdatecb = cb; - _posupdatedata = (void *)data; /* Discard the const early */ -} - -Ecore_X_DND_Source * -_ecore_x_dnd_source_get(void) -{ - return _source; -} - -Ecore_X_DND_Target * -_ecore_x_dnd_target_get(void) -{ - return _target; -} - -EAPI Eina_Bool -ecore_x_dnd_begin(Ecore_X_Window source, - unsigned char *data, - int size) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!ecore_x_dnd_version_get(source)) - return EINA_FALSE; - - /* Take ownership of XdndSelection */ - if (!ecore_x_selection_xdnd_set(source, data, size)) - return EINA_FALSE; - - if (_version_cache) - { - free(_version_cache); - _version_cache = NULL; - _version_cache_num = 0; - _version_cache_alloc = 0; - } - - ecore_x_window_shadow_tree_flush(); - - _source->win = source; - ecore_x_window_ignore_set(_source->win, 1); - _source->state = ECORE_X_DND_SOURCE_DRAGGING; - _source->time = _ecore_x_event_last_time; - _source->prev.window = 0; - - /* Default Accepted Action: move */ - _source->action = ECORE_X_ATOM_XDND_ACTION_MOVE; - _source->accepted_action = None; - _source->dest = None; - - return EINA_TRUE; -} - -EAPI Eina_Bool -ecore_x_dnd_drop(void) -{ - XEvent xev; - int status = EINA_FALSE; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (_source->dest) - { - xev.xany.type = ClientMessage; - xev.xany.display = _ecore_x_disp; - xev.xclient.format = 32; - xev.xclient.window = _source->dest; - - if (_source->will_accept) - { - xev.xclient.message_type = ECORE_X_ATOM_XDND_DROP; - xev.xclient.data.l[0] = _source->win; - xev.xclient.data.l[1] = 0; - xev.xclient.data.l[2] = _source->time; - XSendEvent(_ecore_x_disp, _source->dest, False, 0, &xev); - _source->state = ECORE_X_DND_SOURCE_DROPPED; - status = EINA_TRUE; - } - else - { - xev.xclient.message_type = ECORE_X_ATOM_XDND_LEAVE; - xev.xclient.data.l[0] = _source->win; - xev.xclient.data.l[1] = 0; - XSendEvent(_ecore_x_disp, _source->dest, False, 0, &xev); - _source->state = ECORE_X_DND_SOURCE_IDLE; - } - } - else - { - /* Dropping on nothing */ - ecore_x_selection_xdnd_clear(); - _source->state = ECORE_X_DND_SOURCE_IDLE; - } - - ecore_x_window_ignore_set(_source->win, 0); - - _source->prev.window = 0; - - return status; -} - -EAPI void -ecore_x_dnd_send_status(Eina_Bool will_accept, - Eina_Bool suppress, - Ecore_X_Rectangle rectangle, - Ecore_X_Atom action) -{ - XEvent xev; - - if (_target->state == ECORE_X_DND_TARGET_IDLE) - return; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - memset(&xev, 0, sizeof(XEvent)); - - _target->will_accept = will_accept; - - xev.xclient.type = ClientMessage; - xev.xclient.display = _ecore_x_disp; - xev.xclient.message_type = ECORE_X_ATOM_XDND_STATUS; - xev.xclient.format = 32; - xev.xclient.window = _target->source; - - xev.xclient.data.l[0] = _target->win; - xev.xclient.data.l[1] = 0; - if (will_accept) - xev.xclient.data.l[1] |= 0x1UL; - - if (!suppress) - xev.xclient.data.l[1] |= 0x2UL; - - /* Set rectangle information */ - xev.xclient.data.l[2] = rectangle.x; - xev.xclient.data.l[2] <<= 16; - xev.xclient.data.l[2] |= rectangle.y; - xev.xclient.data.l[3] = rectangle.width; - xev.xclient.data.l[3] <<= 16; - xev.xclient.data.l[3] |= rectangle.height; - - if (will_accept) - { - xev.xclient.data.l[4] = action; - _target->accepted_action = action; - } - else - { - xev.xclient.data.l[4] = None; - _target->accepted_action = action; - } - - XSendEvent(_ecore_x_disp, _target->source, False, 0, &xev); -} - -EAPI void -ecore_x_dnd_send_finished(void) -{ - XEvent xev; - - if (_target->state == ECORE_X_DND_TARGET_IDLE) - return; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - xev.xany.type = ClientMessage; - xev.xany.display = _ecore_x_disp; - xev.xclient.message_type = ECORE_X_ATOM_XDND_FINISHED; - xev.xclient.format = 32; - xev.xclient.window = _target->source; - - xev.xclient.data.l[0] = _target->win; - xev.xclient.data.l[1] = 0; - xev.xclient.data.l[2] = 0; - if (_target->will_accept) - { - xev.xclient.data.l[1] |= 0x1UL; - xev.xclient.data.l[2] = _target->accepted_action; - } - - XSendEvent(_ecore_x_disp, _target->source, False, 0, &xev); - - _target->state = ECORE_X_DND_TARGET_IDLE; -} - -EAPI void -ecore_x_dnd_source_action_set(Ecore_X_Atom action) -{ - _source->action = action; - if (_source->prev.window) - _ecore_x_dnd_drag(_source->prev.window, _source->prev.x, _source->prev.y); -} - -EAPI Ecore_X_Atom -ecore_x_dnd_source_action_get(void) -{ - return _source->action; -} - -void -_ecore_x_dnd_drag(Ecore_X_Window root, - int x, - int y) -{ - XEvent xev; - Ecore_X_Window win; - Ecore_X_Window *skip; - Ecore_X_Xdnd_Position pos; - int num; - - if (_source->state != ECORE_X_DND_SOURCE_DRAGGING) - return; - - /* Preinitialize XEvent struct */ - memset(&xev, 0, sizeof(XEvent)); - xev.xany.type = ClientMessage; - xev.xany.display = _ecore_x_disp; - xev.xclient.format = 32; - - /* Attempt to find a DND-capable window under the cursor */ - skip = ecore_x_window_ignore_list(&num); -// WARNING - this function is HEAVY. it goes to and from x a LOT walking the -// window tree - use the SHADOW version - makes a 1-off tree copy, then uses -// that instead. -// win = ecore_x_window_at_xy_with_skip_get(x, y, skip, num); - win = ecore_x_window_shadow_tree_at_xy_with_skip_get(root, x, y, skip, num); - -// NOTE: This now uses the shadow version to find parent windows -// while ((win) && !(ecore_x_dnd_version_get(win))) -// win = ecore_x_window_parent_get(win); - while ((win) && !(ecore_x_dnd_version_get(win))) - win = ecore_x_window_shadow_parent_get(root, win); - - /* Send XdndLeave to current destination window if we have left it */ - if ((_source->dest) && (win != _source->dest)) - { - xev.xclient.window = _source->dest; - xev.xclient.message_type = ECORE_X_ATOM_XDND_LEAVE; - xev.xclient.data.l[0] = _source->win; - xev.xclient.data.l[1] = 0; - - XSendEvent(_ecore_x_disp, _source->dest, False, 0, &xev); - _source->suppress = 0; - } - - if (win) - { - int x1, x2, y1, y2; - - _source->version = MIN(ECORE_X_DND_VERSION, - ecore_x_dnd_version_get(win)); - if (win != _source->dest) - { - int i; - unsigned char *data; - Ecore_X_Atom *types; - - ecore_x_window_prop_property_get(_source->win, - ECORE_X_ATOM_XDND_TYPE_LIST, - XA_ATOM, - 32, - &data, - &num); - types = (Ecore_X_Atom *)data; - - /* Entered new window, send XdndEnter */ - xev.xclient.window = win; - xev.xclient.message_type = ECORE_X_ATOM_XDND_ENTER; - xev.xclient.data.l[0] = _source->win; - xev.xclient.data.l[1] = 0; - if (num > 3) - xev.xclient.data.l[1] |= 0x1UL; - else - xev.xclient.data.l[1] &= 0xfffffffeUL; - - xev.xclient.data.l[1] |= ((unsigned long)_source->version) << 24; - - for (i = 2; i < 5; i++) - xev.xclient.data.l[i] = 0; - for (i = 0; i < MIN(num, 3); ++i) - xev.xclient.data.l[i + 2] = types[i]; - XFree(data); - XSendEvent(_ecore_x_disp, win, False, 0, &xev); - _source->await_status = 0; - _source->will_accept = 0; - } - - /* Determine if we're still in the rectangle from the last status */ - x1 = _source->rectangle.x; - x2 = _source->rectangle.x + _source->rectangle.width; - y1 = _source->rectangle.y; - y2 = _source->rectangle.y + _source->rectangle.height; - - if ((!_source->await_status) || - (!_source->suppress) || - ((x < x1) || (x > x2) || (y < y1) || (y > y2))) - { - xev.xclient.window = win; - xev.xclient.message_type = ECORE_X_ATOM_XDND_POSITION; - xev.xclient.data.l[0] = _source->win; - xev.xclient.data.l[1] = 0; /* Reserved */ - xev.xclient.data.l[2] = ((x << 16) & 0xffff0000) | (y & 0xffff); - xev.xclient.data.l[3] = _source->time; /* Version 1 */ - xev.xclient.data.l[4] = _source->action; /* Version 2, Needs to be pre-set */ - XSendEvent(_ecore_x_disp, win, False, 0, &xev); - - _source->await_status = 1; - } - } - - if (_posupdatecb) - { - pos.position.x = x; - pos.position.y = y; - pos.win = win; - pos.prev = _source->dest; - _posupdatecb(_posupdatedata, &pos); - } - - _source->prev.x = x; - _source->prev.y = y; - _source->prev.window = root; - _source->dest = win; -} - -/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/ diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dpms.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dpms.c deleted file mode 100644 index 23349f4..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dpms.c +++ /dev/null @@ -1,247 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include -#endif /* ifdef HAVE_CONFIG_H */ - -#include "ecore_x_private.h" - -static Eina_Bool _dpms_available = EINA_FALSE; - -void -_ecore_x_dpms_init(void) -{ -#ifdef ECORE_XDPMS - int _dpms_major, _dpms_minor; - - _dpms_major = 1; - _dpms_minor = 0; - - if (DPMSGetVersion(_ecore_x_disp, &_dpms_major, &_dpms_minor)) - _dpms_available = EINA_TRUE; - else - _dpms_available = EINA_FALSE; - -#else /* ifdef ECORE_XDPMS */ - _dpms_available = EINA_FALSE; -#endif /* ifdef ECORE_XDPMS */ -} - -/** - * @defgroup Ecore_X_DPMS_Group X DPMS Extension Functions - * - * Functions related to the X DPMS extension. - */ - -/** - * Checks if the X DPMS extension is available on the server. - * @return @c 1 if the X DPMS extension is available, @c 0 otherwise. - * @ingroup Ecore_X_DPMS_Group - */ -EAPI Eina_Bool -ecore_x_dpms_query(void) -{ - return _dpms_available; -} - -/** - * Checks if the X server is capable of DPMS. - * @return @c 1 if the X server is capable of DPMS, @c 0 otherwise. - * @ingroup Ecore_X_DPMS_Group - */ -EAPI Eina_Bool -ecore_x_dpms_capable_get(void) -{ -#ifdef ECORE_XDPMS - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return DPMSCapable(_ecore_x_disp) ? EINA_TRUE : EINA_FALSE; -#else /* ifdef ECORE_XDPMS */ - return EINA_FALSE; -#endif /* ifdef ECORE_XDPMS */ -} - -/** - * Checks the DPMS state of the display. - * @return @c 1 if DPMS is enabled, @c 0 otherwise. - * @ingroup Ecore_X_DPMS_Group - */ -EAPI Eina_Bool -ecore_x_dpms_enabled_get(void) -{ -#ifdef ECORE_XDPMS - unsigned char state; - unsigned short power_lvl; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - DPMSInfo(_ecore_x_disp, &power_lvl, &state); - return state ? EINA_TRUE : EINA_FALSE; -#else /* ifdef ECORE_XDPMS */ - return EINA_FALSE; -#endif /* ifdef ECORE_XDPMS */ -} - -/** - * Sets the DPMS state of the display. - * @param enabled @c 0 to disable DPMS characteristics of the server, enable it otherwise. - * @ingroup Ecore_X_DPMS_Group - */ -EAPI void -ecore_x_dpms_enabled_set(int enabled) -{ -#ifdef ECORE_XDPMS - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (enabled) - DPMSEnable(_ecore_x_disp); - else - DPMSDisable(_ecore_x_disp); - -#endif /* ifdef ECORE_XDPMS */ -} - -/** - * Gets the timeouts. The values are in unit of seconds. - * @param standby Amount of time of inactivity before standby mode will be invoked. - * @param suspend Amount of time of inactivity before the screen is placed into suspend mode. - * @param off Amount of time of inactivity before the monitor is shut off. - * @ingroup Ecore_X_DPMS_Group - */ -EAPI void -ecore_x_dpms_timeouts_get(unsigned int *standby, - unsigned int *suspend, - unsigned int *off) -{ -#ifdef ECORE_XDPMS - LOGFN(__FILE__, __LINE__, __FUNCTION__); - DPMSGetTimeouts(_ecore_x_disp, (unsigned short *)standby, - (unsigned short *)suspend, (unsigned short *)off); -#endif /* ifdef ECORE_XDPMS */ -} - -/** - * Sets the timeouts. The values are in unit of seconds. - * @param standby Amount of time of inactivity before standby mode will be invoked. - * @param suspend Amount of time of inactivity before the screen is placed into suspend mode. - * @param off Amount of time of inactivity before the monitor is shut off. - * @ingroup Ecore_X_DPMS_Group - */ -EAPI Eina_Bool -ecore_x_dpms_timeouts_set(unsigned int standby, - unsigned int suspend, - unsigned int off) -{ -#ifdef ECORE_XDPMS - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return DPMSSetTimeouts(_ecore_x_disp, standby, suspend, off) ? EINA_TRUE : EINA_FALSE; -#else /* ifdef ECORE_XDPMS */ - return EINA_FALSE; -#endif /* ifdef ECORE_XDPMS */ -} - -/** - * Returns the amount of time of inactivity before standby mode is invoked. - * @return The standby timeout value. - * @ingroup Ecore_X_DPMS_Group - */ -EAPI unsigned int -ecore_x_dpms_timeout_standby_get(void) -{ -#ifdef ECORE_XDPMS - unsigned short standby, suspend, off; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off); - return standby; -#else /* ifdef ECORE_XDPMS */ - return 0; -#endif /* ifdef ECORE_XDPMS */ -} - -/** - * Returns the amount of time of inactivity before the second level of - * power saving is invoked. - * @return The suspend timeout value. - * @ingroup Ecore_X_DPMS_Group - */ -EAPI unsigned int -ecore_x_dpms_timeout_suspend_get(void) -{ -#ifdef ECORE_XDPMS - unsigned short standby, suspend, off; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off); - return suspend; -#else /* ifdef ECORE_XDPMS */ - return 0; -#endif /* ifdef ECORE_XDPMS */ -} - -/** - * Returns the amount of time of inactivity before the third and final - * level of power saving is invoked. - * @return The off timeout value. - * @ingroup Ecore_X_DPMS_Group - */ -EAPI unsigned int -ecore_x_dpms_timeout_off_get(void) -{ -#ifdef ECORE_XDPMS - unsigned short standby, suspend, off; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off); - return off; -#else /* ifdef ECORE_XDPMS */ - return 0; -#endif /* ifdef ECORE_XDPMS */ -} - -/** - * 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) -{ -#ifdef ECORE_XDPMS - unsigned short standby, suspend, off; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off); - DPMSSetTimeouts(_ecore_x_disp, new_timeout, suspend, off); -#endif /* ifdef ECORE_XDPMS */ -} - -/** - * 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) -{ -#ifdef ECORE_XDPMS - unsigned short standby, suspend, off; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off); - DPMSSetTimeouts(_ecore_x_disp, standby, new_timeout, off); -#endif /* ifdef ECORE_XDPMS */ -} - -/** - * 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) -{ -#ifdef ECORE_XDPMS - unsigned short standby, suspend, off; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off); - DPMSSetTimeouts(_ecore_x_disp, standby, suspend, new_timeout); -#endif /* ifdef ECORE_XDPMS */ -} - diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_drawable.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_drawable.c deleted file mode 100644 index d1b4111..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_drawable.c +++ /dev/null @@ -1,118 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include -#endif /* ifdef HAVE_CONFIG_H */ - -#include "ecore_x_private.h" - -/** - * @defgroup Ecore_X_Drawable_Group X Drawable Functions - * - * Functions that operate on drawables. - */ - -/** - * Retrieves the geometry of the given drawable. - * @param d The given drawable. - * @param x Pointer to an integer into which the X position is to be stored. - * @param y Pointer to an integer into which the Y position is to be stored. - * @param w Pointer to an integer into which the width is to be stored. - * @param h Pointer to an integer into which the height is to be stored. - * @ingroup Ecore_X_Drawable_Group - */ -EAPI void -ecore_x_drawable_geometry_get(Ecore_X_Drawable d, - int *x, - int *y, - int *w, - int *h) -{ - Window dummy_win; - int ret_x, ret_y; - unsigned int ret_w, ret_h, dummy_border, dummy_depth; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!XGetGeometry(_ecore_x_disp, d, &dummy_win, &ret_x, &ret_y, - &ret_w, &ret_h, &dummy_border, &dummy_depth)) - { - ret_x = 0; - ret_y = 0; - ret_w = 0; - ret_h = 0; - } - - if (x) - *x = ret_x; - - if (y) - *y = ret_y; - - if (w) - *w = (int)ret_w; - - if (h) - *h = (int)ret_h; -} - -/** - * Retrieves the width of the border of the given drawable. - * @param d The given drawable. - * @return The border width of the given drawable. - * @ingroup Ecore_X_Drawable_Group - */ -EAPI int -ecore_x_drawable_border_width_get(Ecore_X_Drawable d) -{ - Window dummy_win; - int dummy_x, dummy_y; - unsigned int dummy_w, dummy_h, border_ret, dummy_depth; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!XGetGeometry(_ecore_x_disp, d, &dummy_win, &dummy_x, &dummy_y, - &dummy_w, &dummy_h, &border_ret, &dummy_depth)) - border_ret = 0; - - return (int)border_ret; -} - -/** - * Retrieves the depth of the given drawable. - * @param d The given drawable. - * @return The depth of the given drawable. - * @ingroup Ecore_X_Drawable_Group - */ -EAPI int -ecore_x_drawable_depth_get(Ecore_X_Drawable d) -{ - Window dummy_win; - int dummy_x, dummy_y; - unsigned int dummy_w, dummy_h, dummy_border, depth_ret; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!XGetGeometry(_ecore_x_disp, d, &dummy_win, &dummy_x, &dummy_y, - &dummy_w, &dummy_h, &dummy_border, &depth_ret)) - depth_ret = 0; - - return (int)depth_ret; -} - -/** - * Fill the specified rectangle on a drawable. - * @param d The given drawable. - * @param gc The graphic context that controls the fill rules. - * @param x The X coordinate of the top-left corner of the rectangle. - * @param y The Y coordinate of the top-left corner of the rectangle. - * @param width The width of the rectangle. - * @param height The height of the rectangle. - */ -EAPI void -ecore_x_drawable_rectangle_fill(Ecore_X_Drawable d, - Ecore_X_GC gc, - int x, - int y, - int width, - int height) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XFillRectangle(_ecore_x_disp, d, gc, x, y, width, height); -} - diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_e.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_e.c deleted file mode 100644 index 4bd5218..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_e.c +++ /dev/null @@ -1,1293 +0,0 @@ -/* - * OLD E hints - */ - -#ifdef HAVE_CONFIG_H -# include -#endif /* ifdef HAVE_CONFIG_H */ - -#include "Ecore.h" -#include "ecore_x_private.h" -#include "Ecore_X.h" -#include "Ecore_X_Atoms.h" - -EAPI void -ecore_x_e_init(void) -{ -} - -EAPI void -ecore_x_e_frame_size_set(Ecore_X_Window win, - int fl, - int fr, - int ft, - int fb) -{ - unsigned int frames[4]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - frames[0] = fl; - frames[1] = fr; - frames[2] = ft; - frames[3] = fb; - ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_FRAME_SIZE, frames, 4); -} - -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; - - 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; -} - -static Ecore_X_Virtual_Keyboard_State -_ecore_x_e_vkbd_state_get(Ecore_X_Atom atom) -{ - if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON) - return ECORE_X_VIRTUAL_KEYBOARD_STATE_ON; - - if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF) - return ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF; - - if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ALPHA) - return ECORE_X_VIRTUAL_KEYBOARD_STATE_ALPHA; - - if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_NUMERIC) - return ECORE_X_VIRTUAL_KEYBOARD_STATE_NUMERIC; - - if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PIN) - return ECORE_X_VIRTUAL_KEYBOARD_STATE_PIN; - - if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PHONE_NUMBER) - return ECORE_X_VIRTUAL_KEYBOARD_STATE_PHONE_NUMBER; - - if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HEX) - return ECORE_X_VIRTUAL_KEYBOARD_STATE_HEX; - - if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_TERMINAL) - return ECORE_X_VIRTUAL_KEYBOARD_STATE_TERMINAL; - - if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PASSWORD) - return ECORE_X_VIRTUAL_KEYBOARD_STATE_PASSWORD; - - if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_IP) - return ECORE_X_VIRTUAL_KEYBOARD_STATE_IP; - - if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HOST) - return ECORE_X_VIRTUAL_KEYBOARD_STATE_HOST; - - if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_FILE) - return ECORE_X_VIRTUAL_KEYBOARD_STATE_FILE; - - if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_URL) - return ECORE_X_VIRTUAL_KEYBOARD_STATE_URL; - - if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_KEYPAD) - return ECORE_X_VIRTUAL_KEYBOARD_STATE_KEYPAD; - - if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_J2ME) - return ECORE_X_VIRTUAL_KEYBOARD_STATE_J2ME; - - return ECORE_X_VIRTUAL_KEYBOARD_STATE_UNKNOWN; -} - -static Ecore_X_Atom -_ecore_x_e_vkbd_atom_get(Ecore_X_Virtual_Keyboard_State state) -{ - switch (state) - { - case ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF: - return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF; - - case ECORE_X_VIRTUAL_KEYBOARD_STATE_ON: - return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON; - - case ECORE_X_VIRTUAL_KEYBOARD_STATE_ALPHA: - return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ALPHA; - - case ECORE_X_VIRTUAL_KEYBOARD_STATE_NUMERIC: - return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_NUMERIC; - - case ECORE_X_VIRTUAL_KEYBOARD_STATE_PIN: - return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PIN; - - case ECORE_X_VIRTUAL_KEYBOARD_STATE_PHONE_NUMBER: - return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PHONE_NUMBER; - - case ECORE_X_VIRTUAL_KEYBOARD_STATE_HEX: - return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HEX; - - case ECORE_X_VIRTUAL_KEYBOARD_STATE_TERMINAL: - return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_TERMINAL; - - case ECORE_X_VIRTUAL_KEYBOARD_STATE_PASSWORD: - return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PASSWORD; - - case ECORE_X_VIRTUAL_KEYBOARD_STATE_IP: - return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_IP; - - case ECORE_X_VIRTUAL_KEYBOARD_STATE_HOST: - return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HOST; - - case ECORE_X_VIRTUAL_KEYBOARD_STATE_FILE: - return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_FILE; - - case ECORE_X_VIRTUAL_KEYBOARD_STATE_URL: - return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_URL; - - case ECORE_X_VIRTUAL_KEYBOARD_STATE_KEYPAD: - return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_KEYPAD; - - case ECORE_X_VIRTUAL_KEYBOARD_STATE_J2ME: - return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_J2ME; - - default: break; - } - return 0; -} - -EAPI void -ecore_x_e_virtual_keyboard_state_set(Ecore_X_Window win, - Ecore_X_Virtual_Keyboard_State state) -{ - Ecore_X_Atom atom = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - atom = _ecore_x_e_vkbd_atom_get(state); - ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE, - &atom, 1); -} - -EAPI Ecore_X_Virtual_Keyboard_State -ecore_x_e_virtual_keyboard_state_get(Ecore_X_Window win) -{ - Ecore_X_Atom atom; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!ecore_x_window_prop_atom_get(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE, - &atom, 1)) - return ECORE_X_VIRTUAL_KEYBOARD_STATE_UNKNOWN; - - return _ecore_x_e_vkbd_state_get(atom); -} - -EAPI void -ecore_x_e_virtual_keyboard_state_send(Ecore_X_Window win, - Ecore_X_Virtual_Keyboard_State state) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_client_message32_send(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - _ecore_x_e_vkbd_atom_get(state), - 0, 0, 0, 0); -} - -static Ecore_X_Atom -_ecore_x_e_illume_atom_get(Ecore_X_Illume_Mode mode) -{ - switch (mode) - { - case ECORE_X_ILLUME_MODE_SINGLE: - return ECORE_X_ATOM_E_ILLUME_MODE_SINGLE; - - case ECORE_X_ILLUME_MODE_DUAL_TOP: - return ECORE_X_ATOM_E_ILLUME_MODE_DUAL_TOP; - - case ECORE_X_ILLUME_MODE_DUAL_LEFT: - return ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT; - - default: - break; - } - return ECORE_X_ILLUME_MODE_UNKNOWN; -} - -static Ecore_X_Illume_Mode -_ecore_x_e_illume_mode_get(Ecore_X_Atom atom) -{ - if (atom == ECORE_X_ATOM_E_ILLUME_MODE_SINGLE) - return ECORE_X_ILLUME_MODE_SINGLE; - - if (atom == ECORE_X_ATOM_E_ILLUME_MODE_DUAL_TOP) - return ECORE_X_ILLUME_MODE_DUAL_TOP; - - if (atom == ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT) - return ECORE_X_ILLUME_MODE_DUAL_LEFT; - - return ECORE_X_ILLUME_MODE_UNKNOWN; -} - -EAPI void -ecore_x_e_illume_zone_set(Ecore_X_Window win, - Ecore_X_Window zone) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_window_prop_window_set(win, ECORE_X_ATOM_E_ILLUME_ZONE, - &zone, 1); -} - -EAPI Ecore_X_Window -ecore_x_e_illume_zone_get(Ecore_X_Window win) -{ - Ecore_X_Window zone; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!ecore_x_window_prop_window_get(win, ECORE_X_ATOM_E_ILLUME_ZONE, - &zone, 1)) - return 0; - - return zone; -} - -EAPI void -ecore_x_e_illume_zone_list_set(Ecore_X_Window win, - Ecore_X_Window *zones, - unsigned int n_zones) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_window_prop_window_set(win, ECORE_X_ATOM_E_ILLUME_ZONE_LIST, - zones, n_zones); -} - -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 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_mode_set(Ecore_X_Window win, - Ecore_X_Illume_Mode mode) -{ - Ecore_X_Atom atom = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - atom = _ecore_x_e_illume_atom_get(mode); - ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_E_ILLUME_MODE, - &atom, 1); -} - -EAPI Ecore_X_Illume_Mode -ecore_x_e_illume_mode_get(Ecore_X_Window win) -{ - Ecore_X_Atom atom = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!ecore_x_window_prop_atom_get(win, ECORE_X_ATOM_E_ILLUME_MODE, &atom, 1)) - return ECORE_X_ILLUME_MODE_UNKNOWN; - - return _ecore_x_e_illume_mode_get(atom); -} - -EAPI void -ecore_x_e_illume_mode_send(Ecore_X_Window win, - Ecore_X_Illume_Mode mode) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_MODE, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - _ecore_x_e_illume_atom_get(mode), - 0, 0, 0, 0); -} - -EAPI void -ecore_x_e_illume_focus_back_send(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_FOCUS_BACK, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - 1, 0, 0, 0, 0); -} - -EAPI void -ecore_x_e_illume_focus_forward_send(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_FOCUS_FORWARD, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - 1, 0, 0, 0, 0); -} - -EAPI void -ecore_x_e_illume_focus_home_send(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_FOCUS_HOME, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - 1, 0, 0, 0, 0); -} - -EAPI void -ecore_x_e_illume_close_send(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_CLOSE, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - 1, 0, 0, 0, 0); -} - -EAPI void -ecore_x_e_illume_home_new_send(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_HOME_NEW, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - 1, 0, 0, 0, 0); -} - -EAPI void -ecore_x_e_illume_home_del_send(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_HOME_DEL, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - 1, 0, 0, 0, 0); -} - -EAPI void -ecore_x_e_illume_drag_set(Ecore_X_Window win, - unsigned int drag) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_DRAG, &drag, 1); -} - -EAPI 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_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 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_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) -{ - int ret = 0; - unsigned int geom[4]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ret = - ecore_x_window_prop_card32_get(win, - ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY, - geom, 4); - if (ret != 4) - return EINA_FALSE; - - if (x) - *x = geom[0]; - - if (y) - *y = geom[1]; - - if (w) - *w = geom[2]; - - if (h) - *h = geom[3]; - - return EINA_TRUE; -} - -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) -{ - int ret = 0; - unsigned int geom[4]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ret = - ecore_x_window_prop_card32_get(win, - ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY, - geom, 4); - if (ret != 4) - return EINA_FALSE; - - if (x) - *x = geom[0]; - - if (y) - *y = geom[1]; - - if (w) - *w = geom[2]; - - if (h) - *h = geom[3]; - - return EINA_TRUE; -} - -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) -{ - int ret = 0; - unsigned int geom[4]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ret = - ecore_x_window_prop_card32_get(win, - ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY, - geom, 4); - if (ret != 4) - return EINA_FALSE; - - if (x) - *x = geom[0]; - - if (y) - *y = geom[1]; - - if (w) - *w = geom[2]; - - if (h) - *h = geom[3]; - - return EINA_TRUE; -} - -static Ecore_X_Atom -_ecore_x_e_quickpanel_atom_get(Ecore_X_Illume_Quickpanel_State state) -{ - switch (state) - { - case ECORE_X_ILLUME_QUICKPANEL_STATE_ON: - return ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON; - - case ECORE_X_ILLUME_QUICKPANEL_STATE_OFF: - return ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF; - - default: - break; - } - return 0; -} - -static Ecore_X_Illume_Quickpanel_State -_ecore_x_e_quickpanel_state_get(Ecore_X_Atom atom) -{ - if (atom == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON) - return ECORE_X_ILLUME_QUICKPANEL_STATE_ON; - - if (atom == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF) - return ECORE_X_ILLUME_QUICKPANEL_STATE_OFF; - - return ECORE_X_ILLUME_QUICKPANEL_STATE_UNKNOWN; -} - -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_x_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; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!ecore_x_window_prop_atom_get(win, - ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE, - &atom, 1)) - return ECORE_X_ILLUME_QUICKPANEL_STATE_UNKNOWN; - - return _ecore_x_e_quickpanel_state_get(atom); -} - -EAPI void -ecore_x_e_illume_quickpanel_state_send(Ecore_X_Window win, - Ecore_X_Illume_Quickpanel_State state) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - _ecore_x_e_quickpanel_atom_get(state), - 0, 0, 0, 0); -} - -EAPI void -ecore_x_e_illume_quickpanel_state_toggle(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_client_message32_send(win, - ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE_TOGGLE, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - 0, 0, 0, 0, 0); -} - -EAPI void -ecore_x_e_illume_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_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_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 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_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); -} - -static Ecore_X_Atom -_ecore_x_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_x_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_INDICATOR_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_x_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_x_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_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) -{ - int ret = 0; - Ecore_X_Sync_Counter counter = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ret = - ecore_x_window_prop_xid_get(win, - ECORE_X_ATOM_E_COMP_SYNC_COUNTER, - ECORE_X_ATOM_CARDINAL, - &counter, 1); - if (ret != 1) - return 0; - - return counter; -} - -EAPI void -ecore_x_e_comp_sync_draw_done_send(Ecore_X_Window root, - Ecore_X_Window win) -{ - XEvent xev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!root) - root = DefaultRootWindow(_ecore_x_disp); - - xev.xclient.type = ClientMessage; - xev.xclient.display = _ecore_x_disp; - xev.xclient.window = win; - xev.xclient.message_type = ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE; - xev.xclient.format = 32; - xev.xclient.data.l[0] = win; - xev.xclient.data.l[1] = 0; // version - xev.xclient.data.l[2] = 0; // later - xev.xclient.data.l[3] = 0; // later - xev.xclient.data.l[4] = 0; // later - - XSendEvent(_ecore_x_disp, root, False, - SubstructureRedirectMask | SubstructureNotifyMask, - &xev); -} - -EAPI void -ecore_x_e_comp_sync_draw_size_done_send(Ecore_X_Window root, - Ecore_X_Window win, - int w, - int h) -{ - XEvent xev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!root) - root = DefaultRootWindow(_ecore_x_disp); - - xev.xclient.type = ClientMessage; - xev.xclient.display = _ecore_x_disp; - xev.xclient.window = win; - xev.xclient.message_type = ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE; - xev.xclient.format = 32; - xev.xclient.data.l[0] = win; - xev.xclient.data.l[1] = 1; // version - xev.xclient.data.l[2] = w; // win width at draw time - xev.xclient.data.l[3] = h; // win height at draw time - xev.xclient.data.l[4] = 0; // later - - XSendEvent(_ecore_x_disp, root, False, - SubstructureRedirectMask | SubstructureNotifyMask, - &xev); -} - -EAPI void -ecore_x_e_comp_sync_supported_set(Ecore_X_Window root, - Eina_Bool enabled) -{ - Ecore_X_Window win; - - if (!root) - root = DefaultRootWindow(_ecore_x_disp); - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (enabled) - { - win = ecore_x_window_new(root, 1, 2, 3, 4); - ecore_x_window_prop_xid_set(win, ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED, - ECORE_X_ATOM_WINDOW, &win, 1); - ecore_x_window_prop_xid_set(root, ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED, - ECORE_X_ATOM_WINDOW, &win, 1); - } - else - { - int ret; - - ret = - ecore_x_window_prop_xid_get(root, - ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED, - ECORE_X_ATOM_WINDOW, - &win, 1); - if ((ret == 1) && (win)) - { - ecore_x_window_prop_property_del( - root, - ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED); - ecore_x_window_free(win); - } - } -} - -EAPI Eina_Bool -ecore_x_e_comp_sync_supported_get(Ecore_X_Window root) -{ - Ecore_X_Window win, win2; - int ret; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!root) - root = DefaultRootWindow(_ecore_x_disp); - - ret = - ecore_x_window_prop_xid_get(root, - ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED, - ECORE_X_ATOM_WINDOW, - &win, 1); - if ((ret == 1) && (win)) - { - ret = - ecore_x_window_prop_xid_get(win, - ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED, - ECORE_X_ATOM_WINDOW, - &win2, 1); - if ((ret == 1) && (win2 == win)) - return EINA_TRUE; - } - - return EINA_FALSE; -} - -EAPI void -ecore_x_e_comp_sync_begin_send(Ecore_X_Window win) -{ - XEvent xev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - xev.xclient.type = ClientMessage; - xev.xclient.display = _ecore_x_disp; - xev.xclient.window = win; - xev.xclient.message_type = ECORE_X_ATOM_E_COMP_SYNC_BEGIN; - xev.xclient.format = 32; - xev.xclient.data.l[0] = win; - xev.xclient.data.l[1] = 0; // later - xev.xclient.data.l[2] = 0; // later - xev.xclient.data.l[3] = 0; // later - xev.xclient.data.l[4] = 0; // later - - XSendEvent(_ecore_x_disp, win, False, - NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask, - &xev); -} - -EAPI void -ecore_x_e_comp_sync_end_send(Ecore_X_Window win) -{ - XEvent xev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - xev.xclient.type = ClientMessage; - xev.xclient.display = _ecore_x_disp; - xev.xclient.window = win; - xev.xclient.message_type = ECORE_X_ATOM_E_COMP_SYNC_END; - xev.xclient.format = 32; - xev.xclient.data.l[0] = win; - xev.xclient.data.l[1] = 0; // later - xev.xclient.data.l[2] = 0; // later - xev.xclient.data.l[3] = 0; // later - xev.xclient.data.l[4] = 0; // later - - XSendEvent(_ecore_x_disp, win, False, - NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask, - &xev); -} - -EAPI void -ecore_x_e_comp_sync_cancel_send(Ecore_X_Window win) -{ - XEvent xev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - xev.xclient.type = ClientMessage; - xev.xclient.display = _ecore_x_disp; - xev.xclient.window = win; - xev.xclient.message_type = ECORE_X_ATOM_E_COMP_SYNC_CANCEL; - xev.xclient.format = 32; - xev.xclient.data.l[0] = win; - xev.xclient.data.l[1] = 0; // later - xev.xclient.data.l[2] = 0; // later - xev.xclient.data.l[3] = 0; // later - xev.xclient.data.l[4] = 0; // later - - XSendEvent(_ecore_x_disp, win, False, - NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask, - &xev); -} - -EAPI void -ecore_x_e_comp_flush_send(Ecore_X_Window win) -{ - XEvent xev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - xev.xclient.type = ClientMessage; - xev.xclient.display = _ecore_x_disp; - xev.xclient.window = win; - xev.xclient.message_type = ECORE_X_ATOM_E_COMP_FLUSH; - xev.xclient.format = 32; - xev.xclient.data.l[0] = win; - xev.xclient.data.l[1] = 0; // later - xev.xclient.data.l[2] = 0; // later - xev.xclient.data.l[3] = 0; // later - xev.xclient.data.l[4] = 0; // later - - XSendEvent(_ecore_x_disp, win, False, - NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask, - &xev); -} - -EAPI void -ecore_x_e_comp_dump_send(Ecore_X_Window win) -{ - XEvent xev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - xev.xclient.type = ClientMessage; - xev.xclient.display = _ecore_x_disp; - xev.xclient.window = win; - xev.xclient.message_type = ECORE_X_ATOM_E_COMP_DUMP; - xev.xclient.format = 32; - xev.xclient.data.l[0] = win; - xev.xclient.data.l[1] = 0; // later - xev.xclient.data.l[2] = 0; // later - xev.xclient.data.l[3] = 0; // later - xev.xclient.data.l[4] = 0; // later - - XSendEvent(_ecore_x_disp, win, False, - NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask, - &xev); -} - -EAPI void -ecore_x_e_comp_pixmap_set(Ecore_X_Window win, - Ecore_X_Pixmap pixmap) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (pixmap) - ecore_x_window_prop_xid_set(win, ECORE_X_ATOM_E_COMP_PIXMAP, - ECORE_X_ATOM_PIXMAP, &pixmap, 1); - else - ecore_x_window_prop_property_del(win, pixmap); -} - -EAPI Ecore_X_Pixmap -ecore_x_e_comp_pixmap_get(Ecore_X_Window win) -{ - int ret = 0; - Ecore_X_Pixmap pixmap = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ret = - ecore_x_window_prop_xid_get(win, - ECORE_X_ATOM_E_COMP_PIXMAP, - ECORE_X_ATOM_PIXMAP, - &pixmap, 1); - if (ret != 1) - return 0; - - return pixmap; -} - -static Ecore_X_Atom -_ecore_x_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_x_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_x_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; - - 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_x_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_x_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); -} - diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_error.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_error.c deleted file mode 100644 index 11e9f20..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_error.c +++ /dev/null @@ -1,125 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include -#endif /* ifdef HAVE_CONFIG_H */ - -#include - -#include "Ecore.h" -#include "ecore_private.h" -#include "ecore_x_private.h" -#include "Ecore_X.h" - -static int _ecore_x_error_handle(Display *d, - XErrorEvent *ev); -static int _ecore_x_io_error_handle(Display *d); - -static void (*_error_func)(void *data) = NULL; -static void *_error_data = NULL; -static void (*_io_error_func)(void *data) = NULL; -static void *_io_error_data = NULL; -static int _error_request_code = 0; -static int _error_code = 0; -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; -} - -void -_ecore_x_error_handler_init(void) -{ - XSetErrorHandler((XErrorHandler)_ecore_x_error_handle); - XSetIOErrorHandler((XIOErrorHandler)_ecore_x_io_error_handle); -} - -static int -_ecore_x_error_handle(Display *d, - XErrorEvent *ev) -{ - if (d == _ecore_x_disp) - { - _error_request_code = ev->request_code; - _error_code = ev->error_code; - _error_resource_id = ev->resourceid; - if (_error_func) - _error_func(_error_data); - } - return 0; -} - -static int -_ecore_x_io_error_handle(Display *d) -{ - if (d == _ecore_x_disp) - { - if (_io_error_func) - _io_error_func(_io_error_data); - else - exit(-1); - } - - return 0; -} - diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_events.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_events.c deleted file mode 100644 index 0b06a79..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_events.c +++ /dev/null @@ -1,2487 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include -#endif /* ifdef HAVE_CONFIG_H */ - -#include -#include -#include - -#include - -#include "Ecore.h" -#include "ecore_private.h" -#include "ecore_x_private.h" -#include "Ecore_X.h" -#include "Ecore_X_Atoms.h" - -/** OpenBSD does not define CODESET - * FIXME ?? - */ - -#ifndef CODESET -#define CODESET "INVALID" -#endif /* ifndef CODESET */ - -typedef struct _Ecore_X_Mouse_Down_Info -{ - EINA_INLIST; - int dev; - Window last_win; - Window last_last_win; - Window last_event_win; - Window last_last_event_win; - Time last_time; - Time last_last_time; - Eina_Bool did_double : 1; - Eina_Bool did_triple : 1; -} Ecore_X_Mouse_Down_Info; - -static int _ecore_x_last_event_mouse_move = 0; -static Ecore_Event *_ecore_x_last_event_mouse_move_event = NULL; -static Eina_Inlist *_ecore_x_mouse_down_info_list = NULL; - -static void -_ecore_x_mouse_down_info_clear(void) -{ - Eina_Inlist *l = _ecore_x_mouse_down_info_list; - Ecore_X_Mouse_Down_Info *info = NULL; - while (l) - { - info = EINA_INLIST_CONTAINER_GET(l, Ecore_X_Mouse_Down_Info); - l = eina_inlist_remove(l, l); - free(info); - } - _ecore_x_mouse_down_info_list = NULL; -} - -void -_ecore_x_events_init(void) -{ - //Actually, Nothing to do. -} - -void -_ecore_x_events_shutdown(void) -{ - _ecore_x_mouse_down_info_clear(); -} - -static Ecore_X_Mouse_Down_Info * -_ecore_x_mouse_down_info_get(int dev) -{ - Eina_Inlist *l = _ecore_x_mouse_down_info_list; - Ecore_X_Mouse_Down_Info *info = NULL; - - //Return the exist info - EINA_INLIST_FOREACH(l, info) - if (info->dev == dev) return info; - - //New Device. Add it. - info = calloc(1, sizeof(Ecore_X_Mouse_Down_Info)); - if (!info) return NULL; - - info->dev = dev; - l = eina_inlist_append(l, (Eina_Inlist *)info); - _ecore_x_mouse_down_info_list = l; - return info; -} - -static void -_ecore_x_event_free_mouse_move(void *data __UNUSED__, - void *ev) -{ - Ecore_Event_Mouse_Move *e; - - e = ev; - if (_ecore_x_last_event_mouse_move) - { - _ecore_x_last_event_mouse_move_event = NULL; - _ecore_x_last_event_mouse_move = 0; - } - - free(e); -} - -EAPI void -ecore_x_event_mask_set(Ecore_X_Window w, - Ecore_X_Event_Mask mask) -{ - XWindowAttributes attr; - XSetWindowAttributes s_attr; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!w) - w = DefaultRootWindow(_ecore_x_disp); - - memset(&attr, 0, sizeof(XWindowAttributes)); - XGetWindowAttributes(_ecore_x_disp, w, &attr); - s_attr.event_mask = mask | attr.your_event_mask; - XChangeWindowAttributes(_ecore_x_disp, w, CWEventMask, &s_attr); -} - -EAPI void -ecore_x_event_mask_unset(Ecore_X_Window w, - Ecore_X_Event_Mask mask) -{ - XWindowAttributes attr; - XSetWindowAttributes s_attr; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!w) - w = DefaultRootWindow(_ecore_x_disp); - - memset(&attr, 0, sizeof(XWindowAttributes)); - XGetWindowAttributes(_ecore_x_disp, w, &attr); - s_attr.event_mask = attr.your_event_mask & ~mask; - XChangeWindowAttributes(_ecore_x_disp, w, CWEventMask, &s_attr); -} - -static void -_ecore_x_event_free_xdnd_enter(void *data __UNUSED__, - void *ev) -{ - Ecore_X_Event_Xdnd_Enter *e; - int i; - - e = ev; - for (i = 0; i < e->num_types; i++) - XFree(e->types[i]); - free(e->types); - free(e); -} - -static void -_ecore_x_event_free_selection_notify(void *data __UNUSED__, - void *ev) -{ - Ecore_X_Event_Selection_Notify *e; - Ecore_X_Selection_Data *sel; - - e = ev; - sel = e->data; - if (sel->free) - sel->free(sel); - - free(e->target); - free(e); -} - -static unsigned int -_ecore_x_event_modifiers(unsigned int state) -{ - unsigned int modifiers = 0; - - if (state & ECORE_X_MODIFIER_SHIFT) - modifiers |= ECORE_EVENT_MODIFIER_SHIFT; - - if (state & ECORE_X_MODIFIER_CTRL) - modifiers |= ECORE_EVENT_MODIFIER_CTRL; - - if (state & ECORE_X_MODIFIER_ALT) - modifiers |= ECORE_EVENT_MODIFIER_ALT; - - if (state & ECORE_X_MODIFIER_WIN) - modifiers |= ECORE_EVENT_MODIFIER_WIN; - - if (state & ECORE_X_LOCK_SCROLL) - modifiers |= ECORE_EVENT_LOCK_SCROLL; - - if (state & ECORE_X_LOCK_NUM) - modifiers |= ECORE_EVENT_LOCK_NUM; - - if (state & ECORE_X_LOCK_CAPS) - modifiers |= ECORE_EVENT_LOCK_CAPS; - - if (state & ECORE_X_LOCK_SHIFT) - modifiers |= ECORE_EVENT_LOCK_SHIFT; - - return modifiers; -} - -void -_ecore_mouse_move(unsigned int timestamp, - unsigned int xmodifiers, - int x, - int y, - int x_root, - int y_root, - unsigned int event_window, - unsigned int window, - unsigned int root_win, - int same_screen, - int dev, - double radx, - double rady, - double pressure, - double angle, - double mx, - double my, - double mrx, - double mry) -{ - Ecore_Event_Mouse_Move *e; - Ecore_Event *event; - - e = malloc(sizeof(Ecore_Event_Mouse_Move)); - if (!e) - return; - - e->window = window; - e->root_window = root_win; - e->timestamp = timestamp; - e->same_screen = same_screen; - e->event_window = event_window; - - e->modifiers = _ecore_x_event_modifiers(xmodifiers); - e->x = x; - e->y = y; - e->root.x = x_root; - e->root.y = y_root; - - e->multi.device = dev; - e->multi.radius = (radx + rady) / 2; - e->multi.radius_x = radx; - e->multi.radius_y = rady; - e->multi.pressure = pressure; - e->multi.angle = angle; - e->multi.x = mx; - e->multi.y = my; - e->multi.root.x = mrx; - e->multi.root.y = mry; - - event = ecore_event_add(ECORE_EVENT_MOUSE_MOVE, - e, - _ecore_x_event_free_mouse_move, - NULL); - - _ecore_x_event_last_time = timestamp; - _ecore_x_event_last_win = window; - _ecore_x_event_last_root_x = x_root; - _ecore_x_event_last_root_y = y_root; - - _ecore_x_last_event_mouse_move_event = event; -} - -static void -_ecore_key_press(int event, - XKeyEvent *xevent) -{ - Ecore_Event_Key *e; - char *compose = NULL; - char *tmp = NULL; - char *keyname; - char *key; - char keyname_buffer[256]; - char compose_buffer[256]; - KeySym sym; - XComposeStatus status; - int val; - - _ecore_x_last_event_mouse_move = 0; - keyname = XKeysymToString(XKeycodeToKeysym(xevent->display, - xevent->keycode, 0)); - if (!keyname) - { - snprintf(keyname_buffer, - sizeof(keyname_buffer), - "Keycode-%i", - xevent->keycode); - keyname = keyname_buffer; - } - - sym = 0; - key = NULL; - compose = NULL; - val = XLookupString(xevent, - compose_buffer, - sizeof(compose_buffer), - &sym, - &status); - if (val > 0) - { - compose_buffer[val] = 0; - compose = eina_str_convert(nl_langinfo(CODESET), "UTF-8", - compose_buffer); - if (!compose) - ERR("Ecore_X cannot convert input key string '%s' to UTF-8. " - "Is Eina built with iconv support?", compose_buffer); - tmp = compose; - } - - key = XKeysymToString(sym); - if (!key) - key = keyname; - - e = - malloc(sizeof(Ecore_Event_Key) + strlen(key) + strlen(keyname) + - (compose ? strlen(compose) : 0) + 3); - if (!e) - goto on_error; - - e->keyname = (char *)(e + 1); - e->key = e->keyname + strlen(keyname) + 1; - e->compose = (compose) ? e->key + strlen(key) + 1 : NULL; - e->string = e->compose; - - strcpy((char *)e->keyname, keyname); - strcpy((char *)e->key, key); - if (compose) - strcpy((char *)e->compose, compose); - - e->modifiers = _ecore_x_event_modifiers(xevent->state); - - e->timestamp = xevent->time; - e->window = xevent->subwindow ? xevent->subwindow : xevent->window; - e->event_window = xevent->window; - e->same_screen = xevent->same_screen; - e->root_window = xevent->root; - - ecore_event_add(event, e, NULL, NULL); - - _ecore_x_event_last_time = e->timestamp; - -on_error: - if (tmp) - free(tmp); -} - -Ecore_Event_Mouse_Button * -_ecore_mouse_button(int event, - unsigned int timestamp, - unsigned int xmodifiers, - unsigned int buttons, - int x, - int y, - int x_root, - int y_root, - unsigned int event_window, - unsigned int window, - unsigned int root_win, - int same_screen, - int dev, - double radx, - double rady, - double pressure, - double angle, - double mx, - double my, - double mrx, - double mry) -{ - Ecore_Event_Mouse_Button *e; - - e = malloc(sizeof(Ecore_Event_Mouse_Button)); - if (!e) - return NULL; - - e->window = window; - e->root_window = root_win; - e->timestamp = timestamp; - e->same_screen = same_screen; - e->event_window = event_window; - - e->buttons = buttons; - e->modifiers = _ecore_x_event_modifiers(xmodifiers); - e->double_click = 0; - e->triple_click = 0; - e->x = x; - e->y = y; - e->root.x = x_root; - e->root.y = y_root; - - Ecore_X_Mouse_Down_Info *down_info = _ecore_x_mouse_down_info_get(dev); - - if (down_info) - { - if ((event == ECORE_EVENT_MOUSE_BUTTON_DOWN) && - down_info->did_triple) - { - down_info->last_win = 0; - down_info->last_last_win = 0; - down_info->last_event_win = 0; - down_info->last_last_event_win = 0; - down_info->last_time = 0; - down_info->last_last_time = 0; - } - if (event_window == window) - { - if (event == ECORE_EVENT_MOUSE_BUTTON_DOWN) - { - //Check Double Clicked - if (((int)(timestamp - down_info->last_time) <= - (int)(1000 * _ecore_x_double_click_time)) && - (window == down_info->last_win) && - (event_window == down_info->last_event_win)) - { - e->double_click = 1; - down_info->did_double = EINA_TRUE; - } - else - { - down_info->did_double = EINA_FALSE; - down_info->did_triple = EINA_FALSE; - } - - //Check Triple Clicked - if (((int)(timestamp - down_info->last_last_time) <= - (int)(2 * 1000 * _ecore_x_double_click_time)) && - (window == down_info->last_win) && - (window == down_info->last_last_win) && - (event_window == down_info->last_event_win) && - (event_window == down_info->last_last_event_win) - ) - { - e->triple_click = 1; - down_info->did_triple = EINA_TRUE; - } - else - { - down_info->did_triple = EINA_FALSE; - } - } - else - { - if (down_info->did_double) - e->double_click = 1; - if (down_info->did_triple) - e->triple_click = 1; - } - } - } - - /* NB: Block commented out as _ecore_x_mouse_up_count appears to have - * no use. The variable is also commented out above. This code block is - * the only place that this variable is used, and appears to serve no - * purpose. - dh - if (event == ECORE_EVENT_MOUSE_BUTTON_DOWN - && !e->double_click - && !e->triple_click) - _ecore_x_mouse_up_count = 0; - */ - - e->multi.device = dev; - e->multi.radius = (radx + rady) / 2; - e->multi.radius_x = radx; - e->multi.radius_y = rady; - e->multi.pressure = pressure; - e->multi.angle = angle; - e->multi.x = mx; - e->multi.y = my; - e->multi.root.x = mrx; - e->multi.root.y = mry; - - _ecore_x_event_last_time = e->timestamp; - _ecore_x_event_last_win = e->window; - _ecore_x_event_last_root_x = x_root; - _ecore_x_event_last_root_y = y_root; - - ecore_event_add(event, e, NULL, NULL); - - if ((down_info) && - (event == ECORE_EVENT_MOUSE_BUTTON_DOWN) && - (window == event_window) && - (!down_info->did_triple)) - { - down_info->last_last_win = down_info->last_win; - down_info->last_win = window; - down_info->last_last_event_win = down_info->last_event_win; - down_info->last_event_win = event_window; - down_info->last_last_time = down_info->last_time; - down_info->last_time = timestamp; - } - - return e; -} - -void -_ecore_x_event_handle_any_event(XEvent *xevent) -{ - XEvent *ev = malloc(sizeof(XEvent)); - if (!ev) return; - memcpy(ev, xevent, sizeof(XEvent)); - ecore_event_add(ECORE_X_EVENT_ANY, ev, NULL, NULL); -} - -void -_ecore_x_event_handle_key_press(XEvent *xevent) -{ - _ecore_key_press(ECORE_EVENT_KEY_DOWN, (XKeyEvent *)xevent); -} - -void -_ecore_x_event_handle_key_release(XEvent *xevent) -{ - _ecore_key_press(ECORE_EVENT_KEY_UP, (XKeyEvent *)xevent); -} - -void -_ecore_x_event_handle_button_press(XEvent *xevent) -{ - int i; - - _ecore_x_last_event_mouse_move = 0; - if ((xevent->xbutton.button > 3) && (xevent->xbutton.button < 8)) - { - Ecore_Event_Mouse_Wheel *e; - - e = malloc(sizeof(Ecore_Event_Mouse_Wheel)); - if (!e) - return; - - e->timestamp = xevent->xbutton.time; - e->modifiers = _ecore_x_event_modifiers(xevent->xbutton.state); - switch (xevent->xbutton.button) - { - case 4: e->direction = 0; e->z = -1; break; - - case 5: e->direction = 0; e->z = 1; break; - - case 6: e->direction = 1; e->z = -1; break; - - case 7: e->direction = 1; e->z = 1; break; - - default: e->direction = 0; e->z = 0; break; - } - - e->x = xevent->xbutton.x; - e->y = xevent->xbutton.y; - e->root.x = xevent->xbutton.x_root; - e->root.y = xevent->xbutton.y_root; - - if (xevent->xbutton.subwindow) - e->window = xevent->xbutton.subwindow; - else - e->window = xevent->xbutton.window; - - e->event_window = xevent->xbutton.window; - e->same_screen = xevent->xbutton.same_screen; - e->root_window = xevent->xbutton.root; - - _ecore_x_event_last_time = e->timestamp; - _ecore_x_event_last_win = e->window; - _ecore_x_event_last_root_x = xevent->xbutton.x_root; - _ecore_x_event_last_root_y = xevent->xbutton.y_root; - ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, e, NULL, NULL); - - for (i = 0; i < _ecore_window_grabs_num; i++) - { - if ((_ecore_window_grabs[i] == xevent->xbutton.window) || - (_ecore_window_grabs[i] == xevent->xbutton.subwindow)) - { - Eina_Bool replay = EINA_FALSE; - - if (_ecore_window_grab_replay_func) - replay = _ecore_window_grab_replay_func( - _ecore_window_grab_replay_data, - ECORE_EVENT_MOUSE_WHEEL, - e); - - if (replay) - XAllowEvents(xevent->xbutton.display, - ReplayPointer, xevent->xbutton.time); - else - XAllowEvents(xevent->xbutton.display, - AsyncPointer, xevent->xbutton.time); - - break; - } - } - } - else - { - { - _ecore_mouse_move(xevent->xbutton.time, xevent->xbutton.state, - xevent->xbutton.x, xevent->xbutton.y, - xevent->xbutton.x_root, xevent->xbutton.y_root, - xevent->xbutton.window, - (xevent->xbutton.subwindow ? xevent->xbutton. - subwindow : xevent->xbutton.window), - xevent->xbutton.root, - xevent->xbutton.same_screen, - 0, 1, 1, - 1.0, // pressure - 0.0, // angle - xevent->xbutton.x, xevent->xbutton.y, - xevent->xbutton.x_root, xevent->xbutton.y_root); - } - { - Ecore_Event_Mouse_Button *e; - int event_window; - int window; - - window = - (xevent->xbutton.subwindow ? xevent->xbutton.subwindow : xevent-> - xbutton.window); - event_window = xevent->xbutton.window; - - e = _ecore_mouse_button(ECORE_EVENT_MOUSE_BUTTON_DOWN, - xevent->xbutton.time, - xevent->xbutton.state, - xevent->xbutton.button, - xevent->xbutton.x, - xevent->xbutton.y, - xevent->xbutton.x_root, - xevent->xbutton.y_root, - event_window, - window, - xevent->xbutton.root, - xevent->xbutton.same_screen, - 0, - 1, - 1, - 1.0, -// pressure - 0.0, -// angle - xevent->xbutton.x, - xevent->xbutton.y, - xevent->xbutton.x_root, - xevent->xbutton.y_root); - if (e) - for (i = 0; i < _ecore_window_grabs_num; i++) - { - if ((_ecore_window_grabs[i] == xevent->xbutton.window) || - (_ecore_window_grabs[i] == xevent->xbutton.subwindow)) - { - Eina_Bool replay = EINA_FALSE; - - if (_ecore_window_grab_replay_func) - replay = _ecore_window_grab_replay_func( - _ecore_window_grab_replay_data, - ECORE_EVENT_MOUSE_BUTTON_DOWN, - e); - - if (replay) - XAllowEvents(xevent->xbutton.display, - ReplayPointer, xevent->xbutton.time); - else - XAllowEvents(xevent->xbutton.display, - AsyncPointer, xevent->xbutton.time); - - break; - } - } - } - } -} - -void -_ecore_x_event_handle_button_release(XEvent *xevent) -{ - _ecore_x_last_event_mouse_move = 0; - /* filter out wheel buttons */ - if ((xevent->xbutton.button <= 3) || (xevent->xbutton.button > 7)) - { - _ecore_mouse_move(xevent->xbutton.time, xevent->xbutton.state, - xevent->xbutton.x, xevent->xbutton.y, - xevent->xbutton.x_root, xevent->xbutton.y_root, - xevent->xbutton.window, - (xevent->xbutton.subwindow ? xevent->xbutton. - subwindow : xevent->xbutton.window), - xevent->xbutton.root, - xevent->xbutton.same_screen, - 0, 1, 1, - 1.0, // pressure - 0.0, // angle - xevent->xbutton.x, xevent->xbutton.y, - xevent->xbutton.x_root, xevent->xbutton.y_root); - - _ecore_mouse_button(ECORE_EVENT_MOUSE_BUTTON_UP, - xevent->xbutton.time, xevent->xbutton.state, - xevent->xbutton.button, - xevent->xbutton.x, xevent->xbutton.y, - xevent->xbutton.x_root, xevent->xbutton.y_root, - xevent->xbutton.window, - (xevent->xbutton.subwindow ? xevent->xbutton. - subwindow : xevent->xbutton.window), - xevent->xbutton.root, - xevent->xbutton.same_screen, - 0, 1, 1, - 1.0, // pressure - 0.0, // angle - xevent->xbutton.x, xevent->xbutton.y, - xevent->xbutton.x_root, xevent->xbutton.y_root); - } -} - -void -_ecore_x_event_handle_motion_notify(XEvent *xevent) -{ -/* - if (_ecore_x_last_event_mouse_move) - { - ecore_event_del(_ecore_x_last_event_mouse_move_event); - _ecore_x_last_event_mouse_move = 0; - _ecore_x_last_event_mouse_move_event = NULL; - } - */ - _ecore_mouse_move(xevent->xmotion.time, xevent->xmotion.state, - xevent->xmotion.x, xevent->xmotion.y, - xevent->xmotion.x_root, xevent->xmotion.y_root, - xevent->xmotion.window, - (xevent->xmotion.subwindow ? xevent->xmotion.subwindow : - xevent->xmotion.window), - xevent->xmotion.root, - xevent->xmotion.same_screen, - 0, 1, 1, - 1.0, // pressure - 0.0, // angle - xevent->xmotion.x, xevent->xmotion.y, - xevent->xmotion.x_root, xevent->xmotion.y_root); - - _ecore_x_last_event_mouse_move = 1; - - /* Xdnd handling */ - _ecore_x_dnd_drag(xevent->xmotion.root, - xevent->xmotion.x_root, - xevent->xmotion.y_root); -} - -void -_ecore_x_event_handle_enter_notify(XEvent *xevent) -{ - _ecore_x_last_event_mouse_move = 0; - { - _ecore_mouse_move(xevent->xcrossing.time, xevent->xcrossing.state, - xevent->xcrossing.x, xevent->xcrossing.y, - xevent->xcrossing.x_root, xevent->xcrossing.y_root, - xevent->xcrossing.window, - (xevent->xcrossing.subwindow ? xevent->xcrossing. - subwindow : xevent->xcrossing.window), - xevent->xcrossing.root, - xevent->xcrossing.same_screen, - 0, 1, 1, - 1.0, // pressure - 0.0, // angle - xevent->xcrossing.x, xevent->xcrossing.y, - xevent->xcrossing.x_root, xevent->xcrossing.y_root); - } - { - Ecore_X_Event_Mouse_In *e; - - e = calloc(1, sizeof(Ecore_X_Event_Mouse_In)); - if (!e) - return; - - e->modifiers = _ecore_x_event_modifiers(xevent->xcrossing.state); - e->x = xevent->xcrossing.x; - e->y = xevent->xcrossing.y; - e->root.x = xevent->xcrossing.x_root; - e->root.y = xevent->xcrossing.y_root; - if (xevent->xcrossing.subwindow) - e->win = xevent->xcrossing.subwindow; - else - e->win = xevent->xcrossing.window; - - e->same_screen = xevent->xcrossing.same_screen; - e->root_win = xevent->xcrossing.root; - e->event_win = xevent->xcrossing.window; - - if (xevent->xcrossing.mode == NotifyNormal) - e->mode = ECORE_X_EVENT_MODE_NORMAL; - else if (xevent->xcrossing.mode == NotifyGrab) - e->mode = ECORE_X_EVENT_MODE_GRAB; - else if (xevent->xcrossing.mode == NotifyUngrab) - e->mode = ECORE_X_EVENT_MODE_UNGRAB; - - if (xevent->xcrossing.detail == NotifyAncestor) - e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR; - else if (xevent->xcrossing.detail == NotifyVirtual) - e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL; - else if (xevent->xcrossing.detail == NotifyInferior) - e->detail = ECORE_X_EVENT_DETAIL_INFERIOR; - else if (xevent->xcrossing.detail == NotifyNonlinear) - e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR; - else if (xevent->xcrossing.detail == NotifyNonlinearVirtual) - e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL; - - e->time = xevent->xcrossing.time; - _ecore_x_event_last_time = e->time; - ecore_event_add(ECORE_X_EVENT_MOUSE_IN, e, NULL, NULL); - } -} - -void -_ecore_x_event_handle_leave_notify(XEvent *xevent) -{ - _ecore_x_last_event_mouse_move = 0; - { - _ecore_mouse_move(xevent->xcrossing.time, xevent->xcrossing.state, - xevent->xcrossing.x, xevent->xcrossing.y, - xevent->xcrossing.x_root, xevent->xcrossing.y_root, - xevent->xcrossing.window, - (xevent->xcrossing.subwindow ? xevent->xcrossing. - subwindow : xevent->xcrossing.window), - xevent->xcrossing.root, - xevent->xcrossing.same_screen, - 0, 1, 1, - 1.0, // pressure - 0.0, // angle - xevent->xcrossing.x, xevent->xcrossing.y, - xevent->xcrossing.x_root, xevent->xcrossing.y_root); - } - { - Ecore_X_Event_Mouse_Out *e; - - e = calloc(1, sizeof(Ecore_X_Event_Mouse_Out)); - if (!e) - return; - - e->modifiers = _ecore_x_event_modifiers(xevent->xcrossing.state); - e->x = xevent->xcrossing.x; - e->y = xevent->xcrossing.y; - e->root.x = xevent->xcrossing.x_root; - e->root.y = xevent->xcrossing.y_root; - if (xevent->xcrossing.subwindow) - e->win = xevent->xcrossing.subwindow; - else - e->win = xevent->xcrossing.window; - - e->same_screen = xevent->xcrossing.same_screen; - e->root_win = xevent->xcrossing.root; - e->event_win = xevent->xcrossing.window; - - if (xevent->xcrossing.mode == NotifyNormal) - e->mode = ECORE_X_EVENT_MODE_NORMAL; - else if (xevent->xcrossing.mode == NotifyGrab) - e->mode = ECORE_X_EVENT_MODE_GRAB; - else if (xevent->xcrossing.mode == NotifyUngrab) - e->mode = ECORE_X_EVENT_MODE_UNGRAB; - - if (xevent->xcrossing.detail == NotifyAncestor) - e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR; - else if (xevent->xcrossing.detail == NotifyVirtual) - e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL; - else if (xevent->xcrossing.detail == NotifyInferior) - e->detail = ECORE_X_EVENT_DETAIL_INFERIOR; - else if (xevent->xcrossing.detail == NotifyNonlinear) - e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR; - else if (xevent->xcrossing.detail == NotifyNonlinearVirtual) - e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL; - - e->time = xevent->xcrossing.time; - _ecore_x_event_last_time = e->time; - _ecore_x_event_last_win = e->win; - _ecore_x_event_last_root_x = e->root.x; - _ecore_x_event_last_root_y = e->root.y; - ecore_event_add(ECORE_X_EVENT_MOUSE_OUT, e, NULL, NULL); - } -} - -void -_ecore_x_event_handle_focus_in(XEvent *xevent) -{ - Ecore_X_Event_Window_Focus_In *e; - - _ecore_x_last_event_mouse_move = 0; - - e = calloc(1, sizeof(Ecore_X_Event_Window_Focus_In)); - if (!e) - return; - - e->win = xevent->xfocus.window; - - if (xevent->xfocus.mode == NotifyNormal) - e->mode = ECORE_X_EVENT_MODE_NORMAL; - else if (xevent->xfocus.mode == NotifyWhileGrabbed) - e->mode = ECORE_X_EVENT_MODE_WHILE_GRABBED; - else if (xevent->xfocus.mode == NotifyGrab) - e->mode = ECORE_X_EVENT_MODE_GRAB; - else if (xevent->xfocus.mode == NotifyUngrab) - e->mode = ECORE_X_EVENT_MODE_UNGRAB; - - if (xevent->xfocus.detail == NotifyAncestor) - e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR; - else if (xevent->xfocus.detail == NotifyVirtual) - e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL; - else if (xevent->xfocus.detail == NotifyInferior) - e->detail = ECORE_X_EVENT_DETAIL_INFERIOR; - else if (xevent->xfocus.detail == NotifyNonlinear) - e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR; - else if (xevent->xfocus.detail == NotifyNonlinearVirtual) - e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL; - else if (xevent->xfocus.detail == NotifyPointer) - e->detail = ECORE_X_EVENT_DETAIL_POINTER; - else if (xevent->xfocus.detail == NotifyPointerRoot) - e->detail = ECORE_X_EVENT_DETAIL_POINTER_ROOT; - else if (xevent->xfocus.detail == NotifyDetailNone) - e->detail = ECORE_X_EVENT_DETAIL_DETAIL_NONE; - - e->time = _ecore_x_event_last_time; - _ecore_x_event_last_time = e->time; - ecore_event_add(ECORE_X_EVENT_WINDOW_FOCUS_IN, e, NULL, NULL); -} - -void -_ecore_x_event_handle_focus_out(XEvent *xevent) -{ - Ecore_X_Event_Window_Focus_Out *e; - - _ecore_x_last_event_mouse_move = 0; - - e = calloc(1, sizeof(Ecore_X_Event_Window_Focus_Out)); - if (!e) - return; - - e->win = xevent->xfocus.window; - - if (xevent->xfocus.mode == NotifyNormal) - e->mode = ECORE_X_EVENT_MODE_NORMAL; - else if (xevent->xfocus.mode == NotifyWhileGrabbed) - e->mode = ECORE_X_EVENT_MODE_WHILE_GRABBED; - else if (xevent->xfocus.mode == NotifyGrab) - e->mode = ECORE_X_EVENT_MODE_GRAB; - else if (xevent->xfocus.mode == NotifyUngrab) - e->mode = ECORE_X_EVENT_MODE_UNGRAB; - - if (xevent->xfocus.detail == NotifyAncestor) - e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR; - else if (xevent->xfocus.detail == NotifyVirtual) - e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL; - else if (xevent->xfocus.detail == NotifyInferior) - e->detail = ECORE_X_EVENT_DETAIL_INFERIOR; - else if (xevent->xfocus.detail == NotifyNonlinear) - e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR; - else if (xevent->xfocus.detail == NotifyNonlinearVirtual) - e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL; - else if (xevent->xfocus.detail == NotifyPointer) - e->detail = ECORE_X_EVENT_DETAIL_POINTER; - else if (xevent->xfocus.detail == NotifyPointerRoot) - e->detail = ECORE_X_EVENT_DETAIL_POINTER_ROOT; - else if (xevent->xfocus.detail == NotifyDetailNone) - e->detail = ECORE_X_EVENT_DETAIL_DETAIL_NONE; - - e->time = _ecore_x_event_last_time; - _ecore_x_event_last_time = e->time; - ecore_event_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT, e, NULL, NULL); -} - -void -_ecore_x_event_handle_keymap_notify(XEvent *xevent __UNUSED__) -{ - _ecore_x_last_event_mouse_move = 0; - /* FIXME: handle this event type */ -} - -void -_ecore_x_event_handle_expose(XEvent *xevent) -{ - Ecore_X_Event_Window_Damage *e; - - _ecore_x_last_event_mouse_move = 0; - e = calloc(1, sizeof(Ecore_X_Event_Window_Damage)); - if (!e) - return; - - e->win = xevent->xexpose.window; - e->time = _ecore_x_event_last_time; - e->x = xevent->xexpose.x; - e->y = xevent->xexpose.y; - e->w = xevent->xexpose.width; - e->h = xevent->xexpose.height; - e->count = xevent->xexpose.count; - ecore_event_add(ECORE_X_EVENT_WINDOW_DAMAGE, e, NULL, NULL); -} - -void -_ecore_x_event_handle_graphics_expose(XEvent *xevent) -{ - Ecore_X_Event_Window_Damage *e; - - _ecore_x_last_event_mouse_move = 0; - e = calloc(1, sizeof(Ecore_X_Event_Window_Damage)); - if (!e) - return; - - e->win = xevent->xgraphicsexpose.drawable; - e->time = _ecore_x_event_last_time; - e->x = xevent->xgraphicsexpose.x; - e->y = xevent->xgraphicsexpose.y; - e->w = xevent->xgraphicsexpose.width; - e->h = xevent->xgraphicsexpose.height; - e->count = xevent->xgraphicsexpose.count; - ecore_event_add(ECORE_X_EVENT_WINDOW_DAMAGE, e, NULL, NULL); -} - -void -_ecore_x_event_handle_visibility_notify(XEvent *xevent) -{ - _ecore_x_last_event_mouse_move = 0; -// if (xevent->xvisibility.state != VisibilityPartiallyObscured) - { - Ecore_X_Event_Window_Visibility_Change *e; - - e = calloc(1, sizeof(Ecore_X_Event_Window_Visibility_Change)); - if (!e) - return; - - e->win = xevent->xvisibility.window; - e->time = _ecore_x_event_last_time; - if (xevent->xvisibility.state == VisibilityFullyObscured) - e->fully_obscured = 1; - else - e->fully_obscured = 0; - - ecore_event_add(ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE, e, NULL, NULL); - } -} - -void -_ecore_x_event_handle_create_notify(XEvent *xevent) -{ - Ecore_X_Event_Window_Create *e; - - _ecore_x_last_event_mouse_move = 0; - e = calloc(1, sizeof(Ecore_X_Event_Window_Create)); - if (!e) - return; - - e->win = xevent->xcreatewindow.window; - e->parent = xevent->xcreatewindow.parent; - if (xevent->xcreatewindow.override_redirect) - e->override = 1; - else - e->override = 0; - - e->x = xevent->xcreatewindow.x; - e->y = xevent->xcreatewindow.y; - e->w = xevent->xcreatewindow.width; - e->h = xevent->xcreatewindow.height; - e->border = xevent->xcreatewindow.border_width; - e->time = _ecore_x_event_last_time; - ecore_event_add(ECORE_X_EVENT_WINDOW_CREATE, e, NULL, NULL); -} - -void -_ecore_x_event_handle_destroy_notify(XEvent *xevent) -{ - Ecore_X_Event_Window_Destroy *e; - - _ecore_x_last_event_mouse_move = 0; - e = calloc(1, sizeof(Ecore_X_Event_Window_Destroy)); - if (!e) - return; - - e->win = xevent->xdestroywindow.window; - e->event_win = xevent->xdestroywindow.event; - e->time = _ecore_x_event_last_time; - if (e->win == _ecore_x_event_last_win) - _ecore_x_event_last_win = 0; - - ecore_event_add(ECORE_X_EVENT_WINDOW_DESTROY, e, NULL, NULL); -} - -void -_ecore_x_event_handle_unmap_notify(XEvent *xevent) -{ - Ecore_X_Event_Window_Hide *e; - - _ecore_x_last_event_mouse_move = 0; - e = calloc(1, sizeof(Ecore_X_Event_Window_Hide)); - if (!e) - return; - - e->win = xevent->xunmap.window; - e->event_win = xevent->xunmap.event; - e->time = _ecore_x_event_last_time; - ecore_event_add(ECORE_X_EVENT_WINDOW_HIDE, e, NULL, NULL); -} - -void -_ecore_x_event_handle_map_notify(XEvent *xevent) -{ - Ecore_X_Event_Window_Show *e; - - _ecore_x_last_event_mouse_move = 0; - e = calloc(1, sizeof(Ecore_X_Event_Window_Show)); - if (!e) - return; - - e->win = xevent->xmap.window; - e->event_win = xevent->xmap.event; - e->time = _ecore_x_event_last_time; - ecore_event_add(ECORE_X_EVENT_WINDOW_SHOW, e, NULL, NULL); -} - -void -_ecore_x_event_handle_map_request(XEvent *xevent) -{ - Ecore_X_Event_Window_Show_Request *e; - - _ecore_x_last_event_mouse_move = 0; - e = calloc(1, sizeof(Ecore_X_Event_Window_Show_Request)); - if (!e) - return; - - e->win = xevent->xmaprequest.window; - e->time = _ecore_x_event_last_time; - e->parent = xevent->xmaprequest.parent; - ecore_event_add(ECORE_X_EVENT_WINDOW_SHOW_REQUEST, e, NULL, NULL); -} - -void -_ecore_x_event_handle_reparent_notify(XEvent *xevent) -{ - Ecore_X_Event_Window_Reparent *e; - - _ecore_x_last_event_mouse_move = 0; - e = calloc(1, sizeof(Ecore_X_Event_Window_Reparent)); - if (!e) - return; - - e->win = xevent->xreparent.window; - e->event_win = xevent->xreparent.event; - e->parent = xevent->xreparent.parent; - e->time = _ecore_x_event_last_time; - ecore_event_add(ECORE_X_EVENT_WINDOW_REPARENT, e, NULL, NULL); -} - -void -_ecore_x_event_handle_configure_notify(XEvent *xevent) -{ - Ecore_X_Event_Window_Configure *e; - - _ecore_x_last_event_mouse_move = 0; - e = calloc(1, sizeof(Ecore_X_Event_Window_Configure)); - if (!e) - return; - - e->win = xevent->xconfigure.window; - e->event_win = xevent->xconfigure.event; - e->abovewin = xevent->xconfigure.above; - e->x = xevent->xconfigure.x; - e->y = xevent->xconfigure.y; - e->w = xevent->xconfigure.width; - e->h = xevent->xconfigure.height; - e->border = xevent->xconfigure.border_width; - e->override = xevent->xconfigure.override_redirect; - e->from_wm = xevent->xconfigure.send_event; - e->time = _ecore_x_event_last_time; - ecore_event_add(ECORE_X_EVENT_WINDOW_CONFIGURE, e, NULL, NULL); -} - -void -_ecore_x_event_handle_configure_request(XEvent *xevent) -{ - Ecore_X_Event_Window_Configure_Request *e; - - _ecore_x_last_event_mouse_move = 0; - e = calloc(1, sizeof(Ecore_X_Event_Window_Configure_Request)); - if (!e) - return; - - e->win = xevent->xconfigurerequest.window; - e->parent_win = xevent->xconfigurerequest.parent; - e->abovewin = xevent->xconfigurerequest.above; - e->x = xevent->xconfigurerequest.x; - e->y = xevent->xconfigurerequest.y; - e->w = xevent->xconfigurerequest.width; - e->h = xevent->xconfigurerequest.height; - e->border = xevent->xconfigurerequest.border_width; - e->value_mask = xevent->xconfigurerequest.value_mask; - e->time = _ecore_x_event_last_time; - - if (xevent->xconfigurerequest.detail == Above) - e->detail = ECORE_X_WINDOW_STACK_ABOVE; - else if (xevent->xconfigurerequest.detail == Below) - e->detail = ECORE_X_WINDOW_STACK_BELOW; - else if (xevent->xconfigurerequest.detail == TopIf) - e->detail = ECORE_X_WINDOW_STACK_TOP_IF; - else if (xevent->xconfigurerequest.detail == BottomIf) - e->detail = ECORE_X_WINDOW_STACK_BOTTOM_IF; - else if (xevent->xconfigurerequest.detail == Opposite) - e->detail = ECORE_X_WINDOW_STACK_OPPOSITE; - - ecore_event_add(ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST, e, NULL, NULL); -} - -void -_ecore_x_event_handle_gravity_notify(XEvent *xevent __UNUSED__) -{ - _ecore_x_last_event_mouse_move = 0; - /* FIXME: handle this event type */ -} - -void -_ecore_x_event_handle_resize_request(XEvent *xevent) -{ - Ecore_X_Event_Window_Resize_Request *e; - - _ecore_x_last_event_mouse_move = 0; - e = calloc(1, sizeof(Ecore_X_Event_Window_Resize_Request)); - if (!e) - return; - - e->win = xevent->xresizerequest.window; - e->w = xevent->xresizerequest.width; - e->h = xevent->xresizerequest.height; - e->time = _ecore_x_event_last_time; - ecore_event_add(ECORE_X_EVENT_WINDOW_RESIZE_REQUEST, e, NULL, NULL); -} - -void -_ecore_x_event_handle_circulate_notify(XEvent *xevent) -{ - Ecore_X_Event_Window_Stack *e; - - _ecore_x_last_event_mouse_move = 0; - e = calloc(1, sizeof(Ecore_X_Event_Window_Stack)); - if (!e) - return; - - e->win = xevent->xcirculate.window; - e->event_win = xevent->xcirculate.event; - if (xevent->xcirculate.place == PlaceOnTop) - e->detail = ECORE_X_WINDOW_STACK_ABOVE; - else - e->detail = ECORE_X_WINDOW_STACK_BELOW; - - e->time = _ecore_x_event_last_time; - ecore_event_add(ECORE_X_EVENT_WINDOW_STACK, e, NULL, NULL); -} - -void -_ecore_x_event_handle_circulate_request(XEvent *xevent) -{ - Ecore_X_Event_Window_Stack_Request *e; - - _ecore_x_last_event_mouse_move = 0; - e = calloc(1, sizeof(Ecore_X_Event_Window_Stack_Request)); - if (!e) - return; - - e->win = xevent->xcirculaterequest.window; - e->parent = xevent->xcirculaterequest.parent; - if (xevent->xcirculaterequest.place == PlaceOnTop) - e->detail = ECORE_X_WINDOW_STACK_ABOVE; - else - e->detail = ECORE_X_WINDOW_STACK_BELOW; - - e->time = _ecore_x_event_last_time; - ecore_event_add(ECORE_X_EVENT_WINDOW_STACK_REQUEST, e, NULL, NULL); -} - -void -_ecore_x_event_handle_property_notify(XEvent *xevent) -{ - _ecore_x_last_event_mouse_move = 0; - { - Ecore_X_Event_Window_Property *e; - - e = calloc(1, sizeof(Ecore_X_Event_Window_Property)); - if (!e) - return; - - e->win = xevent->xproperty.window; - e->atom = xevent->xproperty.atom; - e->time = xevent->xproperty.time; - _ecore_x_event_last_time = e->time; - ecore_event_add(ECORE_X_EVENT_WINDOW_PROPERTY, e, NULL, NULL); - } -} - -void -_ecore_x_event_handle_selection_clear(XEvent *xevent) -{ -// Ecore_X_Selection_Intern *d; - Ecore_X_Event_Selection_Clear *e; - Ecore_X_Atom sel; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - _ecore_x_last_event_mouse_move = 0; -/* errr..... why? paranoia. - d = _ecore_x_selection_get(xevent->xselectionclear.selection); - if (d && (xevent->xselectionclear.time > d->time)) - { - _ecore_x_selection_set(None, NULL, 0, - xevent->xselectionclear.selection); - } - */ -/* Generate event for app cleanup */ - e = malloc(sizeof(Ecore_X_Event_Selection_Clear)); - e->win = xevent->xselectionclear.window; - e->time = xevent->xselectionclear.time; - e->atom = sel = xevent->xselectionclear.selection; - if (sel == ECORE_X_ATOM_SELECTION_PRIMARY) - e->selection = ECORE_X_SELECTION_PRIMARY; - else if (sel == ECORE_X_ATOM_SELECTION_SECONDARY) - e->selection = ECORE_X_SELECTION_SECONDARY; - else if (sel == ECORE_X_ATOM_SELECTION_CLIPBOARD) - e->selection = ECORE_X_SELECTION_CLIPBOARD; - else - e->selection = ECORE_X_SELECTION_OTHER; - - ecore_event_add(ECORE_X_EVENT_SELECTION_CLEAR, e, NULL, NULL); -} - -void -_ecore_x_event_handle_selection_request(XEvent *xevent) -{ - Ecore_X_Event_Selection_Request *e; - Ecore_X_Selection_Intern *sd; - void *data = NULL; - int len; - int typesize; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - _ecore_x_last_event_mouse_move = 0; - /* - * Generate a selection request event. - */ - e = malloc(sizeof(Ecore_X_Event_Selection_Request)); - e->owner = xevent->xselectionrequest.owner; - e->requestor = xevent->xselectionrequest.requestor; - e->time = xevent->xselectionrequest.time; - e->selection = xevent->xselectionrequest.selection; - e->target = xevent->xselectionrequest.target; - e->property = xevent->xselectionrequest.property; - ecore_event_add(ECORE_X_EVENT_SELECTION_REQUEST, e, NULL, NULL); - - if ((sd = _ecore_x_selection_get(xevent->xselectionrequest.selection)) && - (sd->win == xevent->xselectionrequest.owner)) - { - Ecore_X_Selection_Intern *si; - - si = _ecore_x_selection_get(xevent->xselectionrequest.selection); - if (si->data) - { - Ecore_X_Atom property = None; - Ecore_X_Atom type; - - /* Set up defaults for strings first */ - type = xevent->xselectionrequest.target; - typesize = 8; - len = sd->length; - - if (!ecore_x_selection_convert(xevent->xselectionrequest.selection, - xevent->xselectionrequest.target, - &data, &len, &type, &typesize)) - /* Refuse selection, conversion to requested target failed */ - property = None; - else if (data) - { - /* FIXME: This does not properly handle large data transfers */ - ecore_x_window_prop_property_set( - xevent->xselectionrequest.requestor, - xevent->xselectionrequest. - property, - type, - typesize, - data, - len); - property = xevent->xselectionrequest.property; - free(data); - } - - ecore_x_selection_notify_send(xevent->xselectionrequest.requestor, - xevent->xselectionrequest.selection, - xevent->xselectionrequest.target, - property, - xevent->xselectionrequest.time); - } - } -} - -void -_ecore_x_event_handle_selection_notify(XEvent *xevent) -{ - Ecore_X_Event_Selection_Notify *e; - unsigned char *data = NULL; - Ecore_X_Atom selection; - int num_ret, format; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - _ecore_x_last_event_mouse_move = 0; - selection = xevent->xselection.selection; - - if (xevent->xselection.target == ECORE_X_ATOM_SELECTION_TARGETS) - { - format = ecore_x_window_prop_property_get(xevent->xselection.requestor, - xevent->xselection.property, - XA_ATOM, 32, &data, &num_ret); - if (!format) - return; - } - else - { - format = ecore_x_window_prop_property_get(xevent->xselection.requestor, - xevent->xselection.property, - AnyPropertyType, 8, &data, - &num_ret); - if (!format) - return; - } - - e = calloc(1, sizeof(Ecore_X_Event_Selection_Notify)); - if (!e) - return; - - e->win = xevent->xselection.requestor; - e->time = xevent->xselection.time; - e->atom = selection; - e->target = _ecore_x_selection_target_get(xevent->xselection.target); - - if (selection == ECORE_X_ATOM_SELECTION_PRIMARY) - e->selection = ECORE_X_SELECTION_PRIMARY; - else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY) - e->selection = ECORE_X_SELECTION_SECONDARY; - else if (selection == ECORE_X_ATOM_SELECTION_XDND) - e->selection = ECORE_X_SELECTION_XDND; - else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD) - e->selection = ECORE_X_SELECTION_CLIPBOARD; - else - e->selection = ECORE_X_SELECTION_OTHER; - - e->data = _ecore_x_selection_parse(e->target, data, num_ret, format); - - ecore_event_add(ECORE_X_EVENT_SELECTION_NOTIFY, e, - _ecore_x_event_free_selection_notify, NULL); -} - -void -_ecore_x_event_handle_colormap_notify(XEvent *xevent) -{ - Ecore_X_Event_Window_Colormap *e; - - _ecore_x_last_event_mouse_move = 0; - e = calloc(1, sizeof(Ecore_X_Event_Window_Colormap)); - if (!e) - return; - - e->win = xevent->xcolormap.window; - e->cmap = xevent->xcolormap.colormap; - e->time = _ecore_x_event_last_time; - if (xevent->xcolormap.state == ColormapInstalled) - e->installed = EINA_TRUE; - else - e->installed = EINA_FALSE; - - ecore_event_add(ECORE_X_EVENT_WINDOW_COLORMAP, e, NULL, NULL); -} - -void -_ecore_x_event_handle_client_message(XEvent *xevent) -{ - _ecore_x_last_event_mouse_move = 0; - /* Special client message event handling here. need to put LOTS of if */ - /* checks here and generate synthetic events per special message known */ - /* otherwise generate generic client message event. this would handle*/ - /* netwm, ICCCM, gnomewm, old kde and mwm hint client message protocols */ - if ((xevent->xclient.message_type == ECORE_X_ATOM_WM_PROTOCOLS) && - (xevent->xclient.format == 32) && - (xevent->xclient.data.l[0] == (long)ECORE_X_ATOM_WM_DELETE_WINDOW)) - { - Ecore_X_Event_Window_Delete_Request *e; - - e = calloc(1, sizeof(Ecore_X_Event_Window_Delete_Request)); - if (!e) - return; - - e->win = xevent->xclient.window; - e->time = _ecore_x_event_last_time; - ecore_event_add(ECORE_X_EVENT_WINDOW_DELETE_REQUEST, e, NULL, NULL); - } - else if ((xevent->xclient.message_type == ECORE_X_ATOM_NET_WM_MOVERESIZE) && - (xevent->xclient.format == 32) && -/* Ignore move and resize with keyboard */ - (xevent->xclient.data.l[2] < 9)) - { - Ecore_X_Event_Window_Move_Resize_Request *e; - - e = calloc(1, sizeof(Ecore_X_Event_Window_Move_Resize_Request)); - if (!e) - return; - - e->win = xevent->xclient.window; - e->x = xevent->xclient.data.l[0]; - e->y = xevent->xclient.data.l[1]; - e->direction = xevent->xclient.data.l[2]; - e->button = xevent->xclient.data.l[3]; - e->source = xevent->xclient.data.l[4]; - ecore_event_add(ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST, e, NULL, NULL); - } - /* Xdnd Client Message Handling Begin */ - /* Message Type: XdndEnter target */ - else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_ENTER) - { - Ecore_X_Event_Xdnd_Enter *e; - Ecore_X_DND_Target *target; - - e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Enter)); - if (!e) return; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - target = _ecore_x_dnd_target_get(); - target->state = ECORE_X_DND_TARGET_ENTERED; - target->source = xevent->xclient.data.l[0]; - target->win = xevent->xclient.window; - target->version = (int)(xevent->xclient.data.l[1] >> 24); - if (target->version > ECORE_X_DND_VERSION) - { - WRN("DND: Requested version %d, we only support up to %d", - target->version, ECORE_X_DND_VERSION); - free(e); - return; - } - - if (xevent->xclient.data.l[1] & 0x1UL) - { - /* source supports more than 3 types, fetch property */ - unsigned char *data; - Ecore_X_Atom *types; - int i, num_ret; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!(ecore_x_window_prop_property_get(target->source, - ECORE_X_ATOM_XDND_TYPE_LIST, - XA_ATOM, - 32, &data, &num_ret))) - { - WRN( - "DND: Could not fetch data type list from source window, aborting."); - free(e); - return; - } - - types = (Ecore_X_Atom *)data; - e->types = calloc(num_ret, sizeof(char *)); - if (e->types) - { - LOGFN(__FILE__, __LINE__, __FUNCTION__); - for (i = 0; i < num_ret; i++) - e->types[i] = XGetAtomName(_ecore_x_disp, types[i]); - } - - e->num_types = num_ret; - } - else - { - int i = 0; - - e->types = calloc(3, sizeof(char *)); - if (e->types) - { - LOGFN(__FILE__, __LINE__, __FUNCTION__); - while ((i < 3) && (xevent->xclient.data.l[i + 2])) - { - e->types[i] = XGetAtomName(_ecore_x_disp, - xevent->xclient.data.l[i + 2]); - i++; - } - } - - e->num_types = i; - } - - e->win = target->win; - e->source = target->source; - ecore_event_add(ECORE_X_EVENT_XDND_ENTER, e, - _ecore_x_event_free_xdnd_enter, NULL); - } - /* Message Type: XdndPosition target */ - else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_POSITION) - { - Ecore_X_Event_Xdnd_Position *e; - Ecore_X_DND_Target *target; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - target = _ecore_x_dnd_target_get(); - if ((target->source != (Ecore_X_Window)xevent->xclient.data.l[0]) || - (target->win != xevent->xclient.window)) - return; - - target->pos.x = xevent->xclient.data.l[2] >> 16; - target->pos.y = xevent->xclient.data.l[2] & 0xFFFFUL; - target->action = xevent->xclient.data.l[4]; /* Version 2 */ - - target->time = (target->version >= 1) ? - (Time)xevent->xclient.data.l[3] : CurrentTime; - - e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Position)); - if (!e) return; - - e->win = target->win; - e->source = target->source; - e->position.x = target->pos.x; - e->position.y = target->pos.y; - e->action = target->action; - ecore_event_add(ECORE_X_EVENT_XDND_POSITION, e, NULL, NULL); - } - /* Message Type: XdndStatus source */ - else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_STATUS) - { - Ecore_X_Event_Xdnd_Status *e; - Ecore_X_DND_Source *source; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - source = _ecore_x_dnd_source_get(); - /* Make sure source/target match */ - if ((source->win != xevent->xclient.window) || - (source->dest != (Window)xevent->xclient.data.l[0])) - return; - - source->await_status = 0; - - source->will_accept = xevent->xclient.data.l[1] & 0x1UL; - source->suppress = (xevent->xclient.data.l[1] & 0x2UL) ? 0 : 1; - - source->rectangle.x = xevent->xclient.data.l[2] >> 16; - source->rectangle.y = xevent->xclient.data.l[2] & 0xFFFFUL; - source->rectangle.width = xevent->xclient.data.l[3] >> 16; - source->rectangle.height = xevent->xclient.data.l[3] & 0xFFFFUL; - - source->accepted_action = xevent->xclient.data.l[4]; - - e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Status)); - if (!e) return; - - e->win = source->win; - e->target = source->dest; - e->will_accept = source->will_accept; - e->rectangle.x = source->rectangle.x; - e->rectangle.y = source->rectangle.y; - e->rectangle.width = source->rectangle.width; - e->rectangle.height = source->rectangle.height; - e->action = source->accepted_action; - - ecore_event_add(ECORE_X_EVENT_XDND_STATUS, e, NULL, NULL); - } - /* Message Type: XdndLeave target */ - /* Pretend the whole thing never happened, sort of */ - else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_LEAVE) - { - Ecore_X_Event_Xdnd_Leave *e; - Ecore_X_DND_Target *target; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - target = _ecore_x_dnd_target_get(); - if ((target->source != (Ecore_X_Window)xevent->xclient.data.l[0]) || - (target->win != xevent->xclient.window)) - return; - - target->state = ECORE_X_DND_TARGET_IDLE; - - e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Leave)); - if (!e) return; - - e->win = xevent->xclient.window; - e->source = (Window)xevent->xclient.data.l[0]; - ecore_event_add(ECORE_X_EVENT_XDND_LEAVE, e, NULL, NULL); - } - /* Message Type: XdndDrop target */ - else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_DROP) - { - Ecore_X_Event_Xdnd_Drop *e; - Ecore_X_DND_Target *target; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - target = _ecore_x_dnd_target_get(); - /* Match source/target */ - if ((target->source != (Window)xevent->xclient.data.l[0]) || - (target->win != xevent->xclient.window)) - return; - - target->time = (target->version >= 1) ? - (Time)xevent->xclient.data.l[2] : _ecore_x_event_last_time; - - e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Drop)); - if (!e) return; - - e->win = target->win; - e->source = target->source; - e->action = target->action; - e->position.x = target->pos.x; - e->position.y = target->pos.y; - ecore_event_add(ECORE_X_EVENT_XDND_DROP, e, NULL, NULL); - } - /* Message Type: XdndFinished source */ - else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_FINISHED) - { - Ecore_X_Event_Xdnd_Finished *e; - Ecore_X_DND_Source *source; - Eina_Bool completed = EINA_TRUE; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - source = _ecore_x_dnd_source_get(); - /* Match source/target */ - if ((source->win != xevent->xclient.window) || - (source->dest != (Window)xevent->xclient.data.l[0])) - return; - - if ((source->version < 5) || (xevent->xclient.data.l[1] & 0x1UL)) - { - LOGFN(__FILE__, __LINE__, __FUNCTION__); - /* Target successfully performed drop action */ - ecore_x_selection_xdnd_clear(); - source->state = ECORE_X_DND_SOURCE_IDLE; - } - else if (source->version >= 5) - { - completed = EINA_FALSE; - source->state = ECORE_X_DND_SOURCE_CONVERTING; - - /* FIXME: Probably need to add a timer to switch back to idle - * and discard the selection data */ - } - - e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Finished)); - if (!e) return; - - e->win = source->win; - e->target = source->dest; - e->completed = completed; - if (source->version >= 5) - { - source->accepted_action = xevent->xclient.data.l[2]; - e->action = source->accepted_action; - } - else - { - source->accepted_action = 0; - e->action = source->action; - } - - ecore_event_add(ECORE_X_EVENT_XDND_FINISHED, e, NULL, NULL); - } - else if (xevent->xclient.message_type == ECORE_X_ATOM_NET_WM_STATE) - { - Ecore_X_Event_Window_State_Request *e; - - e = calloc(1, sizeof(Ecore_X_Event_Window_State_Request)); - if (!e) return; - - e->win = xevent->xclient.window; - if (xevent->xclient.data.l[0] == 0) - e->action = ECORE_X_WINDOW_STATE_ACTION_REMOVE; - else if (xevent->xclient.data.l[0] == 1) - e->action = ECORE_X_WINDOW_STATE_ACTION_ADD; - else if (xevent->xclient.data.l[0] == 2) - e->action = ECORE_X_WINDOW_STATE_ACTION_TOGGLE; - else - { - free(e); - return; - } - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - e->state[0] = _ecore_x_netwm_state_get(xevent->xclient.data.l[1]); - if (e->state[0] == ECORE_X_WINDOW_STATE_UNKNOWN) - { -// char *name; - LOGFN(__FILE__, __LINE__, __FUNCTION__); - -// name = XGetAtomName(_ecore_x_disp, xevent->xclient.data.l[1]); -// if (name) ERR("Unknown state: %s", name); -// XFree(name); - } - e->state[1] = _ecore_x_netwm_state_get(xevent->xclient.data.l[2]); - if (e->state[1] == ECORE_X_WINDOW_STATE_UNKNOWN) - { -// char *name; - LOGFN(__FILE__, __LINE__, __FUNCTION__); - -// name = XGetAtomName(_ecore_x_disp, xevent->xclient.data.l[2]); -// if (name) ERR("Unknown state: %s", name); -// XFree(name); - } - - e->source = xevent->xclient.data.l[3]; - - ecore_event_add(ECORE_X_EVENT_WINDOW_STATE_REQUEST, e, NULL, NULL); - } - else if ((xevent->xclient.message_type == ECORE_X_ATOM_WM_CHANGE_STATE) - && (xevent->xclient.format == 32) - && (xevent->xclient.data.l[0] == IconicState)) - { - Ecore_X_Event_Window_State_Request *e; - - e = calloc(1, sizeof(Ecore_X_Event_Window_State_Request)); - if (!e) - return; - - e->win = xevent->xclient.window; - e->action = ECORE_X_WINDOW_STATE_ACTION_ADD; - e->state[0] = ECORE_X_WINDOW_STATE_ICONIFIED; - - ecore_event_add(ECORE_X_EVENT_WINDOW_STATE_REQUEST, e, NULL, NULL); - } - else if ((xevent->xclient.message_type == ECORE_X_ATOM_NET_WM_DESKTOP) - && (xevent->xclient.format == 32)) - { - Ecore_X_Event_Desktop_Change *e; - - e = calloc(1, sizeof(Ecore_X_Event_Desktop_Change)); - if (!e) - return; - - e->win = xevent->xclient.window; - e->desk = xevent->xclient.data.l[0]; - e->source = xevent->xclient.data.l[1]; - - ecore_event_add(ECORE_X_EVENT_DESKTOP_CHANGE, e, NULL, NULL); - } - else if ((xevent->xclient.message_type == - ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS)) - { - Ecore_X_Event_Frame_Extents_Request *e; - - e = calloc(1, sizeof(Ecore_X_Event_Frame_Extents_Request)); - if (!e) - return; - - e->win = xevent->xclient.window; - - ecore_event_add(ECORE_X_EVENT_FRAME_EXTENTS_REQUEST, e, NULL, NULL); - } - else if ((xevent->xclient.message_type == ECORE_X_ATOM_WM_PROTOCOLS) - && ((Ecore_X_Atom)xevent->xclient.data.l[0] == - ECORE_X_ATOM_NET_WM_PING) - && (xevent->xclient.format == 32)) - { - Ecore_X_Event_Ping *e; - Ecore_X_Window root = 0; - - e = calloc(1, sizeof(Ecore_X_Event_Ping)); - if (!e) - return; - - e->win = xevent->xclient.window; - e->time = xevent->xclient.data.l[1]; - e->event_win = xevent->xclient.data.l[2]; - - /* send a reply anyway - we are alive... eventloop at least */ - ecore_event_add(ECORE_X_EVENT_PING, e, NULL, NULL); - if (ScreenCount(_ecore_x_disp) > 1) - { - LOGFN(__FILE__, __LINE__, __FUNCTION__); - root = ecore_x_window_root_get(e->win); - } - else - root = DefaultRootWindow(_ecore_x_disp); - - if (xevent->xclient.window != root) - { - xevent->xclient.window = root; - XSendEvent(_ecore_x_disp, root, False, - SubstructureRedirectMask | SubstructureNotifyMask, - xevent); - } - } - else if ((xevent->xclient.message_type == - ECORE_X_ATOM_NET_STARTUP_INFO_BEGIN) && - (xevent->xclient.format == 8)) - _ecore_x_netwm_startup_info_begin(xevent->xclient.window, - xevent->xclient.data.b); - else if ((xevent->xclient.message_type == ECORE_X_ATOM_NET_STARTUP_INFO) && - (xevent->xclient.format == 8)) - _ecore_x_netwm_startup_info(xevent->xclient.window, - xevent->xclient.data.b); - else if ((xevent->xclient.message_type == 27777) - && (xevent->xclient.data.l[0] == 0x7162534) - && (xevent->xclient.format == 32) - && (xevent->xclient.window == _ecore_x_private_win)) - { - /* a grab sync marker */ - if (xevent->xclient.data.l[1] == 0x10000001) - _ecore_x_window_grab_remove(xevent->xclient.data.l[2]); - else if (xevent->xclient.data.l[1] == 0x10000002) - _ecore_x_key_grab_remove(xevent->xclient.data.l[2]); - } - else - { - Ecore_X_Event_Client_Message *e; - int i; - - e = calloc(1, sizeof(Ecore_X_Event_Client_Message)); - if (!e) - return; - - e->win = xevent->xclient.window; - e->message_type = xevent->xclient.message_type; - e->format = xevent->xclient.format; - for (i = 0; i < 5; i++) - e->data.l[i] = xevent->xclient.data.l[i]; - - ecore_event_add(ECORE_X_EVENT_CLIENT_MESSAGE, e, NULL, NULL); - } -} - -void -_ecore_x_event_handle_mapping_notify(XEvent *xevent) -{ - Ecore_X_Event_Mapping_Change *e; - - _ecore_x_last_event_mouse_move = 0; - XRefreshKeyboardMapping((XMappingEvent *)xevent); - _ecore_x_modifiers_get(); - e = calloc(1, sizeof(Ecore_X_Event_Mapping_Change)); - if (!e) return; - switch (xevent->xmapping.request) - { - case MappingModifier: - e->type = ECORE_X_MAPPING_MODIFIER; - break; - - case MappingKeyboard: - e->type = ECORE_X_MAPPING_KEYBOARD; - break; - - case MappingPointer: - default: - e->type = ECORE_X_MAPPING_MOUSE; - break; - } - e->keycode = xevent->xmapping.first_keycode; - e->num = xevent->xmapping.count; - ecore_event_add(ECORE_X_EVENT_MAPPING_CHANGE, e, NULL, NULL); -} - -void -_ecore_x_event_handle_shape_change(XEvent *xevent) -{ - XShapeEvent *shape_event; - Ecore_X_Event_Window_Shape *e; - - _ecore_x_last_event_mouse_move = 0; - shape_event = (XShapeEvent *)xevent; - e = calloc(1, sizeof(Ecore_X_Event_Window_Shape)); - if (!e) - return; - - e->win = shape_event->window; - e->time = shape_event->time; - switch (shape_event->kind) - { - case ShapeBounding: - e->type = ECORE_X_SHAPE_BOUNDING; - break; - - case ShapeClip: - e->type = ECORE_X_SHAPE_CLIP; - break; - - case ShapeInput: - e->type = ECORE_X_SHAPE_INPUT; - break; - - default: - break; - } - e->x = shape_event->x; - e->y = shape_event->y; - e->w = shape_event->width; - e->h = shape_event->height; - e->shaped = shape_event->shaped; - ecore_event_add(ECORE_X_EVENT_WINDOW_SHAPE, e, NULL, NULL); -} - -void -_ecore_x_event_handle_screensaver_notify(XEvent *xevent) -{ -#ifdef ECORE_XSS - XScreenSaverNotifyEvent *screensaver_event; - Ecore_X_Event_Screensaver_Notify *e; - - _ecore_x_last_event_mouse_move = 0; - screensaver_event = (XScreenSaverNotifyEvent *)xevent; - e = calloc(1, sizeof(Ecore_X_Event_Screensaver_Notify)); - if (!e) - return; - - e->win = screensaver_event->window; - if (screensaver_event->state == ScreenSaverOn) - e->on = EINA_TRUE; - else - e->on = EINA_FALSE; - - e->time = screensaver_event->time; - ecore_event_add(ECORE_X_EVENT_SCREENSAVER_NOTIFY, e, NULL, NULL); -#else /* ifdef ECORE_XSS */ - xevent = NULL; -#endif /* ifdef ECORE_XSS */ -} - -void -_ecore_x_event_handle_sync_counter(XEvent *xevent) -{ - XSyncCounterNotifyEvent *sync_counter_event; - Ecore_X_Event_Sync_Counter *e; - - _ecore_x_last_event_mouse_move = 0; - sync_counter_event = (XSyncCounterNotifyEvent *)xevent; - e = calloc(1, sizeof(Ecore_X_Event_Sync_Counter)); - if (!e) - return; - - e->time = sync_counter_event->time; - ecore_event_add(ECORE_X_EVENT_SYNC_COUNTER, e, NULL, NULL); -} - -void -_ecore_x_event_handle_sync_alarm(XEvent *xevent) -{ - XSyncAlarmNotifyEvent *sync_alarm_event; - Ecore_X_Event_Sync_Alarm *e; - - _ecore_x_last_event_mouse_move = 0; - sync_alarm_event = (XSyncAlarmNotifyEvent *)xevent; - - e = calloc(1, sizeof(Ecore_X_Event_Sync_Alarm)); - if (!e) - return; - - e->time = sync_alarm_event->time; - e->alarm = sync_alarm_event->alarm; - ecore_event_add(ECORE_X_EVENT_SYNC_ALARM, e, NULL, NULL); -} - -#ifdef ECORE_XRANDR -void -_ecore_x_event_handle_randr_change(XEvent *xevent) -{ - XRRScreenChangeNotifyEvent *randr_event; - Ecore_X_Event_Screen_Change *e; - - _ecore_x_last_event_mouse_move = 0; - randr_event = (XRRScreenChangeNotifyEvent *)xevent; - if (!XRRUpdateConfiguration(xevent)) - ERR("Can't update RR config!"); - - e = calloc(1, sizeof(Ecore_X_Event_Screen_Change)); - if (!e) - return; - - e->win = randr_event->window; - e->root = randr_event->root; - e->size.width = randr_event->width; - e->size.height = randr_event->height; - e->time = randr_event->timestamp; - e->config_time = randr_event->config_timestamp; - e->size.width_mm = randr_event->mwidth; - e->size.height_mm = randr_event->mheight; - e->orientation = randr_event->rotation; - e->subpixel_order = randr_event->subpixel_order; - ecore_event_add(ECORE_X_EVENT_SCREEN_CHANGE, e, NULL, NULL); -} - -static void -_ecore_x_event_handle_randr_notify_crtc_change(const XRRNotifyEvent *xevent) -{ - const XRRCrtcChangeNotifyEvent *randr_event; - Ecore_X_Event_Randr_Crtc_Change *e; - - randr_event = (const XRRCrtcChangeNotifyEvent *)xevent; - - e = calloc(1, sizeof(Ecore_X_Event_Randr_Crtc_Change)); - if (!e) - return; - - e->win = randr_event->window; - e->crtc = randr_event->crtc; - e->mode = randr_event->mode; - e->orientation = randr_event->rotation; - e->geo.x = randr_event->x; - e->geo.y = randr_event->y; - e->geo.w = randr_event->width; - e->geo.h = randr_event->height; - ecore_event_add(ECORE_X_EVENT_RANDR_CRTC_CHANGE, e, NULL, NULL); -} - -static void -_ecore_x_event_handle_randr_notify_output_change(const XRRNotifyEvent *xevent) -{ - const XRROutputChangeNotifyEvent *randr_event; - Ecore_X_Event_Randr_Output_Change *e; - - randr_event = (const XRROutputChangeNotifyEvent *)xevent; - - e = calloc(1, sizeof(Ecore_X_Event_Randr_Output_Change)); - if (!e) - return; - - e->win = randr_event->window; - e->output = randr_event->output; - e->crtc = randr_event->crtc; - e->mode = randr_event->mode; - e->orientation = randr_event->rotation; - e->connection = randr_event->connection; - e->subpixel_order = randr_event->subpixel_order; - ecore_event_add(ECORE_X_EVENT_RANDR_OUTPUT_CHANGE, e, NULL, NULL); -} - -static void -_ecore_x_event_handle_randr_notify_output_property(const XRRNotifyEvent *xevent) -{ - const XRROutputPropertyNotifyEvent *randr_event; - Ecore_X_Event_Randr_Output_Property_Notify *e; - - randr_event = (const XRROutputPropertyNotifyEvent *)xevent; - - e = calloc(1, sizeof(Ecore_X_Event_Randr_Output_Property_Notify)); - if (!e) - return; - - e->win = randr_event->window; - e->output = randr_event->output; - e->property = randr_event->property; - e->time = randr_event->timestamp; - if (randr_event->state == PropertyNewValue) - e->state = ECORE_X_RANDR_PROPERTY_CHANGE_ADD; - else - e->state = ECORE_X_RANDR_PROPERTY_CHANGE_DEL; - ecore_event_add(ECORE_X_EVENT_RANDR_OUTPUT_PROPERTY_NOTIFY, e, NULL, NULL); -} - -void -_ecore_x_event_handle_randr_notify(XEvent *xevent) -{ - const XRRNotifyEvent *randr_event; - - _ecore_x_last_event_mouse_move = 0; - randr_event = (const XRRNotifyEvent *)xevent; - LOGFN(__FILE__, __LINE__, __FUNCTION__); - switch (randr_event->subtype) - { - case RRNotify_CrtcChange: - _ecore_x_event_handle_randr_notify_crtc_change(randr_event); - break; - - case RRNotify_OutputChange: - _ecore_x_event_handle_randr_notify_output_change(randr_event); - break; - - case RRNotify_OutputProperty: - _ecore_x_event_handle_randr_notify_output_property(randr_event); - break; - - default: - ERR("Unknown XRandR RRNotify subtype: %d.", - randr_event->subtype); - break; - } -} - -#endif /* ifdef ECORE_XRANDR */ - -#ifdef ECORE_XFIXES -void -_ecore_x_event_handle_fixes_selection_notify(XEvent *event) -{ - XFixesSelectionNotifyEvent *notify_event = - (XFixesSelectionNotifyEvent *)event; - Ecore_X_Event_Fixes_Selection_Notify *e; - Ecore_X_Atom sel; - - _ecore_x_last_event_mouse_move = 0; - /* Nothing here yet */ - - e = calloc(1, sizeof(*e)); - if (!e) - return; - - e->win = notify_event->window; - e->owner = notify_event->owner; - e->time = notify_event->timestamp; - e->selection_time = notify_event->selection_timestamp; - e->atom = sel = notify_event->selection; - if (sel == ECORE_X_ATOM_SELECTION_PRIMARY) - e->selection = ECORE_X_SELECTION_PRIMARY; - else if (sel == ECORE_X_ATOM_SELECTION_SECONDARY) - e->selection = ECORE_X_SELECTION_SECONDARY; - else if (sel == ECORE_X_ATOM_SELECTION_CLIPBOARD) - e->selection = ECORE_X_SELECTION_CLIPBOARD; - else - e->selection = ECORE_X_SELECTION_OTHER; - e->reason = notify_event->subtype; - - ecore_event_add(ECORE_X_EVENT_FIXES_SELECTION_NOTIFY, e, NULL, NULL); -} - -#endif /* ifdef ECORE_XFIXES */ - -#ifdef ECORE_XDAMAGE -void -_ecore_x_event_handle_damage_notify(XEvent *event) -{ - XDamageNotifyEvent *damage_event; - Ecore_X_Event_Damage *e; - - _ecore_x_last_event_mouse_move = 0; - damage_event = (XDamageNotifyEvent *)event; - - e = calloc(1, sizeof(Ecore_X_Event_Damage)); - if (!e) - return; - - e->level = damage_event->level; - e->drawable = damage_event->drawable; - e->damage = damage_event->damage; - e->more = damage_event->more; - e->time = damage_event->timestamp; - e->area.x = damage_event->area.x; - e->area.y = damage_event->area.y; - e->area.width = damage_event->area.width; - e->area.height = damage_event->area.height; - e->geometry.x = damage_event->geometry.x; - e->geometry.y = damage_event->geometry.y; - e->geometry.width = damage_event->geometry.width; - e->geometry.height = damage_event->geometry.height; - - ecore_event_add(ECORE_X_EVENT_DAMAGE_NOTIFY, e, NULL, NULL); -} - -#endif /* ifdef ECORE_XDAMAGE */ - -static void -_ecore_x_event_free_generic_event(void *data, - void *ev) -{ -#ifdef ECORE_XI2 - Ecore_X_Event_Generic *e = (Ecore_X_Event_Generic *)ev; - - if (data) - { - if (e->data) - XFreeEventData(_ecore_x_disp, (XGenericEventCookie *)data); - free(data); - } - free(e); -#else - return; - data = NULL; ev = NULL; -#endif /* ifdef ECORE_XI2 */ -} - -void -_ecore_x_event_handle_generic_event(XEvent *event) -{ -#ifdef ECORE_XI2 - XGenericEvent *generic_event; - Ecore_X_Event_Generic *e; - XGenericEventCookie *data; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - generic_event = (XGenericEvent *)event; - - e = calloc(1, sizeof(Ecore_X_Event_Generic)); - if (!e) - return; - - if (XGetEventData(_ecore_x_disp, &(event->xcookie))) - { - e->cookie = event->xcookie.cookie; - e->data = event->xcookie.data; - } - else - { - e->cookie = 0; - e->data = NULL; - } - - e->extension = generic_event->extension; - e->evtype = generic_event->evtype; - - if (e->extension == _ecore_x_xi2_opcode) - _ecore_x_input_handler(event); - - data = malloc(sizeof(XGenericEventCookie)); - if (data) memcpy(data, &(event->xcookie), sizeof(XGenericEventCookie)); - ecore_event_add(ECORE_X_EVENT_GENERIC, - e, - _ecore_x_event_free_generic_event, - data); -#else - return; - event = NULL; -#endif /* ifdef ECORE_XI2 */ -} - -#ifdef ECORE_XGESTURE -void -_ecore_x_event_handle_gesture_notify_flick(XEvent *xevent) -{ - XGestureNotifyFlickEvent *xfe; - Ecore_X_Event_Gesture_Notify_Flick *e; - - _ecore_x_last_event_mouse_move = 0; - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - xfe = (XGestureNotifyFlickEvent *)xevent; - e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Flick)); - if (!e) - return; - - e->win = xfe->window; - e->time = xfe->time; - e->subtype = xfe->kind; - e->num_fingers = xfe->num_finger; - e->distance = xfe->distance; - e->duration = xfe->duration; - e->direction = xfe->direction; - e->angle = XFixedToDouble(xfe->angle); - - ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_FLICK, e, NULL, NULL); -} - -void -_ecore_x_event_handle_gesture_notify_pan(XEvent *xevent) -{ - XGestureNotifyPanEvent *xpe; - Ecore_X_Event_Gesture_Notify_Pan *e; - - _ecore_x_last_event_mouse_move = 0; - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - xpe = (XGestureNotifyPanEvent *)xevent; - e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Pan)); - if (!e) - return; - - e->win = xpe->window; - e->time = xpe->time; - e->subtype = xpe->kind; - e->num_fingers = xpe->num_finger; - e->dx = xpe->dx; - e->dy = xpe->dy; - e->distance = xpe->distance; - e->duration = xpe->duration; - e->direction = xpe->direction; - - ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_PAN, e, NULL, NULL); -} - -void -_ecore_x_event_handle_gesture_notify_pinchrotation(XEvent *xevent) -{ - XGestureNotifyPinchRotationEvent *xpre; - Ecore_X_Event_Gesture_Notify_PinchRotation *e; - - _ecore_x_last_event_mouse_move = 0; - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - xpre = (XGestureNotifyPinchRotationEvent *)xevent; - e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_PinchRotation)); - if (!e) - return; - - e->win = xpre->window; - e->time = xpre->time; - e->subtype = xpre->kind; - e->num_fingers = xpre->num_finger; - e->distance = xpre->distance; - e->cx = xpre->cx; - e->cy = xpre->cy; - e->zoom = XFixedToDouble(xpre->zoom); - e->angle = XFixedToDouble(xpre->angle); - - ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_PINCHROTATION, e, NULL, NULL); -} - -void -_ecore_x_event_handle_gesture_notify_tap(XEvent *xevent) -{ - XGestureNotifyTapEvent *xte; - Ecore_X_Event_Gesture_Notify_Tap *e; - - _ecore_x_last_event_mouse_move = 0; - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - xte = (XGestureNotifyTapEvent *)xevent; - e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Tap)); - if (!e) - return; - - e->win = xte->window; - e->time = xte->time; - e->subtype = xte->kind; - e->num_fingers = xte->num_finger; - e->cx = xte->cx; - e->cy = xte->cy; - e->tap_repeat = xte->tap_repeat; - e->interval = xte->interval; - - ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_TAP, e, NULL, NULL); -} - -void -_ecore_x_event_handle_gesture_notify_tapnhold(XEvent *xevent) -{ - XGestureNotifyTapNHoldEvent *xthe; - Ecore_X_Event_Gesture_Notify_TapNHold *e; - - _ecore_x_last_event_mouse_move = 0; - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - xthe = (XGestureNotifyTapNHoldEvent *)xevent; - e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_TapNHold)); - if (!e) - return; - - e->win = xthe->window; - e->time = xthe->time; - e->subtype = xthe->kind; - e->num_fingers = xthe->num_finger; - e->cx = xthe->cx; - e->cy = xthe->cy; - e->interval = xthe->interval; - e->hold_time = xthe->holdtime; - - ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_TAPNHOLD, e, NULL, NULL); -} - -void -_ecore_x_event_handle_gesture_notify_hold(XEvent *xevent) -{ - XGestureNotifyHoldEvent *xhe; - Ecore_X_Event_Gesture_Notify_Hold *e; - - _ecore_x_last_event_mouse_move = 0; - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - xhe = (XGestureNotifyHoldEvent *)xevent; - e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Hold)); - if (!e) - return; - - e->win = xhe->window; - e->time = xhe->time; - e->subtype = xhe->kind; - e->num_fingers = xhe->num_finger; - e->cx = xhe->cx; - e->cy = xhe->cy; - e->hold_time = xhe->holdtime; - - ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_HOLD, e, NULL, NULL); -} - -void -_ecore_x_event_handle_gesture_notify_group(XEvent *xevent) -{ - XGestureNotifyGroupEvent *xge; - Ecore_X_Event_Gesture_Notify_Group *e; - - _ecore_x_last_event_mouse_move = 0; - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - xge = (XGestureNotifyGroupEvent *)xevent; - e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Group)); - if (!e) - return; - - e->win = xge->window; - e->time = xge->time; - e->subtype = xge->kind; - e->num_groups = xge->num_group; - e->group_id = xge->groupid; - - ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_GROUP, e, NULL, NULL); -} - -#endif /* ifdef ECORE_XGESTURE */ - diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_fixes.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_fixes.c deleted file mode 100644 index da0a6c3..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_fixes.c +++ /dev/null @@ -1,365 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include -#endif /* ifdef HAVE_CONFIG_H */ - -#include - -#include "ecore_x_private.h" -#include "Ecore_X.h" - -static int _fixes_available; -#ifdef ECORE_XFIXES -static int _fixes_major, _fixes_minor; -#endif /* ifdef ECORE_XFIXES */ - -void -_ecore_x_fixes_init(void) -{ -#ifdef ECORE_XFIXES - _fixes_major = 3; - _fixes_minor = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (XFixesQueryVersion(_ecore_x_disp, &_fixes_major, &_fixes_minor)) - { - _fixes_available = 1; - - ECORE_X_EVENT_FIXES_SELECTION_NOTIFY = ecore_event_type_new(); - } - else - _fixes_available = 0; - -#else /* ifdef ECORE_XFIXES */ - _fixes_available = 0; -#endif /* ifdef ECORE_XFIXES */ -} - -#ifdef ECORE_XFIXES -/* I don't know what to call this function. */ -static XRectangle * -_ecore_x_rectangle_ecore_to_x(Ecore_X_Rectangle *rects, - int num) -{ - XRectangle *xrect; - int i; - - if (num == 0) - return NULL; - - xrect = malloc(sizeof(XRectangle) * num); - if (!xrect) - return NULL; - - for (i = 0; i < num; i++) - { - xrect[i].x = rects[i].x; - xrect[i].y = rects[i].y; - xrect[i].width = rects[i].width; - xrect[i].height = rects[i].height; - } - return xrect; -} - -static Ecore_X_Rectangle * -_ecore_x_rectangle_x_to_ecore(XRectangle *xrect, - int num) -{ - Ecore_X_Rectangle *rects; - int i; - - if (num == 0) - return NULL; - - rects = malloc(sizeof(Ecore_X_Rectangle) * num); - if (!rects) - return NULL; - - for (i = 0; i < num; i++) - { - rects[i].x = xrect[i].x; - rects[i].y = xrect[i].y; - rects[i].width = xrect[i].width; - rects[i].height = xrect[i].height; - } - return rects; -} - -#endif /* ifdef ECORE_XFIXES */ - -EAPI Eina_Bool -ecore_x_fixes_selection_notification_request(Ecore_X_Atom selection) -{ -#ifdef ECORE_XFIXES - if (_fixes_available) - { - XFixesSelectSelectionInput (_ecore_x_disp, - DefaultRootWindow(_ecore_x_disp), - selection, - XFixesSetSelectionOwnerNotifyMask | - XFixesSelectionWindowDestroyNotifyMask | - XFixesSelectionClientCloseNotifyMask); - return EINA_TRUE; - } -#endif - return EINA_FALSE; -} - -EAPI Ecore_X_Region -ecore_x_region_new(Ecore_X_Rectangle *rects, - int num) -{ -#ifdef ECORE_XFIXES - Ecore_X_Region region; - XRectangle *xrect; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - xrect = _ecore_x_rectangle_ecore_to_x(rects, num); - region = XFixesCreateRegion(_ecore_x_disp, xrect, num); - free(xrect); - return region; -#else /* ifdef ECORE_XFIXES */ - return 0; -#endif /* ifdef ECORE_XFIXES */ -} - -EAPI Ecore_X_Region -ecore_x_region_new_from_bitmap(Ecore_X_Pixmap bitmap) -{ -#ifdef ECORE_XFIXES - Ecore_X_Region region; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - region = XFixesCreateRegionFromBitmap(_ecore_x_disp, bitmap); - return region; -#else /* ifdef ECORE_XFIXES */ - return 0; -#endif /* ifdef ECORE_XFIXES */ -} - -EAPI Ecore_X_Region -ecore_x_region_new_from_window(Ecore_X_Window win, - Ecore_X_Region_Type type) -{ -#ifdef ECORE_XFIXES - Ecore_X_Region region; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - region = XFixesCreateRegionFromWindow(_ecore_x_disp, win, type); - return region; -#else /* ifdef ECORE_XFIXES */ - return 0; -#endif /* ifdef ECORE_XFIXES */ -} - -EAPI Ecore_X_Region -ecore_x_region_new_from_gc(Ecore_X_GC gc) -{ -#ifdef ECORE_XFIXES - Ecore_X_Region region; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - region = XFixesCreateRegionFromGC(_ecore_x_disp, gc); - return region; -#else /* ifdef ECORE_XFIXES */ - return 0; -#endif /* ifdef ECORE_XFIXES */ -} - -EAPI Ecore_X_Region -ecore_x_region_new_from_picture(Ecore_X_Picture picture) -{ -#ifdef ECORE_XFIXES - Ecore_X_Region region; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - region = XFixesCreateRegionFromPicture(_ecore_x_disp, picture); - return region; -#else /* ifdef ECORE_XFIXES */ - return 0; -#endif /* ifdef ECORE_XFIXES */ -} - -EAPI void -ecore_x_region_free(Ecore_X_Region region) -{ -#ifdef ECORE_XFIXES - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XFixesDestroyRegion(_ecore_x_disp, region); -#endif /* ifdef ECORE_XFIXES */ -} - -EAPI void -ecore_x_region_set(Ecore_X_Region region, - Ecore_X_Rectangle *rects, - int num) -{ -#ifdef ECORE_XFIXES - XRectangle *xrect = _ecore_x_rectangle_ecore_to_x(rects, num); - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XFixesSetRegion(_ecore_x_disp, region, xrect, num); -#endif /* ifdef ECORE_XFIXES */ -} - -EAPI void -ecore_x_region_copy(Ecore_X_Region dest, - Ecore_X_Region source) -{ -#ifdef ECORE_XFIXES - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XFixesCopyRegion(_ecore_x_disp, dest, source); -#endif /* ifdef ECORE_XFIXES */ -} - -EAPI void -ecore_x_region_combine(Ecore_X_Region dest, - Ecore_X_Region source1, - Ecore_X_Region source2) -{ -#ifdef ECORE_XFIXES - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XFixesUnionRegion(_ecore_x_disp, dest, source1, source2); -#endif /* ifdef ECORE_XFIXES */ -} - -EAPI void -ecore_x_region_intersect(Ecore_X_Region dest, - Ecore_X_Region source1, - Ecore_X_Region source2) -{ -#ifdef ECORE_XFIXES - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XFixesIntersectRegion(_ecore_x_disp, dest, source1, source2); -#endif /* ifdef ECORE_XFIXES */ -} - -EAPI void -ecore_x_region_subtract(Ecore_X_Region dest, - Ecore_X_Region source1, - Ecore_X_Region source2) -{ -#ifdef ECORE_XFIXES - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XFixesSubtractRegion(_ecore_x_disp, dest, source1, source2); -#endif /* ifdef ECORE_XFIXES */ -} - -EAPI void -ecore_x_region_invert(Ecore_X_Region dest, - Ecore_X_Rectangle *bounds, - Ecore_X_Region source) -{ -#ifdef ECORE_XFIXES - XRectangle *xbound; - int num = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - while (bounds + num) - num++; - xbound = _ecore_x_rectangle_ecore_to_x(bounds, num); - - XFixesInvertRegion(_ecore_x_disp, dest, xbound, source); -#endif /* ifdef ECORE_XFIXES */ -} - -EAPI void -ecore_x_region_translate(Ecore_X_Region region, - int dx, - int dy) -{ -#ifdef ECORE_XFIXES - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XFixesTranslateRegion(_ecore_x_disp, region, dx, dy); -#endif /* ifdef ECORE_XFIXES */ -} - -EAPI void -ecore_x_region_extents(Ecore_X_Region dest, - Ecore_X_Region source) -{ -#ifdef ECORE_XFIXES - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XFixesRegionExtents(_ecore_x_disp, dest, source); -#endif /* ifdef ECORE_XFIXES */ -} - -EAPI Ecore_X_Rectangle * -ecore_x_region_fetch(Ecore_X_Region region, - int *num, - Ecore_X_Rectangle *bounds){ -#ifdef ECORE_XFIXES - Ecore_X_Rectangle *rects; - XRectangle *xrect, xbound; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - xrect = XFixesFetchRegionAndBounds(_ecore_x_disp, region, num, &xbound); - rects = _ecore_x_rectangle_x_to_ecore(xrect, *num); - (*bounds).x = xbound.x; - (*bounds).y = xbound.y; - (*bounds).width = xbound.width; - (*bounds).height = xbound.height; - return rects; -#else /* ifdef ECORE_XFIXES */ - return NULL; -#endif /* ifdef ECORE_XFIXES */ -} - -EAPI void -ecore_x_region_expand(Ecore_X_Region dest, - Ecore_X_Region source, - unsigned int left, - unsigned int right, - unsigned int top, - unsigned int bottom) -{ -#ifdef ECORE_XFIXES - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XFixesExpandRegion(_ecore_x_disp, dest, source, left, right, top, bottom); -#endif /* ifdef ECORE_XFIXES */ -} - -EAPI void -ecore_x_region_gc_clip_set(Ecore_X_Region region, - Ecore_X_GC gc, - int x_origin, - int y_origin) -{ -#ifdef ECORE_XFIXES - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XFixesSetGCClipRegion(_ecore_x_disp, gc, x_origin, y_origin, region); -#endif /* ifdef ECORE_XFIXES */ -} - -EAPI void -ecore_x_region_window_shape_set(Ecore_X_Region region, - Ecore_X_Window win, - Ecore_X_Shape_Type type, - int x_offset, - int y_offset) -{ -#ifdef ECORE_XFIXES - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XFixesSetWindowShapeRegion(_ecore_x_disp, - win, - type, - x_offset, - y_offset, - region); -#endif /* ifdef ECORE_XFIXES */ -} - -EAPI void -ecore_x_region_picture_clip_set(Ecore_X_Region region, - Ecore_X_Picture picture, - int x_origin, - int y_origin) -{ -#ifdef ECORE_XFIXES - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XFixesSetPictureClipRegion(_ecore_x_disp, - picture, - x_origin, - y_origin, - region); -#endif /* ifdef ECORE_XFIXES */ -} - diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_gc.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_gc.c deleted file mode 100644 index 5396366..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_gc.c +++ /dev/null @@ -1,171 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include -#endif /* ifdef HAVE_CONFIG_H */ - -#include - -#include "Ecore.h" -#include "ecore_x_private.h" -#include "Ecore_X.h" - -/** - * Creates a new default graphics context associated with the given - * drawable. - * @param draw Drawable to create graphics context with. If @c 0 is - * given instead, the default root window is used. - * @param value_mask Bitmask values. - * @param value_list List of values. The order of values must be the - * same than the corresponding bitmaks. - * @return The new default graphics context. - */ -EAPI Ecore_X_GC -ecore_x_gc_new(Ecore_X_Drawable draw, - Ecore_X_GC_Value_Mask value_mask, - const unsigned int *value_list) -{ - XGCValues gcv; - int mask; - int idx; - int i; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!draw) - draw = DefaultRootWindow(_ecore_x_disp); - - memset(&gcv, 0, sizeof (gcv)); - - for (i = 0, idx = 0, mask = 1; i <= 22; i++, mask <<= 1) - { - switch (mask & value_mask) - { - case ECORE_X_GC_VALUE_MASK_FUNCTION: - gcv.function = value_list[idx]; - idx++; - break; - - case ECORE_X_GC_VALUE_MASK_PLANE_MASK: - gcv.plane_mask = value_list[idx]; - idx++; - break; - - case ECORE_X_GC_VALUE_MASK_FOREGROUND: - gcv.foreground = value_list[idx]; - idx++; - break; - - case ECORE_X_GC_VALUE_MASK_BACKGROUND: - gcv.background = value_list[idx]; - idx++; - break; - - case ECORE_X_GC_VALUE_MASK_LINE_WIDTH: - gcv.line_width = value_list[idx]; - idx++; - break; - - case ECORE_X_GC_VALUE_MASK_LINE_STYLE: - gcv.line_style = value_list[idx]; - idx++; - break; - - case ECORE_X_GC_VALUE_MASK_CAP_STYLE: - gcv.cap_style = value_list[idx]; - idx++; - break; - - case ECORE_X_GC_VALUE_MASK_JOIN_STYLE: - gcv.join_style = value_list[idx]; - idx++; - break; - - case ECORE_X_GC_VALUE_MASK_FILL_STYLE: - gcv.fill_style = value_list[idx]; - idx++; - break; - - case ECORE_X_GC_VALUE_MASK_FILL_RULE: - gcv.fill_rule = value_list[idx]; - idx++; - break; - - case ECORE_X_GC_VALUE_MASK_TILE: - gcv.tile = value_list[idx]; - idx++; - break; - - case ECORE_X_GC_VALUE_MASK_STIPPLE: - gcv.stipple = value_list[idx]; - idx++; - break; - - case ECORE_X_GC_VALUE_MASK_TILE_STIPPLE_ORIGIN_X: - gcv.ts_x_origin = value_list[idx]; - idx++; - break; - - case ECORE_X_GC_VALUE_MASK_TILE_STIPPLE_ORIGIN_Y: - gcv.ts_y_origin = value_list[idx]; - idx++; - break; - - case ECORE_X_GC_VALUE_MASK_FONT: - gcv.font = value_list[idx]; - idx++; - break; - - case ECORE_X_GC_VALUE_MASK_SUBWINDOW_MODE: - gcv.subwindow_mode = value_list[idx]; - idx++; - break; - - case ECORE_X_GC_VALUE_MASK_GRAPHICS_EXPOSURES: - gcv.graphics_exposures = value_list[idx]; - idx++; - break; - - case ECORE_X_GC_VALUE_MASK_CLIP_ORIGIN_X: - gcv.clip_x_origin = value_list[idx]; - idx++; - break; - - case ECORE_X_GC_VALUE_MASK_CLIP_ORIGIN_Y: - gcv.clip_y_origin = value_list[idx]; - idx++; - break; - - case ECORE_X_GC_VALUE_MASK_CLIP_MASK: - gcv.clip_mask = value_list[idx]; - idx++; - break; - - case ECORE_X_GC_VALUE_MASK_DASH_OFFSET: - gcv.dash_offset = value_list[idx]; - idx++; - break; - - case ECORE_X_GC_VALUE_MASK_DASH_LIST: - gcv.dashes = value_list[idx]; - idx++; - break; - - case ECORE_X_GC_VALUE_MASK_ARC_MODE: - gcv.arc_mode = value_list[idx]; - idx++; - break; - } - } - - return XCreateGC(_ecore_x_disp, draw, value_mask, &gcv); -} - -/** - * Deletes and frees the given graphics context. - * @param gc The given graphics context. - */ -EAPI void -ecore_x_gc_free(Ecore_X_GC gc) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XFreeGC(_ecore_x_disp, gc); -} - diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_gesture.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_gesture.c deleted file mode 100644 index e89421b..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_gesture.c +++ /dev/null @@ -1,136 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include -#endif /* ifdef HAVE_CONFIG_H */ - -#include "ecore_x_private.h" - -static Eina_Bool _gesture_available = EINA_FALSE; - -#ifdef ECORE_XGESTURE -static int _gesture_major, _gesture_minor, _gesture_patch; -int _gesture_version; -#endif /* ifdef ECORE_XGESTURE */ - -void -_ecore_x_gesture_init(void) -{ -#ifdef ECORE_XGESTURE - _gesture_major = 0; - _gesture_minor = 0; - _gesture_patch = 0; - _gesture_version = 0; - - if (XGestureQueryVersion(_ecore_x_disp, &_gesture_major, &_gesture_minor, &_gesture_patch)) - { - _gesture_version = (_gesture_major << 16) | _gesture_minor; - _gesture_available = EINA_TRUE; - } - else - _gesture_available = EINA_FALSE; -#else /* ifdef ECORE_XGESTURE */ - _gesture_available = EINA_FALSE; -#endif /* ifdef ECORE_XGESTURE */ -} - -/* - * @brief query whether gesture is available or not - * @return EINA_TRUE, if extension is available, else EINA_FALSE - */ -EAPI Eina_Bool -ecore_x_gesture_supported(void) -{ - return _gesture_available; -} - -EAPI Eina_Bool -ecore_x_gesture_events_select(Ecore_X_Window win, - Ecore_X_Gesture_Event_Mask mask) -{ -#ifdef ECORE_XGESTURE - if (!_gesture_available) - return EINA_FALSE; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XGestureSelectEvents(_ecore_x_disp, win, mask); - - return EINA_TRUE; -#else /* ifdef ECORE_XGESTURE */ - return EINA_FALSE; - win = 0; - mask = 0; -#endif /* ifdef ECORE_XGESTURE */ -} - -EAPI Ecore_X_Gesture_Event_Mask -ecore_x_gesture_events_selected_get(Ecore_X_Window win) -{ -#ifdef ECORE_XGESTURE - Ecore_X_Gesture_Event_Mask mask; - - if (!_gesture_available) - return ECORE_X_GESTURE_EVENT_MASK_NONE; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (GestureSuccess != XGestureGetSelectedEvents(_ecore_x_disp, win, &mask)) - { - mask = ECORE_X_GESTURE_EVENT_MASK_NONE; - return mask; - } - - return mask; -#else /* ifdef ECORE_XGESTURE */ - return ECORE_X_GESTURE_EVENT_MASK_NONE; - win = 0; -#endif /* ifdef ECORE_XGESTURE */ -} - -EAPI Eina_Bool -ecore_x_gesture_event_grab(Ecore_X_Window win, - Ecore_X_Gesture_Event_Type type, - int num_fingers) -{ -#ifdef ECORE_XGESTURE - if (!_gesture_available) - return EINA_FALSE; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (GestureGrabSuccess != XGestureGrabEvent(_ecore_x_disp, win, type, num_fingers, CurrentTime)) - { - return EINA_FALSE; - } - - return EINA_TRUE; -#else /* ifdef ECORE_XGESTURE */ - return EINA_FALSE; - win = 0; - type = 0; - num_fingers = 0; -#endif /* ifdef ECORE_XGESTURE */ -} - -EAPI Eina_Bool -ecore_x_gesture_event_ungrab(Ecore_X_Window win, - Ecore_X_Gesture_Event_Type type, - int num_fingers) -{ -#ifdef ECORE_XGESTURE - Ecore_X_Gesture_Event_Mask mask; - - if (!_gesture_available) - return EINA_FALSE; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (GestureUngrabSuccess != XGestureUngrabEvent(_ecore_x_disp, win, type, num_fingers, CurrentTime)) - { - return EINA_FALSE; - } - - return EINA_TRUE; -#else /* ifdef ECORE_XGESTURE */ - return EINA_FALSE; - win = 0; - type = 0; - num_fingers = 0; -#endif /* ifdef ECORE_XGESTURE */ -} - diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_icccm.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_icccm.c deleted file mode 100644 index 8d6ea1f..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_icccm.c +++ /dev/null @@ -1,1214 +0,0 @@ -/* - * Various ICCCM related functions. - * - * This is ALL the code involving anything ICCCM related. for both WM and - * client. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif /* ifdef HAVE_CONFIG_H */ - -#include -#include - -#include "Ecore.h" -#include "ecore_x_private.h" -#include "Ecore_X.h" -#include "Ecore_X_Atoms.h" - -EAPI void -ecore_x_icccm_init(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); -} - -EAPI void -ecore_x_icccm_state_set(Ecore_X_Window win, - Ecore_X_Window_State_Hint state) -{ - unsigned long c[2]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (state == ECORE_X_WINDOW_STATE_HINT_WITHDRAWN) - c[0] = WithdrawnState; - else if (state == ECORE_X_WINDOW_STATE_HINT_NORMAL) - c[0] = NormalState; - else if (state == ECORE_X_WINDOW_STATE_HINT_ICONIC) - c[0] = IconicState; - - c[1] = None; - XChangeProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_STATE, - ECORE_X_ATOM_WM_STATE, 32, PropModeReplace, - (unsigned char *)c, 2); -} - -EAPI Ecore_X_Window_State_Hint -ecore_x_icccm_state_get(Ecore_X_Window win) -{ - unsigned char *prop_ret = NULL; - Atom type_ret; - unsigned long bytes_after, num_ret; - int format_ret; - Ecore_X_Window_State_Hint hint; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - hint = ECORE_X_WINDOW_STATE_HINT_NONE; - XGetWindowProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_STATE, - 0, 0x7fffffff, False, ECORE_X_ATOM_WM_STATE, - &type_ret, &format_ret, &num_ret, &bytes_after, - &prop_ret); - if ((prop_ret) && (num_ret == 2)) - { - if (prop_ret[0] == WithdrawnState) - hint = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN; - else if (prop_ret[0] == NormalState) - hint = ECORE_X_WINDOW_STATE_HINT_NORMAL; - else if (prop_ret[0] == IconicState) - hint = ECORE_X_WINDOW_STATE_HINT_ICONIC; - } - - if (prop_ret) - XFree(prop_ret); - - return hint; -} - -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_take_focus_send(Ecore_X_Window win, - Ecore_X_Time t) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS, - ECORE_X_EVENT_MASK_NONE, - ECORE_X_ATOM_WM_TAKE_FOCUS, - t, 0, 0, 0); -} - -EAPI void -ecore_x_icccm_save_yourself_send(Ecore_X_Window win, - Ecore_X_Time t) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS, - ECORE_X_EVENT_MASK_NONE, - ECORE_X_ATOM_WM_SAVE_YOURSELF, - t, 0, 0, 0); -} - -EAPI void -ecore_x_icccm_move_resize_send(Ecore_X_Window win, - int x, - int y, - int w, - int h) -{ - XEvent ev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ev.type = ConfigureNotify; - ev.xconfigure.display = _ecore_x_disp; - ev.xconfigure.event = win; - ev.xconfigure.window = win; - ev.xconfigure.x = x; - ev.xconfigure.y = y; - ev.xconfigure.width = w; - ev.xconfigure.height = h; - ev.xconfigure.border_width = 0; - ev.xconfigure.above = None; - ev.xconfigure.override_redirect = False; - XSendEvent(_ecore_x_disp, win, False, StructureNotifyMask, &ev); -} - -EAPI void -ecore_x_icccm_hints_set(Ecore_X_Window win, - Eina_Bool accepts_focus, - Ecore_X_Window_State_Hint initial_state, - Ecore_X_Pixmap icon_pixmap, - Ecore_X_Pixmap icon_mask, - Ecore_X_Window icon_window, - Ecore_X_Window window_group, - Eina_Bool is_urgent) -{ - XWMHints *hints; - - hints = XAllocWMHints(); - if (!hints) - return; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - hints->flags = InputHint | StateHint; - hints->input = accepts_focus; - if (initial_state == ECORE_X_WINDOW_STATE_HINT_WITHDRAWN) - hints->initial_state = WithdrawnState; - else if (initial_state == ECORE_X_WINDOW_STATE_HINT_NORMAL) - hints->initial_state = NormalState; - else if (initial_state == ECORE_X_WINDOW_STATE_HINT_ICONIC) - hints->initial_state = IconicState; - - if (icon_pixmap != 0) - { - hints->icon_pixmap = icon_pixmap; - hints->flags |= IconPixmapHint; - } - - if (icon_mask != 0) - { - hints->icon_mask = icon_mask; - hints->flags |= IconMaskHint; - } - - if (icon_window != 0) - { - hints->icon_window = icon_window; - hints->flags |= IconWindowHint; - } - - if (window_group != 0) - { - hints->window_group = window_group; - hints->flags |= WindowGroupHint; - } - - if (is_urgent) - hints->flags |= XUrgencyHint; - - XSetWMHints(_ecore_x_disp, win, hints); - XFree(hints); -} - -EAPI Eina_Bool -ecore_x_icccm_hints_get(Ecore_X_Window win, - Eina_Bool *accepts_focus, - Ecore_X_Window_State_Hint *initial_state, - Ecore_X_Pixmap *icon_pixmap, - Ecore_X_Pixmap *icon_mask, - Ecore_X_Window *icon_window, - Ecore_X_Window *window_group, - Eina_Bool *is_urgent) -{ - XWMHints *hints; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (accepts_focus) - *accepts_focus = EINA_TRUE; - - if (initial_state) - *initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL; - - if (icon_pixmap) - *icon_pixmap = 0; - - if (icon_mask) - *icon_mask = 0; - - if (icon_window) - *icon_window = 0; - - if (window_group) - *window_group = 0; - - if (is_urgent) - *is_urgent = EINA_FALSE; - - hints = XGetWMHints(_ecore_x_disp, win); - if (hints) - { - if ((hints->flags & InputHint) && (accepts_focus)) - { - if (hints->input) - *accepts_focus = EINA_TRUE; - else - *accepts_focus = EINA_FALSE; - } - - if ((hints->flags & StateHint) && (initial_state)) - { - if (hints->initial_state == WithdrawnState) - *initial_state = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN; - else if (hints->initial_state == NormalState) - *initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL; - else if (hints->initial_state == IconicState) - *initial_state = ECORE_X_WINDOW_STATE_HINT_ICONIC; - } - - if ((hints->flags & IconPixmapHint) && (icon_pixmap)) - *icon_pixmap = hints->icon_pixmap; - - if ((hints->flags & IconMaskHint) && (icon_mask)) - *icon_mask = hints->icon_mask; - - if ((hints->flags & IconWindowHint) && (icon_window)) - *icon_window = hints->icon_window; - - if ((hints->flags & WindowGroupHint) && (window_group)) - *window_group = hints->window_group; - - if ((hints->flags & XUrgencyHint) && (is_urgent)) - *is_urgent = EINA_TRUE; - - XFree(hints); - return EINA_TRUE; - } - - return EINA_FALSE; -} - -EAPI void -ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win, - Eina_Bool request_pos, - Ecore_X_Gravity gravity, - int min_w, - int min_h, - int max_w, - int max_h, - int base_w, - int base_h, - int step_x, - int step_y, - double min_aspect, - double max_aspect) -{ - XSizeHints hint; - long mask; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!XGetWMNormalHints(_ecore_x_disp, win, &hint, &mask)) - memset(&hint, 0, sizeof(XSizeHints)); - - hint.flags = 0; - if (request_pos) - hint.flags |= USPosition; - - if (gravity != ECORE_X_GRAVITY_NW) - { - hint.flags |= PWinGravity; - hint.win_gravity = gravity; - } - - if ((min_w > 0) || (min_h > 0)) - { - hint.flags |= PMinSize; - hint.min_width = min_w; - hint.min_height = min_h; - } - - if ((max_w > 0) || (max_h > 0)) - { - hint.flags |= PMaxSize; - hint.max_width = max_w; - hint.max_height = max_h; - } - - if ((base_w > 0) || (base_h > 0)) - { - hint.flags |= PBaseSize; - hint.base_width = base_w; - hint.base_height = base_h; - } - - if ((step_x > 1) || (step_y > 1)) - { - hint.flags |= PResizeInc; - hint.width_inc = step_x; - hint.height_inc = step_y; - } - - if ((min_aspect > 0.0) || (max_aspect > 0.0)) - { - hint.flags |= PAspect; - hint.min_aspect.x = min_aspect * 10000; - hint.min_aspect.y = 10000; - hint.max_aspect.x = max_aspect * 10000; - hint.max_aspect.y = 10000; - } - - XSetWMNormalHints(_ecore_x_disp, win, &hint); -} - -EAPI Eina_Bool -ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win, - Eina_Bool *request_pos, - Ecore_X_Gravity *gravity, - int *min_w, - int *min_h, - int *max_w, - int *max_h, - int *base_w, - int *base_h, - int *step_x, - int *step_y, - double *min_aspect, - double *max_aspect) -{ - XSizeHints hint; - long mask; - - int minw = 0, minh = 0; - int maxw = 32767, maxh = 32767; - int basew = -1, baseh = -1; - int stepx = -1, stepy = -1; - double mina = 0.0, maxa = 0.0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!XGetWMNormalHints(_ecore_x_disp, win, &hint, &mask)) - return EINA_FALSE; - - if ((hint.flags & USPosition) || ((hint.flags & PPosition))) - { - if (request_pos) - *request_pos = EINA_TRUE; - } - else if (request_pos) - *request_pos = EINA_FALSE; - - if (hint.flags & PWinGravity) - { - if (gravity) - *gravity = hint.win_gravity; - } - else if (gravity) - *gravity = ECORE_X_GRAVITY_NW; - - if (hint.flags & PMinSize) - { - minw = hint.min_width; - minh = hint.min_height; - } - - if (hint.flags & PMaxSize) - { - maxw = hint.max_width; - maxh = hint.max_height; - if (maxw < minw) - maxw = minw; - - if (maxh < minh) - maxh = minh; - } - - if (hint.flags & PBaseSize) - { - basew = hint.base_width; - baseh = hint.base_height; - if (basew > minw) - minw = basew; - - if (baseh > minh) - minh = baseh; - } - - if (hint.flags & PResizeInc) - { - stepx = hint.width_inc; - stepy = hint.height_inc; - if (stepx < 1) - stepx = 1; - - if (stepy < 1) - stepy = 1; - } - - if (hint.flags & PAspect) - { - if (hint.min_aspect.y > 0) - mina = ((double)hint.min_aspect.x) / ((double)hint.min_aspect.y); - - if (hint.max_aspect.y > 0) - maxa = ((double)hint.max_aspect.x) / ((double)hint.max_aspect.y); - } - - if (min_w) - *min_w = minw; - - if (min_h) - *min_h = minh; - - if (max_w) - *max_w = maxw; - - if (max_h) - *max_h = maxh; - - if (base_w) - *base_w = basew; - - if (base_h) - *base_h = baseh; - - if (step_x) - *step_x = stepx; - - if (step_y) - *step_y = stepy; - - if (min_aspect) - *min_aspect = mina; - - if (max_aspect) - *max_aspect = maxa; - - return EINA_TRUE; -} - -EAPI void -ecore_x_icccm_title_set(Ecore_X_Window win, - const char *t) -{ - char *list[1]; - XTextProperty xprop; - int ret; - - if (!t) - return; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - xprop.value = NULL; -#ifdef X_HAVE_UTF8_STRING - list[0] = strdup(t); - ret = - Xutf8TextListToTextProperty(_ecore_x_disp, list, 1, XUTF8StringStyle, - &xprop); -#else /* ifdef X_HAVE_UTF8_STRING */ - list[0] = strdup(t); - ret = - XmbTextListToTextProperty(_ecore_x_disp, list, 1, XStdICCTextStyle, - &xprop); -#endif /* ifdef X_HAVE_UTF8_STRING */ - if (ret >= Success) - { - XSetWMName(_ecore_x_disp, win, &xprop); - if (xprop.value) - XFree(xprop.value); - } - else if (XStringListToTextProperty(list, 1, &xprop) >= Success) - { - XSetWMName(_ecore_x_disp, win, &xprop); - if (xprop.value) - XFree(xprop.value); - } - - free(list[0]); -} - -EAPI char * -ecore_x_icccm_title_get(Ecore_X_Window win) -{ - XTextProperty xprop; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - xprop.value = NULL; - if (XGetWMName(_ecore_x_disp, win, &xprop) >= Success) - { - if (xprop.value) - { - char **list = NULL; - char *t = NULL; - int num = 0; - int ret; - - if (xprop.encoding == ECORE_X_ATOM_UTF8_STRING) - t = strdup((char *)xprop.value); - else - { - /* convert to utf8 */ -#ifdef X_HAVE_UTF8_STRING - ret = Xutf8TextPropertyToTextList(_ecore_x_disp, &xprop, - &list, &num); -#else /* ifdef X_HAVE_UTF8_STRING */ - ret = XmbTextPropertyToTextList(_ecore_x_disp, &xprop, - &list, &num); -#endif /* ifdef X_HAVE_UTF8_STRING */ - - if ((ret == XLocaleNotSupported) || - (ret == XNoMemory) || (ret == XConverterNotFound)) - t = strdup((char *)xprop.value); - else if ((ret >= Success) && (num > 0)) - t = strdup(list[0]); - - if (list) - XFreeStringList(list); - } - - if (xprop.value) - XFree(xprop.value); - - return t; - } - } - - return NULL; -} - -/** - * Set protocol atoms explicitly - * @param win The Window - * @param protos An array of protocol atoms - * @param num the number of members of the array - */ -EAPI void -ecore_x_icccm_protocol_atoms_set(Ecore_X_Window win, - Ecore_X_Atom *protos, - int num) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (num > 0) - XSetWMProtocols(_ecore_x_disp, win, (Atom *)(protos), num); - else - XDeleteProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_PROTOCOLS); -} - -/** - * Set or unset a wm protocol property. - * @param win The Window - * @param protocol The protocol to enable/disable - * @param on On/Off - */ -EAPI void -ecore_x_icccm_protocol_set(Ecore_X_Window win, - Ecore_X_WM_Protocol protocol, - Eina_Bool on) -{ - Atom *protos = NULL; - Atom proto; - int protos_count = 0; - int already_set = 0; - int i; - - /* Check for invalid values */ - if (protocol >= ECORE_X_WM_PROTOCOL_NUM) - return; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - proto = _ecore_x_atoms_wm_protocols[protocol]; - - if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count)) - { - protos = NULL; - protos_count = 0; - } - - for (i = 0; i < protos_count; i++) - { - if (protos[i] == proto) - { - already_set = 1; - break; - } - } - - if (on) - { - Atom *new_protos = NULL; - - if (already_set) - goto leave; - - new_protos = malloc((protos_count + 1) * sizeof(Atom)); - if (!new_protos) - goto leave; - - for (i = 0; i < protos_count; i++) - new_protos[i] = protos[i]; - new_protos[protos_count] = proto; - XSetWMProtocols(_ecore_x_disp, win, new_protos, protos_count + 1); - free(new_protos); - } - else - { - if (!already_set) - goto leave; - - for (i = 0; i < protos_count; i++) - { - if (protos[i] == proto) - { - int j; - - for (j = i + 1; j < protos_count; j++) - protos[j - 1] = protos[j]; - if (protos_count > 1) - XSetWMProtocols(_ecore_x_disp, win, protos, - protos_count - 1); - else - XDeleteProperty(_ecore_x_disp, win, - ECORE_X_ATOM_WM_PROTOCOLS); - - goto leave; - } - } - } - -leave: - if (protos) - XFree(protos); -} - -/** - * Determines whether a protocol is set for a window. - * @param win The Window - * @param protocol The protocol to query - * @return 1 if the protocol is set, else 0. - */ -EAPI Eina_Bool -ecore_x_icccm_protocol_isset(Ecore_X_Window win, - Ecore_X_WM_Protocol protocol) -{ - Atom proto, *protos = NULL; - int i, protos_count = 0; - Eina_Bool ret = EINA_FALSE; - - /* check for invalid values */ - if (protocol >= ECORE_X_WM_PROTOCOL_NUM) - return EINA_FALSE; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - proto = _ecore_x_atoms_wm_protocols[protocol]; - - if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count)) - return EINA_FALSE; - - for (i = 0; i < protos_count; i++) - if (protos[i] == proto) - { - ret = EINA_TRUE; - break; - } - - if (protos) - XFree(protos); - - return ret; -} - -/** - * Set a window name & class. - * @param win The window - * @param n The name string - * @param c The class string - * - * Set a window name * class - */ -EAPI void -ecore_x_icccm_name_class_set(Ecore_X_Window win, - const char *n, - const char *c) -{ - XClassHint *xch; - - xch = XAllocClassHint(); - if (!xch) - return; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - xch->res_name = (char *)n; - xch->res_class = (char *)c; - XSetClassHint(_ecore_x_disp, win, xch); - XFree(xch); -} - -/** - * Get a window name & class. - * @param win The window - * @param n The name string - * @param c The class string - * - * Get a window name * class - */ -EAPI void -ecore_x_icccm_name_class_get(Ecore_X_Window win, - char **n, - char **c) -{ - XClassHint xch; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (n) - *n = NULL; - - if (c) - *c = NULL; - - xch.res_name = NULL; - xch.res_class = NULL; - if (XGetClassHint(_ecore_x_disp, win, &xch)) - { - if (n) - if (xch.res_name) - *n = strdup(xch.res_name); - - if (c) - if (xch.res_class) - *c = strdup(xch.res_class); - - XFree(xch.res_name); - XFree(xch.res_class); - } -} - -/** - * Get a window client machine string. - * @param win The window - * @return The windows client machine string - * - * Return the client machine of a window. String must be free'd when done with. - */ -EAPI char * -ecore_x_icccm_client_machine_get(Ecore_X_Window win) -{ - char *name; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - name = ecore_x_window_prop_string_get(win, ECORE_X_ATOM_WM_CLIENT_MACHINE); - return name; -} - -/** - * Sets the WM_COMMAND property for @a win. - * - * @param win The window. - * @param argc Number of arguments. - * @param argv Arguments. - */ -EAPI void -ecore_x_icccm_command_set(Ecore_X_Window win, - int argc, - char **argv) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XSetCommand(_ecore_x_disp, win, argv, argc); -} - -/** - * Get the WM_COMMAND property for @a win. - * - * Return the command of a window. String must be free'd when done with. - * - * @param win The window. - * @param argc Number of arguments. - * @param argv Arguments. - */ -EAPI void -ecore_x_icccm_command_get(Ecore_X_Window win, - int *argc, - char ***argv) -{ - int i, c; - char **v; - - if (argc) - *argc = 0; - - if (argv) - *argv = NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!XGetCommand(_ecore_x_disp, win, &v, &c)) - return; - - if (c < 1) - { - if (v) - XFreeStringList(v); - - return; - } - - if (argc) - *argc = c; - - if (argv) - { - (*argv) = malloc(c * sizeof(char *)); - if (!*argv) - { - XFreeStringList(v); - if (argc) - *argc = 0; - - return; - } - - for (i = 0; i < c; i++) - { - if (v[i]) - (*argv)[i] = strdup(v[i]); - else - (*argv)[i] = strdup(""); - } - } - - XFreeStringList(v); -} - -/** - * Set a window icon name. - * @param win The window - * @param t The icon name string - * - * Set a window icon name - */ -EAPI void -ecore_x_icccm_icon_name_set(Ecore_X_Window win, - const char *t) -{ - char *list[1]; - XTextProperty xprop; - int ret; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - xprop.value = NULL; -#ifdef X_HAVE_UTF8_STRING - list[0] = strdup(t); - ret = Xutf8TextListToTextProperty(_ecore_x_disp, list, 1, - XUTF8StringStyle, &xprop); -#else /* ifdef X_HAVE_UTF8_STRING */ - list[0] = strdup(t); - ret = XmbTextListToTextProperty(_ecore_x_disp, list, 1, - XStdICCTextStyle, &xprop); -#endif /* ifdef X_HAVE_UTF8_STRING */ - if (ret >= Success) - { - XSetWMIconName(_ecore_x_disp, win, &xprop); - if (xprop.value) - XFree(xprop.value); - } - else if (XStringListToTextProperty(list, 1, &xprop) >= Success) - { - XSetWMIconName(_ecore_x_disp, win, &xprop); - if (xprop.value) - XFree(xprop.value); - } - - free(list[0]); -} - -/** - * Get a window icon name. - * @param win The window - * @return The windows icon name string - * - * Return the icon name of a window. String must be free'd when done with. - */ -EAPI char * -ecore_x_icccm_icon_name_get(Ecore_X_Window win) -{ - XTextProperty xprop; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - xprop.value = NULL; - if (XGetWMIconName(_ecore_x_disp, win, &xprop) >= Success) - { - if (xprop.value) - { - char **list = NULL; - char *t = NULL; - int num = 0; - int ret; - - if (xprop.encoding == ECORE_X_ATOM_UTF8_STRING) - t = strdup((char *)xprop.value); - else - { - /* convert to utf8 */ -#ifdef X_HAVE_UTF8_STRING - ret = Xutf8TextPropertyToTextList(_ecore_x_disp, &xprop, - &list, &num); -#else /* ifdef X_HAVE_UTF8_STRING */ - ret = XmbTextPropertyToTextList(_ecore_x_disp, &xprop, - &list, &num); -#endif /* ifdef X_HAVE_UTF8_STRING */ - - if ((ret == XLocaleNotSupported) || - (ret == XNoMemory) || (ret == XConverterNotFound)) - t = strdup((char *)xprop.value); - else if (ret >= Success) - { - if ((num >= 1) && (list)) - t = strdup(list[0]); - - if (list) - XFreeStringList(list); - } - } - - if (xprop.value) - XFree(xprop.value); - - return t; - } - } - - return NULL; -} - -/** - * Add a subwindow to the list of windows that need a different colormap installed. - * @param win The toplevel window - * @param subwin The subwindow to be added to the colormap windows list - */ -EAPI void -ecore_x_icccm_colormap_window_set(Ecore_X_Window win, - Ecore_X_Window subwin) -{ - int num = 0, i; - unsigned char *old_data = NULL; - unsigned char *data = NULL; - Window *oldset = NULL; - Window *newset = NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!ecore_x_window_prop_property_get(win, - ECORE_X_ATOM_WM_COLORMAP_WINDOWS, - XA_WINDOW, 32, &old_data, &num)) - { - newset = calloc(1, sizeof(Window)); - if (!newset) - return; - - newset[0] = subwin; - num = 1; - data = (unsigned char *)newset; - } - else - { - newset = calloc(num + 1, sizeof(Window)); - oldset = (Window *)old_data; - if (!newset) - return; - - for (i = 0; i < num; ++i) - { - if (oldset[i] == subwin) - { - if (old_data) - XFree(old_data); - - old_data = NULL; - free(newset); - return; - } - - newset[i] = oldset[i]; - } - - newset[num++] = subwin; - if (old_data) - XFree(old_data); - - data = (unsigned char *)newset; - } - - ecore_x_window_prop_property_set(win, - ECORE_X_ATOM_WM_COLORMAP_WINDOWS, - XA_WINDOW, 32, data, num); - free(newset); -} - -/** - * Remove a window from the list of colormap windows. - * @param win The toplevel window - * @param subwin The window to be removed from the colormap window list. - */ -EAPI void -ecore_x_icccm_colormap_window_unset(Ecore_X_Window win, - Ecore_X_Window subwin) -{ - int num = 0, i, j, k = 0; - unsigned char *old_data = NULL; - unsigned char *data = NULL; - Window *oldset = NULL; - Window *newset = NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!ecore_x_window_prop_property_get(win, - ECORE_X_ATOM_WM_COLORMAP_WINDOWS, - XA_WINDOW, 32, &old_data, &num)) - return; - - oldset = (Window *)old_data; - for (i = 0; i < num; i++) - { - if (oldset[i] == subwin) - { - if (num == 1) - { - XDeleteProperty(_ecore_x_disp, - win, ECORE_X_ATOM_WM_COLORMAP_WINDOWS); - if (old_data) - XFree(old_data); - - old_data = NULL; - return; - } - else - { - newset = calloc(num - 1, sizeof(Window)); - data = (unsigned char *)newset; - for (j = 0; j < num; ++j) - if (oldset[j] != subwin) - newset[k++] = oldset[j]; - - ecore_x_window_prop_property_set( - win, - ECORE_X_ATOM_WM_COLORMAP_WINDOWS, - XA_WINDOW, - 32, - data, - k); - if (old_data) - XFree(old_data); - - old_data = NULL; - free(newset); - return; - } - } - } - - if (old_data) - XFree(old_data); -} - -/** - * Specify that a window is transient for another top-level window and should be handled accordingly. - * @param win the transient window - * @param forwin the toplevel window - */ -EAPI void -ecore_x_icccm_transient_for_set(Ecore_X_Window win, - Ecore_X_Window forwin) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XSetTransientForHint(_ecore_x_disp, win, forwin); -} - -/** - * 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__); - XDeleteProperty(_ecore_x_disp, 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) -{ - Window forwin; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (XGetTransientForHint(_ecore_x_disp, win, &forwin)) - return (Ecore_X_Window)forwin; - else - return 0; -} - -/** - * Set the window role hint. - * @param win The window - * @param role The role string - */ -EAPI void -ecore_x_icccm_window_role_set(Ecore_X_Window win, - const char *role) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_window_prop_string_set(win, ECORE_X_ATOM_WM_WINDOW_ROLE, - (char *)role); -} - -/** - * 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's client leader. - * @param win The window - * @param l The client leader window - * - * All non-transient top-level windows created by an app other than - * the main window must have this property set to the app's main window. - */ -EAPI void -ecore_x_icccm_client_leader_set(Ecore_X_Window win, - Ecore_X_Window l) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_window_prop_window_set(win, ECORE_X_ATOM_WM_CLIENT_LEADER, - &l, 1); -} - -/** - * Get the window's client leader. - * @param win The window - * @return The window's client leader window, or 0 if unset */ -EAPI Ecore_X_Window -ecore_x_icccm_client_leader_get(Ecore_X_Window win) -{ - Ecore_X_Window l; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (ecore_x_window_prop_window_get(win, ECORE_X_ATOM_WM_CLIENT_LEADER, - &l, 1) > 0) - return l; - - return 0; -} - -EAPI void -ecore_x_icccm_iconic_request_send(Ecore_X_Window win, - Ecore_X_Window root) -{ - XEvent xev; - - if (!win) - return; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!root) - root = DefaultRootWindow(_ecore_x_disp); - - xev.xclient.type = ClientMessage; - xev.xclient.serial = 0; - xev.xclient.send_event = True; - xev.xclient.display = _ecore_x_disp; - xev.xclient.window = win; - xev.xclient.format = 32; - xev.xclient.message_type = ECORE_X_ATOM_WM_CHANGE_STATE; - xev.xclient.data.l[0] = IconicState; - - XSendEvent(_ecore_x_disp, root, False, - SubstructureNotifyMask | SubstructureRedirectMask, &xev); -} - -/* FIXME: there are older E hints, gnome hints and mwm hints and new netwm */ -/* hints. each should go in their own file/section so we know which */ -/* is which. also older kde hints too. we should try support as much */ -/* as makese sense to support */ diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_image.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_image.c deleted file mode 100644 index b8e720c..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_image.c +++ /dev/null @@ -1,600 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include - -#include "ecore_x_private.h" -#include "Ecore_X.h" - -#include -#include - -static int _ecore_x_image_shm_can = -1; -static int _ecore_x_image_err = 0; - -static int -_ecore_x_image_error_handler(Display *d __UNUSED__, - XErrorEvent *ev __UNUSED__) -{ - _ecore_x_image_err = 1; - return 0; -} - -static void -_ecore_x_image_shm_check(void) -{ - XErrorHandler ph; - XShmSegmentInfo shminfo; - XImage *xim; - - if (_ecore_x_image_shm_can != -1) - return; - - XSync(_ecore_x_disp, False); - _ecore_x_image_err = 0; - - xim = XShmCreateImage(_ecore_x_disp, - DefaultVisual(_ecore_x_disp, - DefaultScreen(_ecore_x_disp)), - DefaultDepth(_ecore_x_disp, - DefaultScreen(_ecore_x_disp)), - ZPixmap, NULL, - &shminfo, 1, 1); - if (!xim) - { - _ecore_x_image_shm_can = 0; - return; - } - - shminfo.shmid = shmget(IPC_PRIVATE, xim->bytes_per_line * xim->height, - IPC_CREAT | 0666); - if (shminfo.shmid == -1) - { - XDestroyImage(xim); - _ecore_x_image_shm_can = 0; - return; - } - - shminfo.readOnly = False; - shminfo.shmaddr = shmat(shminfo.shmid, 0, 0); - xim->data = shminfo.shmaddr; - - if (xim->data == (char *)-1) - { - XDestroyImage(xim); - _ecore_x_image_shm_can = 0; - return; - } - - ph = XSetErrorHandler((XErrorHandler)_ecore_x_image_error_handler); - XShmAttach(_ecore_x_disp, &shminfo); - XShmGetImage(_ecore_x_disp, DefaultRootWindow(_ecore_x_disp), - xim, 0, 0, 0xffffffff); - XSync(_ecore_x_disp, False); - XSetErrorHandler((XErrorHandler)ph); - if (_ecore_x_image_err) - { - XShmDetach(_ecore_x_disp, &shminfo); - XDestroyImage(xim); - shmdt(shminfo.shmaddr); - shmctl(shminfo.shmid, IPC_RMID, 0); - _ecore_x_image_shm_can = 0; - return; - } - - XShmDetach(_ecore_x_disp, &shminfo); - XDestroyImage(xim); - shmdt(shminfo.shmaddr); - shmctl(shminfo.shmid, IPC_RMID, 0); - - _ecore_x_image_shm_can = 1; -} - -struct _Ecore_X_Image -{ - XShmSegmentInfo shminfo; - Ecore_X_Visual vis; - XImage *xim; - int depth; - int w, h; - int bpl, bpp, rows; - unsigned char *data; - Eina_Bool shm : 1; -}; - -EAPI Ecore_X_Image * -ecore_x_image_new(int w, - int h, - Ecore_X_Visual vis, - int depth) -{ - Ecore_X_Image *im; - - im = calloc(1, sizeof(Ecore_X_Image)); - if (!im) - return NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - im->w = w; - im->h = h; - im->vis = vis; - im->depth = depth; - _ecore_x_image_shm_check(); - im->shm = _ecore_x_image_shm_can; - return im; -} - -EAPI void -ecore_x_image_free(Ecore_X_Image *im) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (im->shm) - { - if (im->xim) - { - XShmDetach(_ecore_x_disp, &(im->shminfo)); - XDestroyImage(im->xim); - shmdt(im->shminfo.shmaddr); - shmctl(im->shminfo.shmid, IPC_RMID, 0); - } - } - else if (im->xim) - { - free(im->xim->data); - im->xim->data = NULL; - XDestroyImage(im->xim); - } - - free(im); -} - -static void -_ecore_x_image_shm_create(Ecore_X_Image *im) -{ - im->xim = XShmCreateImage(_ecore_x_disp, im->vis, im->depth, - ZPixmap, NULL, &(im->shminfo), - im->w, im->h); - if (!im->xim) - return; - - im->shminfo.shmid = shmget(IPC_PRIVATE, - im->xim->bytes_per_line * im->xim->height, - IPC_CREAT | 0666); - if (im->shminfo.shmid == -1) - { - XDestroyImage(im->xim); - return; - } - - im->shminfo.readOnly = False; - im->shminfo.shmaddr = shmat(im->shminfo.shmid, 0, 0); - im->xim->data = im->shminfo.shmaddr; - if ((im->xim->data == (char *)-1) || - (!im->xim->data)) - { - shmdt(im->shminfo.shmaddr); - shmctl(im->shminfo.shmid, IPC_RMID, 0); - XDestroyImage(im->xim); - return; - } - - XShmAttach(_ecore_x_disp, &im->shminfo); - - im->data = (unsigned char *)im->xim->data; - - im->bpl = im->xim->bytes_per_line; - im->rows = im->xim->height; - if (im->xim->bits_per_pixel <= 8) - im->bpp = 1; - else if (im->xim->bits_per_pixel <= 16) - im->bpp = 2; - else - im->bpp = 4; -} - -EAPI Eina_Bool -ecore_x_image_get(Ecore_X_Image *im, - Ecore_X_Drawable draw, - int x, - int y, - int sx, - int sy, - int w, - int h) -{ - Eina_Bool ret = EINA_TRUE; - XErrorHandler ph; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (im->shm) - { - if (!im->xim) - _ecore_x_image_shm_create(im); - - if (!im->xim) - return 0; - - _ecore_x_image_err = 0; - // optimised path - ph = XSetErrorHandler((XErrorHandler)_ecore_x_image_error_handler); - if ((sx == 0) && (w == im->w)) - { - im->xim->data = (char *) - im->data + (im->xim->bytes_per_line * sy) + (sx * im->bpp); - im->xim->width = w; - im->xim->height = h; - XGrabServer(_ecore_x_disp); - if (!XShmGetImage(_ecore_x_disp, draw, im->xim, x, y, 0xffffffff)) - ret = EINA_FALSE; - XUngrabServer(_ecore_x_disp); - ecore_x_sync(); - } - // unavoidable thanks to mit-shm get api - tmp shm buf + copy into it - else - { - Ecore_X_Image *tim; - unsigned char *spixels, *sp, *pixels, *p; - int bpp, bpl, rows, sbpp, sbpl, srows; - int r; - - tim = ecore_x_image_new(w, h, im->vis, im->depth); - if (tim) - { - ret = ecore_x_image_get(tim, draw, x, y, 0, 0, w, h); - if (ret) - { - spixels = ecore_x_image_data_get(tim, - &sbpl, - &srows, - &sbpp); - pixels = ecore_x_image_data_get(im, &bpl, &rows, &bpp); - if ((pixels) && (spixels)) - { - p = pixels + (sy * bpl) + (sx * bpp); - sp = spixels; - for (r = srows; r > 0; r--) - { - memcpy(p, sp, sbpl); - p += bpl; - sp += sbpl; - } - } - } - - ecore_x_image_free(tim); - } - } - - XSetErrorHandler((XErrorHandler)ph); - if (_ecore_x_image_err) - ret = EINA_FALSE; - } - else - { - printf("currently unimplemented ecore_x_image_get without shm\n"); - ret = EINA_FALSE; - } - - return ret; -} - -EAPI void -ecore_x_image_put(Ecore_X_Image *im, - Ecore_X_Drawable draw, - Ecore_X_GC gc, - int x, - int y, - int sx, - int sy, - int w, - int h) -{ - Ecore_X_GC tgc = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!gc) - { - XGCValues gcv; - memset(&gcv, 0, sizeof(gcv)); - gcv.subwindow_mode = IncludeInferiors; - tgc = XCreateGC(_ecore_x_disp, draw, GCSubwindowMode, &gcv); - gc = tgc; - } - if (!im->xim) _ecore_x_image_shm_create(im); - if (im->xim) - XShmPutImage(_ecore_x_disp, draw, gc, im->xim, sx, sy, x, y, w, h, False); - if (tgc) ecore_x_gc_free(tgc); -} - -EAPI void * -ecore_x_image_data_get(Ecore_X_Image *im, - int *bpl, - int *rows, - int *bpp) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!im->xim) _ecore_x_image_shm_create(im); - if (!im->xim) return NULL; - if (bpl) *bpl = im->bpl; - if (rows) *rows = im->rows; - if (bpp) *bpp = im->bpp; - return im->data; -} - -EAPI Eina_Bool -ecore_x_image_is_argb32_get(Ecore_X_Image *im) -{ - Visual *vis = im->vis; - if (!im->xim) _ecore_x_image_shm_create(im); - if (((vis->class == TrueColor) || - (vis->class == DirectColor)) && - (im->depth >= 24) && - (vis->red_mask == 0xff0000) && - (vis->green_mask == 0x00ff00) && - (vis->blue_mask == 0x0000ff)) - { -#ifdef WORDS_BIGENDIAN - if (im->xim->bitmap_bit_order == LSBFirst) return EINA_TRUE; -#else - if (im->xim->bitmap_bit_order == MSBFirst) return EINA_TRUE; -#endif - } - return EINA_FALSE; -} - -EAPI Eina_Bool -ecore_x_image_to_argb_convert(void *src, - int sbpp, - int sbpl, - Ecore_X_Colormap c, - Ecore_X_Visual v, - int x, - int y, - int w, - int h, - unsigned int *dst, - int dbpl, - int dx, - int dy) -{ - Visual *vis = v; - XColor *cols = NULL; - int n = 0, nret = 0, i, row; - unsigned int pal[256], r, g, b; - enum - { - rgbnone = 0, - rgb565, - bgr565, - rgbx555, - argbx888, - abgrx888, - rgba888x, - bgra888x, - argbx666 - }; - int mode = 0; - - sbpp *= 8; - - n = vis->map_entries; - if ((n <= 256) && - ((vis->class == PseudoColor) || - (vis->class == StaticColor) || - (vis->class == GrayScale) || - (vis->class == StaticGray))) - { - if (!c) - c = DefaultColormap(_ecore_x_disp, - DefaultScreen(_ecore_x_disp)); - cols = alloca(n * sizeof(XColor)); - for (i = 0; i < n; i++) - { - cols[i].pixel = i; - cols[i].flags = DoRed | DoGreen | DoBlue; - cols[i].red = 0; - cols[i].green = 0; - cols[i].blue = 0; - } - XQueryColors(_ecore_x_disp, c, cols, n); - for (i = 0; i < n; i++) - { - pal[i] = 0xff000000 | - ((cols[i].red >> 8) << 16) | - ((cols[i].green >> 8) << 8) | - ((cols[i].blue >> 8)); - } - nret = n; - } - else if ((vis->class == TrueColor) || - (vis->class == DirectColor)) - { - if ((vis->red_mask == 0x00ff0000) && - (vis->green_mask == 0x0000ff00) && - (vis->blue_mask == 0x000000ff)) - mode = argbx888; - else if ((vis->red_mask == 0x000000ff) && - (vis->green_mask == 0x0000ff00) && - (vis->blue_mask == 0x00ff0000)) - mode = abgrx888; - else if ((vis->red_mask == 0xff000000) && - (vis->green_mask == 0x00ff0000) && - (vis->blue_mask == 0x0000ff00)) - mode = rgba888x; - else if ((vis->red_mask == 0x0000ff00) && - (vis->green_mask == 0x00ff0000) && - (vis->blue_mask == 0xff000000)) - mode = bgra888x; - else if ((vis->red_mask == 0x0003f000) && - (vis->green_mask == 0x00000fc0) && - (vis->blue_mask == 0x0000003f)) - mode = argbx666; - else if ((vis->red_mask == 0x0000f800) && - (vis->green_mask == 0x000007e0) && - (vis->blue_mask == 0x0000001f)) - mode = rgb565; - else if ((vis->red_mask == 0x0000001f) && - (vis->green_mask == 0x000007e0) && - (vis->blue_mask == 0x0000f800)) - mode = bgr565; - else if ((vis->red_mask == 0x00007c00) && - (vis->green_mask == 0x000003e0) && - (vis->blue_mask == 0x0000001f)) - mode = rgbx555; - else - return EINA_FALSE; - } - for (row = 0; row < h; row++) - { - unsigned char *s8; - unsigned short *s16; - unsigned int *s32; - unsigned int *dp, *de; - - dp = ((unsigned int *)(((unsigned char *)dst) + - ((dy + row) * dbpl))) + dx; - de = dp + w; - switch (sbpp) - { - case 8: - s8 = ((unsigned char *)(((unsigned char *)src) + ((y + row) * sbpl))) + x; - if (nret > 0) - { - while (dp < de) - { - *dp = pal[*s8]; - s8++; dp++; - } - } - else - return EINA_FALSE; - break; - - case 16: - s16 = ((unsigned short *)(((unsigned char *)src) + ((y + row) * sbpl))) + x; - switch (mode) - { - case rgb565: - while (dp < de) - { - r = (*s16 & 0xf800) << 8; - g = (*s16 & 0x07e0) << 5; - b = (*s16 & 0x001f) << 3; - r |= (r >> 5) & 0xff0000; - g |= (g >> 6) & 0x00ff00; - b |= (b >> 5); - *dp = 0xff000000 | r | g | b; - s16++; dp++; - } - break; - - case bgr565: - while (dp < de) - { - r = (*s16 & 0x001f) << 19; - g = (*s16 & 0x07e0) << 5; - b = (*s16 & 0xf800) >> 8; - r |= (r >> 5) & 0xff0000; - g |= (g >> 6) & 0x00ff00; - b |= (b >> 5); - *dp = 0xff000000 | r | g | b; - s16++; dp++; - } - break; - - case rgbx555: - while (dp < de) - { - r = (*s16 & 0x7c00) << 9; - g = (*s16 & 0x03e0) << 6; - b = (*s16 & 0x001f) << 3; - r |= (r >> 5) & 0xff0000; - g |= (g >> 5) & 0x00ff00; - b |= (b >> 5); - *dp = 0xff000000 | r | g | b; - s16++; dp++; - } - break; - - default: - return EINA_FALSE; - break; - } - break; - - case 24: - case 32: - s32 = ((unsigned int *)(((unsigned char *)src) + ((y + row) * sbpl))) + x; - switch (mode) - { - case argbx888: - while (dp < de) - { - *dp = 0xff000000 | *s32; - s32++; dp++; - } - break; - - case abgrx888: - while (dp < de) - { - r = *s32 & 0x000000ff; - g = *s32 & 0x0000ff00; - b = *s32 & 0x00ff0000; - *dp = 0xff000000 | (r << 16) | (g) | (b >> 16); - s32++; dp++; - } - break; - - case rgba888x: - while (dp < de) - { - *dp = 0xff000000 | (*s32 >> 8); - s32++; dp++; - } - break; - - case bgra888x: - while (dp < de) - { - r = *s32 & 0x0000ff00; - g = *s32 & 0x00ff0000; - b = *s32 & 0xff000000; - *dp = 0xff000000 | (r << 8) | (g >> 8) | (b >> 24); - s32++; dp++; - } - break; - - case argbx666: - while (dp < de) - { - r = (*s32 & 0x3f000) << 6; - g = (*s32 & 0x00fc0) << 4; - b = (*s32 & 0x0003f) << 2; - r |= (r >> 6) & 0xff0000; - g |= (g >> 6) & 0x00ff00; - b |= (b >> 6); - *dp = 0xff000000 | r | g | b; - s32++; dp++; - } - break; - - default: - return EINA_FALSE; - break; - } - break; - break; - - default: - return EINA_FALSE; - break; - } - } - return EINA_TRUE; -} - diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_mwm.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_mwm.c deleted file mode 100644 index 7812cc2..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_mwm.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Various MWM related functions. - * - * This is ALL the code involving anything MWM related. for both WM and - * client. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif /* ifdef HAVE_CONFIG_H */ - -#include - -#include "Ecore.h" -#include "ecore_x_private.h" -#include "Ecore_X.h" -#include "Ecore_X_Atoms.h" - -#define ECORE_X_MWM_HINTS_FUNCTIONS (1 << 0) -#define ECORE_X_MWM_HINTS_DECORATIONS (1 << 1) -#define ECORE_X_MWM_HINTS_INPUT_MODE (1 << 2) -#define ECORE_X_MWM_HINTS_STATUS (1 << 3) - -typedef struct _mwmhints -{ - CARD32 flags; - CARD32 functions; - CARD32 decorations; - INT32 inputmode; - CARD32 status; -} -MWMHints; - -EAPI Eina_Bool -ecore_x_mwm_hints_get(Ecore_X_Window win, - Ecore_X_MWM_Hint_Func *fhint, - Ecore_X_MWM_Hint_Decor *dhint, - Ecore_X_MWM_Hint_Input *ihint) -{ - unsigned char *p = NULL; - MWMHints *mwmhints = NULL; - int num; - Eina_Bool ret; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ret = EINA_FALSE; - if (!ecore_x_window_prop_property_get(win, - ECORE_X_ATOM_MOTIF_WM_HINTS, - ECORE_X_ATOM_MOTIF_WM_HINTS, - 32, &p, &num)) - return EINA_FALSE; - - mwmhints = (MWMHints *)p; - if (mwmhints) - { - if (num >= 4) - { - if (dhint) - { - if (mwmhints->flags & ECORE_X_MWM_HINTS_DECORATIONS) - *dhint = mwmhints->decorations; - else - *dhint = ECORE_X_MWM_HINT_DECOR_ALL; - } - - if (fhint) - { - if (mwmhints->flags & ECORE_X_MWM_HINTS_FUNCTIONS) - *fhint = mwmhints->functions; - else - *fhint = ECORE_X_MWM_HINT_FUNC_ALL; - } - - if (ihint) - { - if (mwmhints->flags & ECORE_X_MWM_HINTS_INPUT_MODE) - *ihint = mwmhints->inputmode; - else - *ihint = ECORE_X_MWM_HINT_INPUT_MODELESS; - } - - ret = EINA_TRUE; - } - - free(mwmhints); - } - - return ret; -} - -EAPI void -ecore_x_mwm_borderless_set(Ecore_X_Window win, - Eina_Bool borderless) -{ - unsigned int data[5] = {0, 0, 0, 0, 0}; - - data[0] = 2; /* just set the decorations hint! */ - data[2] = !borderless; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_window_prop_property_set(win, - ECORE_X_ATOM_MOTIF_WM_HINTS, - ECORE_X_ATOM_MOTIF_WM_HINTS, - 32, (void *)data, 5); -} - diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_netwm.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_netwm.c deleted file mode 100644 index 3076c3c..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_netwm.c +++ /dev/null @@ -1,2056 +0,0 @@ -/* - * _NET_WM... aka Extended Window Manager Hint (EWMH) functions. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include - -#include "Ecore.h" -#include "ecore_x_private.h" -#include "Ecore_X.h" - -typedef struct _Ecore_X_Startup_Info Ecore_X_Startup_Info; - -struct _Ecore_X_Startup_Info -{ - Ecore_X_Window win; - - int init; - - int buffer_size; - char *buffer; - - int length; - - /* These are the sequence info fields */ - char *id; - char *name; - int screen; - char *bin; - char *icon; - int desktop; - int timestamp; - char *description; - char *wmclass; - int silent; -}; - -static void _ecore_x_window_prop_string_utf8_set(Ecore_X_Window win, - Ecore_X_Atom atom, - const char *str); -static char *_ecore_x_window_prop_string_utf8_get(Ecore_X_Window win, - Ecore_X_Atom atom); -#if 0 /* Unused */ -static int _ecore_x_netwm_startup_info_process(Ecore_X_Startup_Info *info); -static int _ecore_x_netwm_startup_info_parse(Ecore_X_Startup_Info *info, - char *data); -#endif /* if 0 */ -static void _ecore_x_netwm_startup_info_free(void *data); - -/* - * Convenience macros - */ -#define _ATOM_SET_UTF8_STRING_LIST(win, atom, string, cnt) \ - XChangeProperty(_ecore_x_disp, \ - win, \ - atom, \ - ECORE_X_ATOM_UTF8_STRING, \ - 8, \ - PropModeReplace, \ - (unsigned char *)string, \ - cnt) - -/* - * Local variables - */ - -static Eina_Hash *startup_info = NULL; - -EAPI void -ecore_x_netwm_init(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - startup_info = eina_hash_string_superfast_new( - _ecore_x_netwm_startup_info_free); -} - -EAPI void -ecore_x_netwm_shutdown(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (startup_info) - eina_hash_free(startup_info); - - startup_info = NULL; -} - -/* - * WM identification - */ -EAPI void -ecore_x_netwm_wm_identify(Ecore_X_Window root, - Ecore_X_Window check, - const char *wm_name) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_window_prop_window_set(root, - ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK, - &check, - 1); - ecore_x_window_prop_window_set(check, - ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK, - &check, - 1); - _ecore_x_window_prop_string_utf8_set(check, - ECORE_X_ATOM_NET_WM_NAME, - wm_name); - /* This one isn't mandatory */ - _ecore_x_window_prop_string_utf8_set(root, - ECORE_X_ATOM_NET_WM_NAME, - wm_name); -} - -/* - * Set supported atoms - */ -EAPI void -ecore_x_netwm_supported_set(Ecore_X_Window root, - Ecore_X_Atom *supported, - int num) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_window_prop_atom_set(root, - ECORE_X_ATOM_NET_SUPPORTED, - supported, - num); -} - -EAPI Eina_Bool -ecore_x_netwm_supported_get(Ecore_X_Window root, - Ecore_X_Atom **supported, - int *num) -{ - int num_ret; - - if (num) - *num = 0; - - if (supported) - *supported = NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - num_ret = ecore_x_window_prop_atom_list_get(root, ECORE_X_ATOM_NET_SUPPORTED, - supported); - if (num_ret <= 0) - return EINA_FALSE; - - if (num) - *num = num_ret; - - return EINA_TRUE; -} - -/* - * Desktop configuration and status - */ -EAPI void -ecore_x_netwm_desk_count_set(Ecore_X_Window root, - unsigned int n_desks) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS, - &n_desks, 1); -} - -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, *t; - const char *s; - unsigned int i; - int l, len; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - buf = NULL; - len = 0; - - for (i = 0; i < n_desks; i++) - { - s = (names) ? names[i] : NULL; - if (!s) - { - /* Default to "Desk-" */ - sprintf(ss, "Desk-%d", i); - s = ss; - } - - l = strlen(s) + 1; - t = realloc(buf, len + l); - if (t) - { - buf = t; - memcpy(buf + len, s, l); - } - len += l; - } - - _ATOM_SET_UTF8_STRING_LIST(root, ECORE_X_ATOM_NET_DESKTOP_NAMES, buf, len); - - free(buf); -} - -EAPI void -ecore_x_netwm_desk_size_set(Ecore_X_Window root, - unsigned int width, - unsigned int height) -{ - unsigned int size[2]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - size[0] = width; - size[1] = height; - ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_DESKTOP_GEOMETRY, size, - 2); -} - -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 = DefaultRootWindow(_ecore_x_disp); - - ret = ecore_x_window_prop_card32_list_get(root, ECORE_X_ATOM_NET_WORKAREA, - &areas); - if (!areas) - { - if (n_desks) *n_desks = 0; - return 0; - } - if (n_desks) *n_desks = ret / 4; - return areas; -} - -EAPI void -ecore_x_netwm_desk_current_set(Ecore_X_Window root, - unsigned int desk) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_CURRENT_DESKTOP, &desk, - 1); -} - -EAPI void -ecore_x_netwm_showing_desktop_set(Ecore_X_Window root, - Eina_Bool on) -{ - unsigned int val; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - val = (on) ? 1 : 0; - ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_SHOWING_DESKTOP, &val, - 1); -} - -/* - * Client status - */ - -/* Mapping order */ -EAPI void -ecore_x_netwm_client_list_set(Ecore_X_Window root, - Ecore_X_Window *p_clients, - unsigned int n_clients) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_CLIENT_LIST, - p_clients, n_clients); -} - -/* Stacking order */ -EAPI void -ecore_x_netwm_client_list_stacking_set(Ecore_X_Window root, - Ecore_X_Window *p_clients, - unsigned int n_clients) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_CLIENT_LIST_STACKING, - p_clients, n_clients); -} - -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) -{ - XEvent xev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!root) - root = DefaultRootWindow(_ecore_x_disp); - - xev.xclient.type = ClientMessage; - xev.xclient.display = _ecore_x_disp; - xev.xclient.window = win; - xev.xclient.message_type = ECORE_X_ATOM_NET_ACTIVE_WINDOW; - xev.xclient.format = 32; - xev.xclient.data.l[0] = type; - xev.xclient.data.l[1] = CurrentTime; - xev.xclient.data.l[2] = current_win; - xev.xclient.data.l[3] = 0; - xev.xclient.data.l[4] = 0; - - XSendEvent(_ecore_x_disp, root, False, - SubstructureRedirectMask | SubstructureNotifyMask, &xev); -} - -EAPI void -ecore_x_netwm_name_set(Ecore_X_Window win, - const char *name) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - _ecore_x_window_prop_string_utf8_set(win, ECORE_X_ATOM_NET_WM_NAME, name); -} - -EAPI int -ecore_x_netwm_name_get(Ecore_X_Window win, - char **name) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (name) - *name = _ecore_x_window_prop_string_utf8_get(win, - ECORE_X_ATOM_NET_WM_NAME); - - return 1; -} - -EAPI void -ecore_x_netwm_startup_id_set(Ecore_X_Window win, - const char *id) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - _ecore_x_window_prop_string_utf8_set(win, ECORE_X_ATOM_NET_STARTUP_ID, id); -} - -EAPI int -ecore_x_netwm_startup_id_get(Ecore_X_Window win, - char **id) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (id) - *id = _ecore_x_window_prop_string_utf8_get(win, - ECORE_X_ATOM_NET_STARTUP_ID); - - return 1; -} - -EAPI void -ecore_x_netwm_visible_name_set(Ecore_X_Window win, - const char *name) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - _ecore_x_window_prop_string_utf8_set(win, ECORE_X_ATOM_NET_WM_VISIBLE_NAME, - name); -} - -EAPI int -ecore_x_netwm_visible_name_get(Ecore_X_Window win, - char **name) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (name) - *name = _ecore_x_window_prop_string_utf8_get( - win, - ECORE_X_ATOM_NET_WM_VISIBLE_NAME); - - return 1; -} - -EAPI void -ecore_x_netwm_icon_name_set(Ecore_X_Window win, - const char *name) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - _ecore_x_window_prop_string_utf8_set(win, ECORE_X_ATOM_NET_WM_ICON_NAME, - name); -} - -EAPI int -ecore_x_netwm_icon_name_get(Ecore_X_Window win, - char **name) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (name) - *name = _ecore_x_window_prop_string_utf8_get( - win, - ECORE_X_ATOM_NET_WM_ICON_NAME); - - return 1; -} - -EAPI void -ecore_x_netwm_visible_icon_name_set(Ecore_X_Window win, - const char *name) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - _ecore_x_window_prop_string_utf8_set(win, - ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME, - name); -} - -EAPI int -ecore_x_netwm_visible_icon_name_get(Ecore_X_Window win, - char **name) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (name) - *name = _ecore_x_window_prop_string_utf8_get( - win, - ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME); - - return 1; -} - -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) -{ - int ret; - unsigned int tmp; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_DESKTOP, - &tmp, 1); - - if (desk) - *desk = tmp; - - return ret == 1 ? EINA_TRUE : EINA_FALSE; -} - -/* - * _NET_WM_STRUT is deprecated - */ -EAPI void -ecore_x_netwm_strut_set(Ecore_X_Window win, - int left, - int right, - int top, - int bottom) -{ - unsigned int strut[4]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - strut[0] = left; - strut[1] = right; - strut[2] = top; - strut[3] = bottom; - ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_STRUT, strut, 4); -} - -/* - * _NET_WM_STRUT is deprecated - */ -EAPI Eina_Bool -ecore_x_netwm_strut_get(Ecore_X_Window win, - int *left, - int *right, - int *top, - int *bottom) -{ - int ret = 0; - unsigned int strut[4]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ret = ecore_x_window_prop_card32_get(win, - ECORE_X_ATOM_NET_WM_STRUT, - strut, - 4); - if (ret != 4) - return EINA_FALSE; - - if (left) - *left = strut[0]; - - if (right) - *right = strut[1]; - - if (top) - *top = strut[2]; - - if (bottom) - *bottom = strut[3]; - - return EINA_TRUE; -} - -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) -{ - int ret = 0; - unsigned int strut[12]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ret = ecore_x_window_prop_card32_get(win, - ECORE_X_ATOM_NET_WM_STRUT_PARTIAL, - strut, - 12); - if (ret != 12) - return EINA_FALSE; - - if (left) - *left = strut[0]; - - if (right) - *right = strut[1]; - - if (top) - *top = strut[2]; - - if (bottom) - *bottom = strut[3]; - - if (left_start_y) - *left_start_y = strut[4]; - - if (left_end_y) - *left_end_y = strut[5]; - - if (right_start_y) - *right_start_y = strut[6]; - - if (right_end_y) - *right_end_y = strut[7]; - - if (top_start_x) - *top_start_x = strut[8]; - - if (top_end_x) - *top_end_x = strut[9]; - - if (bottom_start_x) - *bottom_start_x = strut[10]; - - if (bottom_end_x) - *bottom_end_x = strut[11]; - - return EINA_TRUE; -} - -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)) - { - // unpremul - 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) -{ - unsigned int *data, *p; - unsigned int *src; - unsigned int len, icons, i; - int num_ret; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (num) - *num = 0; - - if (icon) - *icon = NULL; - - num_ret = ecore_x_window_prop_card32_list_get(win, ECORE_X_ATOM_NET_WM_ICON, - &data); - if (num_ret <= 0) - return EINA_FALSE; - - if (!data) - return EINA_FALSE; - - if (num_ret < 2) - { - free(data); - return EINA_FALSE; - } - - /* Check how many icons there are */ - icons = 0; - p = data; - while (p) - { - len = p[0] * p[1]; - p += (len + 2); - if ((p - data) > num_ret) - { - free(data); - return EINA_FALSE; - } - - icons++; - - if ((p - data) == num_ret) - p = NULL; - } - if (num) - *num = icons; - - /* If the user doesn't want the icons, return */ - if (!icon) - { - free(data); - return EINA_TRUE; - } - - /* Allocate memory */ - *icon = malloc(icons * sizeof(Ecore_X_Icon)); - if (!(*icon)) - { - free(data); - return EINA_FALSE; - } - - /* Fetch the icons */ - p = data; - for (i = 0; i < icons; i++) - { - unsigned int *ps, *pd, *pe; - - len = p[0] * p[1]; - ((*icon)[i]).width = p[0]; - ((*icon)[i]).height = p[1]; - src = &(p[2]); - ((*icon)[i]).data = malloc(len * sizeof(unsigned int)); - if (!((*icon)[i]).data) - { - while (i) - free(((*icon)[--i]).data); - free(*icon); - free(data); - return EINA_FALSE; - } - - pd = ((*icon)[i]).data; - ps = src; - pe = ps + len; - for (; ps < pe; ps++) - { - unsigned int r, g, b, a; - - a = (*ps >> 24) & 0xff; - r = (((*ps >> 16) & 0xff) * a) / 255; - g = (((*ps >> 8) & 0xff) * a) / 255; - b = (((*ps) & 0xff) * a) / 255; - *pd = (a << 24) | (r << 16) | (g << 8) | (b); - pd++; - } - p += (len + 2); - } - - free(data); - - return EINA_TRUE; -} - -EAPI void -ecore_x_netwm_icon_geometry_set(Ecore_X_Window win, - int x, - int y, - int width, - int height) -{ - unsigned int geometry[4]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - geometry[0] = x; - geometry[1] = y; - geometry[2] = width; - geometry[3] = height; - ecore_x_window_prop_card32_set(win, - ECORE_X_ATOM_NET_WM_ICON_GEOMETRY, - geometry, - 4); -} - -EAPI Eina_Bool -ecore_x_netwm_icon_geometry_get(Ecore_X_Window win, - int *x, - int *y, - int *width, - int *height) -{ - int ret; - unsigned int geometry[4]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ret = ecore_x_window_prop_card32_get(win, - ECORE_X_ATOM_NET_WM_ICON_GEOMETRY, - geometry, - 4); - if (ret != 4) - return EINA_FALSE; - - if (x) - *x = geometry[0]; - - if (y) - *y = geometry[1]; - - if (width) - *width = geometry[2]; - - if (height) - *height = geometry[3]; - - return EINA_TRUE; -} - -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_pid_get(Ecore_X_Window win, - int *pid) -{ - int ret; - unsigned int tmp; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_PID, - &tmp, 1); - if (pid) - *pid = tmp; - - return ret == 1 ? EINA_TRUE : EINA_FALSE; -} - -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) -{ - int ret = 0; - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_HANDLED_ICONS, - NULL, 0); - return ret == 0 ? EINA_TRUE : EINA_FALSE; -} - -EAPI void -ecore_x_netwm_user_time_set(Ecore_X_Window win, - unsigned int tim) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_USER_TIME, - &tim, 1); -} - -EAPI Eina_Bool -ecore_x_netwm_user_time_get(Ecore_X_Window win, - unsigned int *tim) -{ - int ret; - unsigned int tmp; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_USER_TIME, - &tmp, 1); - if (tim) - *tim = tmp; - - return ret == 1 ? EINA_TRUE : EINA_FALSE; -} - -Ecore_X_Window_State -_ecore_x_netwm_state_get(Ecore_X_Atom a) -{ - if (a == ECORE_X_ATOM_NET_WM_STATE_MODAL) - return ECORE_X_WINDOW_STATE_MODAL; - else if (a == ECORE_X_ATOM_NET_WM_STATE_STICKY) - return ECORE_X_WINDOW_STATE_STICKY; - else if (a == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT) - return ECORE_X_WINDOW_STATE_MAXIMIZED_VERT; - else if (a == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ) - return ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ; - else if (a == ECORE_X_ATOM_NET_WM_STATE_SHADED) - return ECORE_X_WINDOW_STATE_SHADED; - else if (a == ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR) - return ECORE_X_WINDOW_STATE_SKIP_TASKBAR; - else if (a == ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER) - return ECORE_X_WINDOW_STATE_SKIP_PAGER; - else if (a == ECORE_X_ATOM_NET_WM_STATE_HIDDEN) - return ECORE_X_WINDOW_STATE_HIDDEN; - else if (a == ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN) - return ECORE_X_WINDOW_STATE_FULLSCREEN; - else if (a == ECORE_X_ATOM_NET_WM_STATE_ABOVE) - return ECORE_X_WINDOW_STATE_ABOVE; - else if (a == ECORE_X_ATOM_NET_WM_STATE_BELOW) - return ECORE_X_WINDOW_STATE_BELOW; - else if (a == ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION) - return ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION; - else - return ECORE_X_WINDOW_STATE_UNKNOWN; -} - -static Ecore_X_Atom -_ecore_x_netwm_state_atom_get(Ecore_X_Window_State s) -{ - switch (s) - { - case ECORE_X_WINDOW_STATE_MODAL: - return ECORE_X_ATOM_NET_WM_STATE_MODAL; - - case ECORE_X_WINDOW_STATE_STICKY: - return ECORE_X_ATOM_NET_WM_STATE_STICKY; - - case ECORE_X_WINDOW_STATE_MAXIMIZED_VERT: - return ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT; - - case ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ: - return ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ; - - case ECORE_X_WINDOW_STATE_SHADED: - return ECORE_X_ATOM_NET_WM_STATE_SHADED; - - case ECORE_X_WINDOW_STATE_SKIP_TASKBAR: - return ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR; - - case ECORE_X_WINDOW_STATE_SKIP_PAGER: - return ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER; - - case ECORE_X_WINDOW_STATE_HIDDEN: - return ECORE_X_ATOM_NET_WM_STATE_HIDDEN; - - case ECORE_X_WINDOW_STATE_FULLSCREEN: - return ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN; - - case ECORE_X_WINDOW_STATE_ABOVE: - return ECORE_X_ATOM_NET_WM_STATE_ABOVE; - - case ECORE_X_WINDOW_STATE_BELOW: - return ECORE_X_ATOM_NET_WM_STATE_BELOW; - - case ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION: - return ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION; - - default: - return 0; - } -} - -EAPI void -ecore_x_netwm_window_state_set(Ecore_X_Window win, - Ecore_X_Window_State *state, - unsigned int num) -{ - Ecore_X_Atom *set; - unsigned int i; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!num) - { - ecore_x_window_prop_property_del(win, ECORE_X_ATOM_NET_WM_STATE); - return; - } - - set = malloc(num * sizeof(Ecore_X_Atom)); - if (!set) - return; - - for (i = 0; i < num; i++) - set[i] = _ecore_x_netwm_state_atom_get(state[i]); - - ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_NET_WM_STATE, set, num); - - free(set); -} - -EAPI Eina_Bool -ecore_x_netwm_window_state_get(Ecore_X_Window win, - Ecore_X_Window_State **state, - unsigned int *num) -{ - int num_ret, i; - Ecore_X_Atom *atoms; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (num) - *num = 0; - - if (state) - *state = NULL; - - num_ret = ecore_x_window_prop_atom_list_get(win, ECORE_X_ATOM_NET_WM_STATE, - &atoms); - if (num_ret <= 0) - return EINA_FALSE; - - if (state) - { - *state = malloc(num_ret * sizeof(Ecore_X_Window_State)); - if (*state) - for (i = 0; i < num_ret; ++i) - (*state)[i] = _ecore_x_netwm_state_get(atoms[i]); - - if (num) - *num = num_ret; - } - - free(atoms); - return EINA_TRUE; -} - -static Ecore_X_Window_Type -_ecore_x_netwm_window_type_type_get(Ecore_X_Atom atom) -{ - if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP) - return ECORE_X_WINDOW_TYPE_DESKTOP; - else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK) - return ECORE_X_WINDOW_TYPE_DOCK; - else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR) - return ECORE_X_WINDOW_TYPE_TOOLBAR; - else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU) - return ECORE_X_WINDOW_TYPE_MENU; - else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY) - return ECORE_X_WINDOW_TYPE_UTILITY; - else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH) - return ECORE_X_WINDOW_TYPE_SPLASH; - else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG) - return ECORE_X_WINDOW_TYPE_DIALOG; - else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL) - return ECORE_X_WINDOW_TYPE_NORMAL; - else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DROPDOWN_MENU) - return ECORE_X_WINDOW_TYPE_DROPDOWN_MENU; - else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_POPUP_MENU) - return ECORE_X_WINDOW_TYPE_POPUP_MENU; - else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLTIP) - return ECORE_X_WINDOW_TYPE_TOOLTIP; - else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NOTIFICATION) - return ECORE_X_WINDOW_TYPE_NOTIFICATION; - else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_COMBO) - return ECORE_X_WINDOW_TYPE_COMBO; - else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DND) - return ECORE_X_WINDOW_TYPE_DND; - else - return ECORE_X_WINDOW_TYPE_UNKNOWN; -} - -static Ecore_X_Atom -_ecore_x_netwm_window_type_atom_get(Ecore_X_Window_Type type) -{ - switch (type) - { - case ECORE_X_WINDOW_TYPE_DESKTOP: - return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP; - - case ECORE_X_WINDOW_TYPE_DOCK: - return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK; - - case ECORE_X_WINDOW_TYPE_TOOLBAR: - return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR; - - case ECORE_X_WINDOW_TYPE_MENU: - return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU; - - case ECORE_X_WINDOW_TYPE_UTILITY: - return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY; - - case ECORE_X_WINDOW_TYPE_SPLASH: - return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH; - - case ECORE_X_WINDOW_TYPE_DIALOG: - return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG; - - case ECORE_X_WINDOW_TYPE_NORMAL: - return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL; - - case ECORE_X_WINDOW_TYPE_DROPDOWN_MENU: - return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DROPDOWN_MENU; - - case ECORE_X_WINDOW_TYPE_POPUP_MENU: - return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_POPUP_MENU; - - case ECORE_X_WINDOW_TYPE_TOOLTIP: - return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLTIP; - - case ECORE_X_WINDOW_TYPE_NOTIFICATION: - return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NOTIFICATION; - - case ECORE_X_WINDOW_TYPE_COMBO: - return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_COMBO; - - case ECORE_X_WINDOW_TYPE_DND: - return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DND; - - default: - return 0; - } -} - -/* - * FIXME: We should set WM_TRANSIENT_FOR if type is ECORE_X_WINDOW_TYPE_TOOLBAR - * , ECORE_X_WINDOW_TYPE_MENU or ECORE_X_WINDOW_TYPE_DIALOG - */ -EAPI void -ecore_x_netwm_window_type_set(Ecore_X_Window win, - Ecore_X_Window_Type type) -{ - Ecore_X_Atom atom; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - atom = _ecore_x_netwm_window_type_atom_get(type); - ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_NET_WM_WINDOW_TYPE, - &atom, 1); -} - -/* FIXME: Maybe return 0 on some conditions? */ -EAPI Eina_Bool -ecore_x_netwm_window_type_get(Ecore_X_Window win, - Ecore_X_Window_Type *type) -{ - int num; - Ecore_X_Atom *atoms = NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (type) - *type = ECORE_X_WINDOW_TYPE_NORMAL; - - num = ecore_x_window_prop_atom_list_get(win, - ECORE_X_ATOM_NET_WM_WINDOW_TYPE, - &atoms); - if ((type) && (num >= 1) && (atoms)) - *type = _ecore_x_netwm_window_type_type_get(atoms[0]); - - free(atoms); - if (num >= 1) - return EINA_TRUE; - - return EINA_FALSE; -} - -EAPI int -ecore_x_netwm_window_types_get(Ecore_X_Window win, - Ecore_X_Window_Type **types) -{ - int num, i; - Ecore_X_Atom *atoms = NULL; - Ecore_X_Window_Type *atoms2 = NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (types) - *types = NULL; - - num = ecore_x_window_prop_atom_list_get(win, - ECORE_X_ATOM_NET_WM_WINDOW_TYPE, - &atoms); - if ((num <= 0) || (!atoms)) - { - if (atoms) - free(atoms); - - return 0; - } - - atoms2 = malloc(num * sizeof(Ecore_X_Window_Type)); - if (!atoms2) - return 0; - - for (i = 0; i < num; i++) - atoms2[i] = _ecore_x_netwm_window_type_type_get(atoms[i]); - free(atoms); - if (types) - *types = atoms2; - else - free(atoms2); - - return num; -} - -static Ecore_X_Atom -_ecore_x_netwm_action_atom_get(Ecore_X_Action action) -{ - switch (action) - { - case ECORE_X_ACTION_MOVE: - return ECORE_X_ATOM_NET_WM_ACTION_MOVE; - - case ECORE_X_ACTION_RESIZE: - return ECORE_X_ATOM_NET_WM_ACTION_RESIZE; - - case ECORE_X_ACTION_MINIMIZE: - return ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE; - - case ECORE_X_ACTION_SHADE: - return ECORE_X_ATOM_NET_WM_ACTION_SHADE; - - case ECORE_X_ACTION_STICK: - return ECORE_X_ATOM_NET_WM_ACTION_STICK; - - case ECORE_X_ACTION_MAXIMIZE_HORZ: - return ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ; - - case ECORE_X_ACTION_MAXIMIZE_VERT: - return ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT; - - case ECORE_X_ACTION_FULLSCREEN: - return ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN; - - case ECORE_X_ACTION_CHANGE_DESKTOP: - return ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP; - - case ECORE_X_ACTION_CLOSE: - return ECORE_X_ATOM_NET_WM_ACTION_CLOSE; - - case ECORE_X_ACTION_ABOVE: - return ECORE_X_ATOM_NET_WM_ACTION_ABOVE; - - case ECORE_X_ACTION_BELOW: - return ECORE_X_ATOM_NET_WM_ACTION_BELOW; - - default: - return 0; - } -} - -/* FIXME: Get complete list */ -EAPI Eina_Bool -ecore_x_netwm_allowed_action_isset(Ecore_X_Window win, - Ecore_X_Action action) -{ - int num, i; - Ecore_X_Atom *atoms, atom; - Eina_Bool ret = EINA_FALSE; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - num = ecore_x_window_prop_atom_list_get(win, ECORE_X_ATOM_NET_WM_WINDOW_TYPE, - &atoms); - if (num <= 0) - return ret; - - atom = _ecore_x_netwm_action_atom_get(action); - - for (i = 0; i < num; ++i) - { - if (atom == atoms[i]) - { - ret = 1; - break; - } - } - - free(atoms); - return ret; -} - -/* FIXME: Set complete list */ -EAPI void -ecore_x_netwm_allowed_action_set(Ecore_X_Window win, - Ecore_X_Action *action, - unsigned int num) -{ - Ecore_X_Atom *set; - unsigned int i; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!num) - { - ecore_x_window_prop_property_del(win, - ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS); - return; - } - - set = malloc(num * sizeof(Ecore_X_Atom)); - if (!set) - return; - - for (i = 0; i < num; i++) - set[i] = _ecore_x_netwm_action_atom_get(action[i]); - - ecore_x_window_prop_atom_set(win, - ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS, - set, - num); - - free(set); -} - -EAPI Eina_Bool -ecore_x_netwm_allowed_action_get(Ecore_X_Window win, - Ecore_X_Action **action, - unsigned int *num) -{ - int num_ret, i; - Ecore_X_Atom *atoms; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (num) - *num = 0; - - if (action) - *action = NULL; - - num_ret = ecore_x_window_prop_atom_list_get( - win, - ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS, - &atoms); - if (num_ret <= 0) - return EINA_FALSE; - - if (action) - { - *action = malloc(num_ret * sizeof(Ecore_X_Action)); - if (*action) - for (i = 0; i < num_ret; ++i) - (*action)[i] = _ecore_x_netwm_action_atom_get(atoms[i]); - - if (num) - *num = num_ret; - } - - free(atoms); - return EINA_TRUE; -} - -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) -{ - int ret; - unsigned int tmp; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_WINDOW_OPACITY, - &tmp, 1); - if (opacity) - *opacity = tmp; - - return ret == 1 ? EINA_TRUE : EINA_FALSE; -} - -EAPI void -ecore_x_netwm_frame_size_set(Ecore_X_Window win, - int fl, - int fr, - int ft, - int fb) -{ - unsigned int frames[4]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - frames[0] = fl; - frames[1] = fr; - frames[2] = ft; - frames[3] = fb; - ecore_x_window_prop_card32_set(win, - ECORE_X_ATOM_NET_FRAME_EXTENTS, - frames, - 4); -} - -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 Eina_Bool -ecore_x_netwm_sync_counter_get(Ecore_X_Window win, - Ecore_X_Sync_Counter *counter) -{ - int ret; - unsigned int tmp; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ret = ecore_x_window_prop_card32_get( - win, - ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER, - &tmp, - 1); - - if (counter) - *counter = tmp; - - return ret == 1 ? EINA_TRUE : EINA_FALSE; -} - -EAPI void -ecore_x_netwm_ping_send(Ecore_X_Window win) -{ - XEvent xev; - - if (!win) - return; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - xev.xclient.type = ClientMessage; - xev.xclient.display = _ecore_x_disp; - xev.xclient.window = win; - xev.xclient.message_type = ECORE_X_ATOM_WM_PROTOCOLS; - xev.xclient.format = 32; - xev.xclient.data.l[0] = ECORE_X_ATOM_NET_WM_PING; - xev.xclient.data.l[1] = _ecore_x_event_last_time; - xev.xclient.data.l[2] = win; - xev.xclient.data.l[3] = 0; - xev.xclient.data.l[4] = 0; - - XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev); -} - -EAPI void -ecore_x_netwm_sync_request_send(Ecore_X_Window win, - unsigned int serial) -{ - XSyncValue value; - XEvent xev; - - if (!win) - return; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XSyncIntToValue(&value, (int)serial); - - xev.xclient.type = ClientMessage; - xev.xclient.display = _ecore_x_disp; - xev.xclient.window = win; - xev.xclient.message_type = ECORE_X_ATOM_WM_PROTOCOLS; - xev.xclient.format = 32; - xev.xclient.data.l[0] = ECORE_X_ATOM_NET_WM_SYNC_REQUEST; - xev.xclient.data.l[1] = _ecore_x_event_last_time; - xev.xclient.data.l[2] = XSyncValueLow32(value); - xev.xclient.data.l[3] = XSyncValueHigh32(value); - xev.xclient.data.l[4] = 0; - - XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev); -} - -EAPI void -ecore_x_netwm_state_request_send(Ecore_X_Window win, - Ecore_X_Window root, - Ecore_X_Window_State s1, - Ecore_X_Window_State s2, - Eina_Bool set) -{ - XEvent xev; - - if (!win) - return; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!root) - root = DefaultRootWindow(_ecore_x_disp); - - xev.xclient.type = ClientMessage; - xev.xclient.serial = 0; - xev.xclient.send_event = True; - xev.xclient.display = _ecore_x_disp; - xev.xclient.window = win; - xev.xclient.format = 32; - xev.xclient.message_type = ECORE_X_ATOM_NET_WM_STATE; - xev.xclient.data.l[0] = !!set; - xev.xclient.data.l[1] = _ecore_x_netwm_state_atom_get(s1); - xev.xclient.data.l[2] = _ecore_x_netwm_state_atom_get(s2); - /* 1 == normal client, if someone wants to use this - * function in a pager, this should be 2 */ - xev.xclient.data.l[3] = 1; - xev.xclient.data.l[4] = 0; - - XSendEvent(_ecore_x_disp, root, False, - SubstructureNotifyMask | SubstructureRedirectMask, &xev); -} - -EAPI void -ecore_x_netwm_desktop_request_send(Ecore_X_Window win, - Ecore_X_Window root, - unsigned int desktop) -{ - XEvent xev; - - if (!win) - return; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!root) - root = DefaultRootWindow(_ecore_x_disp); - - xev.xclient.type = ClientMessage; - xev.xclient.serial = 0; - xev.xclient.send_event = True; - xev.xclient.display = _ecore_x_disp; - xev.xclient.window = win; - xev.xclient.format = 32; - xev.xclient.message_type = ECORE_X_ATOM_NET_WM_DESKTOP; - xev.xclient.data.l[0] = desktop; - - XSendEvent(_ecore_x_disp, root, False, - SubstructureNotifyMask | SubstructureRedirectMask, &xev); -} - -int -_ecore_x_netwm_startup_info_begin(Ecore_X_Window win __UNUSED__, - char *data __UNUSED__) -{ -#if 0 - Ecore_X_Startup_Info *info; - unsigned char *exists = 0; - - if (!startup_info) - return 0; - - info = eina_hash_find(startup_info, (void *)win); - if (info) - { - exists = 1; - WRN("Already got info for win: 0x%x", win); - _ecore_x_netwm_startup_info_free(info); - } - - info = calloc(1, sizeof(Ecore_X_Startup_Info)); - if (!info) - return 0; - - info->win = win; - info->length = 0; - info->buffer_size = 161; - info->buffer = calloc(info->buffer_size, sizeof(char)); - if (!info->buffer) - { - _ecore_x_netwm_startup_info_free(info); - return 0; - } - - memcpy(info->buffer, data, 20); - info->length += 20; - info->buffer[info->length] = 0; - if (exists) - eina_hash_modify(startup_info, (void *)info->win, info); - else - eina_hash_add(startup_info, (void *)info->win, info); - - if (strlen(info->buffer) != 20) - /* We have a '\0' in there, the message is done */ - _ecore_x_netwm_startup_info_process(info); - -#endif /* if 0 */ - return 1; -} - -int -_ecore_x_netwm_startup_info(Ecore_X_Window win __UNUSED__, - char *data __UNUSED__) -{ -#if 0 - Ecore_X_Startup_Info *info; - char *p; - - if (!startup_info) - return 0; - - info = eina_hash_find(startup_info, (void *)win); - if (!info) - return 0; - - if ((info->length + 20) > info->buffer_size) - { - info->buffer_size += 160; - info->buffer = realloc(info->buffer, info->buffer_size * sizeof(char)); - if (!info->buffer) - { - eina_hash_del(startup_info, (void *)info->win); - _ecore_x_netwm_startup_info_free(info); - return 0; - } - } - - memcpy(info->buffer + info->length, data, 20); - p = info->buffer + info->length; - info->length += 20; - info->buffer[info->length] = 0; - if (strlen(p) != 20) - /* We have a '\0' in there, the message is done */ - _ecore_x_netwm_startup_info_process(info); - -#endif /* if 0 */ - return 1; -} - -/* - * Set UTF-8 string property - */ -static void -_ecore_x_window_prop_string_utf8_set(Ecore_X_Window win, - Ecore_X_Atom atom, - const char *str) -{ - XChangeProperty(_ecore_x_disp, win, atom, ECORE_X_ATOM_UTF8_STRING, 8, - PropModeReplace, (unsigned char *)str, strlen(str)); -} - -/* - * Get UTF-8 string property - */ -static char * -_ecore_x_window_prop_string_utf8_get(Ecore_X_Window win, - Ecore_X_Atom atom) -{ - char *str; - unsigned char *prop_ret; - Atom type_ret; - unsigned long bytes_after, num_ret; - int format_ret; - - str = NULL; - prop_ret = NULL; - XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False, - ECORE_X_ATOM_UTF8_STRING, &type_ret, - &format_ret, &num_ret, &bytes_after, &prop_ret); - if (prop_ret && num_ret > 0 && format_ret == 8) - { - str = malloc(num_ret + 1); - if (str) - { - memcpy(str, prop_ret, num_ret); - str[num_ret] = '\0'; - } - } - - if (prop_ret) - XFree(prop_ret); - - return str; -} - -#if 0 /* Unused */ -/* - * Process startup info - */ -static int -_ecore_x_netwm_startup_info_process(Ecore_X_Startup_Info *info) -{ - Ecore_X_Event_Startup_Sequence *e; - int event; - char *p; - - p = strchr(info->buffer, ':'); - if (!p) - { - eina_hash_del(startup_info, (void *)info->win); - _ecore_x_netwm_startup_info_free(info); - return 0; - } - - *p = 0; - if (!strcmp(info->buffer, "new")) - { - if (info->init) - event = ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE; - else - event = ECORE_X_EVENT_STARTUP_SEQUENCE_NEW; - - info->init = 1; - } - else if (!strcmp(info->buffer, "change")) - event = ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE; - else if (!strcmp(info->buffer, "remove")) - event = ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE; - else - { - eina_hash_del(startup_info, (void *)info->win); - _ecore_x_netwm_startup_info_free(info); - return 0; - } - - p++; - - if (!_ecore_x_netwm_startup_info_parse(info, p)) - { - eina_hash_del(startup_info, (void *)info->win); - _ecore_x_netwm_startup_info_free(info); - return 0; - } - - if (info->init) - { - e = calloc(1, sizeof(Ecore_X_Event_Startup_Sequence)); - if (!e) - { - eina_hash_del(startup_info, (void *)info->win); - _ecore_x_netwm_startup_info_free(info); - return 0; - } - - e->win = info->win; - ecore_event_add(event, e, NULL, NULL); - } - - if (event == ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE) - { - eina_hash_del(startup_info, (void *)info->win); - _ecore_x_netwm_startup_info_free(info); - } - else - { - /* Discard buffer */ - info->length = 0; - info->buffer[0] = 0; - } - - return 1; -} - -/* - * Parse startup info - */ -static int -_ecore_x_netwm_startup_info_parse(Ecore_X_Startup_Info *info, - char *data) -{ - while (*data) - { - int in_quot_sing, in_quot_dbl, escaped; - char *p, *pp; - char *key; - char value[1024]; - - /* Skip space */ - while (*data == ' ') - data++; - /* Get key */ - key = data; - data = strchr(key, '='); - if (!data) - return 0; - - *data = 0; - data++; - - /* Get value */ - p = data; - pp = value; - in_quot_dbl = 0; - in_quot_sing = 0; - escaped = 0; - while (*p) - { - if ((pp - value) >= 1024) - return 0; - - if (escaped) - { - *pp = *p; - pp++; - escaped = 0; - } - else if (in_quot_sing) - { - if (*p == '\\') - escaped = 1; - else if (*p == '\'') - in_quot_sing = 0; - else - { - *pp = *p; - pp++; - } - } - else if (in_quot_dbl) - { - if (*p == '\\') - escaped = 1; - else if (*p == '\"') - in_quot_dbl = 0; - else - { - *pp = *p; - pp++; - } - } - else - { - if (*p == '\\') - escaped = 1; - else if (*p == '\'') - in_quot_sing = 1; - else if (*p == '\"') - in_quot_dbl = 1; - else if (*p == ' ') - break; - else - { - *pp = *p; - pp++; - } - } - - p++; - } - if ((in_quot_dbl) || (in_quot_sing)) - return 0; - - data = p; - *pp = 0; - - /* Parse info */ - if (!strcmp(key, "ID")) - { - if ((info->id) && (strcmp(info->id, value))) - return 0; - - info->id = strdup(value); - p = strstr(value, "_TIME"); - if (p) - info->timestamp = atoi(p + 5); - } - else if (!strcmp(key, "NAME")) - { - if (info->name) - free(info->name); - - info->name = strdup(value); - } - else if (!strcmp(key, "SCREEN")) - info->screen = atoi(value); - else if (!strcmp(key, "BIN")) - { - if (info->bin) - free(info->bin); - - info->bin = strdup(value); - } - else if (!strcmp(key, "ICON")) - { - if (info->icon) - free(info->icon); - - info->icon = strdup(value); - } - else if (!strcmp(key, "DESKTOP")) - info->desktop = atoi(value); - else if (!strcmp(key, "TIMESTAMP")) - { - if (!info->timestamp) - info->timestamp = atoi(value); - } - else if (!strcmp(key, "DESCRIPTION")) - { - if (info->description) - free(info->description); - - info->description = strdup(value); - } - else if (!strcmp(key, "WMCLASS")) - { - if (info->wmclass) - free(info->wmclass); - - info->wmclass = strdup(value); - } - else if (!strcmp(key, "SILENT")) - info->silent = atoi(value); - else - ERR("Ecore X Sequence, Unknown: %s=%s", key, value); - } - if (!info->id) - return 0; - - return 1; -} - -#endif /* if 0 */ - -/* - * Free startup info struct - */ -static void -_ecore_x_netwm_startup_info_free(void *data) -{ - Ecore_X_Startup_Info *info; - - info = data; - if (!info) - return; - - if (info->buffer) - free(info->buffer); - - if (info->id) - free(info->id); - - if (info->name) - free(info->name); - - if (info->bin) - free(info->bin); - - if (info->icon) - free(info->icon); - - if (info->description) - free(info->description); - - if (info->wmclass) - free(info->wmclass); - - free(info); -} - -/* - * Is screen composited? - */ -EAPI Eina_Bool -ecore_x_screen_is_composited(int screen) -{ - Ecore_X_Window win; - static Ecore_X_Atom atom = None; - char buf[32]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - snprintf(buf, sizeof(buf), "_NET_WM_CM_S%i", screen); - if (atom == None) - atom = XInternAtom(_ecore_x_disp, buf, False); - - if (atom == None) - return EINA_FALSE; - - win = XGetSelectionOwner(_ecore_x_disp, atom); - - return (win != None) ? EINA_TRUE : EINA_FALSE; -} - -EAPI void -ecore_x_screen_is_composited_set(int screen, - Ecore_X_Window win) -{ - static Ecore_X_Atom atom = None; - char buf[32]; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - snprintf(buf, sizeof(buf), "_NET_WM_CM_S%i", screen); - if (atom == None) - atom = XInternAtom(_ecore_x_disp, buf, False); - - if (atom == None) - return; - - XSetSelectionOwner(_ecore_x_disp, atom, win, _ecore_x_event_last_time); -} - diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_pixmap.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_pixmap.c deleted file mode 100644 index 7b13615..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_pixmap.c +++ /dev/null @@ -1,121 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include -#endif /* ifdef HAVE_CONFIG_H */ - -#include "Ecore.h" -#include "ecore_x_private.h" -#include "Ecore_X.h" - -/** - * @defgroup Ecore_X_Pixmap_Group X Pixmap Functions - * - * Functions that operate on pixmaps. - */ - -/** - * Creates a new pixmap. - * @param win Window used to determine which screen of the display the - * pixmap should be created on. If 0, the default root window - * is used. - * @param w Width of the new pixmap. - * @param h Height of the new pixmap. - * @param dep Depth of the pixmap. If 0, the default depth of the default - * screen is used. - * @return New pixmap. - * @ingroup Ecore_X_Pixmap_Group - */ -EAPI Ecore_X_Pixmap -ecore_x_pixmap_new(Ecore_X_Window win, - int w, - int h, - int dep) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (win == 0) - win = DefaultRootWindow(_ecore_x_disp); - - if (dep == 0) - dep = DefaultDepth(_ecore_x_disp, DefaultScreen(_ecore_x_disp)); - - return XCreatePixmap(_ecore_x_disp, win, w, h, dep); -} - -/** - * Deletes the reference to the given pixmap. - * - * If no other clients have a reference to the given pixmap, the server - * will destroy it. - * - * @param pmap The given pixmap. - * @ingroup Ecore_X_Pixmap_Group - */ -EAPI void -ecore_x_pixmap_free(Ecore_X_Pixmap pmap) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XFreePixmap(_ecore_x_disp, pmap); -} - -/** - * Pastes a rectangular area of the given pixmap onto the given drawable. - * @param pmap The given pixmap. - * @param dest The given drawable. - * @param gc The graphics context which governs which operation will - * be used to paste the area onto the drawable. - * @param sx The X position of the area on the pixmap. - * @param sy The Y position of the area on the pixmap. - * @param w The width of the area. - * @param h The height of the area. - * @param dx The X position at which to paste the area on @p dest. - * @param dy The Y position at which to paste the area on @p dest. - * @ingroup Ecore_X_Pixmap_Group - */ -EAPI void -ecore_x_pixmap_paste(Ecore_X_Pixmap pmap, - Ecore_X_Drawable dest, - Ecore_X_GC gc, - int sx, - int sy, - int w, - int h, - int dx, - int dy) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XCopyArea(_ecore_x_disp, pmap, dest, gc, sx, sy, w, h, dx, dy); -} - -/** - * Retrieves the size of the given pixmap. - * @param pmap The given pixmap. - * @param x Pointer to an integer in which to store the X position. - * @param y Pointer to an integer in which to store the Y position. - * @param w Pointer to an integer in which to store the width. - * @param h Pointer to an integer in which to store the height. - * @ingroup Ecore_X_Pixmap_Group - */ -EAPI void -ecore_x_pixmap_geometry_get(Ecore_X_Pixmap pmap, - int *x, - int *y, - int *w, - int *h) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (pmap) - ecore_x_drawable_geometry_get(pmap, x, y, w, h); -} - -/** - * Retrieves the depth of the given pixmap. - * @param pmap The given pixmap. - * @return The depth of the pixmap. - * @ingroup Ecore_X_Pixmap_Group - */ -EAPI int -ecore_x_pixmap_depth_get(Ecore_X_Pixmap pmap) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return ecore_x_drawable_depth_get(pmap); -} - diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_private.h b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_private.h deleted file mode 100644 index 02a01f7..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_private.h +++ /dev/null @@ -1,385 +0,0 @@ -#ifndef _ECORE_X_PRIVATE_H -#define _ECORE_X_PRIVATE_H - -#include -#ifndef MAXHOSTNAMELEN -#define MAXHOSTNAMELEN 256 -#endif /* ifndef MAXHOSTNAMELEN */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef ECORE_XCURSOR -#include -#endif /* ifdef ECORE_XCURSOR */ -#ifdef ECORE_XPRINT -#include -#endif /* ifdef ECORE_XPRINT */ -#ifdef ECORE_XINERAMA -#include -#endif /* ifdef ECORE_XINERAMA */ -#ifdef ECORE_XRANDR -#include -#endif /* ifdef ECORE_XRANDR */ -#ifdef ECORE_XSS -#include -#endif /* ifdef ECORE_XSS */ -#ifdef ECORE_XRENDER -#include -#endif /* ifdef ECORE_XRENDER */ -#ifdef ECORE_XFIXES -#include -#endif /* ifdef ECORE_XFIXES */ -#ifdef ECORE_XCOMPOSITE -#include -#endif /* ifdef ECORE_XCOMPOSITE */ -#ifdef ECORE_XDAMAGE -#include -#endif /* ifdef ECORE_XDAMAGE */ -#ifdef ECORE_XGESTURE -#include -#include -#endif /* ifdef ECORE_XGESTURE */ -#ifdef ECORE_XDPMS -#include -#endif /* ifdef ECORE_XDPMS */ -#ifdef ECORE_XKB -#include -#endif /* ifdef ECORE_XKB */ -#ifdef ECORE_XI2 -#include -#endif /* ifdef ECORE_XI2 */ - -#ifndef XK_MISCELLANY -# define XK_MISCELLANY 1 -#endif - -#include "Ecore.h" -#include "ecore_private.h" -#include "Ecore_X.h" -#include "Ecore_Input.h" - -extern int _ecore_xlib_log_dom; -#ifdef ECORE_XLIB_DEFAULT_LOG_COLOR -# undef ECORE_XLIB_DEFAULT_LOG_COLOR -#endif /* ifdef ECORE_XLIB_DEFAULT_LOG_COLOR */ -#define ECORE_XLIB_DEFAULT_LOG_COLOR EINA_COLOR_BLUE - -#ifdef ERR -# undef ERR -#endif /* ifdef ERR */ -#define ERR(...) EINA_LOG_DOM_ERR(_ecore_xlib_log_dom, __VA_ARGS__) - -#ifdef DBG -# undef DBG -#endif /* ifdef DBG */ -#define DBG(...) EINA_LOG_DOM_DBG(_ecore_xlib_log_dom, __VA_ARGS__) - -#ifdef INF -# undef INF -#endif /* ifdef INF */ -#define INF(...) EINA_LOG_DOM_INFO(_ecore_xlib_log_dom, __VA_ARGS__) - -#ifdef WRN -# undef WRN -#endif /* ifdef WRN */ -#define WRN(...) EINA_LOG_DOM_WARN(_ecore_xlib_log_dom, __VA_ARGS__) - -#ifdef CRIT -# undef CRIT -#endif /* ifdef CRIT */ -#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_xlib_log_dom, __VA_ARGS__) - -typedef struct _Ecore_X_Selection_Intern Ecore_X_Selection_Intern; - -struct _Ecore_X_Selection_Intern -{ - Ecore_X_Window win; - Ecore_X_Atom selection; - unsigned char *data; - int length; - Time time; -}; - -typedef struct _Ecore_X_Selection_Converter Ecore_X_Selection_Converter; - -struct _Ecore_X_Selection_Converter -{ - Ecore_X_Atom target; - Eina_Bool (*convert)(char *target, void *data, int size, void **data_ret, int *size_ret, Ecore_X_Atom *type, int *typeseize); - Ecore_X_Selection_Converter *next; -}; - -typedef struct _Ecore_X_Selection_Parser Ecore_X_Selection_Parser; - -struct _Ecore_X_Selection_Parser -{ - char *target; - void *(*parse)(const char *target, void *data, int size, int format); - Ecore_X_Selection_Parser *next; -}; - -typedef struct _Ecore_X_DND_Source -{ - int version; - Ecore_X_Window win, dest; - - enum { - ECORE_X_DND_SOURCE_IDLE, - ECORE_X_DND_SOURCE_DRAGGING, - ECORE_X_DND_SOURCE_DROPPED, - ECORE_X_DND_SOURCE_CONVERTING - } state; - - struct - { - short x, y; - unsigned short width, height; - } rectangle; - - struct - { - Ecore_X_Window window; - int x, y; - } prev; - - Time time; - - Ecore_X_Atom action, accepted_action; - - int will_accept; - int suppress; - - int await_status; -} Ecore_X_DND_Source; - -typedef struct _Ecore_X_DND_Target -{ - int version; - Ecore_X_Window win, source; - - enum { - ECORE_X_DND_TARGET_IDLE, - ECORE_X_DND_TARGET_ENTERED - } state; - - struct - { - int x, y; - } pos; - - Time time; - - Ecore_X_Atom action, accepted_action; - - int will_accept; -} Ecore_X_DND_Target; - -extern int ECORE_X_MODIFIER_SHIFT; -extern int ECORE_X_MODIFIER_CTRL; -extern int ECORE_X_MODIFIER_ALT; -extern int ECORE_X_MODIFIER_WIN; - -extern int ECORE_X_LOCK_SCROLL; -extern int ECORE_X_LOCK_NUM; -extern int ECORE_X_LOCK_CAPS; -extern int ECORE_X_LOCK_SHIFT; - -extern Display *_ecore_x_disp; -extern double _ecore_x_double_click_time; -extern Time _ecore_x_event_last_time; -extern Window _ecore_x_event_last_win; -extern int _ecore_x_event_last_root_x; -extern int _ecore_x_event_last_root_y; -extern Eina_Bool _ecore_x_xcursor; - -extern Ecore_X_Atom _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_NUM]; - -extern int _ecore_window_grabs_num; -extern Window *_ecore_window_grabs; -extern Eina_Bool (*_ecore_window_grab_replay_func)(void *data, - int event_type, - void *event); -extern void *_ecore_window_grab_replay_data; - -extern Ecore_X_Window _ecore_x_private_win; - -void _ecore_x_error_handler_init(void); -void _ecore_x_event_handle_any_event(XEvent *xevent); -void _ecore_x_event_handle_key_press(XEvent *xevent); -void _ecore_x_event_handle_key_release(XEvent *xevent); -void _ecore_x_event_handle_button_press(XEvent *xevent); -void _ecore_x_event_handle_button_release(XEvent *xevent); -void _ecore_x_event_handle_motion_notify(XEvent *xevent); -void _ecore_x_event_handle_enter_notify(XEvent *xevent); -void _ecore_x_event_handle_leave_notify(XEvent *xevent); -void _ecore_x_event_handle_focus_in(XEvent *xevent); -void _ecore_x_event_handle_focus_out(XEvent *xevent); -void _ecore_x_event_handle_keymap_notify(XEvent *xevent); -void _ecore_x_event_handle_expose(XEvent *xevent); -void _ecore_x_event_handle_graphics_expose(XEvent *xevent); -void _ecore_x_event_handle_visibility_notify(XEvent *xevent); -void _ecore_x_event_handle_create_notify(XEvent *xevent); -void _ecore_x_event_handle_destroy_notify(XEvent *xevent); -void _ecore_x_event_handle_unmap_notify(XEvent *xevent); -void _ecore_x_event_handle_map_notify(XEvent *xevent); -void _ecore_x_event_handle_map_request(XEvent *xevent); -void _ecore_x_event_handle_reparent_notify(XEvent *xevent); -void _ecore_x_event_handle_configure_notify(XEvent *xevent); -void _ecore_x_event_handle_configure_request(XEvent *xevent); -void _ecore_x_event_handle_gravity_notify(XEvent *xevent); -void _ecore_x_event_handle_resize_request(XEvent *xevent); -void _ecore_x_event_handle_circulate_notify(XEvent *xevent); -void _ecore_x_event_handle_circulate_request(XEvent *xevent); -void _ecore_x_event_handle_property_notify(XEvent *xevent); -void _ecore_x_event_handle_selection_clear(XEvent *xevent); -void _ecore_x_event_handle_selection_request(XEvent *xevent); -void _ecore_x_event_handle_selection_notify(XEvent *xevent); -void _ecore_x_event_handle_colormap_notify(XEvent *xevent); -void _ecore_x_event_handle_client_message(XEvent *xevent); -void _ecore_x_event_handle_mapping_notify(XEvent *xevent); -void _ecore_x_event_handle_shape_change(XEvent *xevent); -void _ecore_x_event_handle_screensaver_notify(XEvent *xevent); -#ifdef ECORE_XGESTURE -void _ecore_x_event_handle_gesture_notify_flick(XEvent *xevent); -void _ecore_x_event_handle_gesture_notify_pan(XEvent *xevent); -void _ecore_x_event_handle_gesture_notify_pinchrotation(XEvent *xevent); -void _ecore_x_event_handle_gesture_notify_tap(XEvent *xevent); -void _ecore_x_event_handle_gesture_notify_tapnhold(XEvent *xevent); -void _ecore_x_event_handle_gesture_notify_hold(XEvent *xevent); -void _ecore_x_event_handle_gesture_notify_group(XEvent *xevent); -#endif /* ifdef ECORE_XGESTURE */ -void _ecore_x_event_handle_sync_counter(XEvent *xevent); -void _ecore_x_event_handle_sync_alarm(XEvent *xevent); -#ifdef ECORE_XRANDR -void _ecore_x_event_handle_randr_change(XEvent *xevent); -void _ecore_x_event_handle_randr_notify(XEvent *xevent); -#endif /* ifdef ECORE_XRANDR */ -#ifdef ECORE_XFIXES -void _ecore_x_event_handle_fixes_selection_notify(XEvent *xevent); -#endif /* ifdef ECORE_XFIXES */ -#ifdef ECORE_XDAMAGE -void _ecore_x_event_handle_damage_notify(XEvent *xevent); -#endif /* ifdef ECORE_XDAMAGE */ -void _ecore_x_event_handle_generic_event(XEvent *xevent); - -void _ecore_x_selection_data_init(void); -void _ecore_x_selection_shutdown(void); -Ecore_X_Atom _ecore_x_selection_target_atom_get(const char *target); -char *_ecore_x_selection_target_get(Ecore_X_Atom target); -Ecore_X_Selection_Intern *_ecore_x_selection_get(Ecore_X_Atom selection); -Eina_Bool _ecore_x_selection_set(Window w, - const void *data, - int len, - Ecore_X_Atom selection); -int _ecore_x_selection_convert(Ecore_X_Atom selection, - Ecore_X_Atom target, - void **data_ret, - Ecore_X_Atom *targettype, - int *targetsize); -void *_ecore_x_selection_parse(const char *target, - void *data, - int size, - int format); - -void _ecore_x_sync_magic_send(int val, - Ecore_X_Window swin); -void _ecore_x_window_grab_remove(Ecore_X_Window win); -void _ecore_x_key_grab_remove(Ecore_X_Window win); - -/* from dnd */ -void _ecore_x_dnd_init(void); -Ecore_X_DND_Source *_ecore_x_dnd_source_get(void); -Ecore_X_DND_Target *_ecore_x_dnd_target_get(void); -void _ecore_x_dnd_drag(Ecore_X_Window root, - int x, - int y); -void _ecore_x_dnd_shutdown(void); - -/* from netwm */ -Ecore_X_Window_State _ecore_x_netwm_state_get(Ecore_X_Atom a); -int _ecore_x_netwm_startup_info_begin(Ecore_X_Window win, - char *data); -int _ecore_x_netwm_startup_info(Ecore_X_Window win, - char *data); - -/* Fixes * Damage * Composite * DPMS */ -void _ecore_x_fixes_init(void); -void _ecore_x_damage_init(void); -void _ecore_x_composite_init(void); -void _ecore_x_dpms_init(void); -void _ecore_x_randr_init(void); -void _ecore_x_gesture_init(void); - -void _ecore_x_atoms_init(void); - -extern int _ecore_x_xi2_opcode; - -void _ecore_x_events_init(void); -void _ecore_x_events_shutdown(void); - -void _ecore_x_input_init(void); -void _ecore_x_input_shutdown(void); -void _ecore_x_input_handler(XEvent *xevent); -/* from sync */ - -void _ecore_mouse_move(unsigned int timestamp, - unsigned int xmodifiers, - int x, - int y, - int x_root, - int y_root, - unsigned int event_window, - unsigned int window, - unsigned int root_win, - int same_screen, - int dev, - double radx, - double rady, - double pressure, - double angle, - double mx, - double my, - double mrx, - double mry); -Ecore_Event_Mouse_Button *_ecore_mouse_button(int event, - unsigned int timestamp, - unsigned int xmodifiers, - unsigned int buttons, - int x, - int y, - int x_root, - int y_root, - unsigned int event_window, - unsigned int window, - unsigned int root_win, - int same_screen, - int dev, - double radx, - double rady, - double pressure, - double angle, - double mx, - double my, - double mrx, - double mry); - -void _ecore_x_modifiers_get(void); - -//#define LOGFNS 1 - -#ifdef LOGFNS -#include -#define LOGFN(fl, ln, fn) printf("-ECORE-X: %25s: %5i - %s\n", fl, ln, fn); -#else /* ifdef LOGFNS */ -#define LOGFN(fl, ln, fn) -#endif /* ifdef LOGFNS */ - -#endif /* ifndef _ECORE_X_PRIVATE_H */ diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr.c deleted file mode 100644 index d4d834f..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr.c +++ /dev/null @@ -1,102 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include -#endif /* ifdef HAVE_CONFIG_H */ - -#include "ecore_x_private.h" -#include "ecore_x_randr.h" - -static Eina_Bool _randr_available = EINA_FALSE; -#ifdef ECORE_XRANDR -static int _randr_major, _randr_minor; -int _randr_version; -#define RANDR_1_1 ((1 << 16) | 1) -#define RANDR_1_2 ((1 << 16) | 2) -#define RANDR_1_3 ((1 << 16) | 3) - -#define RANDR_VALIDATE_ROOT(screen, \ - root) ((screen = \ - XRRRootToScreen(_ecore_x_disp, \ - root)) != -1) - -#define Ecore_X_Randr_Unset -1 - -XRRScreenResources *(*_ecore_x_randr_get_screen_resources)(Display * dpy, - Window window); - -#endif /* ifdef ECORE_XRANDR */ - -void -_ecore_x_randr_init(void) -{ -#ifdef ECORE_XRANDR - _randr_major = 1; - _randr_minor = 3; - _randr_version = 0; - - _ecore_x_randr_get_screen_resources = NULL; - if (XRRQueryVersion(_ecore_x_disp, &_randr_major, &_randr_minor)) - { - _randr_version = (_randr_major << 16) | _randr_minor; - if (_randr_version >= RANDR_1_3) - _ecore_x_randr_get_screen_resources = XRRGetScreenResourcesCurrent; - else if (_randr_version == RANDR_1_2) - _ecore_x_randr_get_screen_resources = XRRGetScreenResources; - - _randr_available = EINA_TRUE; - } - else - _randr_available = EINA_FALSE; - -#else - _randr_available = EINA_FALSE; -#endif -} - -/* - * @brief query whether randr is available or not - * @return EINA_TRUE, if extension is available, else EINA_FALSE - */ -EAPI Eina_Bool -ecore_x_randr_query(void) -{ - return _randr_available; -} - -/* - * @return version of the RandRR extension supported by the server or, - * in case RandRR extension is not available, Ecore_X_Randr_Unset (=-1). - * bit version information: 31 MAJOR 16 | 15 MINOR 0 - */ -EAPI int -ecore_x_randr_version_get(void) -{ -#ifdef ECORE_XRANDR - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (_randr_available) - { - return _randr_version; - } - else - { - return Ecore_X_Randr_Unset; - } -#else - return -1; -#endif -} - -Eina_Bool -_ecore_x_randr_root_validate(Ecore_X_Window root) -{ -#ifdef ECORE_XRANDR - Ecore_X_Randr_Screen scr = -1; - if (root && RANDR_VALIDATE_ROOT(scr, root)) - return EINA_TRUE; - else - return EINA_FALSE; - -#else - return EINA_FALSE; -#endif -} - diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr.h b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr.h deleted file mode 100644 index eca3c0c..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef ECORE_X_INLINE_X -#define ECORE_X_INLINE_X -Eina_Bool _ecore_x_randr_root_validate(Ecore_X_Window root); -Eina_Bool _ecore_x_randr_output_validate(Ecore_X_Window root, - Ecore_X_Randr_Output - output); -#endif diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_11.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_11.c deleted file mode 100644 index 816f8d5..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_11.c +++ /dev/null @@ -1,335 +0,0 @@ -/* - * vim:ts=8:sw=3:sts=8:expandtab:cino=>5n-3f0^-2{2 - */ - -#ifdef HAVE_CONFIG_H -# include -#endif /* ifdef HAVE_CONFIG_H */ - -#include "ecore_x_private.h" -#include "ecore_x_randr.h" -#include -#include -#include -#include - -#define Ecore_X_Randr_None 0 -#ifdef ECORE_XRANDR - -#define RANDR_1_1 ((1 << 16) | 1) - -#define RANDR_VALIDATE_ROOT(screen, \ - root) ((screen = \ - XRRRootToScreen(_ecore_x_disp, \ - root)) != -1) -#define RANDR_CHECK_1_1_RET(ret) if (_randr_version < RANDR_1_1) \ - return ret - -extern XRRScreenResources *(*_ecore_x_randr_get_screen_resources)(Display * - dpy, - Window - window); -extern int _randr_version; -#endif /* ifdef ECORE_XRANDR */ - -/* - * @param root window which's primary output will be queried - */ -EAPI Ecore_X_Randr_Orientation -ecore_x_randr_screen_primary_output_orientations_get(Ecore_X_Window root) -{ -#ifdef ECORE_XRANDR - Rotation rot = Ecore_X_Randr_None, crot; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - rot = - XRRRotations(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp, - root), &crot); - return rot; -#else /* ifdef ECORE_XRANDR */ - return Ecore_X_Randr_None; -#endif /* ifdef ECORE_XRANDR */ -} - -/* - * @param root window which's primary output will be queried - * @return the current orientation of the root window's screen primary output - */ -EAPI Ecore_X_Randr_Orientation -ecore_x_randr_screen_primary_output_orientation_get(Ecore_X_Window root) -{ -#ifdef ECORE_XRANDR - Rotation crot = Ecore_X_Randr_None; - XRRRotations(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp, - root), &crot); - return crot; -#else /* ifdef ECORE_XRANDR */ - return Ecore_X_Randr_None; -#endif /* ifdef ECORE_XRANDR */ -} - -/* - * @brief sets a given screen's primary output's orientation - * @param root window which's screen's primary output will be queried - * @param orientation orientation which should be set for the root window's screen primary output - * @return EINA_TRUE if the primary output's orientation could be successfully altered - */ -EAPI Eina_Bool -ecore_x_randr_screen_primary_output_orientation_set( - Ecore_X_Window root, - Ecore_X_Randr_Orientation - orientation) -{ -#ifdef ECORE_XRANDR - XRRScreenConfiguration *xrr_screen_cfg = NULL; - int sizeid; - Rotation crot; - Eina_Bool ret = EINA_FALSE; - if (!(xrr_screen_cfg = XRRGetScreenInfo(_ecore_x_disp, root))) - return EINA_FALSE; - - sizeid = XRRConfigCurrentConfiguration(xrr_screen_cfg, &crot); - if (!XRRSetScreenConfig(_ecore_x_disp, xrr_screen_cfg, root, sizeid, - orientation, CurrentTime)) - ret = EINA_TRUE; - - if (xrr_screen_cfg) - XRRFreeScreenConfigInfo(xrr_screen_cfg); - - return ret; -#else /* ifdef ECORE_XRANDR */ - return EINA_FALSE; -#endif /* ifdef ECORE_XRANDR */ -} - -/* - * @brief gets a screen's primary output's possible sizes - * @param root window which's primary output will be queried - * @param num number of sizes reported as supported by the screen's primary output - * @return an array of sizes reported as supported by the screen's primary output or - if query failed - NULL - */ -EAPI Ecore_X_Randr_Screen_Size_MM * -ecore_x_randr_screen_primary_output_sizes_get(Ecore_X_Window root, - int *num) -{ -#ifdef ECORE_XRANDR - Ecore_X_Randr_Screen_Size_MM *ret = NULL; - XRRScreenSize *sizes; - int i, n; - - /* we don't have to free sizes, because they're hold in a cache inside X*/ - sizes = - XRRSizes(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp, - root), &n); - if ((!sizes) || (n <= 0)) return NULL; - ret = calloc(n, sizeof(Ecore_X_Randr_Screen_Size_MM)); - if (!ret) - return NULL; - - if (num) - *num = n; - - for (i = 0; i < n; i++) - { - ret[i].width = sizes[i].width; - ret[i].height = sizes[i].height; - ret[i].width_mm = sizes[i].mwidth; - ret[i].height_mm = sizes[i].mheight; - } - return ret; -#else /* ifdef ECORE_XRANDR */ - return NULL; -#endif /* ifdef ECORE_XRANDR */ -} - -/* - * @brief get the current set size of a given screen's primary output - * @param root window which's primary output will be queried - * @param w the current size's width - * @param h the current size's height - * @param w_mm the current size's width in mm - * @param h_mm the current size's height in mm - * @param size_index of current set size to be used with ecore_x_randr_primary_output_size_set() - */ -EAPI void -ecore_x_randr_screen_primary_output_current_size_get(Ecore_X_Window root, - int *w, - int *h, - int *w_mm, - int *h_mm, - int *size_index) -{ -#ifdef ECORE_XRANDR - XRRScreenSize *sizes; - XRRScreenConfiguration *sc = NULL; - int idx; - Rotation orientation; - int n; - - if (!(sc = XRRGetScreenInfo(_ecore_x_disp, root))) - { - ERR("Couldn't get screen information for %d", root); - return; - } - - idx = XRRConfigCurrentConfiguration(sc, &orientation); - - sizes = - XRRSizes(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp, - root), &n); - if ((idx < n) && (idx >= 0)) - { - if (w) - *w = sizes[idx].width; - - if (h) - *h = sizes[idx].height; - - if (w_mm) - *w_mm = sizes[idx].mwidth; - - if (h_mm) - *h_mm = sizes[idx].mheight; - - if (size_index) - *size_index = idx; - } - - XRRFreeScreenConfigInfo(sc); -#endif /* ifdef ECORE_XRANDR */ -} - -/* - * @brief sets a given screen's primary output size, but disables all other outputs at the same time - * @param root window which's primary output will be queried - * @param size_index within the list of sizes reported as supported by the root window's screen primary output - * @return EINA_TRUE on success, EINA_FALSE on failure due to e.g. invalid times - */ -EAPI Eina_Bool -ecore_x_randr_screen_primary_output_size_set(Ecore_X_Window root, - int size_index) -{ -#ifdef ECORE_XRANDR - XRRScreenConfiguration *sc = NULL; - Eina_Bool ret = EINA_FALSE; - int nsizes = 0; - - if (size_index >= 0 && _ecore_x_randr_root_validate(root)) - { - XRRSizes(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp, - root), &nsizes); - - if (size_index < nsizes) - { - sc = XRRGetScreenInfo(_ecore_x_disp, root); - if (!XRRSetScreenConfig(_ecore_x_disp, sc, - root, size_index, - ECORE_X_RANDR_ORIENTATION_ROT_0, CurrentTime)) - { - ret = EINA_TRUE; - } - - if (sc) - XRRFreeScreenConfigInfo(sc); - } - } - - return ret; -#else /* ifdef ECORE_XRANDR */ - return EINA_FALSE; -#endif /* ifdef ECORE_XRANDR */ -} - -/* - * @param root window which's primary output will be queried - * @return currently used refresh rate or - if request failed or RandRR is not available - 0.0 - */ -EAPI Ecore_X_Randr_Refresh_Rate -ecore_x_randr_screen_primary_output_current_refresh_rate_get( - Ecore_X_Window root) -{ -#ifdef ECORE_XRANDR - Ecore_X_Randr_Refresh_Rate ret = 0.0; - XRRScreenConfiguration *sc = NULL; - - if (!_ecore_x_randr_root_validate(root) || - !(sc = XRRGetScreenInfo(_ecore_x_disp, root))) - return ret; - - ret = XRRConfigCurrentRate(sc); - if (sc) - XRRFreeScreenConfigInfo(sc); - - return ret; -#else /* ifdef ECORE_XRANDR */ - return 0.0; -#endif /* ifdef ECORE_XRANDR */ -} - -/* - * @param root window which's primary output will be queried - * @param size_index referencing the size to query valid refresh rates for - * @return currently used refresh rate or - if request failed or RandRR is not available - NULL - */ -EAPI Ecore_X_Randr_Refresh_Rate * -ecore_x_randr_screen_primary_output_refresh_rates_get(Ecore_X_Window root, - int size_index, - int *num) -{ -#ifdef ECORE_XRANDR - Ecore_X_Randr_Refresh_Rate *ret = NULL, *rates = NULL; - Ecore_X_Randr_Screen scr; - int n; - - if (num - && RANDR_VALIDATE_ROOT(scr, root) - && (rates = XRRRates(_ecore_x_disp, scr, size_index, &n))) - { - if (rates && (ret = malloc(sizeof(Ecore_X_Randr_Refresh_Rate) * n))) - { - memcpy(ret, rates, (sizeof(Ecore_X_Randr_Refresh_Rate) * n)); - *num = n; - } - } - - return ret; -#else /* ifdef ECORE_XRANDR */ - return NULL; -#endif /* ifdef ECORE_XRANDR */ -} - -//>= 1.1 -/* - * @brief sets the current primary output's refresh rate - * @param root window which's primary output will be queried - * @param size_index referencing the size to be set - * @param rate the refresh rate to be set - * @return EINA_TRUE on success else EINA_FALSE - */ -EAPI Eina_Bool -ecore_x_randr_screen_primary_output_refresh_rate_set( - Ecore_X_Window root, - int size_index, - Ecore_X_Randr_Refresh_Rate - rate) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_1_RET(EINA_FALSE); - Eina_Bool ret = EINA_FALSE; - XRRScreenConfiguration *sc = NULL; - - if (!(sc = XRRGetScreenInfo(_ecore_x_disp, root))) - return ret; - - if (!XRRSetScreenConfigAndRate(_ecore_x_disp, sc, - root, size_index, - RR_Rotate_0, rate, CurrentTime)) - ret = EINA_TRUE; - - XRRFreeScreenConfigInfo(sc); - return ret; -#else /* ifdef ECORE_XRANDR */ - return EINA_FALSE; -#endif /* ifdef ECORE_XRANDR */ -} - diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12.c deleted file mode 100644 index ec23b3c..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12.c +++ /dev/null @@ -1,2360 +0,0 @@ -/* - * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "ecore_x_private.h" -#include "ecore_x_randr.h" -#include -#include -#include -#include - -#define Ecore_X_Randr_None (Ecore_X_Randr_Crtc)0 -#define Ecore_X_Randr_Unset (Ecore_X_Randr_Crtc) - 1 - -#ifdef ECORE_XRANDR - -#define RANDR_1_2 ((1 << 16) | 2) - -#define RANDR_VALIDATE_ROOT(screen, root) \ - ((screen = XRRRootToScreen(_ecore_x_disp, root)) != -1) - -#define RANDR_CHECK_1_2_RET(ret) if (_randr_version < RANDR_1_2) \ - return ret - -#define RANDR_PROPERTY_EDID "EDID" -#define RANDR_PROPERTY_BACKLIGHT "Backlight" -#define RANDR_PROPERTY_SIGNAL_FORMAT "SignalFormat" -#define RANDR_PROPERTY_SIGNAL_PROPERTIES "SignalProperties" -#define RANDR_PROPERTY_CONNECTOR_TYPE "ConnectorType" -#define RANDR_PROPERTY_CONNECTOR_NUMBER "ConnectorNumber" -#define RANDR_PROPERTY_COMPATIBILITY_LIST "CompatibilityList" -#define RANDR_PROPERTY_CLONE_LIST "CloneList" - -extern XRRScreenResources *(*_ecore_x_randr_get_screen_resources)(Display * - dpy, - Window - window); -extern int _randr_version; -#endif - -/** - * @brief enable event selection. This enables basic interaction with - * output/crtc events and requires RRandR >= 1.2. - * @param win select this window's properties for RandRR events - * @param on enable/disable selecting - */ -EAPI void -ecore_x_randr_events_select(Ecore_X_Window win, - Eina_Bool on) -{ -#ifdef ECORE_XRANDR - int mask; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!on) - mask = 0; - else - { - mask = RRScreenChangeNotifyMask; - if (_randr_version >= RANDR_1_2) - mask |= (RRCrtcChangeNotifyMask | - RROutputChangeNotifyMask | - RROutputPropertyNotifyMask); - } - - XRRSelectInput(_ecore_x_disp, win, mask); -#endif -} - -/** - * @brief validates a CRTC for a given root window's screen. - * @param root the window which's default display will be queried - * @param crtc the CRTC to be validated. - * @return in case it is found EINA_TRUE will be returned. Else EINA_FALSE is returned. - */ -static inline Eina_Bool -_ecore_x_randr_crtc_validate(Ecore_X_Window root, - Ecore_X_Randr_Crtc crtc) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(EINA_FALSE); - - XRRScreenResources *res = NULL; - int i; - Eina_Bool ret = EINA_FALSE; - - if ((crtc == Ecore_X_Randr_None) || - (crtc == Ecore_X_Randr_Unset)) - return ret; - - if (_ecore_x_randr_root_validate(root) && crtc && - (res = _ecore_x_randr_get_screen_resources (_ecore_x_disp, root))) - { - for (i = 0; i < res->ncrtc; i++) - { - if (res->crtcs[i] == crtc) - { - ret = EINA_TRUE; - break; - } - } - XRRFreeScreenResources(res); - } - - return ret; -#else - return EINA_FALSE; -#endif -} - -Eina_Bool -_ecore_x_randr_output_validate(Ecore_X_Window root, - Ecore_X_Randr_Output output) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(EINA_FALSE); - - Eina_Bool ret = EINA_FALSE; - XRRScreenResources *res = NULL; - int i; - - if (_ecore_x_randr_root_validate(root) && output && - (res = _ecore_x_randr_get_screen_resources (_ecore_x_disp, root))) - { - for (i = 0; i < res->noutput; i++) - { - if (res->outputs[i] == output) - { - ret = EINA_TRUE; - break; - } - } - XRRFreeScreenResources(res); - } - - return ret; -#else - return EINA_FALSE; -#endif -} - -static inline Eina_Bool -_ecore_x_randr_mode_validate(Ecore_X_Window root, - Ecore_X_Randr_Mode mode) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(EINA_FALSE); - - Eina_Bool ret = EINA_FALSE; - XRRScreenResources *res = NULL; - int i; - - if (_ecore_x_randr_root_validate(root) && mode && - (res = _ecore_x_randr_get_screen_resources (_ecore_x_disp, root))) - { - for (i = 0; i < res->nmode; i++) - { - if (res->modes[i].id == mode) - { - ret = EINA_TRUE; - break; - } - } - XRRFreeScreenResources(res); - } - - return ret; -#else - return EINA_FALSE; -#endif -} - -/* - * @param w width of screen in px - * @param h height of screen in px - */ -EAPI void -ecore_x_randr_screen_current_size_get(Ecore_X_Window root, - int *w, - int *h, - int *w_mm, - int *h_mm) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(); - Ecore_X_Randr_Screen scr; - - if (!RANDR_VALIDATE_ROOT(scr, root)) - return; - - if (w) - *w = DisplayWidth(_ecore_x_disp, scr); - - if (h) - *h = DisplayHeight(_ecore_x_disp, scr); - - if (w_mm) - *w_mm = DisplayWidthMM(_ecore_x_disp, scr); - - if (h_mm) - *h_mm = DisplayHeightMM(_ecore_x_disp, scr); - -#endif -} - -/* - * @param root window which's screen will be queried - * @param wmin minimum width the screen can be set to - * @param hmin minimum height the screen can be set to - * @param wmax maximum width the screen can be set to - * @param hmax maximum height the screen can be set to - */ -EAPI void -ecore_x_randr_screen_size_range_get(Ecore_X_Window root, - int *wmin, - int *hmin, - int *wmax, - int *hmax) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(); - int twmin, thmin, twmax, thmax; - if (XRRGetScreenSizeRange (_ecore_x_disp, root, &twmin, &thmin, &twmax, - &thmax)) - { - if (wmin) - *wmin = twmin; - - if (hmin) - *hmin = thmin; - - if (wmax) - *wmax = twmax; - - if (hmax) - *hmax = thmax; - } - -#endif -} - -/* - * @param root window which's screen's size should be set. If invalid (e.g. NULL) no action is taken. - * @param w width in px the screen should be set to. If out of valid boundaries, current value is assumed. - * @param h height in px the screen should be set to. If out of valid boundaries, current value is assumed. - * @param w_mm width in mm the screen should be set to. If 0, current aspect is assumed. - * @param h_mm height in mm the screen should be set to. If 0, current aspect is assumed. - * @return EINA_TRUE if request was successfully sent or screen is already in - * requested size, EINA_FALSE if parameters are invalid - */ -EAPI Eina_Bool -ecore_x_randr_screen_current_size_set(Ecore_X_Window root, - int w, - int h, - int w_mm, - int h_mm) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(EINA_FALSE); - - Ecore_X_Randr_Screen scr; - int w_c, h_c, w_mm_c, h_mm_c, twmin, thmin, twmax, thmax; - - if (!RANDR_VALIDATE_ROOT(scr, root)) - return EINA_FALSE; - - ecore_x_randr_screen_current_size_get(root, &w_c, &h_c, &w_mm_c, &h_mm_c); - if ((w == w_c) && (h == h_c) && (w_mm_c == w_mm) && (h_mm_c == h_mm)) - return EINA_TRUE; - - ecore_x_randr_screen_size_range_get(root, &twmin, &thmin, &twmax, &thmax); - - if (((w != Ecore_X_Randr_None) && - ((w < twmin) || - (w > twmax))) || - ((h != Ecore_X_Randr_None) && ((h < thmin) || (h > thmax)))) - return EINA_FALSE; - - if (w <= 0) - w = DisplayWidth(_ecore_x_disp, scr); - - if (h <= 0) - h = DisplayHeight(_ecore_x_disp, scr); - - if (w_mm <= 0) - w_mm = - (int)(((double)(DisplayWidthMM(_ecore_x_disp, - scr) / - (double)DisplayWidth(_ecore_x_disp, - scr))) * (double)w); - - if (h_mm <= 0) - h_mm = - (int)(((double)(DisplayHeightMM(_ecore_x_disp, - scr) / - (double)DisplayHeight(_ecore_x_disp, - scr))) * (double)h); - - XRRSetScreenSize (_ecore_x_disp, root, w, h, w_mm, h_mm); - return EINA_TRUE; -#else - return EINA_FALSE; -#endif -} - -/* - * @brief get detailed information for all modes related to a root window's screen - * @param root window which's screen's ressources are queried - * @param num number of modes returned - * @return modes' information - */ -EAPI Ecore_X_Randr_Mode_Info ** -ecore_x_randr_modes_info_get(Ecore_X_Window root, - int *num) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(NULL); - XRRScreenResources *res = NULL; - Ecore_X_Randr_Mode_Info **ret = NULL; - int i; - - if (_ecore_x_randr_root_validate(root) && - (res = _ecore_x_randr_get_screen_resources (_ecore_x_disp, root))) - { - if ((ret = - (Ecore_X_Randr_Mode_Info **)malloc(sizeof( - Ecore_X_Randr_Mode_Info *) - * - res->nmode))) - { - for (i = 0; i < res->nmode; i++) - { - if ((ret[i] = malloc(sizeof(Ecore_X_Randr_Mode_Info)))) - { - ret[i]->xid = res->modes[i].id; - ret[i]->width = res->modes[i].width; - ret[i]->height = res->modes[i].height; - ret[i]->dotClock = res->modes[i].dotClock; - ret[i]->hSyncStart = res->modes[i].hSyncStart; - ret[i]->hSyncEnd = res->modes[i].hSyncEnd; - ret[i]->hTotal = res->modes[i].hTotal; - ret[i]->hSkew = res->modes[i].hSkew; - ret[i]->vSyncStart = res->modes[i].vSyncStart; - ret[i]->vSyncEnd = res->modes[i].vSyncEnd; - ret[i]->vTotal = res->modes[i].vTotal; - if ((ret[i]->name = (malloc(res->modes[i].nameLength + 1)))) - strncpy(ret[i]->name, res->modes[i].name, - (res->modes[i].nameLength + 1)); - else - ret[i]->name = NULL; - - ret[i]->nameLength = res->modes[i].nameLength; - ret[i]->modeFlags = res->modes[i].modeFlags; - } - else - { - while (i > 0) - free(ret[--i]); - free(ret); - ret = NULL; - break; - } - } - } - - if (ret && num) - *num = res->nmode; - - XRRFreeScreenResources(res); - } - - return ret; -#else - return NULL; -#endif -} - -/* - * @brief 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) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(EINA_FALSE); - Ecore_X_Randr_Mode mode = Ecore_X_Randr_None; - - if (_ecore_x_randr_root_validate(root) && mode_info) - mode = XRRCreateMode(_ecore_x_disp, root, (XRRModeInfo*)mode_info); - - return mode; -#else - return Ecore_X_Randr_None; -#endif -} - -/* - * @brief delete a mode from the display - * @param mode_info - * @since 1.2.0 - */ -EAPI void -ecore_x_randr_mode_del(Ecore_X_Randr_Mode mode) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(); - - XRRDestroyMode(_ecore_x_disp, mode); -#else - return; -#endif -} - -/* - * @brief get detailed information for a given mode id - * @param root window which's screen's ressources are queried - * @param mode the XID which identifies the mode of interest - * @return mode's detailed information - */ -EAPI Ecore_X_Randr_Mode_Info * -ecore_x_randr_mode_info_get(Ecore_X_Window root, - Ecore_X_Randr_Mode mode) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(NULL); - XRRScreenResources *res = NULL; - Ecore_X_Randr_Mode_Info *ret = NULL; - int i; - - if (_ecore_x_randr_root_validate(root) && - (res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root))) - { - for (i = 0; i < res->nmode; i++) - { - if ((res->modes[i].id == mode) && - (ret = malloc(sizeof(Ecore_X_Randr_Mode_Info)))) - { - ret->xid = res->modes[i].id; - ret->width = res->modes[i].width; - ret->height = res->modes[i].height; - ret->dotClock = res->modes[i].dotClock; - ret->hSyncStart = res->modes[i].hSyncStart; - ret->hSyncEnd = res->modes[i].hSyncEnd; - ret->hTotal = res->modes[i].hTotal; - ret->hSkew = res->modes[i].hSkew; - ret->vSyncStart = res->modes[i].vSyncStart; - ret->vSyncEnd = res->modes[i].vSyncEnd; - ret->vTotal = res->modes[i].vTotal; - ret->name = NULL; - ret->nameLength = 0; - if (res->modes[i].nameLength > 0) - { - ret->nameLength = res->modes[i].nameLength; - ret->name = malloc(res->modes[i].nameLength + 1); - if (ret->name) - memcpy(ret->name, res->modes[i].name, - res->modes[i].nameLength + 1); - } - ret->modeFlags = res->modes[i].modeFlags; - break; - } - } - XRRFreeScreenResources(res); - } - - return ret; -#else - return NULL; -#endif -} - -/* - * @brief free detailed mode information. The pointer handed in will be set to - * NULL after freeing the memory. - * @param mode_info the mode information that should be freed - */ -EAPI void -ecore_x_randr_mode_info_free(Ecore_X_Randr_Mode_Info *mode_info) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(); - if (!mode_info) - return; - - if (mode_info->name) - free(mode_info->name); - - free(mode_info); - mode_info = NULL; -#endif -} - -/* - * @brief get all known CRTCs related to a root window's screen - * @param root window which's screen's ressources are queried - * @param num number of CRTCs returned - * @return CRTC IDs - */ -EAPI Ecore_X_Randr_Crtc * -ecore_x_randr_crtcs_get(Ecore_X_Window root, - int *num) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(NULL); - XRRScreenResources *res = NULL; - Ecore_X_Randr_Crtc *ret = NULL; - - if (num && root && - (res = _ecore_x_randr_get_screen_resources (_ecore_x_disp, root))) - { - if ((ret = malloc(sizeof(Ecore_X_Randr_Crtc) * res->ncrtc))) - { - memcpy(ret, res->crtcs, (sizeof(Ecore_X_Randr_Crtc) * res->ncrtc)); - *num = res->ncrtc; - } - - XRRFreeScreenResources(res); - } - - return ret; -#else - return NULL; -#endif -} - -/* - * @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. 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. 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_XRANDR - Ecore_X_Window root; - Eina_Rectangle w_geo, c_geo; - Ecore_X_Randr_Crtc *crtcs; - Ecore_X_Randr_Mode mode; - Ecore_X_Randr_Output *ret = NULL; - Window tw; - int ncrtcs, i, nret = 0, rx = 0, ry = 0; - - if (_randr_version < RANDR_1_2) goto _ecore_x_randr_window_crtcs_get_fail; - - ecore_x_window_geometry_get(window, - &w_geo.x, &w_geo.y, - &w_geo.w, &w_geo.h); - - root = ecore_x_window_root_get(window); - crtcs = ecore_x_randr_crtcs_get(root, &ncrtcs); - if (!crtcs) goto _ecore_x_randr_window_crtcs_get_fail; - - /* now get window RELATIVE to root window - thats what matters. */ - XTranslateCoordinates(_ecore_x_disp, window, root, 0, 0, &rx, &ry, &tw); - w_geo.x = rx; - w_geo.y = ry; - - for (i = 0, 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 = realloc(ret, (sizeof(Ecore_X_Randr_Crtc) * ++nret)); - ret[nret] = crtcs[i]; - } - } - free(crtcs); - - if (num) *num = nret; - return ret; - -_ecore_x_randr_window_crtcs_get_fail: -#endif - if (num) *num = 0; - return NULL; -} - -EAPI Ecore_X_Randr_Output * -ecore_x_randr_outputs_get(Ecore_X_Window root, - int *num) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(NULL); - XRRScreenResources *res = NULL; - Ecore_X_Randr_Output *ret = NULL; - - if (num && root && - (res = _ecore_x_randr_get_screen_resources (_ecore_x_disp, root))) - { - if ((ret = malloc(sizeof(Ecore_X_Randr_Output) * res->noutput))) - { - memcpy(ret, res->outputs, - (sizeof(Ecore_X_Randr_Output) * res->noutput)); - if (num) - *num = res->noutput; - } - - if (res) - XRRFreeScreenResources(res); - } - - return ret; -#else - return NULL; -#endif -} - -//Per Crtc -/* - * @brief get a CRTC's outputs. - * @param root the root window which's screen will be queried - * @param num number of outputs referenced by given CRTC - */ -EAPI Ecore_X_Randr_Output * -ecore_x_randr_crtc_outputs_get(Ecore_X_Window root, - Ecore_X_Randr_Crtc crtc, - int *num) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(NULL); - XRRScreenResources *res = NULL; - Ecore_X_Randr_Output *ret = NULL; - XRRCrtcInfo *crtc_info = NULL; - - if (_ecore_x_randr_crtc_validate(root, - crtc) && - (res = - _ecore_x_randr_get_screen_resources (_ecore_x_disp, - root)) && - (crtc_info = XRRGetCrtcInfo(_ecore_x_disp, res, crtc))) - { - if ((ret = malloc(sizeof(Ecore_X_Randr_Output) * crtc_info->noutput))) - { - memcpy(ret, crtc_info->outputs, - (sizeof(Ecore_X_Randr_Output) * crtc_info->noutput)); - if (num) - *num = crtc_info->noutput; - } - - if (crtc_info) - XRRFreeCrtcInfo(crtc_info); - - if (res) - XRRFreeScreenResources(res); - } - - return ret; -#else - return NULL; -#endif -} - -/* - * @brief get a CRTC's possible outputs. - * @param root the root window which's screen will be queried - * @param num number of possible outputs referenced by given CRTC - */ -EAPI Ecore_X_Randr_Output * -ecore_x_randr_crtc_possible_outputs_get(Ecore_X_Window root, - Ecore_X_Randr_Crtc crtc, - int *num) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(NULL); - XRRScreenResources *res = NULL; - Ecore_X_Randr_Output *ret = NULL; - XRRCrtcInfo *crtc_info = NULL; - - if (_ecore_x_randr_crtc_validate(root, - crtc) && - (res = _ecore_x_randr_get_screen_resources (_ecore_x_disp, root))) - { - if ((crtc_info = XRRGetCrtcInfo(_ecore_x_disp, res, crtc))) - { - if ((ret = - malloc(sizeof(Ecore_X_Randr_Output) * crtc_info->npossible))) - { - memcpy(ret, crtc_info->possible, - (sizeof(Ecore_X_Randr_Output) * crtc_info->npossible)); - if (num) - *num = res->ncrtc; - } - - XRRFreeCrtcInfo(crtc_info); - } - - XRRFreeScreenResources(res); - } - - return ret; -#else - return NULL; -#endif -} - -EAPI void -ecore_x_randr_crtc_geometry_get(Ecore_X_Window root, - Ecore_X_Randr_Crtc crtc, - int *x, - int *y, - int *w, - int *h) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(); - XRRScreenResources *res = NULL; - XRRCrtcInfo *crtc_info = NULL; - - if (_ecore_x_randr_crtc_validate(root, - crtc) && - (res = - _ecore_x_randr_get_screen_resources (_ecore_x_disp, - root)) && - (crtc_info = XRRGetCrtcInfo(_ecore_x_disp, res, crtc))) - { - if (x) - *x = crtc_info->x; - - if (y) - *y = crtc_info->y; - - if (w) - *w = crtc_info->width; - - if (h) - *h = crtc_info->height; - - XRRFreeCrtcInfo(crtc_info); - XRRFreeScreenResources(res); - } - -#endif -} - -/* - * @brief sets the position of given CRTC within root window's screen - * @param root the window's screen to be queried - * @param crtc the CRTC which's position within the mentioned screen is to be altered - * @param x position on the x-axis (0 == left) of the screen. if x < 0 current value will be kept. - * @param y position on the y-ayis (0 == top) of the screen. if y < 0, current value will be kept. - * @return EINA_TRUE if position could be successfully be altered. - */ -EAPI Eina_Bool -ecore_x_randr_crtc_pos_set(Ecore_X_Window root, - Ecore_X_Randr_Crtc crtc, - int x, - int y) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(EINA_FALSE); - int w_c, h_c, w_new = 0, h_new = 0; - Eina_Rectangle crtc_geo; - - ecore_x_randr_crtc_geometry_get(root, - crtc, - &crtc_geo.x, - &crtc_geo.y, - &crtc_geo.w, - &crtc_geo.h); - ecore_x_randr_screen_current_size_get(root, &w_c, &h_c, NULL, NULL); - if (x < 0) - x = crtc_geo.x; - - if (y < 0) - y = crtc_geo.y; - - if ((x + crtc_geo.w) > w_c) - w_new = x + crtc_geo.w; - - if ((y + crtc_geo.h) > h_c) - h_new = y + crtc_geo.h; - - if ((w_new != 0) || (h_new != 0)) - if (!ecore_x_randr_screen_current_size_set(root, w_new, h_new, 0, 0)) - return EINA_FALSE; - - return ecore_x_randr_crtc_settings_set(root, - crtc, - NULL, - Ecore_X_Randr_Unset, - x, - y, - Ecore_X_Randr_Unset, - Ecore_X_Randr_Unset); -#else - return EINA_FALSE; -#endif -} - -/** - * @brief Get the current set mode of a given CRTC - * @param root the window's screen to be queried - * @param crtc the CRTC which's should be queried - * @return currently set mode or - in case parameters are invalid - - * Ecore_X_Randr_Unset - */ -EAPI Ecore_X_Randr_Mode -ecore_x_randr_crtc_mode_get(Ecore_X_Window root, - Ecore_X_Randr_Crtc crtc) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(Ecore_X_Randr_Unset); - XRRScreenResources *res = NULL; - XRRCrtcInfo *crtc_info = NULL; - Ecore_X_Randr_Mode ret = Ecore_X_Randr_Unset; - if (_ecore_x_randr_root_validate(root) && - _ecore_x_randr_crtc_validate(root, - crtc) && - (res = - _ecore_x_randr_get_screen_resources(_ecore_x_disp, - root)) && - (crtc_info = XRRGetCrtcInfo(_ecore_x_disp, res, crtc))) - { - ret = crtc_info->mode; - XRRFreeCrtcInfo(crtc_info); - XRRFreeScreenResources(res); - } - - return ret; -#else - return Ecore_X_Randr_Unset; -#endif -} - -/** - * @brief sets a mode for a CRTC and the outputs attached to it - * @param root the window's screen to be queried - * @param crtc the CRTC which shall be set - * @param outputs array of outputs which have to be compatible with the mode. If - * NULL CRTC will be disabled. - * @param noutputs number of outputs in array to be used. Use - * Ecore_X_Randr_Unset (or -1) to use currently used outputs. - * @param mode XID of the mode to be set. If set to 0 the CRTC will be disabled. - * If set to -1 the call will fail. - * @return EINA_TRUE if mode setting was successful. Else EINA_FALSE - */ -EAPI Eina_Bool -ecore_x_randr_crtc_mode_set(Ecore_X_Window root, - Ecore_X_Randr_Crtc crtc, - Ecore_X_Randr_Output *outputs, - int noutputs, - Ecore_X_Randr_Mode mode) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(EINA_FALSE); - - if (mode == Ecore_X_Randr_Unset) - return EINA_FALSE; - - return ecore_x_randr_crtc_settings_set(root, - crtc, - outputs, - noutputs, - Ecore_X_Randr_Unset, - Ecore_X_Randr_Unset, - mode, - Ecore_X_Randr_Unset); -#else - return EINA_FALSE; -#endif -} - -EAPI void -ecore_x_randr_crtc_size_get(Ecore_X_Window root, - Ecore_X_Randr_Crtc crtc, - int *w, - int *h) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(); - ecore_x_randr_crtc_geometry_get(root, crtc, NULL, NULL, w, h); -#endif -} - -EAPI Ecore_X_Randr_Refresh_Rate -ecore_x_randr_crtc_refresh_rate_get(Ecore_X_Window root, - Ecore_X_Randr_Crtc crtc, - Ecore_X_Randr_Mode mode) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(0.0); - XRRScreenResources *res = NULL; - XRRCrtcInfo *crtc_info = NULL; - Ecore_X_Randr_Refresh_Rate ret = 0.0; - int i; - - if (_ecore_x_randr_crtc_validate(root, - crtc) && - (res = _ecore_x_randr_get_screen_resources (_ecore_x_disp, root))) - { - for (i = 0; i < res->nmode; i++) - if (res->modes[i].id == mode) - { - if (res->modes[i].hTotal && res->modes[i].vTotal) - ret = ((double)res->modes[i].dotClock / - ((double)res->modes[i].hTotal * - (double)res->modes[i].vTotal)); - - break; - } - } - - if (crtc_info) - XRRFreeCrtcInfo(crtc_info); - - if (res) - XRRFreeScreenResources(res); - - return ret; -#else - return 0.0; -#endif -} - -EAPI Ecore_X_Randr_Orientation -ecore_x_randr_crtc_orientations_get(Ecore_X_Window root, - Ecore_X_Randr_Crtc crtc) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(Ecore_X_Randr_None); - XRRCrtcInfo *crtc_info = NULL; - XRRScreenResources *res = NULL; - Ecore_X_Randr_Orientation ret = Ecore_X_Randr_None; - - if (_ecore_x_randr_crtc_validate(root, - crtc) && - (res = - _ecore_x_randr_get_screen_resources (_ecore_x_disp, - root)) && - (crtc_info = XRRGetCrtcInfo(_ecore_x_disp, res, crtc))) - { - ret = crtc_info->rotations; - } - if (crtc_info) - XRRFreeCrtcInfo(crtc_info); - - if (res) - XRRFreeScreenResources(res); - - return ret; -#else - return Ecore_X_Randr_None; -#endif -} - -EAPI Ecore_X_Randr_Orientation -ecore_x_randr_crtc_orientation_get(Ecore_X_Window root, - Ecore_X_Randr_Crtc crtc) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(Ecore_X_Randr_None); - XRRCrtcInfo *crtc_info = NULL; - XRRScreenResources *res = NULL; - Ecore_X_Randr_Orientation ret = Ecore_X_Randr_None; - - if (_ecore_x_randr_crtc_validate(root, - crtc) && - (res = - _ecore_x_randr_get_screen_resources (_ecore_x_disp, - root)) && - (crtc_info = XRRGetCrtcInfo(_ecore_x_disp, res, crtc))) - { - ret = crtc_info->rotation; - } - if (crtc_info) - XRRFreeCrtcInfo(crtc_info); - - if (res) - XRRFreeScreenResources(res); - - return ret; -#else - return Ecore_X_Randr_None; -#endif -} - -EAPI Eina_Bool -ecore_x_randr_crtc_orientation_set(Ecore_X_Window root, - Ecore_X_Randr_Crtc crtc, - Ecore_X_Randr_Orientation orientation) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(EINA_FALSE); - Eina_Bool ret = EINA_FALSE; - - if (orientation != Ecore_X_Randr_None) - { - ret = ecore_x_randr_crtc_settings_set(root, - crtc, - NULL, - Ecore_X_Randr_Unset, - Ecore_X_Randr_Unset, - Ecore_X_Randr_Unset, - Ecore_X_Randr_Unset, - orientation); - } - - return ret; -#else - return EINA_FALSE; -#endif -} - -EAPI void -ecore_x_randr_crtc_pos_get(Ecore_X_Window root, - Ecore_X_Randr_Crtc crtc, - int *x, - int *y) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(); - - ecore_x_randr_crtc_geometry_get(root, crtc, x, y, NULL, NULL); -#endif -} - -EAPI Eina_Bool -ecore_x_randr_crtc_clone_set(Ecore_X_Window root, - Ecore_X_Randr_Crtc original, - Ecore_X_Randr_Crtc clon) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(EINA_FALSE); - - XRRScreenResources *res = NULL; - XRRCrtcInfo *clone_crtc_info = NULL; - Ecore_X_Randr_Mode original_mode = Ecore_X_Randr_None; - Ecore_X_Randr_Orientation original_orientation = Ecore_X_Randr_None; - Eina_Bool ret = EINA_FALSE; - int x, y; - - if (_ecore_x_randr_root_validate(root) && - _ecore_x_randr_crtc_validate(root, - original) && - _ecore_x_randr_crtc_validate(root, - clon) && - (res = - _ecore_x_randr_get_screen_resources (_ecore_x_disp, - root)) && - (clone_crtc_info = XRRGetCrtcInfo(_ecore_x_disp, res, clon))) - { - ecore_x_randr_crtc_geometry_get(root, original, &x, &y, NULL, NULL); - original_mode = ecore_x_randr_crtc_mode_get(root, original); - original_orientation = ecore_x_randr_crtc_orientation_get(root, - original); - ret = ecore_x_randr_crtc_settings_set(root, - clon, - NULL, - Ecore_X_Randr_Unset, - x, - y, - original_mode, - original_orientation); - XRRFreeCrtcInfo(clone_crtc_info); - XRRFreeScreenResources(res); - } - - return ret; -#else - return EINA_FALSE; -#endif -} - -/** - * @brief sets the demanded parameters for a given CRTC. Note that the CRTC is - * auto enabled in it's preferred mode, when it was disabled before. - * @param root the root window which's default display will be queried - * @param crtc the CRTC which's configuration should be altered - * @param outputs an array of outputs, that should display this CRTC's content. - * @param noutputs number of outputs in the array of outputs. - * If set to Ecore_X_Randr_Unset, current outputs and number of outputs will be used. - * If set to Ecore_X_Randr_None, CRTC will be disabled - * @param x new x coordinate. If <0 (e.g. Ecore_X_Randr_Unset) the current x - * corrdinate will be assumed. - * @param y new y coordinate. If <0 (e.g. Ecore_X_Randr_Unset) the current y - * corrdinate will be assumed. - * @param mode the new mode to be set. If Ecore_X_Randr_None is passed, the - * CRTC will be disabled. If Ecore_X_Randr_Unset is passed, the current mode is assumed. - * @param orientation the new orientation to be set. If Ecore_X_Randr_Unset is used, - * the current mode is assumed. - * @return EINA_TRUE if the configuration alteration was successful, else - * EINA_FALSE - */ -EAPI Eina_Bool -ecore_x_randr_crtc_settings_set(Ecore_X_Window root, - Ecore_X_Randr_Crtc crtc, - Ecore_X_Randr_Output *outputs, - int noutputs, - int x, - int y, - Ecore_X_Randr_Mode mode, - Ecore_X_Randr_Orientation orientation) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(EINA_FALSE); - XRRScreenResources *res = NULL; - XRRCrtcInfo *crtc_info = NULL; - Eina_Bool ret = EINA_FALSE; - - if (_ecore_x_randr_crtc_validate(root, - crtc) && - (res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root))) - { - if ((crtc_info = XRRGetCrtcInfo(_ecore_x_disp, res, crtc))) - { - if ((mode == Ecore_X_Randr_None) || - (noutputs == Ecore_X_Randr_None)) - { - outputs = NULL; - noutputs = 0; - } - else if (noutputs == (int)Ecore_X_Randr_Unset) - { - outputs = (Ecore_X_Randr_Output *)crtc_info->outputs; - noutputs = crtc_info->noutput; - } - - if (mode == Ecore_X_Randr_Unset) - mode = crtc_info->mode; - - if (x < 0) - x = crtc_info->x; - - if (y < 0) - y = crtc_info->y; - - if (orientation == Ecore_X_Randr_Unset) - orientation = crtc_info->rotation; - - if (!XRRSetCrtcConfig(_ecore_x_disp, res, crtc, CurrentTime, - x, y, mode, orientation, (RROutput *)outputs, - noutputs)) - ret = EINA_TRUE; - - XRRFreeCrtcInfo(crtc_info); - } - - XRRFreeScreenResources(res); - } - - return ret; -#else - return EINA_FALSE; -#endif -} - -/** - * @brief sets a CRTC relative to another one. - * @param crtc_r1 the CRTC to be positioned. - * @param crtc_r2 the CRTC the position should be relative to - * @param policy the relation between the crtcs - * @param alignment in case CRTCs size differ, aligns CRTC1 accordingly at CRTC2's - * borders - * @return EINA_TRUE if crtc could be successfully positioned. EINA_FALSE if - * repositioning failed or if position of new crtc would be out of given screen's min/max bounds. - */ -EAPI Eina_Bool -ecore_x_randr_crtc_pos_relative_set(Ecore_X_Window root, - Ecore_X_Randr_Crtc crtc_r1, - Ecore_X_Randr_Crtc crtc_r2, - Ecore_X_Randr_Output_Policy policy, - Ecore_X_Randr_Relative_Alignment alignment) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(EINA_FALSE); - - Eina_Rectangle r1_geo, r2_geo; - int w_max, h_max, cw, ch, x_n = Ecore_X_Randr_Unset, y_n = - Ecore_X_Randr_Unset; - /* - int r1_noutputs, r2_noutputs, r1_nmodes, i, j, outputs_mode_found, mode_w, mode_h; - Ecore_X_Randr_Output *r1_outputs, *r2_outputs, *r2_r1_outputs; - Ecore_X_Randr_Mode *r1_modes, r2_mode, r1_mode; - Eina_Bool ret; - */ - - if ((ecore_x_randr_crtc_mode_get(root, crtc_r1) == Ecore_X_Randr_None) - || (ecore_x_randr_crtc_mode_get(root, crtc_r2) == Ecore_X_Randr_None)) - return EINA_FALSE; - - if (!_ecore_x_randr_crtc_validate(root, crtc_r1) || - (!(crtc_r1 != crtc_r2) && - !_ecore_x_randr_crtc_validate(root, crtc_r2))) - return EINA_FALSE; - - ecore_x_randr_crtc_geometry_get(root, - crtc_r1, - &r1_geo.x, - &r1_geo.y, - &r1_geo.w, - &r1_geo.h); - ecore_x_randr_crtc_geometry_get(root, - crtc_r2, - &r2_geo.x, - &r2_geo.y, - &r2_geo.w, - &r2_geo.h); - ecore_x_randr_screen_size_range_get(root, NULL, NULL, &w_max, &h_max); - ecore_x_randr_screen_current_size_get(root, &cw, &ch, NULL, NULL); - - switch (policy) - { - case ECORE_X_RANDR_OUTPUT_POLICY_RIGHT: - //set r1 right of r2 - x_n = r2_geo.x + r2_geo.w; - - switch (alignment) - { - case ECORE_X_RANDR_RELATIVE_ALIGNMENT_NONE: - y_n = Ecore_X_Randr_Unset; - break; - - case ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_REL: - y_n = - ((int)(((double)r2_geo.h / - 2.0) + (double)r2_geo.y - ((double)r1_geo.h / 2.0))); - break; - - case ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_SCR: - y_n = ((int)((double)ch / 2.0) - ((double)r1_geo.h / 2.0)); - break; - } - break; - - case ECORE_X_RANDR_OUTPUT_POLICY_LEFT: - //set r1 left of r2 - x_n = r2_geo.x - r1_geo.w; - - switch (alignment) - { - case ECORE_X_RANDR_RELATIVE_ALIGNMENT_NONE: - y_n = Ecore_X_Randr_Unset; - break; - - case ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_REL: - y_n = - ((int)(((double)r2_geo.h / - 2.0) + r2_geo.y - ((double)r1_geo.h / 2.0))); - break; - - case ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_SCR: - y_n = ((int)(((double)ch / 2.0) - ((double)r1_geo.h / 2.0))); - break; - } - break; - - case ECORE_X_RANDR_OUTPUT_POLICY_BELOW: - //set r1 below r2 - y_n = r2_geo.y + r2_geo.h; - - switch (alignment) - { - case ECORE_X_RANDR_RELATIVE_ALIGNMENT_NONE: - x_n = Ecore_X_Randr_Unset; - break; - - case ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_REL: - x_n = - ((int)((((double)r2_geo.x + - (double)r2_geo.w) / 2.0) - ((double)r1_geo.w / 2.0))); - break; - - case ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_SCR: - x_n = ((int)((double)cw / 2.0)); - break; - } - break; - - case ECORE_X_RANDR_OUTPUT_POLICY_ABOVE: - y_n = r2_geo.y - r1_geo.h; - - //set r1 above r2 - switch (alignment) - { - case ECORE_X_RANDR_RELATIVE_ALIGNMENT_NONE: - x_n = Ecore_X_Randr_Unset; - break; - - case ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_REL: - x_n = - ((int)((((double)r2_geo.x + - (double)r2_geo.w) / 2.0) - ((double)r1_geo.w / 2.0))); - break; - - case ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_SCR: - x_n = ((int)((double)cw / 2.0)); - break; - } - break; - - case ECORE_X_RANDR_OUTPUT_POLICY_CLONE: - return ecore_x_randr_crtc_pos_set(root, crtc_r1, r2_geo.x, r2_geo.y); - - /* entire cloning (including modesetting) - //all outputs of crtc1 capable of crtc2's current mode? - r2_mode = ecore_x_randr_crtc_mode_get(root, crtc_r2); - if (!(r1_outputs = - ecore_x_randr_crtc_outputs_get(root, crtc_r1, - &r1_noutputs)) || - (r1_noutputs == 0)) - return EINA_FALSE; - - for (i = 0, outputs_mode_found = 0; i < r1_noutputs; i++) - { - if (!(r1_modes = - ecore_x_randr_output_modes_get(root, r1_outputs[i], - &r1_nmodes, NULL))) - { - free(r1_outputs); - return EINA_FALSE; - } - - for (j = 0; j < r1_nmodes; j++) - { - ecore_x_randr_mode_size_get(root, - r1_modes[j], - &mode_w, - &mode_h); - if ((mode_w == r2_geo.w) && (mode_h == r2_geo.h)) - { - r1_mode = r1_modes[j]; - ++outputs_mode_found; - free(r1_modes); - r1_modes = NULL; - break; - } - } - if (r1_modes) - free(r1_modes); - - if (outputs_mode_found <= i) - { - //an output doesn't support the set mode, cancel! - free(r1_outputs); - return EINA_FALSE; - } - } - free (r1_outputs); - //CRTC 1's outputs support a mode of same geometry as CRTC 2. - ret = - (ecore_x_randr_crtc_mode_set(root, crtc_r1, Ecore_X_Randr_None, - Ecore_X_Randr_None, - r1_mode) && - ecore_x_randr_crtc_pos_set(root, crtc_r1, r2_geo.x, r2_geo.y)); - return ret; - */ - - /* entire cloning on same CRTC - //all outputs of crtc1 capable of crtc2's current mode? - r2_mode = ecore_x_randr_crtc_mode_get(root, crtc_r2); - if (!(r1_outputs = - ecore_x_randr_crtc_outputs_get(root, crtc_r1, - &r1_noutputs)) || - (r1_noutputs == 0)) - return EINA_FALSE; - - for (i = 0, outputs_mode_found = 0; i < r1_noutputs; i++) - { - if (!(r1_modes = - ecore_x_randr_output_modes_get(root, r1_outputs[i], - &r1_nmodes, NULL))) - { - free(r1_outputs); - return EINA_FALSE; - } - - for (j = 0; j < r1_nmodes; j++) - { - if (r1_modes[j] == r2_mode) - { - ++outputs_mode_found; - free(r1_modes); - r1_modes = NULL; - break; - } - } - if (r1_modes) - free(r1_modes); - - if (outputs_mode_found <= i) - { - //an output doesn't support the set mode, cancel! - free(r1_outputs); - return EINA_FALSE; - } - } - //check whether crtc r2 can use all outputs of r1. - if (!(r2_outputs = - ecore_x_randr_crtc_possible_outputs_get(root, crtc_r2, - &r2_noutputs)) || - (r2_noutputs == 0)) - { - free(r1_outputs); - return EINA_FALSE; - } - - for (i = 0; i < r1_noutputs; i++) - { - for (j = 0; j < r2_noutputs; ) - { - if (r1_outputs[i] == r2_outputs[j]) - break; - - j++; - } - if (j == r2_noutputs) - { - //didn't find the output! - free (r1_outputs); - free (r2_outputs); - return EINA_FALSE; - } - } - - //apparently crtc2 supports all outputs of r1 - //TODO: check with the compatible list of outputs (property in RR1.3) - r2_r1_outputs = - malloc(sizeof(Ecore_X_Randr_Output) * (r1_noutputs + r2_noutputs)); - for (i = 0; i < r1_noutputs; i++) - { - r2_r1_outputs[i] = r1_outputs[i]; - } - free(r1_outputs); - for (; i < r2_noutputs; i++) - { - r2_r1_outputs[i] = r2_outputs[i]; - } - free(r2_outputs); - ret = - ecore_x_randr_crtc_mode_set(root, crtc_r2, r2_r1_outputs, - (r1_noutputs + r1_noutputs), r2_mode); - free (r2_r1_outputs); - return ret; - */ - case ECORE_X_RANDR_OUTPUT_POLICY_NONE: - break; - } - if ((x_n == r1_geo.x) && (y_n == r1_geo.x)) - return EINA_TRUE; - - //out of possible bounds? - if (((y_n + r1_geo.h) > h_max) || ((x_n + r1_geo.w) > w_max)) - return EINA_FALSE; - - return ecore_x_randr_crtc_pos_set(root, crtc_r1, x_n, y_n); -#else - return EINA_FALSE; -#endif -} - -/* - * @brief add given mode to given output - * @param output the output the mode is added to - * @param mode the mode added to the output - * @return EINA_FALSE if output or mode equal Ecore_X_Randr_None, else EINA_TRUE - * Additionally, if xcb backend is used, the success of the addition is reported - * back directly. - * @since 1.2.0 - */ -EAPI Eina_Bool -ecore_x_randr_output_mode_add(Ecore_X_Randr_Output output, - Ecore_X_Randr_Mode mode) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(EINA_FALSE); - - if ((output == Ecore_X_Randr_None) || (mode == Ecore_X_Randr_None)) - return EINA_FALSE; - - XRRAddOutputMode(_ecore_x_disp, output, mode); - return EINA_TRUE; -#else - return EINA_FALSE; -#endif -} - -/* - * @brief delete given mode from given output - * @param output the output the mode is removed from - * @param mode the mode removed from the output - * @since 1.2.0 - */ -EAPI void -ecore_x_randr_output_mode_del(Ecore_X_Randr_Output output, - Ecore_X_Randr_Mode mode) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(); - - if ((output == Ecore_X_Randr_None) || (mode == Ecore_X_Randr_None)) - return; - - XRRDeleteOutputMode(_ecore_x_disp, output, mode); -#else - return; -#endif -} - -EAPI Ecore_X_Randr_Mode * -ecore_x_randr_output_modes_get(Ecore_X_Window root, - Ecore_X_Randr_Output output, - int *num, - int *npreferred) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(NULL); - XRRScreenResources *res = NULL; - XRROutputInfo *output_info = NULL; - Ecore_X_Randr_Mode *modes = NULL; - - if ((output != Ecore_X_Randr_None) - && (res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root)) - && (output_info = - XRRGetOutputInfo(_ecore_x_disp, res, (RROutput)output))) - { - if ((modes = malloc(sizeof(Ecore_X_Randr_Mode) * output_info->nmode))) - { - memcpy(modes, output_info->modes, - (sizeof(Ecore_X_Randr_Mode) * output_info->nmode)); - if (num) - *num = output_info->nmode; - - if (npreferred) - *npreferred = output_info->npreferred; - } - } - - if (output_info) - XRRFreeOutputInfo(output_info); - - if (res) - XRRFreeScreenResources(res); - - return modes; -#else - return NULL; -#endif -} - -EAPI Ecore_X_Randr_Crtc * -ecore_x_randr_output_possible_crtcs_get(Ecore_X_Window root, - Ecore_X_Randr_Output output, - int *num) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(NULL); - XRRScreenResources *res = NULL; - XRROutputInfo *output_info = NULL; - Ecore_X_Randr_Crtc *crtcs = NULL; - - if ((output != Ecore_X_Randr_None)) - { - if ((res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root))) - { - if ((output_info = XRRGetOutputInfo(_ecore_x_disp, res, output))) - { - if ((crtcs = malloc(sizeof(Ecore_X_Randr_Crtc) * output_info->ncrtc))) - { - memcpy(crtcs, output_info->crtcs, (sizeof(Ecore_X_Randr_Crtc) * output_info->ncrtc)); - if (num) *num = output_info->ncrtc; - } - XRRFreeOutputInfo(output_info); - } - XRRFreeScreenResources(res); - } - } - return crtcs; -#else - return Ecore_X_Randr_None; -#endif -} - -/** - * @brief gets the the outputs which might be used simultenously on the same - * CRTC. - * @param root window that this information should be queried for. - * @param output the output which's clones we concern - * @param num number of possible clones - */ -EAPI Ecore_X_Randr_Output * -ecore_x_randr_output_clones_get(Ecore_X_Window root, - Ecore_X_Randr_Output output, - int *num) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(NULL); - XRRScreenResources *res = NULL; - XRROutputInfo *output_info = NULL; - Ecore_X_Randr_Output *outputs = NULL; - - if ((output != Ecore_X_Randr_None)) - { - if ((res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root))) - { - if ((output_info = XRRGetOutputInfo(_ecore_x_disp, res, output))) - { - if ((outputs = malloc(sizeof(Ecore_X_Randr_Output) * output_info->nclone))) - { - memcpy(outputs, output_info->clones, (sizeof(Ecore_X_Randr_Output) * output_info->nclone)); - if (num) *num = output_info->nclone; - } - XRRFreeOutputInfo(output_info); - } - XRRFreeScreenResources(res); - } - } - return outputs; -#else - return Ecore_X_Randr_None; -#endif -} - -EAPI Ecore_X_Randr_Crtc -ecore_x_randr_output_crtc_get(Ecore_X_Window root, - Ecore_X_Randr_Output output) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(Ecore_X_Randr_None); - XRRScreenResources *res = NULL; - XRROutputInfo *output_info = NULL; - Ecore_X_Randr_Crtc ret = Ecore_X_Randr_None; - - if ((output != Ecore_X_Randr_None)) - { - if ((res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root))) - { - if ((output_info = XRRGetOutputInfo(_ecore_x_disp, res, output))) - { - ret = output_info->crtc; - XRRFreeOutputInfo(output_info); - } - XRRFreeScreenResources(res); - } - } - - return ret; -#else - return Ecore_X_Randr_None; -#endif -} - -/** - * @brief gets the given output's name as reported by X - * @param root the window which's screen will be queried - * @param len length of returned c-string. - * @return name of the output as reported by X - */ -EAPI char * -ecore_x_randr_output_name_get(Ecore_X_Window root, - Ecore_X_Randr_Output output, - int *len) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(NULL); - XRRScreenResources *res = NULL; - XRROutputInfo *output_info = NULL; - char *ret = NULL; - - if ((output != Ecore_X_Randr_None) - && (res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root)) - && (output_info = XRRGetOutputInfo(_ecore_x_disp, res, output))) - { - /* - * Actually the below command is correct, but due to a bug in libXrandr - * it doesn't work. Therefore we stick with strlen(). - * Replace the line below with the following once this bug is - * fixed within libXrandr. - * - * *len = output_info->nameLen; - * - */ - if ((ret = strdup(output_info->name)) && len) - *len = strlen(ret); - - XRRFreeOutputInfo(output_info); - } - - if (res) - XRRFreeScreenResources(res); - - return ret; -#else - return NULL; -#endif -} - -/** - * @brief gets the width and hight of a given mode - * @param mode the mode which's size is to be looked up - * @param w width of given mode in px - * @param h height of given mode in px - */ -EAPI void -ecore_x_randr_mode_size_get(Ecore_X_Window root, - Ecore_X_Randr_Mode mode, - int *w, - int *h) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(); - XRRScreenResources *res = NULL; - int i; - - if ((mode != Ecore_X_Randr_None) - && (w || h) - && (res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root))) - { - for (i = 0; i < res->nmode; i++) - { - if (res->modes[i].id == mode) - { - if (w) - *w = res->modes[i].width; - - if (h) - *h = res->modes[i].height; - - break; - } - } - } - - if (res) - XRRFreeScreenResources(res); - -#endif -} - -/** - * @brief gets the EDID information of an attached output if available. - * Note that this information is not to be compared using ordinary string - * comparison functions, since it includes 0-bytes. - * @param root window this information should be queried from - * @param output the XID of the output - * @param length length of the byte-array. If NULL, request will fail. - */ -EAPI unsigned char * -ecore_x_randr_output_edid_get(Ecore_X_Window root, - Ecore_X_Randr_Output output, - unsigned long *length) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(NULL); - Atom name = XInternAtom (_ecore_x_disp, RANDR_PROPERTY_EDID, False); - unsigned char *prop_data, *ret = NULL; - int actual_format; - unsigned long nitems, bytes_after; - Atom actual_type; - - if (!length || !_ecore_x_randr_output_validate(root, output)) - return NULL; - - if (XRRGetOutputProperty (_ecore_x_disp, output, name, - 0, 100, False, False, - AnyPropertyType, - &actual_type, &actual_format, - &nitems, &bytes_after, &prop_data) == Success) - { - if (actual_type == XA_INTEGER && actual_format == 8) - { - if ((ret = malloc(nitems * sizeof(unsigned char)))) - { - if (length && - (memcpy(ret, prop_data, (nitems * sizeof(unsigned char))))) - *length = nitems; - - return ret; - } - } - } - - return NULL; -#else - return NULL; -#endif -} - -EAPI Ecore_X_Randr_Connection_Status -ecore_x_randr_output_connection_status_get(Ecore_X_Window root, - Ecore_X_Randr_Output output) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(ECORE_X_RANDR_CONNECTION_STATUS_UNKNOWN); - XRRScreenResources *res = NULL; - XRROutputInfo *output_info = NULL; - Ecore_X_Randr_Connection_Status ret = - ECORE_X_RANDR_CONNECTION_STATUS_UNKNOWN; - - if ((output != Ecore_X_Randr_None) - && (res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root)) - && (output_info = XRRGetOutputInfo(_ecore_x_disp, res, output))) - { - ret = output_info->connection; - } - - if (output_info) - XRRFreeOutputInfo(output_info); - - if (res) - XRRFreeScreenResources(res); - - return ret; -#else - return ECORE_X_RANDR_CONNECTION_STATUS_UNKNOWN; -#endif -} - -EAPI void -ecore_x_randr_output_size_mm_get(Ecore_X_Window root, - Ecore_X_Randr_Output output, - int *w_mm, - int *h_mm) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(); - XRRScreenResources *res = NULL; - XRROutputInfo *output_info = NULL; - - if ((output != Ecore_X_Randr_None) - && (res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root))) - { - if ((output_info = - XRRGetOutputInfo(_ecore_x_disp, res, (RROutput)output))) - { - if (w_mm) - *w_mm = output_info->mm_width; - - if (h_mm) - *h_mm = output_info->mm_height; - - XRRFreeOutputInfo(output_info); - } - - XRRFreeScreenResources(res); - } - -#endif -} - -EAPI Eina_Bool -ecore_x_randr_move_all_crtcs_but(Ecore_X_Window root, - const Ecore_X_Randr_Crtc *not_moved, - int nnot_moved, - int dx, - int dy) -{ -#ifdef ECORE_XRANDR - Ecore_X_Randr_Crtc *crtcs_to_be_moved = NULL; - XRRScreenResources *res = NULL; - int i, j, k, n; - Eina_Bool ret; - - if ((nnot_moved <= 0) || (!not_moved) - || !_ecore_x_randr_root_validate(root) - || !(res = - _ecore_x_randr_get_screen_resources (_ecore_x_disp, root))) - return EINA_FALSE; - - n = (res->ncrtc - nnot_moved); - if ((crtcs_to_be_moved = malloc(sizeof(Ecore_X_Randr_Crtc) * n))) - { - for (i = 0, k = 0; (i < res->ncrtc) && (k < n); i++) - { - for (j = 0; j < nnot_moved; j++) - { - if (res->crtcs[i] == not_moved[j]) - break; - } - if (j == nnot_moved) - //crtcs[i] is not in the 'not to move'-list - crtcs_to_be_moved[k++] = res->crtcs[i]; - } - } - - XRRFreeScreenResources(res); - ret = ecore_x_randr_move_crtcs(root, crtcs_to_be_moved, n, dx, dy); - free(crtcs_to_be_moved); - return ret; -#else - return EINA_FALSE; -#endif -} - -/* - * @brief move given CRTCs belonging to the given root window's screen dx/dy pixels relative to their current position. The screen size will be automatically adjusted if necessary and possible. - * @param root window which's screen's resources are used - * @param crtcs list of CRTCs to be moved - * @param ncrtc number of CRTCs in array - * @param dx amount of pixels the CRTCs should be moved in x direction - * @param dy amount of pixels the CRTCs should be moved in y direction - * @return EINA_TRUE if all crtcs could be moved successfully. - */ -EAPI Eina_Bool -ecore_x_randr_move_crtcs(Ecore_X_Window root, - const Ecore_X_Randr_Crtc *crtcs, - int ncrtc, - int dx, - int dy) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(EINA_FALSE); - XRRScreenResources *res = NULL; - XRRCrtcInfo **crtc_info = NULL; - Eina_Bool ret = EINA_TRUE; - int i, cw, ch, w_max, h_max, nw, nh; - - crtc_info = alloca(sizeof(XRRCrtcInfo *) * ncrtc); - memset(crtc_info, 0, sizeof(XRRCrtcInfo *) * ncrtc); - if (_ecore_x_randr_root_validate(root) - && (res = _ecore_x_randr_get_screen_resources (_ecore_x_disp, root))) - { - ecore_x_randr_screen_size_range_get(root, NULL, NULL, &w_max, &h_max); - ecore_x_randr_screen_current_size_get(root, &cw, &ch, NULL, NULL); - nw = cw; - nh = ch; - - for (i = 0; - (i < ncrtc) && - (crtc_info[i] = XRRGetCrtcInfo(_ecore_x_disp, res, crtcs[i])); - i++) - { - if (((crtc_info[i]->x + dx) < 0) || - ((int)(crtc_info[i]->x + crtc_info[i]->width + dx) > w_max) - || ((crtc_info[i]->y + dy) < 0) || - ((int)(crtc_info[i]->y + crtc_info[i]->height + dy) > h_max) - ) - goto _ecore_x_randr_move_crtcs_fail_free_crtc_info; - - nw = MAX((int)(crtc_info[i]->x + crtc_info[i]->width + dx), nw); - nh = MAX((int)(crtc_info[i]->y + crtc_info[i]->height + dy), nh); - } - //not out of bounds - - //resize if necessary - if (!(((nw > cw) || - (nh > ch)) || - ecore_x_randr_screen_current_size_set(root, nw, nh, - Ecore_X_Randr_Unset, - Ecore_X_Randr_Unset))) - goto _ecore_x_randr_move_crtcs_fail_free_crtc_info; - - //actually move all the crtcs, keep their rotation and mode. - for (i = 0; (i < ncrtc) && crtc_info[i]; i++) - { - if ((crtc_info[i]) && - (!ecore_x_randr_crtc_settings_set(root, crtcs[i], NULL, - Ecore_X_Randr_Unset, - (crtc_info[i]->x + dx), - (crtc_info[i]->y + dy), - crtc_info[i]->mode, - crtc_info[i]->rotation))) - { - ret = EINA_FALSE; - break; - } - } - if (i < ncrtc) - { - //something went wrong, let's try to move the already moved crtcs - //back. - while ((i--) >= 0) - { - if (crtc_info[i]) - ecore_x_randr_crtc_settings_set(root, - crtcs[i], - NULL, - Ecore_X_Randr_Unset, - (crtc_info[i]->x - dx), - (crtc_info[i]->y - dy), - crtc_info[i]->mode, - crtc_info[i]->rotation); - } - } - - for (i = 0; i < ncrtc; i++) - { - if (crtc_info[i]) XRRFreeCrtcInfo(crtc_info[i]); - } - } - - XRRFreeScreenResources(res); - - return ret; -_ecore_x_randr_move_crtcs_fail_free_crtc_info: - while (i-- > 0) - XRRFreeCrtcInfo(crtc_info[i]); - XRRFreeScreenResources(res); - return EINA_FALSE; -#else - return EINA_FALSE; -#endif -} - -/** - * @brief removes unused screen space. The most upper left CRTC is set to 0x0 - * and all other CRTCs dx,dy respectively. - * @param root the window's screen which will be reset. - */ -EAPI void -ecore_x_randr_screen_reset(Ecore_X_Window root) -{ -#ifdef ECORE_XRANDR - XRRCrtcInfo *crtc_info = NULL; - XRRScreenResources *res = NULL; - //the 100000 are just a random huge number. - int i, dx_min = 100000, dy_min = 100000, w_n = 0, h_n = 0, nenabled_crtcs = 0; - - if (!_ecore_x_randr_root_validate(root) || - !(res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root))) - return; - - Ecore_X_Randr_Crtc enabled_crtcs[res->ncrtc]; - - for (i = 0; i < res->ncrtc; i++) - { - if (!(crtc_info = - XRRGetCrtcInfo(_ecore_x_disp, res, - res->crtcs[i])) || - (crtc_info->mode == Ecore_X_Randr_None) || - (crtc_info->mode == Ecore_X_Randr_Unset) - || ((crtc_info->noutput == 0))) - continue; - - enabled_crtcs[nenabled_crtcs++] = res->crtcs[i]; - - if ((int)(crtc_info->x + crtc_info->width) > w_n) - w_n = (crtc_info->x + crtc_info->width); - - if ((int)(crtc_info->y + crtc_info->height) > h_n) - h_n = (crtc_info->y + crtc_info->height); - - if (crtc_info->x < dx_min) - dx_min = crtc_info->x; - if (crtc_info->y < dy_min) - dy_min = crtc_info->y; - - XRRFreeCrtcInfo(crtc_info); - } - if ((dx_min > 0) || (dy_min > 0)) - { - if (ecore_x_randr_move_crtcs(root, enabled_crtcs, nenabled_crtcs, -dx_min, -dy_min)) - { - w_n -= dx_min; - h_n -= dy_min; - } - } - ecore_x_randr_screen_current_size_set(root, - w_n, - h_n, - Ecore_X_Randr_Unset, - Ecore_X_Randr_Unset); -#endif -} - -/** - * @brief set up the backlight level to the given level. - * @param root the window's screen which will be set. - * @param level of the backlight between 0 and 1 - */ - -EAPI void -ecore_x_randr_screen_backlight_level_set(Ecore_X_Window root, - double level) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(); - Atom _backlight; - XRRScreenResources *resources = NULL; - Ecore_X_Randr_Output output; - int o; - - if ((level < 0) || (level > 1)) - { - ERR("Wrong value for the backlight level. It should be between 0 and 1."); - return; - } - - /* - * To make sure that the _backlight atomic property still exists. - */ - _backlight = XInternAtom(_ecore_x_disp, RANDR_PROPERTY_BACKLIGHT, True); - if (_backlight == None) - { - WRN("Backlight setting is not supported on this server or driver"); - return; - } - - /* get the ressources */ - resources = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root); - if (!resources) return; - - for (o = 0; o < resources->noutput; o++) - { - output = resources->outputs[o]; - if (ecore_x_randr_output_backlight_level_get(root, output) >= 0) - { - ecore_x_randr_output_backlight_level_set(root, output, level); - } - } - XRRFreeScreenResources(resources); -#endif -} - -/* - * @brief check if a backlight is available - * @return whether a blacklight is available - */ - -EAPI Eina_Bool -ecore_x_randr_output_backlight_available(void) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(-1); - Atom _backlight; - - _backlight = XInternAtom(_ecore_x_disp, RANDR_PROPERTY_BACKLIGHT, True); - - return (_backlight == None) ? EINA_FALSE : EINA_TRUE; - -#endif - return EINA_FALSE; -} - -/* - * @brief get the backlight level of the given output - * @param root window which's screen should be queried - * @param output from which the backlight level should be retrieved - * @return the backlight level - */ - -EAPI double -ecore_x_randr_output_backlight_level_get(Ecore_X_Window root, - Ecore_X_Randr_Output output) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(-1); - Atom actual_type; - Atom _backlight; - XRRPropertyInfo *info = NULL; - double dvalue; - int actual_format; - long value, max, min; - unsigned long nitems; - unsigned long bytes_after; - unsigned char *prop = NULL; - - /* set backlight variable if not already done */ - - _backlight = XInternAtom(_ecore_x_disp, RANDR_PROPERTY_BACKLIGHT, True); - if (_backlight == None) - { - ERR("Backlight property is not suppported on this server or driver"); - return -1; - } - - if (!_ecore_x_randr_output_validate(root, output)) - { - ERR("Invalid output"); - return -1; - } - - if (XRRGetOutputProperty(_ecore_x_disp, output, _backlight, - 0, 4, False, False, None, - &actual_type, &actual_format, - &nitems, &bytes_after, &prop) != Success) - { - WRN("Backlight not supported on this output"); - return -1; - } - - if ((actual_type != XA_INTEGER) || (nitems != 1) || (actual_format != 32)) return -1; - - value = *((long *)prop); - free (prop); - - /* I have the current value of the backlight */ - /* Now retrieve the min and max intensities of the output */ - info = XRRQueryOutputProperty(_ecore_x_disp, output, _backlight); - if (info) - { - dvalue = -1; - if ((info->range) && (info->num_values == 2)) - { - /* finally convert the current value in the interval [0..1] */ - min = info->values[0]; - max = info->values[1]; - dvalue = ((double)(value - min)) / ((double)(max - min)); - } - free(info); - return dvalue; - } -#endif - return -1; -} - -/* - * @brief set the backlight level of a given output - * @param root window which's screen should be queried - * @param output that should be set - * @param level for which the backlight should be set - * @return EINA_TRUE in case of success - */ - -EAPI Eina_Bool -ecore_x_randr_output_backlight_level_set(Ecore_X_Window root, - Ecore_X_Randr_Output output, - double level) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_2_RET(EINA_FALSE); - Atom _backlight; - XRRPropertyInfo *info = NULL; - double min, max, tmp; - long new; - - if ((level < 0) || (level > 1)) - { - ERR("Backlight level should be between 0 and 1"); - return EINA_FALSE; - } - - if (!_ecore_x_randr_output_validate(root, output)) - { - ERR("Wrong output value"); - return EINA_FALSE; - } - - _backlight = XInternAtom(_ecore_x_disp, RANDR_PROPERTY_BACKLIGHT, True); - if (_backlight == None) - { - WRN("Backlight property is not suppported on this server or driver"); - return EINA_FALSE; - } - - info = XRRQueryOutputProperty(_ecore_x_disp, output, _backlight); - if (info) - { - if ((info->range) && (info->num_values == 2)) - { - min = info->values[0]; - max = info->values[1]; - tmp = (level * (max - min)) + min; - new = tmp; - if (new > max) new = max; - if (new < min) new = min; - XRRChangeOutputProperty(_ecore_x_disp, output, _backlight, XA_INTEGER, 32, - PropModeReplace, (unsigned char *)&new, 1); - XFlush(_ecore_x_disp); - } - free(info); - return EINA_TRUE; - } -#endif - return EINA_FALSE; -} - -/* - * @brief get the outputs, which display a certain window - * @param window window the displaying outputs shall be found for - * @param num the number of outputs displaying the window - * @return array of outputs that display a certain window. NULL if no outputs - * was found that displays the specified window. - */ - -EAPI Ecore_X_Randr_Output * -ecore_x_randr_window_outputs_get(Ecore_X_Window window, - int *num) -{ -#ifdef ECORE_XRANDR - Ecore_X_Window root; - Ecore_X_Randr_Crtc *crtcs; - Ecore_X_Randr_Output *outputs, *ret = NULL; - int ncrtcs, noutputs, i, nret = 0; - - if (_randr_version < RANDR_1_2) goto _ecore_x_randr_current_output_get_fail; - - 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) - goto _ecore_x_randr_current_output_get_fail_free; - nret += noutputs; - ret = realloc(ret, (nret * sizeof(Ecore_X_Randr_Output))); - memcpy(&ret[nret], outputs, (noutputs * sizeof(Ecore_X_Randr_Output))); - free(outputs); - } - 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; -} - -/* - * @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. NULL if no outputs - * was found that displays the specified window. - */ - -EAPI Ecore_X_Randr_Output * -ecore_x_randr_current_output_get(Ecore_X_Window window, - int *num) -{ - return ecore_x_randr_window_outputs_get(window, num); -} - diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12_edid.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12_edid.c deleted file mode 100644 index 5bda332..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12_edid.c +++ /dev/null @@ -1,463 +0,0 @@ -/* - * Copyright 2006-2009 Red Hat, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * on the rights to use, copy, modify, merge, publish, distribute, sub - * license, and/or sell copies of the Software, and to permit persons to whom - * the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -/* Original Author: Adam Jackson */ -/* Heavily modified by: Leif Middelschulte */ - -#include "Ecore_X.h" -#include -#include -#include -#include - -/* TODO: - * - see other TODO's within this file. - */ - -#define ECORE_X_RANDR_EDID_VERSION_10 ((1 << 8) | 0) -#define ECORE_X_RANDR_EDID_VERSION_11 ((1 << 8) | 1) -#define ECORE_X_RANDR_EDID_VERSION_12 ((1 << 8) | 2) -#define ECORE_X_RANDR_EDID_VERSION_13 ((1 << 8) | 3) -#define ECORE_X_RANDR_EDID_VERSION_14 ((1 << 8) | 4) - -#define _ECORE_X_RANDR_EDID_OFFSET_MANUFACTURER 0x08 -#define _ECORE_X_RANDR_EDID_OFFSET_TYPE 0x14 -#define _ECORE_X_RANDR_EDID_OFFSET_VERSION_MAJOR 0x12 -#define _ECORE_X_RANDR_EDID_OFFSET_VERSION_MINOR 0x13 -#define _ECORE_X_RANDR_EDID_OFFSET_DPMS 0x18 -#define _ECORE_X_RANDR_EDID_OFFSET_COLORSPACE 0x18 -#define _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK 0x36 -#define _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE 3 -#define _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_CONTENT 5 -#define _ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO_PREFERRED 15 -#define _ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO 14 - -#define _ECORE_X_RANDR_EDID_MASK_DIGITAL 0x80 -#define _ECORE_X_RANDR_EDID_MASK_DIGITAL_INTERFACE 0x0f -#define _ECORE_X_RANDR_EDID_MASK_DIGITAL_TMDS_DFP_10 0x01 -#define _ECORE_X_RANDR_EDID_MASK_COLORSCHEME_ANALOGOUS 0x18 -#define _ECORE_X_RANDR_EDID_MASK_COLORSCHEME_DIGITAL_YCRCB_444 0x10 -#define _ECORE_X_RANDR_EDID_MASK_COLORSCHEME_DIGITAL_YCRCB_422 0x08 -#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_PREFERRED 0xe0 -#define _ECORE_X_RANDR_EDID_MASK_DPMS 0xE0 -#define _ECORE_X_RANDR_EDID_MASK_DPMS_STANDBY 0x80 -#define _ECORE_X_RANDR_EDID_MASK_DPMS_SUSPEND 0x40 -#define _ECORE_X_RANDR_EDID_MASK_DPMS_OFF 0x20 -#define _ECORE_X_RANDR_EDID_MASK_INTERFACE_TYPE 0x0f -#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_4_3 0x80 -#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_16_9 0x40 -#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_16_10 0x20 -#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_5_4 0x10 -#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_15_9 0x08 - -#define _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX 13 - -typedef enum _Ecore_X_Randr_Edid_Aspect_Ratio_Preferred { - ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_4_3 = 0x00, - ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_16_9 = 0x01, - ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_16_10 = 0x02, - ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_5_4 = 0x03, - ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_15_9 = 0x04 -} Ecore_X_Randr_Edid_Aspect_Ratio_Preferred; - -/* Some convenience loops */ -#define _ECORE_X_RANDR_EDID_FOR_EACH_EXTENSION_BLOCK(edid, edid_length, extension_block_iter) \ - for (extension_block_iter = edid; extension_block_iter < (edid + edid_length); extension_block_iter += 128) - -#define _ECORE_X_RANDR_EDID_FOR_EACH_CEA_BLOCK(edid, edid_length, cea_block_iter) \ - _ECORE_X_RANDR_EDID_FOR_EACH_EXTENSION_BLOCK(edid, edid_length, cea_block_iter) \ - if (cea_block_iter[0] == 0x02) - -/* The following macro is to be used with caution as it inherits another loop. - * Therefore using a 'break;' statement will lead to continuation in the - * inherent 'Extension block'-loop. - */ -#define _ECORE_X_RANDR_EDID_FOR_EACH_CEA_DETAILED_BLOCK(edid, edid_length, cea_block_iter, detailed_block_iter) \ - _ECORE_X_RANDR_EDID_FOR_EACH_CEA_BLOCK(edid, edid_length, cea_block_iter) \ - for (detailed_block_iter = cea_block_iter + cea_block_iter[2]; detailed_block_iter + 18 < cea_block_iter + 127; detailed_block_iter += 18) \ - if (detailed_block_iter[0]) - -#define _ECORE_X_RANDR_EDID_FOR_EACH_DESCRIPTOR_BLOCK(edid, block) \ - for (block = edid + _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK; block <= (edid + _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK + (3 * 18)); block += 18) - -#define _ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block) \ - _ECORE_X_RANDR_EDID_FOR_EACH_DESCRIPTOR_BLOCK(edid, block) \ - if ((block[0] == 0) && (block[1] == 0)) - -EAPI Eina_Bool -ecore_x_randr_edid_has_valid_header(unsigned char *edid, - unsigned long edid_length) -{ - const unsigned char header[] = - { 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 }; - if (!edid) return EINA_FALSE; - if (edid_length < 8) return EINA_FALSE; - if (!memcmp(edid, header, 8)) return EINA_TRUE; - return EINA_FALSE; -} - -EAPI int -ecore_x_randr_edid_version_get(unsigned char *edid, - unsigned long edid_length) -{ - if ((edid_length > _ECORE_X_RANDR_EDID_OFFSET_VERSION_MINOR) && - (ecore_x_randr_edid_has_valid_header(edid, edid_length))) - return (edid[_ECORE_X_RANDR_EDID_OFFSET_VERSION_MAJOR] << 8) | - edid[_ECORE_X_RANDR_EDID_OFFSET_VERSION_MINOR]; - return ECORE_X_RANDR_EDID_UNKNOWN_VALUE; -} - -EAPI int -ecore_x_randr_edid_manufacturer_model_get(unsigned char *edid, - unsigned long edid_length) -{ - if ((edid_length > 0x0b) && - (ecore_x_randr_edid_has_valid_header(edid, edid_length))) - return (int)(edid[0x0a] + (edid[0x0b] << 8)); - return ECORE_X_RANDR_EDID_UNKNOWN_VALUE; -} - -EAPI int -ecore_x_randr_edid_manufacturer_serial_number_get(unsigned char *edid, - unsigned long edid_length) -{ - if ((edid_length > 0x0f) && - (ecore_x_randr_edid_has_valid_header(edid, edid_length))) - return (int)(edid[0x0c] + (edid[0x0d] << 8) + - (edid[0x0e] << 16) + (edid[0x0f] << 24)); - return ECORE_X_RANDR_EDID_UNKNOWN_VALUE; -} - -EAPI char * -ecore_x_randr_edid_manufacturer_name_get(unsigned char *edid, - unsigned long edid_length) -{ - if ((edid_length > (_ECORE_X_RANDR_EDID_OFFSET_MANUFACTURER + 1)) && - (ecore_x_randr_edid_has_valid_header(edid, edid_length))) - { - unsigned char *x; - char *name; - - x = (edid + _ECORE_X_RANDR_EDID_OFFSET_MANUFACTURER); - name = malloc(sizeof(char) * 4); - if (!name) return NULL; - name[0] = ((x[0] & 0x7c) >> 2) + '@'; - name[1] = ((x[0] & 0x03) << 3) + ((x[1] & 0xe0) >> 5) + '@'; - name[2] = (x[1] & 0x1f) + '@'; - name[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] = 0; - return name; - } - return NULL; -} - -EAPI char * -ecore_x_randr_edid_display_name_get(unsigned char *edid, - unsigned long edid_length) -{ - unsigned char *block = NULL; - int version = ecore_x_randr_edid_version_get(edid, edid_length); - - if (version < ECORE_X_RANDR_EDID_VERSION_13) return NULL; - _ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block) - { - if (block[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] == 0xfc) - { - char *name, *p; - const char *edid_name; - - edid_name = (const char *)block + _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_CONTENT; - name = malloc(sizeof(char) * _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX); - if (!name) return NULL; - strncpy(name, edid_name, (_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX - 1)); - name[_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX] = 0; - for (p = name; *p; p++) - { - if ((*p < ' ') || (*p > '~')) *p = 0; - } - return name; - } - } - return NULL; -} - -EAPI Ecore_X_Randr_Edid_Aspect_Ratio -ecore_x_randr_edid_display_aspect_ratio_preferred_get(unsigned char *edid, - unsigned long edid_length) -{ - unsigned char *block = NULL; - int version = ecore_x_randr_edid_version_get(edid, edid_length); - - if (version < ECORE_X_RANDR_EDID_VERSION_13) return ECORE_X_RANDR_EDID_UNKNOWN_VALUE; - _ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block) - { - if ((block[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] == 0xfd) && - (block[10] == 0x04)) - { - Ecore_X_Randr_Edid_Aspect_Ratio_Preferred preferred_ratio = - (Ecore_X_Randr_Edid_Aspect_Ratio_Preferred) - ((block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO_PREFERRED] & - _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_PREFERRED) >> 5); - switch (preferred_ratio) - { - case ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_4_3: - return ECORE_X_RANDR_EDID_ASPECT_RATIO_4_3; - - case ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_16_9: - return ECORE_X_RANDR_EDID_ASPECT_RATIO_16_9; - - case ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_16_10: - return ECORE_X_RANDR_EDID_ASPECT_RATIO_16_10; - - case ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_5_4: - return ECORE_X_RANDR_EDID_ASPECT_RATIO_5_4; - - case ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_15_9: - return ECORE_X_RANDR_EDID_ASPECT_RATIO_15_9; - - default: - return ECORE_X_RANDR_EDID_UNKNOWN_VALUE; - } - } - } - return ECORE_X_RANDR_EDID_UNKNOWN_VALUE; -} - -EAPI Ecore_X_Randr_Edid_Aspect_Ratio -ecore_x_randr_edid_display_aspect_ratios_get(unsigned char *edid, - unsigned long edid_length) -{ - Ecore_X_Randr_Edid_Aspect_Ratio ret = ECORE_X_RANDR_EDID_UNKNOWN_VALUE; - unsigned char *block = NULL; - int version = ecore_x_randr_edid_version_get(edid, edid_length); - - if (version < ECORE_X_RANDR_EDID_VERSION_13) return ECORE_X_RANDR_EDID_UNKNOWN_VALUE; - _ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block) - { - if ((block[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] == 0xfd) && - (block[10] == 0x04)) - { - if (block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO] & _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_4_3) - ret |= ECORE_X_RANDR_EDID_ASPECT_RATIO_4_3; - if (block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO] & _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_16_9) - ret |= ECORE_X_RANDR_EDID_ASPECT_RATIO_16_9; - if (block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO] & _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_16_10) - ret |= ECORE_X_RANDR_EDID_ASPECT_RATIO_16_10; - if (block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO] & _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_5_4) - ret |= ECORE_X_RANDR_EDID_ASPECT_RATIO_5_4; - if (block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO] & _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_15_9) - ret |= ECORE_X_RANDR_EDID_ASPECT_RATIO_15_9; - } - } - return ret; -} - -EAPI char * -ecore_x_randr_edid_display_ascii_get(unsigned char *edid, - unsigned long edid_length) -{ - unsigned char *block = NULL; - int version = ecore_x_randr_edid_version_get(edid, edid_length); - - if (version < ECORE_X_RANDR_EDID_VERSION_13) return NULL; - _ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block) - { - if (block[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] == 0xfe) - { - char *ascii, *p; - const char *edid_ascii = (const char *)block + - _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_CONTENT; - /* - * TODO: Two of these in a row, in the third and fourth slots, - * seems to be specified by SPWG: http://www.spwg.org/ - */ - ascii = malloc(sizeof(char) * _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX); - if (!ascii) return NULL; - strncpy(ascii, edid_ascii, (_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX - 1)); - ascii[_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX] = 0; - for (p = ascii; *p; p++) - { - if ((*p < ' ') || (*p > '~')) *p = 0; - } - return ascii; - } - } - return NULL; -} - -EAPI char * -ecore_x_randr_edid_display_serial_get(unsigned char *edid, - unsigned long edid_length) -{ - unsigned char *block = NULL; - int version = ecore_x_randr_edid_version_get(edid, edid_length); - - if (version < ECORE_X_RANDR_EDID_VERSION_13) return NULL; - _ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block) - { - if (block[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] == 0xff) - { - char *serial, *p; - const char *edid_serial = (const char *)block + - _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_CONTENT; - /* - * TODO: Two of these in a row, in the third and fourth slots, - * seems to be specified by SPWG: http://www.spwg.org/ - */ - serial = malloc(sizeof(char) * _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX); - if (!serial) return NULL; - strncpy(serial, edid_serial, (_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX - 1)); - serial[_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX] = 0; - for (p = serial; *p; p++) - { - if ((*p < ' ') || (*p > '~')) *p = 0; - } - return serial; - } - } - return NULL; -} - -EAPI Eina_Bool -ecore_x_randr_edid_info_has_valid_checksum(unsigned char *edid, - unsigned long edid_length) -{ - unsigned char *cea_block_iter = NULL; - char sum = 0; - int i; - int version = ecore_x_randr_edid_version_get(edid, edid_length); - - if (version < ECORE_X_RANDR_EDID_VERSION_13) return EINA_FALSE; - if (edid_length < 128) return EINA_FALSE; - - /* Check the EDID block itself */ - for (i = 0; i < 128; i++) - sum += edid[i]; - if (sum) return EINA_FALSE; - - /* Check the cea extension blocks */ - _ECORE_X_RANDR_EDID_FOR_EACH_CEA_BLOCK(edid, edid_length, cea_block_iter) - { - for (i = 0, sum = 0; i < 128; i++) - sum += cea_block_iter[i]; - } - if (sum) return EINA_FALSE; - return EINA_TRUE; -} - -EAPI Eina_Bool -ecore_x_randr_edid_dpms_available_get(unsigned char *edid, - unsigned long edid_length) -{ - int version = ecore_x_randr_edid_version_get(edid, edid_length); - - if (version < ECORE_X_RANDR_EDID_VERSION_13) return EINA_FALSE; - return !!(edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] & - _ECORE_X_RANDR_EDID_MASK_DPMS); -} - -EAPI Eina_Bool -ecore_x_randr_edid_dpms_standby_available_get(unsigned char *edid, - unsigned long edid_length) -{ - int version = ecore_x_randr_edid_version_get(edid, edid_length); - - if (version < ECORE_X_RANDR_EDID_VERSION_13) return EINA_FALSE; - if (edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] & _ECORE_X_RANDR_EDID_MASK_DPMS) - return !!(edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] & - _ECORE_X_RANDR_EDID_MASK_DPMS_STANDBY); - return EINA_FALSE; -} - -EAPI Eina_Bool -ecore_x_randr_edid_dpms_suspend_available_get(unsigned char *edid, - unsigned long edid_length) -{ - int version = ecore_x_randr_edid_version_get(edid, edid_length); - - if (version < ECORE_X_RANDR_EDID_VERSION_13) return EINA_FALSE; - if (edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] & _ECORE_X_RANDR_EDID_MASK_DPMS) - return !!(edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] & - _ECORE_X_RANDR_EDID_MASK_DPMS_SUSPEND); - return EINA_FALSE; -} - -EAPI Eina_Bool -ecore_x_randr_edid_dpms_off_available_get(unsigned char *edid, - unsigned long edid_length) -{ - int version = ecore_x_randr_edid_version_get(edid, edid_length); - - if (version < ECORE_X_RANDR_EDID_VERSION_13) return EINA_FALSE; - if (edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] & _ECORE_X_RANDR_EDID_MASK_DPMS) - return !!(edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] & - _ECORE_X_RANDR_EDID_MASK_DPMS_OFF); - return EINA_FALSE; -} - -EAPI Eina_Bool -ecore_x_randr_edid_display_type_digital_get(unsigned char *edid, - unsigned long edid_length) -{ - int version = ecore_x_randr_edid_version_get(edid, edid_length); - - if (version < ECORE_X_RANDR_EDID_VERSION_13) return EINA_FALSE; - return !!(edid[_ECORE_X_RANDR_EDID_OFFSET_TYPE] & - _ECORE_X_RANDR_EDID_MASK_DIGITAL); -} - -EAPI Ecore_X_Randr_Edid_Display_Colorscheme -ecore_x_randr_edid_display_colorscheme_get(unsigned char *edid, - unsigned long edid_length) -{ - Ecore_X_Randr_Edid_Display_Colorscheme colorscheme = ECORE_X_RANDR_EDID_UNKNOWN_VALUE; - int version = ecore_x_randr_edid_version_get(edid, edid_length); - - if (version < ECORE_X_RANDR_EDID_VERSION_13) return colorscheme; - if (ecore_x_randr_edid_display_type_digital_get(edid, edid_length)) - { - colorscheme = ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_COLOR_RGB_4_4_4; - if (edid[_ECORE_X_RANDR_EDID_OFFSET_COLORSPACE] & - _ECORE_X_RANDR_EDID_MASK_COLORSCHEME_DIGITAL_YCRCB_444) - colorscheme |= ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_COLOR_RGB_YCRCB_4_4_4; - if (edid[_ECORE_X_RANDR_EDID_OFFSET_COLORSPACE] & - _ECORE_X_RANDR_EDID_MASK_COLORSCHEME_DIGITAL_YCRCB_422) - colorscheme |= ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_COLOR_RGB_YCRCB_4_2_2; - } - else - colorscheme = edid[_ECORE_X_RANDR_EDID_OFFSET_COLORSPACE] & _ECORE_X_RANDR_EDID_MASK_COLORSCHEME_ANALOGOUS; - return colorscheme; -} - -EAPI Ecore_X_Randr_Edid_Display_Interface_Type -ecore_x_randr_edid_display_interface_type_get(unsigned char *edid, - unsigned long edid_length) -{ - Ecore_X_Randr_Edid_Display_Interface_Type type = ECORE_X_RANDR_EDID_UNKNOWN_VALUE; - int version = ecore_x_randr_edid_version_get(edid, edid_length); - - if (version < ECORE_X_RANDR_EDID_VERSION_13) return type; - type = edid[_ECORE_X_RANDR_EDID_OFFSET_TYPE] & - _ECORE_X_RANDR_EDID_MASK_INTERFACE_TYPE; - if (type > ECORE_X_RANDR_EDID_DISPLAY_INTERFACE_DISPLAY_PORT) - type = ECORE_X_RANDR_EDID_UNKNOWN_VALUE; - return type; -} - diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_13.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_13.c deleted file mode 100644 index 5d1c8e9..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_13.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * vim:ts=8:sw=3:sts=8:expandtab:cino=>5n-3f0^-2{2 - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "ecore_x_private.h" -#include "ecore_x_randr.h" -#include -#include -#include -#include - -#define Ecore_X_Randr_None 0 -#define Ecore_X_Randr_Unset -1 - -#ifdef ECORE_XRANDR - -#define RANDR_1_3 ((1 << 16) | 3) -#define RANDR_CHECK_1_3_RET(ret) if (_randr_version < RANDR_1_3) \ - return ret - -extern XRRScreenResources *(*_ecore_x_randr_get_screen_resources)(Display * - dpy, - Window - window); -extern int _randr_version; -#endif - -/* - * @param root window which's screen should be queried - * @return Ecore_X_Randr_Ouptut_Id or - if query failed or none is set - Ecore_X_Randr_None - */ -EAPI Ecore_X_Randr_Output -ecore_x_randr_primary_output_get(Ecore_X_Window root) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_3_RET(Ecore_X_Randr_None); - if (!_ecore_x_randr_root_validate(root)) - return Ecore_X_Randr_None; - - return XRRGetOutputPrimary(_ecore_x_disp, root); -#else - return Ecore_X_Randr_None; -#endif -} - -/* - * @param root window which's screen should be queried - * @param output that should be set as given root window's screen primary output - */ -EAPI void -ecore_x_randr_primary_output_set(Ecore_X_Window root, - Ecore_X_Randr_Output output) -{ -#ifdef ECORE_XRANDR - RANDR_CHECK_1_3_RET(); - - if (_ecore_x_randr_output_validate(root, output)) - { - XRRSetOutputPrimary(_ecore_x_disp, root, output); - } - -#endif -} - diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_region.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_region.c deleted file mode 100644 index 81d7eea..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_region.c +++ /dev/null @@ -1,158 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include -#endif /* ifdef HAVE_CONFIG_H */ - -#include "ecore_x_private.h" - -/* - * [x] XCreateRegion - * [ ] XPolygonRegion - * [x] XSetRegion - * [x] XDestroyRegion - * - * [x] XOffsetRegion - * [ ] XShrinkRegion - * - * [ ] XClipBox - * [x] XIntersectRegion - * [x] XUnionRegion - * [x] XUnionRectWithRegion - * [x] XSubtractRegion - * [ ] XXorRegion - * - * [x] XEmptyRegion - * [x] XEqualRegion - * - * [x] XPointInRegion - * [x] XRectInRegion - */ - -EAPI Ecore_X_XRegion * -ecore_x_xregion_new() -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return (Ecore_X_XRegion *)XCreateRegion(); -} - -EAPI void -ecore_x_xregion_free(Ecore_X_XRegion *region) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!region) - return; - - XDestroyRegion((Region)region); -} - -EAPI Eina_Bool -ecore_x_xregion_set(Ecore_X_XRegion *region, - Ecore_X_GC gc) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return XSetRegion(_ecore_x_disp, gc, (Region)region) ? EINA_TRUE : EINA_FALSE; -} - -EAPI void -ecore_x_xregion_translate(Ecore_X_XRegion *region, - int x, - int y) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!region) - return; - - /* return value not used */ - XOffsetRegion((Region)region, x, y); -} - -EAPI Eina_Bool -ecore_x_xregion_intersect(Ecore_X_XRegion *dst, - Ecore_X_XRegion *r1, - Ecore_X_XRegion *r2) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return XIntersectRegion((Region)r1, (Region)r2, (Region)dst) ? EINA_TRUE : EINA_FALSE; -} - -EAPI Eina_Bool -ecore_x_xregion_union(Ecore_X_XRegion *dst, - Ecore_X_XRegion *r1, - Ecore_X_XRegion *r2) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return XUnionRegion((Region)r1, (Region)r2, (Region)dst) ? EINA_TRUE : EINA_FALSE; -} - -EAPI Eina_Bool -ecore_x_xregion_union_rect(Ecore_X_XRegion *dst, - Ecore_X_XRegion *src, - Ecore_X_Rectangle *rect) -{ - XRectangle xr; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - xr.x = rect->x; - xr.y = rect->y; - xr.width = rect->width; - xr.height = rect->height; - - return XUnionRectWithRegion(&xr, (Region)src, (Region)dst) ? EINA_TRUE : EINA_FALSE; -} - -EAPI Eina_Bool -ecore_x_xregion_subtract(Ecore_X_XRegion *dst, - Ecore_X_XRegion *rm, - Ecore_X_XRegion *rs) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return XSubtractRegion((Region)rm, (Region)rs, (Region)dst) ? EINA_TRUE : EINA_FALSE; -} - -EAPI Eina_Bool -ecore_x_xregion_is_empty(Ecore_X_XRegion *region) -{ - if (!region) - return EINA_TRUE; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return XEmptyRegion((Region)region) ? EINA_TRUE : EINA_FALSE; -} - -EAPI Eina_Bool -ecore_x_xregion_is_equal(Ecore_X_XRegion *r1, - Ecore_X_XRegion *r2) -{ - if (!r1 || !r2) - return EINA_FALSE; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return XEqualRegion((Region)r1, (Region)r1) ? EINA_TRUE : EINA_FALSE; -} - -EAPI Eina_Bool -ecore_x_xregion_point_contain(Ecore_X_XRegion *region, - int x, - int y) -{ - if (!region) - return EINA_FALSE; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return XPointInRegion((Region)region, x, y) ? EINA_TRUE : EINA_FALSE; -} - -EAPI Eina_Bool -ecore_x_xregion_rect_contain(Ecore_X_XRegion *region, - Ecore_X_Rectangle *rect) -{ - if (!region || !rect) - return EINA_FALSE; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return XRectInRegion((Region)region, - rect->x, - rect->y, - rect->width, - rect->height) ? EINA_TRUE : EINA_FALSE; -} - diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_screensaver.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_screensaver.c deleted file mode 100644 index 40dd738..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_screensaver.c +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Screensaver code - */ - -#ifdef HAVE_CONFIG_H -# include -#endif /* ifdef HAVE_CONFIG_H */ - -#include "Ecore.h" -#include "ecore_x_private.h" -#include "Ecore_X.h" -#include "Ecore_X_Atoms.h" - -static int _screensaver_available = -1; - -EAPI Eina_Bool -ecore_x_screensaver_event_available_get(void) -{ - if (_screensaver_available >= 0) - return _screensaver_available; - -#ifdef ECORE_XSS - int _screensaver_major, _screensaver_minor; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - _screensaver_major = 1; - _screensaver_minor = 0; - - if (XScreenSaverQueryVersion(_ecore_x_disp, &_screensaver_major, - &_screensaver_minor)) - _screensaver_available = 1; - else - _screensaver_available = 0; - -#else /* ifdef ECORE_XSS */ - _screensaver_available = 0; -#endif /* ifdef ECORE_XSS */ - return _screensaver_available; -} - -EAPI int -ecore_x_screensaver_idle_time_get(void) -{ -#ifdef ECORE_XSS - XScreenSaverInfo *xss; - int idle; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - xss = XScreenSaverAllocInfo(); - XScreenSaverQueryInfo(_ecore_x_disp, - RootWindow(_ecore_x_disp, DefaultScreen( - _ecore_x_disp)), xss); - idle = xss->idle / 1000; - XFree(xss); - - return idle; -#else - return 0; -#endif /* ifdef ECORE_XSS */ -} - -EAPI void -ecore_x_screensaver_set(int timeout, - int interval, - int prefer_blanking, - int allow_exposures) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XSetScreenSaver(_ecore_x_disp, - timeout, - interval, - prefer_blanking, - allow_exposures); -} - -EAPI void -ecore_x_screensaver_timeout_set(int timeout) -{ - int pto, pint, pblank, pexpo; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo); - XSetScreenSaver(_ecore_x_disp, timeout, pint, pblank, pexpo); -} - -EAPI int -ecore_x_screensaver_timeout_get(void) -{ - int pto, pint, pblank, pexpo; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo); - return pto; -} - -EAPI void -ecore_x_screensaver_blank_set(int blank) -{ - int pto, pint, pblank, pexpo; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo); - XSetScreenSaver(_ecore_x_disp, pto, pint, blank, pexpo); -} - -EAPI int -ecore_x_screensaver_blank_get(void) -{ - int pto, pint, pblank, pexpo; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo); - return pblank; -} - -EAPI void -ecore_x_screensaver_expose_set(int expose) -{ - int pto, pint, pblank, pexpo; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo); - XSetScreenSaver(_ecore_x_disp, pto, pint, pblank, expose); -} - -EAPI int -ecore_x_screensaver_expose_get(void) -{ - int pto, pint, pblank, pexpo; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo); - return pexpo; -} - -EAPI void -ecore_x_screensaver_interval_set(int interval) -{ - int pto, pint, pblank, pexpo; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo); - XSetScreenSaver(_ecore_x_disp, pto, interval, pblank, pexpo); -} - -EAPI int -ecore_x_screensaver_interval_get(void) -{ - int pto, pint, pblank, pexpo; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo); - return pint; -} - -EAPI void -ecore_x_screensaver_event_listen_set(Eina_Bool on) -{ -#ifdef ECORE_XSS - Ecore_X_Window root; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - root = DefaultRootWindow(_ecore_x_disp); - if (on) - XScreenSaverSelectInput(_ecore_x_disp, root, ScreenSaverNotifyMask); - else - XScreenSaverSelectInput(_ecore_x_disp, root, 0); -#else - return; - on = EINA_FALSE; -#endif /* ifdef ECORE_XSS */ -} - diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_selection.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_selection.c deleted file mode 100644 index fa177c3..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_selection.c +++ /dev/null @@ -1,1002 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include -#endif /* ifdef HAVE_CONFIG_H */ - -#include -#include - -#include "Ecore.h" -#include "ecore_private.h" -#include "ecore_x_private.h" -#include "Ecore_X.h" -#include "Ecore_X_Atoms.h" - -static Ecore_X_Selection_Intern selections[4]; -static Ecore_X_Selection_Converter *converters = NULL; -static Ecore_X_Selection_Parser *parsers = NULL; - -static Eina_Bool _ecore_x_selection_converter_text(char *target, - void *data, - int size, - void **data_ret, - int *size_ret, - Ecore_X_Atom *tprop, - int *); -static int _ecore_x_selection_data_default_free(void *data); -static void *_ecore_x_selection_parser_files(const char *target, - void *data, - int size, - int format); -static int _ecore_x_selection_data_files_free(void *data); -static void *_ecore_x_selection_parser_text(const char *target, - void *data, - int size, - int format); -static int _ecore_x_selection_data_text_free(void *data); -static void *_ecore_x_selection_parser_targets(const char *target, - void *data, - int size, - int format); -static int _ecore_x_selection_data_targets_free(void *data); - -#define ECORE_X_SELECTION_DATA(x) ((Ecore_X_Selection_Data *)(x)) - -void -_ecore_x_selection_data_init(void) -{ - /* Initialize global data */ - memset(selections, 0, sizeof(selections)); - - /* Initialize converters */ - ecore_x_selection_converter_atom_add(ECORE_X_ATOM_TEXT, - _ecore_x_selection_converter_text); -#ifdef X_HAVE_UTF8_STRING - ecore_x_selection_converter_atom_add(ECORE_X_ATOM_UTF8_STRING, - _ecore_x_selection_converter_text); -#endif /* ifdef X_HAVE_UTF8_STRING */ - ecore_x_selection_converter_atom_add(ECORE_X_ATOM_COMPOUND_TEXT, - _ecore_x_selection_converter_text); - ecore_x_selection_converter_atom_add(ECORE_X_ATOM_STRING, - _ecore_x_selection_converter_text); - - /* Initialize parsers */ - ecore_x_selection_parser_add("text/plain", - _ecore_x_selection_parser_text); - ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_UTF8_STRING, - _ecore_x_selection_parser_text); - ecore_x_selection_parser_add("text/uri-list", - _ecore_x_selection_parser_files); - ecore_x_selection_parser_add("_NETSCAPE_URL", - _ecore_x_selection_parser_files); - ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_TARGETS, - _ecore_x_selection_parser_targets); -} - -void -_ecore_x_selection_shutdown(void) -{ - Ecore_X_Selection_Converter *cnv; - Ecore_X_Selection_Parser *prs; - - /* free the selection converters */ - cnv = converters; - while (cnv) - { - Ecore_X_Selection_Converter *tmp; - - tmp = cnv->next; - free(cnv); - cnv = tmp; - } - converters = NULL; - - /* free the selection parsers */ - prs = parsers; - while (prs) - { - Ecore_X_Selection_Parser *tmp; - - tmp = prs; - prs = prs->next; - free(tmp->target); - free(tmp); - } - parsers = NULL; -} - -Ecore_X_Selection_Intern * -_ecore_x_selection_get(Ecore_X_Atom selection) -{ - if (selection == ECORE_X_ATOM_SELECTION_PRIMARY) - return &selections[0]; - else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY) - return &selections[1]; - else if (selection == ECORE_X_ATOM_SELECTION_XDND) - return &selections[2]; - else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD) - return &selections[3]; - else - return NULL; -} - -Eina_Bool -_ecore_x_selection_set(Window w, - const void *data, - int size, - Ecore_X_Atom selection) -{ - int in; - unsigned char *buf = NULL; - - XSetSelectionOwner(_ecore_x_disp, selection, w, _ecore_x_event_last_time); - if (XGetSelectionOwner(_ecore_x_disp, selection) != w) - return EINA_FALSE; - - if (selection == ECORE_X_ATOM_SELECTION_PRIMARY) - in = 0; - else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY) - in = 1; - else if (selection == ECORE_X_ATOM_SELECTION_XDND) - in = 2; - else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD) - in = 3; - else - return EINA_FALSE; - - if (data) - { - selections[in].win = w; - selections[in].selection = selection; - selections[in].length = size; - selections[in].time = _ecore_x_event_last_time; - - buf = malloc(size); - if (!buf) return EINA_FALSE; - memcpy(buf, data, size); - selections[in].data = buf; - } - else if (selections[in].data) - { - free(selections[in].data); - memset(&selections[in], 0, sizeof(Ecore_X_Selection_Data)); - } - - return EINA_TRUE; -} - -/** - * Claim ownership of the PRIMARY selection and set its data. - * @param w The window to which this selection belongs - * @param data The data associated with the selection - * @param size The size of the data buffer in bytes - * @return Returns 1 if the ownership of the selection was successfully - * claimed, or 0 if unsuccessful. - */ -EAPI Eina_Bool -ecore_x_selection_primary_set(Ecore_X_Window w, - const void *data, - int size) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return _ecore_x_selection_set(w, data, size, ECORE_X_ATOM_SELECTION_PRIMARY); -} - -/** - * Release ownership of the primary selection - * @return Returns 1 if the selection was successfully cleared, - * or 0 if unsuccessful. - * - */ -EAPI Eina_Bool -ecore_x_selection_primary_clear(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return _ecore_x_selection_set(None, NULL, 0, ECORE_X_ATOM_SELECTION_PRIMARY); -} - -/** - * Claim ownership of the SECONDARY selection and set its data. - * @param w The window to which this selection belongs - * @param data The data associated with the selection - * @param size The size of the data buffer in bytes - * @return Returns 1 if the ownership of the selection was successfully - * claimed, or 0 if unsuccessful. - */ -EAPI Eina_Bool -ecore_x_selection_secondary_set(Ecore_X_Window w, - const void *data, - int size) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return _ecore_x_selection_set(w, - data, - size, - ECORE_X_ATOM_SELECTION_SECONDARY); -} - -/** - * Release ownership of the secondary selection - * @return Returns 1 if the selection was successfully cleared, - * or 0 if unsuccessful. - * - */ -EAPI Eina_Bool -ecore_x_selection_secondary_clear(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return _ecore_x_selection_set(None, - NULL, - 0, - ECORE_X_ATOM_SELECTION_SECONDARY); -} - -/** - * Claim ownership of the XDND selection and set its data. - * @param w The window to which this selection belongs - * @param data The data associated with the selection - * @param size The size of the data buffer in bytes - * @return Returns 1 if the ownership of the selection was successfully - * claimed, or 0 if unsuccessful. - */ -EAPI Eina_Bool -ecore_x_selection_xdnd_set(Ecore_X_Window w, - const void *data, - int size) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return _ecore_x_selection_set(w, data, size, ECORE_X_ATOM_SELECTION_XDND); -} - -/** - * Release ownership of the XDND selection - * @return Returns 1 if the selection was successfully cleared, - * or 0 if unsuccessful. - * - */ -EAPI Eina_Bool -ecore_x_selection_xdnd_clear(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return _ecore_x_selection_set(None, NULL, 0, ECORE_X_ATOM_SELECTION_XDND); -} - -/** - * Claim ownership of the CLIPBOARD selection and set its data. - * @param w The window to which this selection belongs - * @param data The data associated with the selection - * @param size The size of the data buffer in bytes - * @return Returns 1 if the ownership of the selection was successfully - * claimed, or 0 if unsuccessful. - * - * Get the converted data from a previous CLIPBOARD selection - * request. The buffer must be freed when done with. - */ -EAPI Eina_Bool -ecore_x_selection_clipboard_set(Ecore_X_Window w, - const void *data, - int size) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return _ecore_x_selection_set(w, - data, - size, - ECORE_X_ATOM_SELECTION_CLIPBOARD); -} - -/** - * Release ownership of the clipboard selection - * @return Returns 1 if the selection was successfully cleared, - * or 0 if unsuccessful. - * - */ -EAPI Eina_Bool -ecore_x_selection_clipboard_clear(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return _ecore_x_selection_set(None, - NULL, - 0, - ECORE_X_ATOM_SELECTION_CLIPBOARD); -} - -Ecore_X_Atom -_ecore_x_selection_target_atom_get(const char *target) -{ - Ecore_X_Atom x_target; - - if (!strcmp(target, ECORE_X_SELECTION_TARGET_TEXT)) - x_target = ECORE_X_ATOM_TEXT; - else if (!strcmp(target, ECORE_X_SELECTION_TARGET_COMPOUND_TEXT)) - x_target = ECORE_X_ATOM_COMPOUND_TEXT; - else if (!strcmp(target, ECORE_X_SELECTION_TARGET_STRING)) - x_target = ECORE_X_ATOM_STRING; - else if (!strcmp(target, ECORE_X_SELECTION_TARGET_UTF8_STRING)) - x_target = ECORE_X_ATOM_UTF8_STRING; - else if (!strcmp(target, ECORE_X_SELECTION_TARGET_FILENAME)) - x_target = ECORE_X_ATOM_FILE_NAME; - else - x_target = ecore_x_atom_get(target); - - return x_target; -} - -char * -_ecore_x_selection_target_get(Ecore_X_Atom target) -{ - /* FIXME: Should not return mem allocated with strdup or X mixed, - * one should use free to free, the other XFree */ - if (target == ECORE_X_ATOM_FILE_NAME) - return strdup(ECORE_X_SELECTION_TARGET_FILENAME); - else if (target == ECORE_X_ATOM_STRING) - return strdup(ECORE_X_SELECTION_TARGET_STRING); - else if (target == ECORE_X_ATOM_UTF8_STRING) - return strdup(ECORE_X_SELECTION_TARGET_UTF8_STRING); - else if (target == ECORE_X_ATOM_TEXT) - return strdup(ECORE_X_SELECTION_TARGET_TEXT); - else - return XGetAtomName(_ecore_x_disp, target); -} - -static void -_ecore_x_selection_request(Ecore_X_Window w, - Ecore_X_Atom selection, - const char *target_str) -{ - Ecore_X_Atom target, prop; - - target = _ecore_x_selection_target_atom_get(target_str); - - if (selection == ECORE_X_ATOM_SELECTION_PRIMARY) - prop = ECORE_X_ATOM_SELECTION_PROP_PRIMARY; - else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY) - prop = ECORE_X_ATOM_SELECTION_PROP_SECONDARY; - else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD) - prop = ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD; - else - return; - - XConvertSelection(_ecore_x_disp, selection, target, prop, - w, CurrentTime); -} - -EAPI void -ecore_x_selection_primary_request(Ecore_X_Window w, - const char *target) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - _ecore_x_selection_request(w, ECORE_X_ATOM_SELECTION_PRIMARY, target); -} - -EAPI void -ecore_x_selection_secondary_request(Ecore_X_Window w, - const char *target) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - _ecore_x_selection_request(w, ECORE_X_ATOM_SELECTION_SECONDARY, target); -} - -EAPI void -ecore_x_selection_xdnd_request(Ecore_X_Window w, - const char *target) -{ - Ecore_X_Atom atom; - Ecore_X_DND_Target *_target; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - _target = _ecore_x_dnd_target_get(); - atom = _ecore_x_selection_target_atom_get(target); - XConvertSelection(_ecore_x_disp, ECORE_X_ATOM_SELECTION_XDND, atom, - ECORE_X_ATOM_SELECTION_PROP_XDND, w, - _target->time); -} - -EAPI void -ecore_x_selection_clipboard_request(Ecore_X_Window w, - const char *target) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - _ecore_x_selection_request(w, ECORE_X_ATOM_SELECTION_CLIPBOARD, target); -} - -EAPI void -ecore_x_selection_converter_atom_add(Ecore_X_Atom target, - Eina_Bool (*func)(char *target, - void *data, - int size, - void **data_ret, - int *size_ret, - Ecore_X_Atom *ttype, - int *tsize)) -{ - Ecore_X_Selection_Converter *cnv; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - cnv = converters; - if (converters) - { - while (1) - { - if (cnv->target == target) - { - cnv->convert = func; - return; - } - - if (cnv->next) - cnv = cnv->next; - else - break; - } - - cnv->next = calloc(1, sizeof(Ecore_X_Selection_Converter)); - if (!cnv->next) return; - cnv = cnv->next; - } - else - { - converters = calloc(1, sizeof(Ecore_X_Selection_Converter)); - if (!converters) return; - cnv = converters; - } - - cnv->target = target; - cnv->convert = func; -} - -EAPI void -ecore_x_selection_converter_add(char *target, - Eina_Bool (*func)(char *target, - void *data, - int size, - void **data_ret, - int *size_ret, - Ecore_X_Atom *, - int *)) -{ - Ecore_X_Atom x_target; - - if (!func || !target) - return; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - x_target = _ecore_x_selection_target_atom_get(target); - - ecore_x_selection_converter_atom_add(x_target, func); -} - -EAPI void -ecore_x_selection_converter_atom_del(Ecore_X_Atom target) -{ - Ecore_X_Selection_Converter *cnv, *prev_cnv; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - prev_cnv = NULL; - cnv = converters; - - while (cnv) - { - if (cnv->target == target) - { - if (prev_cnv) - prev_cnv->next = cnv->next; - else - { - converters = cnv->next; /* This was the first converter */ - } - - free(cnv); - - return; - } - - prev_cnv = cnv; - cnv = cnv->next; - } -} - -EAPI void -ecore_x_selection_converter_del(char *target) -{ - Ecore_X_Atom x_target; - - if (!target) - return; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - x_target = _ecore_x_selection_target_atom_get(target); - ecore_x_selection_converter_atom_del(x_target); -} - -EAPI Eina_Bool -ecore_x_selection_notify_send(Ecore_X_Window requestor, - Ecore_X_Atom selection, - Ecore_X_Atom target, - Ecore_X_Atom property, - Ecore_X_Time tim) -{ - XEvent xev; - XSelectionEvent xnotify; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - xnotify.type = SelectionNotify; - xnotify.display = _ecore_x_disp; - xnotify.requestor = requestor; - xnotify.selection = selection; - xnotify.target = target; - xnotify.property = property; - xnotify.time = tim; - xnotify.send_event = True; - xnotify.serial = 0; - - xev.xselection = xnotify; - return (XSendEvent(_ecore_x_disp, requestor, False, 0, &xev) > 0) ? EINA_TRUE : EINA_FALSE; -} - -/* Locate and run conversion callback for specified selection target */ -EAPI Eina_Bool -ecore_x_selection_convert(Ecore_X_Atom selection, - Ecore_X_Atom target, - void **data_ret, - int *size, - Ecore_X_Atom *targtype, - int *typesize) -{ - Ecore_X_Selection_Intern *sel; - Ecore_X_Selection_Converter *cnv; - void *data; - char *tgt_str; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - sel = _ecore_x_selection_get(selection); - tgt_str = _ecore_x_selection_target_get(target); - - for (cnv = converters; cnv; cnv = cnv->next) - { - if (cnv->target == target) - { - int r; - r = cnv->convert(tgt_str, sel->data, sel->length, &data, size, - targtype, typesize); - free(tgt_str); - if (r) - { - *data_ret = data; - return r; - } - else - return EINA_FALSE; - } - } - - /* ICCCM says "If the selection cannot be converted into a form based on the target (and parameters, if any), the owner should refuse the SelectionRequest as previously described." */ - return EINA_FALSE; - - /* Default, just return the data - * data_ret = malloc(sel->length); - memcpy(*data_ret, sel->data, sel->length); - free(tgt_str); - return 1; - */ -} - -/* TODO: We need to work out a mechanism for automatic conversion to any requested - * locale using Ecore_Txt functions */ -/* Converter for standard non-utf8 text targets */ -static Eina_Bool -_ecore_x_selection_converter_text(char *target, - void *data, - int size, - void **data_ret, - int *size_ret, - Ecore_X_Atom *targprop __UNUSED__, - int *s __UNUSED__) -{ - XTextProperty text_prop; - char *mystr; - XICCEncodingStyle style; - - if (!data || !size) - return EINA_FALSE; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!strcmp(target, ECORE_X_SELECTION_TARGET_TEXT)) - style = XTextStyle; - else if (!strcmp(target, ECORE_X_SELECTION_TARGET_COMPOUND_TEXT)) - style = XCompoundTextStyle; - else if (!strcmp(target, ECORE_X_SELECTION_TARGET_STRING)) - style = XStringStyle; - -#ifdef X_HAVE_UTF8_STRING - else if (!strcmp(target, ECORE_X_SELECTION_TARGET_UTF8_STRING)) - style = XUTF8StringStyle; -#endif /* ifdef X_HAVE_UTF8_STRING */ - else - return EINA_FALSE; - - mystr = alloca(size + 1); - memcpy(mystr, data, size); - mystr[size] = '\0'; - -#ifdef X_HAVE_UTF8_STRING - if (Xutf8TextListToTextProperty(_ecore_x_disp, &mystr, 1, style, - &text_prop) == Success) - { - int bufsize = strlen((char *)text_prop.value) + 1; - *data_ret = malloc(bufsize); - if (!*data_ret) - { - return EINA_FALSE; - } - memcpy(*data_ret, text_prop.value, bufsize); - *size_ret = bufsize; - XFree(text_prop.value); - return EINA_TRUE; - } - -#else /* ifdef X_HAVE_UTF8_STRING */ - if (XmbTextListToTextProperty(_ecore_x_disp, &mystr, 1, style, - &text_prop) == Success) - { - int bufsize = strlen(text_prop.value) + 1; - *data_ret = malloc(bufsize); - if (!*data_ret) return EINA_FALSE; - memcpy(*data_ret, text_prop.value, bufsize); - *size_ret = bufsize; - XFree(text_prop.value); - return EINA_TRUE; - } - -#endif /* ifdef X_HAVE_UTF8_STRING */ - else - { - return EINA_TRUE; - } -} - -EAPI void -ecore_x_selection_parser_add(const char *target, - void *(*func)(const char *target, void *data, - int size, - int format)) -{ - Ecore_X_Selection_Parser *prs; - - if (!target) - return; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - prs = parsers; - if (parsers) - { - while (prs->next) - { - if (!strcmp(prs->target, target)) - { - prs->parse = func; - return; - } - - prs = prs->next; - } - - prs->next = calloc(1, sizeof(Ecore_X_Selection_Parser)); - if (!prs->next) return; - prs = prs->next; - } - else - { - parsers = calloc(1, sizeof(Ecore_X_Selection_Parser)); - if (!parsers) return; - prs = parsers; - } - - prs->target = strdup(target); - prs->parse = func; -} - -EAPI void -ecore_x_selection_parser_del(const char *target) -{ - Ecore_X_Selection_Parser *prs, *prev_prs; - - if (!target) - return; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - prev_prs = NULL; - prs = parsers; - - while (prs) - { - if (!strcmp(prs->target, target)) - { - if (prev_prs) - prev_prs->next = prs->next; - else - { - parsers = prs->next; /* This was the first parser */ - } - - free(prs->target); - free(prs); - - return; - } - - prev_prs = prs; - prs = prs->next; - } -} - -/** - * Change the owner and last-change time for the specified selection. - * @param win The owner of the specified atom. - * @param atom The selection atom - * @param tim Specifies the time - * @since 1.1.0 - */ -EAPI void -ecore_x_selection_owner_set(Ecore_X_Window win, - Ecore_X_Atom atom, - Ecore_X_Time tim) -{ - XSetSelectionOwner(_ecore_x_disp, atom, win, tim); -} - -/** - * Return the window that currently owns the specified selection. - * - * @param atom The specified selection atom. - * - * @return The window that currently owns the specified selection. - * @since 1.1.0 - */ -EAPI Ecore_X_Window -ecore_x_selection_owner_get(Ecore_X_Atom atom) -{ - return XGetSelectionOwner(_ecore_x_disp, atom); -} - -/* Locate and run conversion callback for specified selection target */ -void * -_ecore_x_selection_parse(const char *target, - void *data, - int size, - int format) -{ - Ecore_X_Selection_Parser *prs; - Ecore_X_Selection_Data *sel; - - for (prs = parsers; prs; prs = prs->next) - { - if (!strcmp(prs->target, target)) - { - sel = prs->parse(target, data, size, format); - if (sel) return sel; - } - } - - /* Default, just return the data */ - sel = calloc(1, sizeof(Ecore_X_Selection_Data)); - if (!sel) return NULL; - sel->free = _ecore_x_selection_data_default_free; - sel->length = size; - sel->format = format; - sel->data = data; - return sel; -} - -static int -_ecore_x_selection_data_default_free(void *data) -{ - Ecore_X_Selection_Data *sel; - - sel = data; - free(sel->data); - free(sel); - return 1; -} - -static void * -_ecore_x_selection_parser_files(const char *target, - void *_data, - int size, - int format __UNUSED__) -{ - Ecore_X_Selection_Data_Files *sel; - char *t, *data = _data; - int i, is; - char *tmp; - char **t2; - - if (strcmp(target, "text/uri-list") && - strcmp(target, "_NETSCAPE_URL")) - return NULL; - - sel = calloc(1, sizeof(Ecore_X_Selection_Data_Files)); - if (!sel) return NULL; - ECORE_X_SELECTION_DATA(sel)->free = _ecore_x_selection_data_files_free; - - if (data[size - 1]) - { - /* Isn't nul terminated */ - size++; - t = realloc(data, size); - if (!t) - { - free(sel); - return NULL; - } - data = t; - data[size - 1] = 0; - } - - tmp = malloc(size); - if (!tmp) - { - free(sel); - return NULL; - } - i = 0; - is = 0; - while ((is < size) && (data[is])) - { - if ((i == 0) && (data[is] == '#')) - for (; ((data[is]) && (data[is] != '\n')); is++) ; - else - { - if ((data[is] != '\r') && - (data[is] != '\n')) - tmp[i++] = data[is++]; - else - { - while ((data[is] == '\r') || (data[is] == '\n')) - is++; - tmp[i] = 0; - sel->num_files++; - t2 = realloc(sel->files, sel->num_files * sizeof(char *)); - if (t2) - { - sel->files = t2; - sel->files[sel->num_files - 1] = strdup(tmp); - } - tmp[0] = 0; - i = 0; - } - } - } - if (i > 0) - { - tmp[i] = 0; - sel->num_files++; - t2 = realloc(sel->files, sel->num_files * sizeof(char *)); - if (t2) - { - sel->files = t2; - sel->files[sel->num_files - 1] = strdup(tmp); - } - } - - free(tmp); - free(data); - - ECORE_X_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_FILES; - ECORE_X_SELECTION_DATA(sel)->length = sel->num_files; - - return ECORE_X_SELECTION_DATA(sel); -} - -static int -_ecore_x_selection_data_files_free(void *data) -{ - Ecore_X_Selection_Data_Files *sel; - int i; - - sel = data; - if (sel->files) - { - for (i = 0; i < sel->num_files; i++) - free(sel->files[i]); - free(sel->files); - } - - free(sel); - return 0; -} - -static void * -_ecore_x_selection_parser_text(const char *target __UNUSED__, - void *_data, - int size, - int format __UNUSED__) -{ - Ecore_X_Selection_Data_Text *sel; - unsigned char *data = _data; - void *t; - - sel = calloc(1, sizeof(Ecore_X_Selection_Data_Text)); - if (!sel) return NULL; - if (data[size - 1]) - { - /* Isn't nul terminated */ - size++; - t = realloc(data, size); - if (!t) - { - free(sel); - return NULL; - } - data = t; - data[size - 1] = 0; - } - - sel->text = (char *)data; - ECORE_X_SELECTION_DATA(sel)->length = size; - ECORE_X_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_TEXT; - ECORE_X_SELECTION_DATA(sel)->data = data; - ECORE_X_SELECTION_DATA(sel)->free = _ecore_x_selection_data_text_free; - return sel; -} - -static int -_ecore_x_selection_data_text_free(void *data) -{ - Ecore_X_Selection_Data_Text *sel; - - sel = data; - free(sel->text); - free(sel); - return 1; -} - -static void * -_ecore_x_selection_parser_targets(const char *target __UNUSED__, - void *data, - int size, - int format __UNUSED__) -{ - Ecore_X_Selection_Data_Targets *sel; - unsigned long *targets; - int i; - - sel = calloc(1, sizeof(Ecore_X_Selection_Data_Targets)); - if (!sel) return NULL; - targets = (unsigned long *)data; - - sel->num_targets = size - 2; - sel->targets = malloc((size - 2) * sizeof(char *)); - if (!sel->targets) - { - free(sel); - return NULL; - } - for (i = 2; i < size; i++) - sel->targets[i - 2] = XGetAtomName(_ecore_x_disp, targets[i]); - - ECORE_X_SELECTION_DATA(sel)->free = _ecore_x_selection_data_targets_free; - ECORE_X_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_TARGETS; - ECORE_X_SELECTION_DATA(sel)->length = size; - ECORE_X_SELECTION_DATA(sel)->data = data; - return sel; -} - -static int -_ecore_x_selection_data_targets_free(void *data) -{ - Ecore_X_Selection_Data_Targets *sel; - int i; - - sel = data; - - if (sel->targets) - { - for (i = 0; i < sel->num_targets; i++) - XFree(sel->targets[i]); - free(sel->targets); - } - - free(ECORE_X_SELECTION_DATA(sel)->data); - free(sel); - return 1; -} - diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_sync.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_sync.c deleted file mode 100644 index 0c7f546..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_sync.c +++ /dev/null @@ -1,159 +0,0 @@ -/* - * XSync code - */ - -#ifdef HAVE_CONFIG_H -# include -#endif /* ifdef HAVE_CONFIG_H */ - -#include "Ecore.h" -#include "ecore_x_private.h" -#include "Ecore_X.h" -#include "Ecore_X_Atoms.h" - -EAPI Ecore_X_Sync_Alarm -ecore_x_sync_alarm_new(Ecore_X_Sync_Counter counter) -{ - Ecore_X_Sync_Alarm alarm; - XSyncAlarmAttributes values; - XSyncValue init; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XSyncIntToValue(&init, 0); - XSyncSetCounter(_ecore_x_disp, counter, init); - - values.trigger.counter = counter; - values.trigger.value_type = XSyncAbsolute; - XSyncIntToValue(&values.trigger.wait_value, 1); - values.trigger.test_type = XSyncPositiveComparison; - - XSyncIntToValue(&values.delta, 1); - - values.events = True; - - alarm = XSyncCreateAlarm(_ecore_x_disp, - XSyncCACounter | - XSyncCAValueType | - XSyncCAValue | - XSyncCATestType | - XSyncCADelta | - XSyncCAEvents, - &values); - - ecore_x_sync(); - return alarm; -} - -EAPI Eina_Bool -ecore_x_sync_alarm_free(Ecore_X_Sync_Alarm alarm) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return XSyncDestroyAlarm(_ecore_x_disp, alarm); -} - -EAPI Eina_Bool -ecore_x_sync_counter_query(Ecore_X_Sync_Counter counter, - unsigned int *val) -{ - XSyncValue value; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (XSyncQueryCounter(_ecore_x_disp, counter, &value)) - { - *val = (unsigned int)XSyncValueLow32(value); - return EINA_TRUE; - } - - return EINA_FALSE; -} - -EAPI Ecore_X_Sync_Counter -ecore_x_sync_counter_new(int val) -{ - XSyncCounter counter; - XSyncValue v; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XSyncIntToValue(&v, val); - counter = XSyncCreateCounter(_ecore_x_disp, v); - return counter; -} - -EAPI void -ecore_x_sync_counter_free(Ecore_X_Sync_Counter counter) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XSyncDestroyCounter(_ecore_x_disp, counter); -} - -EAPI void -ecore_x_sync_counter_inc(Ecore_X_Sync_Counter counter, - int by) -{ - XSyncValue v; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XSyncIntToValue(&v, by); - XSyncChangeCounter(_ecore_x_disp, counter, v); -} - -EAPI void -ecore_x_sync_counter_val_wait(Ecore_X_Sync_Counter counter, - int val) -{ - XSyncWaitCondition cond; - XSyncValue v, v2; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XSyncQueryCounter(_ecore_x_disp, counter, &v); - XSyncIntToValue(&v, val); - XSyncIntToValue(&v2, val + 1); - cond.trigger.counter = counter; - cond.trigger.value_type = XSyncAbsolute; - cond.trigger.wait_value = v; - cond.trigger.test_type = XSyncPositiveComparison; - cond.event_threshold = v2; - XSyncAwait(_ecore_x_disp, &cond, 1); -// XSync(_ecore_x_disp, False); // dont need this -} - -EAPI void -ecore_x_sync_counter_set(Ecore_X_Sync_Counter counter, - int val) -{ - XSyncValue v; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XSyncIntToValue(&v, val); - XSyncSetCounter(_ecore_x_disp, counter, v); -} - -EAPI void -ecore_x_sync_counter_2_set(Ecore_X_Sync_Counter counter, - int val_hi, - unsigned int val_lo) -{ - XSyncValue v; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XSyncIntsToValue(&v, val_lo, val_hi); - XSyncSetCounter(_ecore_x_disp, counter, v); -} - -EAPI Eina_Bool -ecore_x_sync_counter_2_query(Ecore_X_Sync_Counter counter, - int *val_hi, - unsigned int *val_lo) -{ - XSyncValue value; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (XSyncQueryCounter(_ecore_x_disp, counter, &value)) - { - *val_lo = (unsigned int)XSyncValueLow32(value); - *val_hi = (int)XSyncValueHigh32(value); - return EINA_TRUE; - } - return EINA_FALSE; -} - diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_test.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_test.c deleted file mode 100644 index 23eea10..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_test.c +++ /dev/null @@ -1,167 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include -#endif /* ifdef HAVE_CONFIG_H */ - -#include - -#ifdef ECORE_XTEST -# include -#endif /* ifdef ECORE_XTEST */ - -#include "ecore_x_private.h" -#include "Ecore_X.h" -#include - -EAPI Eina_Bool -#ifdef ECORE_XTEST -ecore_x_test_fake_key_down(const char *key) -#else -ecore_x_test_fake_key_down(const char *key __UNUSED__) -#endif -{ -#ifdef ECORE_XTEST - KeyCode keycode = 0; - KeySym keysym; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!strncmp(key, "Keycode-", 8)) - keycode = atoi(key + 8); - else - { - keysym = XStringToKeysym(key); - if (keysym == NoSymbol) - return EINA_FALSE; - - keycode = XKeysymToKeycode(_ecore_x_disp, keysym); - } - - if (keycode == 0) - return EINA_FALSE; - - return XTestFakeKeyEvent(_ecore_x_disp, keycode, 1, 0) ? EINA_TRUE : EINA_FALSE; -#else /* ifdef ECORE_XTEST */ - return EINA_FALSE; -#endif /* ifdef ECORE_XTEST */ -} - -EAPI Eina_Bool -#ifdef ECORE_XTEST -ecore_x_test_fake_key_up(const char *key) -#else -ecore_x_test_fake_key_up(const char *key __UNUSED__) -#endif -{ -#ifdef ECORE_XTEST - KeyCode keycode = 0; - KeySym keysym; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!strncmp(key, "Keycode-", 8)) - keycode = atoi(key + 8); - else - { - keysym = XStringToKeysym(key); - if (keysym == NoSymbol) - return EINA_FALSE; - - keycode = XKeysymToKeycode(_ecore_x_disp, keysym); - } - - if (keycode == 0) - return EINA_FALSE; - - return XTestFakeKeyEvent(_ecore_x_disp, keycode, 0, 0) ? EINA_TRUE : EINA_FALSE; -#else /* ifdef ECORE_XTEST */ - return EINA_FALSE; -#endif /* ifdef ECORE_XTEST */ -} - -EAPI Eina_Bool -#ifdef ECORE_XTEST -ecore_x_test_fake_key_press(const char *key) -#else -ecore_x_test_fake_key_press(const char *key __UNUSED__) -#endif -{ -#ifdef ECORE_XTEST - KeyCode keycode = 0; - KeySym keysym = 0; - int shift = 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!strncmp(key, "Keycode-", 8)) - keycode = atoi(key + 8); - else - { - keysym = XStringToKeysym(key); - if (keysym == NoSymbol) - return EINA_FALSE; - - keycode = XKeysymToKeycode(_ecore_x_disp, keysym); - if (XKeycodeToKeysym(_ecore_x_disp, keycode, 0) != keysym) - { - if (XKeycodeToKeysym(_ecore_x_disp, keycode, 1) == keysym) - shift = 1; - else - keycode = 0; - } - else - shift = 0; - } - - if (keycode == 0) - { - static int mod = 0; - KeySym *keysyms; - int keycode_min, keycode_max, keycode_num; - int i; - - XDisplayKeycodes(_ecore_x_disp, &keycode_min, &keycode_max); - keysyms = XGetKeyboardMapping(_ecore_x_disp, keycode_min, - keycode_max - keycode_min + 1, - &keycode_num); - mod = (mod + 1) & 0x7; - i = (keycode_max - keycode_min - mod - 1) * keycode_num; - - keysyms[i] = keysym; - XChangeKeyboardMapping(_ecore_x_disp, keycode_min, keycode_num, - keysyms, (keycode_max - keycode_min)); - XFree(keysyms); - XSync(_ecore_x_disp, False); - keycode = keycode_max - mod - 1; - } - - if (shift) - XTestFakeKeyEvent(_ecore_x_disp, - XKeysymToKeycode(_ecore_x_disp, XK_Shift_L), 1, 0); - - XTestFakeKeyEvent(_ecore_x_disp, keycode, 1, 0); - XTestFakeKeyEvent(_ecore_x_disp, keycode, 0, 0); - if (shift) - XTestFakeKeyEvent(_ecore_x_disp, - XKeysymToKeycode(_ecore_x_disp, XK_Shift_L), 0, 0); - - return EINA_TRUE; -#else /* ifdef ECORE_XTEST */ - return EINA_FALSE; -#endif /* ifdef ECORE_XTEST */ -} - -EAPI const char * -ecore_x_keysym_string_get(int keysym) -{ - return XKeysymToString(keysym); -} - -EAPI int -ecore_x_keysym_keycode_get(const char *keyname) -{ - int keycode = 0; - - if (!strncmp(keyname, "Keycode-", 8)) - keycode = atoi(keyname + 8); - else - keycode = XKeysymToKeycode(_ecore_x_disp, XStringToKeysym(keyname)); - - return keycode; -} diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_vsync.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_vsync.c deleted file mode 100644 index 4296bb2..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_vsync.c +++ /dev/null @@ -1,351 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include -#endif /* ifdef HAVE_CONFIG_H */ - -#include "Ecore.h" -#include "ecore_x_private.h" -#include "Ecore_X.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#define ECORE_X_VSYNC_DRI2 1 - -#ifdef ECORE_X_VSYNC_DRI2 -// relevant header bits of dri/drm inlined here to avoid needing external -// headers to build -/// drm -typedef unsigned int drm_magic_t; - -typedef enum -{ - DRM_VBLANK_ABSOLUTE = 0x00000000, - DRM_VBLANK_RELATIVE = 0x00000001, - DRM_VBLANK_EVENT = 0x04000000, - DRM_VBLANK_FLIP = 0x08000000, - DRM_VBLANK_NEXTONMISS = 0x10000000, - DRM_VBLANK_SECONDARY = 0x20000000, - DRM_VBLANK_SIGNAL = 0x40000000 -} -drmVBlankSeqType; - -typedef struct _drmVBlankReq -{ - drmVBlankSeqType type; - unsigned int sequence; - unsigned long signal; -} drmVBlankReq; - -typedef struct _drmVBlankReply -{ - drmVBlankSeqType type; - unsigned int sequence; - long tval_sec; - long tval_usec; -} drmVBlankReply; - -typedef union _drmVBlank -{ - drmVBlankReq request; - drmVBlankReply reply; -} drmVBlank; - -#define DRM_EVENT_CONTEXT_VERSION 2 - -typedef struct _drmEventContext -{ - int version; - void (*vblank_handler)(int fd, - unsigned int sequence, - unsigned int tv_sec, - unsigned int tv_usec, - void *user_data); - void (*page_flip_handler)(int fd, - unsigned int sequence, - unsigned int tv_sec, - unsigned int tv_usec, - void *user_data); -} drmEventContext; - -static int (*sym_drmClose)(int fd) = NULL; -static int (*sym_drmGetMagic)(int fd, - drm_magic_t *magic) = NULL; -static int (*sym_drmWaitVBlank)(int fd, - drmVBlank *vbl) = NULL; -static int (*sym_drmHandleEvent)(int fd, - drmEventContext *evctx) = NULL; - -//// dri - -static Bool (*sym_DRI2QueryExtension)(Display *display, - int *eventBase, - int *errorBase) = NULL; -static Bool (*sym_DRI2QueryVersion)(Display *display, - int *major, - int *minor) = NULL; -static Bool (*sym_DRI2Connect)(Display *display, - XID window, - char **driverName, - char **deviceName) = NULL; -static Bool (*sym_DRI2Authenticate)(Display *display, - XID window, - drm_magic_t magic) = NULL; - -//// dri/drm data needed -static int dri2_event = 0; -static int dri2_error = 0; -static int dri2_major = 0; -static int dri2_minor = 0; -static char *device_name = 0; -static char *driver_name = 0; -static drm_magic_t drm_magic; - -static int drm_fd = -1; -static int drm_event_is_busy = 0; -static int drm_animators_interval = 1; -static drmEventContext drm_evctx; -static Ecore_Fd_Handler *dri_drm_fdh = NULL; - -static void *dri_lib = NULL; -static void *drm_lib = NULL; - -static Window dri_drm_vsync_root = 0; - -static void -_dri_drm_tick_schedule(void) -{ - drmVBlank vbl; - - vbl.request.type = DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT; - vbl.request.sequence = drm_animators_interval; - vbl.request.signal = 0; - sym_drmWaitVBlank(drm_fd, &vbl); -} - -static void -_dri_drm_tick_begin(void *data __UNUSED__) -{ - drm_event_is_busy = 1; - _dri_drm_tick_schedule(); -} - -static void -_dri_drm_tick_end(void *data __UNUSED__) -{ - drm_event_is_busy = 0; -} - -static void -_dri_drm_vblank_handler(int fd __UNUSED__, - unsigned int frame __UNUSED__, - unsigned int sec __UNUSED__, - unsigned int usec __UNUSED__, - void *data __UNUSED__) -{ - ecore_animator_custom_tick(); - if (drm_event_is_busy) _dri_drm_tick_schedule(); -} - -static Eina_Bool -_dri_drm_cb(void *data __UNUSED__, - Ecore_Fd_Handler *fd_handler __UNUSED__) -{ - sym_drmHandleEvent(drm_fd, &drm_evctx); - return ECORE_CALLBACK_RENEW; -} - -// yes. most evil. we dlopen libdrm and libGL etc. to manually find smbols -// so we can be as compatible as possible given the whole mess of the -// gl/dri/drm etc. world. and handle graceful failure at runtime not -// compile time -static int -_dri_drm_link(void) -{ - const char *drm_libs[] = - { - "libdrm.so.2", - "libdrm.so.1", - "libdrm.so.0", - "libdrm.so", - NULL, - }; - const char *dri_libs[] = - { - "libdri2.so.2", - "libdri2.so.1", - "libdri2.so.0", - "libdri2.so", - "libGL.so.4", - "libGL.so.3", - "libGL.so.2", - "libGL.so.1", - "libGL.so.0", - "libGL.so", - NULL, - }; - int i, fail; -#define SYM(lib, xx) \ - do { \ - sym_ ## xx = dlsym(lib, #xx); \ - if (!(sym_ ## xx)) { \ - fprintf(stderr, "%s\n", dlerror()); \ - fail = 1; \ - } \ - } while (0) - - if (dri_lib) return 1; - for (i = 0; drm_libs[i]; i++) - { - drm_lib = dlopen(drm_libs[i], RTLD_LOCAL | RTLD_LAZY); - if (drm_lib) - { - fail = 0; - SYM(drm_lib, drmClose); - SYM(drm_lib, drmWaitVBlank); - SYM(drm_lib, drmHandleEvent); - if (fail) - { - dlclose(drm_lib); - drm_lib = NULL; - } - else break; - } - } - if (!drm_lib) return 0; - for (i = 0; dri_libs[i]; i++) - { - dri_lib = dlopen(dri_libs[i], RTLD_LOCAL | RTLD_LAZY); - if (dri_lib) - { - fail = 0; - SYM(dri_lib, DRI2QueryExtension); - SYM(dri_lib, DRI2QueryVersion); - SYM(dri_lib, DRI2Connect); - SYM(dri_lib, DRI2Authenticate); - if (fail) - { - dlclose(dri_lib); - dri_lib = NULL; - } - else break; - } - } - if (!dri_lib) - { - dlclose(drm_lib); - drm_lib = NULL; - return 0; - } - return 1; -} - -static int -_dri_drm_init(void) -{ - if (!sym_DRI2QueryExtension(_ecore_x_disp, &dri2_event, &dri2_error)) - return 0; - if (!sym_DRI2QueryVersion(_ecore_x_disp, &dri2_major, &dri2_minor)) - return 0; - if (dri2_major < 2) - return 0; - if (!sym_DRI2Connect(_ecore_x_disp, dri_drm_vsync_root, &driver_name, &device_name)) - return 0; - drm_fd = open(device_name, O_RDWR); - if (drm_fd < 0) - return 0; - sym_drmGetMagic(drm_fd, &drm_magic); - if (!sym_DRI2Authenticate(_ecore_x_disp, dri_drm_vsync_root, drm_magic)) - { - close(drm_fd); - drm_fd = -1; - return 0; - } - memset(&drm_evctx, 0, sizeof(drm_evctx)); - drm_evctx.version = DRM_EVENT_CONTEXT_VERSION; - drm_evctx.vblank_handler = _dri_drm_vblank_handler; - drm_evctx.page_flip_handler = NULL; - - dri_drm_fdh = ecore_main_fd_handler_add(drm_fd, ECORE_FD_READ, - _dri_drm_cb, NULL, NULL, NULL); - if (!dri_drm_fdh) - { - close(drm_fd); - drm_fd = -1; - return 0; - } - return 1; -} - -static void -_dri_drm_shutdown(void) -{ - if (drm_fd >= 0) - { - close(drm_fd); - drm_fd = -1; - } - if (dri_drm_fdh) - { - ecore_main_fd_handler_del(dri_drm_fdh); - dri_drm_fdh = NULL; - } -} - -#endif - -EAPI Eina_Bool -ecore_x_vsync_animator_tick_source_set(Ecore_X_Window win) -{ -#ifdef ECORE_X_VSYNC_DRI2 - Ecore_X_Window root; - - root = ecore_x_window_root_get(win); - if (root != dri_drm_vsync_root) - { - dri_drm_vsync_root = root; - if (dri_drm_vsync_root) - { - if (!_dri_drm_link()) - { - ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_TIMER); - return EINA_FALSE; - } - _dri_drm_shutdown(); - if (!_dri_drm_init()) - { - dri_drm_vsync_root = 0; - ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_TIMER); - return EINA_FALSE; - } - ecore_animator_custom_source_tick_begin_callback_set - (_dri_drm_tick_begin, NULL); - ecore_animator_custom_source_tick_end_callback_set - (_dri_drm_tick_end, NULL); - ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_CUSTOM); - } - else - { - if (drm_fd >= 0) - { - _dri_drm_shutdown(); - ecore_animator_custom_source_tick_begin_callback_set - (NULL, NULL); - ecore_animator_custom_source_tick_end_callback_set - (NULL, NULL); - ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_TIMER); - } - } - } - return EINA_TRUE; -#else - return EINA_FALSE; - win = 0; -#endif -} - diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window.c deleted file mode 100644 index 90392bf..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window.c +++ /dev/null @@ -1,1723 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include -#endif /* ifdef HAVE_CONFIG_H */ - -#include -#include -#include - -#include "Ecore.h" -#include "ecore_x_private.h" -#include "Ecore_X.h" -#include "Ecore_X_Atoms.h" - -static int ignore_num = 0; -static Ecore_X_Window *ignore_list = NULL; - -/** - * @defgroup Ecore_X_Window_Create_Group X Window Creation Functions - * - * Functions that can be used to create an X window. - */ - -/** - * Creates a new window. - * @param parent The parent window to use. If @p parent is @c 0, the root - * window of the default display is used. - * @param x X position. - * @param y Y position. - * @param w Width. - * @param h Height. - * @return The new window handle. - * @ingroup Ecore_X_Window_Create_Group - */ -EAPI Ecore_X_Window -ecore_x_window_new(Ecore_X_Window parent, - int x, - int y, - int w, - int h) -{ - Window win; - XSetWindowAttributes attr; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (parent == 0) - parent = DefaultRootWindow(_ecore_x_disp); - - attr.backing_store = NotUseful; - attr.override_redirect = False; - attr.border_pixel = 0; - attr.background_pixmap = None; - attr.bit_gravity = NorthWestGravity; - attr.win_gravity = NorthWestGravity; - attr.save_under = False; - attr.do_not_propagate_mask = NoEventMask; - attr.event_mask = KeyPressMask | - KeyReleaseMask | - ButtonPressMask | - ButtonReleaseMask | - EnterWindowMask | - LeaveWindowMask | - PointerMotionMask | - ExposureMask | - VisibilityChangeMask | - StructureNotifyMask | - FocusChangeMask | - PropertyChangeMask | - ColormapChangeMask; - win = XCreateWindow(_ecore_x_disp, parent, - x, y, w, h, 0, - CopyFromParent, /*DefaultDepth(_ecore_x_disp, DefaultScreen(_ecore_x_disp)),*/ - InputOutput, - CopyFromParent, /*DefaultVisual(_ecore_x_disp, DefaultScreen(_ecore_x_disp)),*/ - CWBackingStore | - CWOverrideRedirect | -/* CWColormap | */ - CWBorderPixel | - CWBackPixmap | - CWSaveUnder | - CWDontPropagate | - CWEventMask | - CWBitGravity | - CWWinGravity, - &attr); - - if (parent == DefaultRootWindow(_ecore_x_disp)) - ecore_x_window_defaults_set(win); - - return win; -} - -/** - * Creates a window with the override redirect attribute set to @c True. - * @param parent The parent window to use. If @p parent is @c 0, the root - * window of the default display is used. - * @param x X position. - * @param y Y position. - * @param w Width. - * @param h Height. - * @return The new window handle. - * @ingroup Ecore_X_Window_Create_Group - */ -EAPI Ecore_X_Window -ecore_x_window_override_new(Ecore_X_Window parent, - int x, - int y, - int w, - int h) -{ - Window win; - XSetWindowAttributes attr; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (parent == 0) - parent = DefaultRootWindow(_ecore_x_disp); - - attr.backing_store = NotUseful; - attr.override_redirect = True; - attr.border_pixel = 0; - attr.background_pixmap = None; - attr.bit_gravity = NorthWestGravity; - attr.win_gravity = NorthWestGravity; - attr.save_under = False; - attr.do_not_propagate_mask = NoEventMask; - attr.event_mask = KeyPressMask | - KeyReleaseMask | - ButtonPressMask | - ButtonReleaseMask | - EnterWindowMask | - LeaveWindowMask | - PointerMotionMask | - ExposureMask | - VisibilityChangeMask | - StructureNotifyMask | - FocusChangeMask | - PropertyChangeMask | - ColormapChangeMask; - win = XCreateWindow(_ecore_x_disp, parent, - x, y, w, h, 0, - CopyFromParent, /*DefaultDepth(_ecore_x_disp, DefaultScreen(_ecore_x_disp)),*/ - InputOutput, - CopyFromParent, /*DefaultVisual(_ecore_x_disp, DefaultScreen(_ecore_x_disp)),*/ - CWBackingStore | - CWOverrideRedirect | -/* CWColormap | */ - CWBorderPixel | - CWBackPixmap | - CWSaveUnder | - CWDontPropagate | - CWEventMask | - CWBitGravity | - CWWinGravity, - &attr); - return win; -} - -/** - * Creates a new input window. - * @param parent The parent window to use. If @p parent is @c 0, the root - * window of the default display is used. - * @param x X position. - * @param y Y position. - * @param w Width. - * @param h Height. - * @return The new window. - * @ingroup Ecore_X_Window_Create_Group - */ -EAPI Ecore_X_Window -ecore_x_window_input_new(Ecore_X_Window parent, - int x, - int y, - int w, - int h) -{ - Window win; - XSetWindowAttributes attr; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (parent == 0) - parent = DefaultRootWindow(_ecore_x_disp); - - attr.override_redirect = True; - attr.do_not_propagate_mask = NoEventMask; - attr.event_mask = KeyPressMask | - KeyReleaseMask | - ButtonPressMask | - ButtonReleaseMask | - EnterWindowMask | - LeaveWindowMask | - PointerMotionMask | - ExposureMask | - VisibilityChangeMask | - StructureNotifyMask | - FocusChangeMask | - PropertyChangeMask | - ColormapChangeMask; - win = XCreateWindow(_ecore_x_disp, parent, - x, y, w, h, 0, - CopyFromParent, - InputOnly, - CopyFromParent, /*DefaultVisual(_ecore_x_disp, DefaultScreen(_ecore_x_disp)),*/ - CWOverrideRedirect | - CWDontPropagate | - CWEventMask, - &attr); - - if (parent == DefaultRootWindow(_ecore_x_disp)) - { - } - - return win; -} - -/** - * @defgroup Ecore_X_Window_Properties_Group X Window Property Functions - * - * Functions that set window properties. - */ - -/** - * Sets the default properties for the given window. - * - * The default properties set for the window are @c WM_CLIENT_MACHINE and - * @c _NET_WM_PID. - * - * @param win The given window. - * @ingroup Ecore_X_Window_Properties_Group - */ -EAPI void -ecore_x_window_defaults_set(Ecore_X_Window win) -{ - long pid; - char buf[MAXHOSTNAMELEN]; - char *hostname[1]; - int argc; - char **argv; - XTextProperty xprop; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - /* - * Set WM_CLIENT_MACHINE. - */ - gethostname(buf, MAXHOSTNAMELEN); - buf[MAXHOSTNAMELEN - 1] = '\0'; - hostname[0] = buf; - /* The ecore function uses UTF8 which Xlib may not like (especially - * with older clients) */ - /* ecore_x_window_prop_string_set(win, ECORE_X_ATOM_WM_CLIENT_MACHINE, - (char *)buf); */ - if (XStringListToTextProperty(hostname, 1, &xprop)) - { - XSetWMClientMachine(_ecore_x_disp, win, &xprop); - XFree(xprop.value); - } - - /* - * Set _NET_WM_PID - */ - pid = getpid(); - ecore_x_netwm_pid_set(win, pid); - - ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NORMAL); - - ecore_app_args_get(&argc, &argv); - ecore_x_icccm_command_set(win, argc, argv); -} - -EAPI void -ecore_x_window_configure(Ecore_X_Window win, - Ecore_X_Window_Configure_Mask mask, - int x, - int y, - int w, - int h, - int border_width, - Ecore_X_Window sibling, - int stack_mode) -{ - XWindowChanges xwc; - - if (!win) - return; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - xwc.x = x; - xwc.y = y; - xwc.width = w; - xwc.height = h; - xwc.border_width = border_width; - xwc.sibling = sibling; - xwc.stack_mode = stack_mode; - - XConfigureWindow(_ecore_x_disp, win, mask, &xwc); -} - -/** - * @defgroup Ecore_X_Window_Destroy_Group X Window Destroy Functions - * - * Functions to destroy X windows. - */ - -/** - * Deletes the given window. - * @param win The given window. - * @ingroup Ecore_X_Window_Destroy_Group - */ -EAPI void -ecore_x_window_free(Ecore_X_Window win) -{ - /* sorry sir, deleting the root window doesn't sound like - * a smart idea. - */ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (win) - XDestroyWindow(_ecore_x_disp, win); -} - -/** - * Set if a window should be ignored. - * @param win The given window. - * @param ignore if to ignore - */ -EAPI void -ecore_x_window_ignore_set(Ecore_X_Window win, - int ignore) -{ - int i, j, cnt; - Ecore_X_Window *t; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (ignore) - { - if (ignore_list) - { - for (i = 0; i < ignore_num; i++) - { - if (win == ignore_list[i]) - return; - } - t = realloc(ignore_list, (ignore_num + 1) * sizeof(Ecore_X_Window)); - if (!t) return; - ignore_list = t; - ignore_list[ignore_num++] = win; - } - else - { - ignore_num = 0; - ignore_list = malloc(sizeof(Ecore_X_Window)); - if (ignore_list) - ignore_list[ignore_num++] = win; - } - } - else - { - if (!ignore_list) - return; - - for (cnt = ignore_num, i = 0, j = 0; i < cnt; i++) - { - if (win != ignore_list[i]) - ignore_list[j++] = ignore_list[i]; - else - ignore_num--; - } - - if (ignore_num <= 0) - { - free(ignore_list); - ignore_list = NULL; - return; - } - t = realloc(ignore_list, ignore_num * sizeof(Ecore_X_Window)); - if (t) ignore_list = t; - } -} - -/** - * Get the ignore list - * @param num number of windows in the list - * @return list of windows to ignore - */ -EAPI Ecore_X_Window * -ecore_x_window_ignore_list(int *num) -{ - if (num) - *num = ignore_num; - - return ignore_list; -} - -/** - * Sends a delete request to the given window. - * @param win The given window. - * @ingroup Ecore_X_Window_Destroy_Group - */ -EAPI void -ecore_x_window_delete_request_send(Ecore_X_Window win) -{ - XEvent xev; - - /* sorry sir, deleting the root window doesn't sound like - * a smart idea. - */ - if (!win) - return; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - xev.xclient.type = ClientMessage; - xev.xclient.display = _ecore_x_disp; - xev.xclient.window = win; - xev.xclient.message_type = ECORE_X_ATOM_WM_PROTOCOLS; - xev.xclient.format = 32; - xev.xclient.data.l[0] = ECORE_X_ATOM_WM_DELETE_WINDOW; - xev.xclient.data.l[1] = CurrentTime; - - XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev); -} - -/** - * @defgroup Ecore_X_Window_Visibility_Group X Window Visibility Functions - * - * Functions to access and change the visibility of X windows. - */ - -/** - * Shows a window. - * - * Synonymous to "mapping" a window in X Window System terminology. - * - * @param win The window to show. - * @ingroup Ecore_X_Window_Visibility - */ -EAPI void -ecore_x_window_show(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XMapWindow(_ecore_x_disp, win); -} - -/** - * Hides a window. - * - * Synonymous to "unmapping" a window in X Window System terminology. - * - * @param win The window to hide. - * @ingroup Ecore_X_Window_Visibility - */ -EAPI void -ecore_x_window_hide(Ecore_X_Window win) -{ - XEvent xev; - Window root; - int idum; - unsigned int uidum; - - /* ICCCM: SEND unmap event... */ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - root = win; - if (ScreenCount(_ecore_x_disp) == 1) - root = DefaultRootWindow(_ecore_x_disp); - else - XGetGeometry(_ecore_x_disp, - win, - &root, - &idum, - &idum, - &uidum, - &uidum, - &uidum, - &uidum); - - xev.xunmap.type = UnmapNotify; - xev.xunmap.serial = 0; - xev.xunmap.send_event = True; - xev.xunmap.display = _ecore_x_disp; - xev.xunmap.event = root; - xev.xunmap.window = win; - xev.xunmap.from_configure = False; - XSendEvent(_ecore_x_disp, xev.xunmap.event, False, - SubstructureRedirectMask | SubstructureNotifyMask, &xev); - XUnmapWindow(_ecore_x_disp, win); -} - -/** - * @defgroup Ecore_X_Window_Geometry_Group X Window Geometry Functions - * - * Functions that change or retrieve the geometry of X windows. - */ - -/** - * Moves a window to the position @p x, @p y. - * - * The position is relative to the upper left hand corner of the - * parent window. - * - * @param win The window to move. - * @param x X position. - * @param y Y position. - * @ingroup Ecore_X_Window_Geometry_Group - */ -EAPI void -ecore_x_window_move(Ecore_X_Window win, - int x, - int y) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XMoveWindow(_ecore_x_disp, win, x, y); -} - -/** - * Resizes a window. - * @param win The window to resize. - * @param w New width of the window. - * @param h New height of the window. - * @ingroup Ecore_X_Window_Geometry_Group - */ -EAPI void -ecore_x_window_resize(Ecore_X_Window win, - int w, - int h) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (w < 1) - w = 1; - - if (h < 1) - h = 1; - - XResizeWindow(_ecore_x_disp, win, w, h); -} - -/** - * Moves and resizes a window. - * @param win The window to move and resize. - * @param x New X position of the window. - * @param y New Y position of the window. - * @param w New width of the window. - * @param h New height of the window. - * @ingroup Ecore_X_Window_Geometry_Group - */ -EAPI void -ecore_x_window_move_resize(Ecore_X_Window win, - int x, - int y, - int w, - int h) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (w < 1) - w = 1; - - if (h < 1) - h = 1; - - XMoveResizeWindow(_ecore_x_disp, win, x, y, w, h); -} - -/** - * @defgroup Ecore_X_Window_Focus_Functions X Window Focus Functions - * - * Functions that give the focus to an X Window. - */ - -/** - * Sets the focus to the window @p win. - * @param win The window to focus. - * @ingroup Ecore_X_Window_Focus_Functions - */ -EAPI void -ecore_x_window_focus(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (win == 0) - win = DefaultRootWindow(_ecore_x_disp); // XSetInputFocus(_ecore_x_disp, win, RevertToNone, CurrentTime); - -// XSetInputFocus(_ecore_x_disp, win, RevertToPointerRoot, CurrentTime); - XSetInputFocus(_ecore_x_disp, win, RevertToParent, CurrentTime); -} - -/** - * Sets the focus to the given window at a specific time. - * @param win The window to focus. - * @param t When to set the focus to the window. - * @ingroup Ecore_X_Window_Focus_Functions - */ -EAPI void -ecore_x_window_focus_at_time(Ecore_X_Window win, - Ecore_X_Time t) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (win == 0) - win = DefaultRootWindow(_ecore_x_disp); // XSetInputFocus(_ecore_x_disp, win, RevertToNone, t); - -// XSetInputFocus(_ecore_x_disp, win, PointerRoot, t); - XSetInputFocus(_ecore_x_disp, win, RevertToParent, t); -} - -/** - * 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) -{ - Window win; - int revert_mode; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - win = 0; - XGetInputFocus(_ecore_x_disp, &win, &revert_mode); - return win; -} - -/** - * @defgroup Ecore_X_Window_Z_Order_Group X Window Z Order Functions - * - * Functions that change the Z order of X windows. - */ - -/** - * Raises the given window. - * @param win The window to raise. - * @ingroup Ecore_X_Window_Z_Order_Group - */ -EAPI void -ecore_x_window_raise(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XRaiseWindow(_ecore_x_disp, win); -} - -/** - * Lowers the given window. - * @param win The window to lower. - * @ingroup Ecore_X_Window_Z_Order_Group - */ -EAPI void -ecore_x_window_lower(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XLowerWindow(_ecore_x_disp, win); -} - -/** - * @defgroup Ecore_X_Window_Parent_Group X Window Parent Functions - * - * Functions that retrieve or changes the parent window of a window. - */ - -/** - * Moves a window to within another window at a given position. - * @param win The window to reparent. - * @param new_parent The new parent window. - * @param x X position within new parent window. - * @param y Y position within new parent window. - * @ingroup Ecore_X_Window_Parent_Group - */ -EAPI void -ecore_x_window_reparent(Ecore_X_Window win, - Ecore_X_Window new_parent, - int x, - int y) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (new_parent == 0) - new_parent = DefaultRootWindow(_ecore_x_disp); - - XReparentWindow(_ecore_x_disp, win, new_parent, x, y); -} - -/** - * Retrieves the size of the given window. - * @param win The given window. - * @param w Pointer to an integer into which the width is to be stored. - * @param h Pointer to an integer into which the height is to be stored. - * @ingroup Ecore_X_Window_Geometry_Group - */ -EAPI void -ecore_x_window_size_get(Ecore_X_Window win, - int *w, - int *h) -{ - int dummy_x, dummy_y; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (win == 0) - win = DefaultRootWindow(_ecore_x_disp); - - ecore_x_drawable_geometry_get(win, &dummy_x, &dummy_y, w, h); -} - -/** - * Retrieves the geometry of the given window. - * - * Note that the x & y coordingates are relative to your parent. In - * particular for reparenting window managers - relative to you window border. - * If you want screen coordinates either walk the window tree to the root, - * else for ecore_evas applications see ecore_evas_geometry_get(). Elementary - * applications can use elm_win_screen_position_get(). - * - * @param win The given window. - * @param x Pointer to an integer in which the X position is to be stored. - * @param y Pointer to an integer in which the Y position is to be stored. - * @param w Pointer to an integer in which the width is to be stored. - * @param h Pointer to an integer in which the height is to be stored. - * @ingroup Ecore_X_Window_Geometry_Group - */ -EAPI void -ecore_x_window_geometry_get(Ecore_X_Window win, - int *x, - int *y, - int *w, - int *h) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!win) - win = DefaultRootWindow(_ecore_x_disp); - - ecore_x_drawable_geometry_get(win, x, y, w, h); -} - -/** - * Retrieves the width of the border of the given window. - * @param win The given window. - * @return Width of the border of @p win. - * @ingroup Ecore_X_Window_Geometry_Group - */ -EAPI int -ecore_x_window_border_width_get(Ecore_X_Window win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - /* doesn't make sense to call this on a root window */ - if (!win) - return 0; - - return ecore_x_drawable_border_width_get(win); -} - -/** - * Sets the width of the border of the given window. - * @param win The given window. - * @param width The new border width. - * @ingroup Ecore_X_Window_Geometry_Group - */ -EAPI void -ecore_x_window_border_width_set(Ecore_X_Window win, - int width) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - /* doesn't make sense to call this on a root window */ - if (!win) - return; - - XSetWindowBorderWidth (_ecore_x_disp, win, width); -} - -/** - * 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); -} - -/** - * To be documented. - * - * FIXME: To be fixed. - */ -EAPI void -ecore_x_window_cursor_show(Ecore_X_Window win, - Eina_Bool show) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (win == 0) - win = DefaultRootWindow(_ecore_x_disp); - - if (!show) - { - Cursor c; - XColor cl; - Pixmap p, m; - GC gc; - XGCValues gcv; - - p = XCreatePixmap(_ecore_x_disp, win, 1, 1, 1); - m = XCreatePixmap(_ecore_x_disp, win, 1, 1, 1); - gc = XCreateGC(_ecore_x_disp, m, 0, &gcv); - XSetForeground(_ecore_x_disp, gc, 0); - XDrawPoint(_ecore_x_disp, m, gc, 0, 0); - XFreeGC(_ecore_x_disp, gc); - c = XCreatePixmapCursor(_ecore_x_disp, p, m, &cl, &cl, 0, 0); - XDefineCursor(_ecore_x_disp, win, c); - XFreeCursor(_ecore_x_disp, c); - XFreePixmap(_ecore_x_disp, p); - XFreePixmap(_ecore_x_disp, m); - } - else - XDefineCursor(_ecore_x_disp, win, 0); -} - -EAPI void -ecore_x_window_cursor_set(Ecore_X_Window win, - Ecore_X_Cursor c) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (c == 0) - XUndefineCursor(_ecore_x_disp, win); - else - XDefineCursor(_ecore_x_disp, win, c); -} - -/** - * Finds out whether the given window is currently visible. - * @param win The given window. - * @return 1 if the window is visible, otherwise 0. - * @ingroup Ecore_X_Window_Visibility_Group - */ -EAPI int -ecore_x_window_visible_get(Ecore_X_Window win) -{ - XWindowAttributes attr; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return XGetWindowAttributes(_ecore_x_disp, win, &attr) && - (attr.map_state == IsViewable); -} - -typedef struct _Shadow Shadow; -struct _Shadow -{ - Shadow *parent; - Shadow **children; - Window win; - int children_num; - short x, y; - unsigned short w, h; -}; - -static Shadow **shadow_base = NULL; -static int shadow_num = 0; - -static Shadow * -_ecore_x_window_tree_walk(Window win) -{ - Window *list = NULL; - Window parent_win = 0, root_win = 0; - unsigned int num; - Shadow *s, **sl; - XWindowAttributes att; - - if (!XGetWindowAttributes(_ecore_x_disp, win, &att)) - return NULL; // if (att.class == InputOnly) return NULL; - - if (att.map_state != IsViewable) - return NULL; - - s = calloc(1, sizeof(Shadow)); - if (!s) - return NULL; - - s->win = win; - s->x = att.x; - s->y = att.y; - s->w = att.width; - s->h = att.height; - if (XQueryTree(_ecore_x_disp, s->win, &root_win, &parent_win, - &list, &num)) - { - s->children = calloc(1, sizeof(Shadow *) * num); - if (s->children) - { - size_t i, j; - s->children_num = num; - for (i = 0; i < num; i++) - { - s->children[i] = _ecore_x_window_tree_walk(list[i]); - if (s->children[i]) - s->children[i]->parent = s; - } - /* compress list down */ - j = 0; - for (i = 0; i < num; i++) - { - if (s->children[i]) - { - s->children[j] = s->children[i]; - j++; - } - } - if (j == 0) - { - free(s->children); - s->children = NULL; - s->children_num = 0; - } - else - { - s->children_num = j; - sl = realloc(s->children, sizeof(Shadow *) * j); - if (sl) - s->children = sl; - } - } - } - - if (list) - XFree(list); - - return s; -} - -static void -_ecore_x_window_tree_shadow_free1(Shadow *s) -{ - int i; - - if (!s) - return; - - if (s->children) - { - for (i = 0; i < s->children_num; i++) - { - if (s->children[i]) - _ecore_x_window_tree_shadow_free1(s->children[i]); - } - free(s->children); - } - - free(s); -} - -static void -_ecore_x_window_tree_shadow_free(void) -{ - int i; - - if (!shadow_base) - return; - - for (i = 0; i < shadow_num; i++) - { - if (!shadow_base[i]) - continue; - - _ecore_x_window_tree_shadow_free1(shadow_base[i]); - } - free(shadow_base); - shadow_base = NULL; - shadow_num = 0; -} - -static void -_ecore_x_window_tree_shadow_populate(void) -{ - Ecore_X_Window *roots; - int i, num; - - roots = ecore_x_window_root_list(&num); - if (roots) - { - shadow_base = calloc(1, sizeof(Shadow *) * num); - if (shadow_base) - { - shadow_num = num; - for (i = 0; i < num; i++) - shadow_base[i] = _ecore_x_window_tree_walk(roots[i]); - } - - free(roots); - } -} - -/* - static int shadow_count = 0; - - static void - _ecore_x_window_tree_shadow_start(void) - { - shadow_count++; - if (shadow_count > 1) return; - _ecore_x_window_tree_shadow_populate(); - } - - static void - _ecore_x_window_tree_shadow_stop(void) - { - shadow_count--; - if (shadow_count != 0) return; - _ecore_x_window_tree_shadow_free(); - } - */ - -static Shadow * -_ecore_x_window_shadow_tree_find_shadow(Shadow *s, - Window win) -{ - Shadow *ss; - int i; - - if (s->win == win) - return s; - - if (s->children) - for (i = 0; i < s->children_num; i++) - { - if (!s->children[i]) - continue; - - if ((ss = - _ecore_x_window_shadow_tree_find_shadow(s->children[i], win))) - return ss; - } - - return NULL; -} - -static Shadow * -_ecore_x_window_shadow_tree_find(Window base) -{ - Shadow *s; - int i; - - for (i = 0; i < shadow_num; i++) - { - if (!shadow_base[i]) - continue; - - if ((s = _ecore_x_window_shadow_tree_find_shadow(shadow_base[i], base))) - return s; - } - return NULL; -} - -static int -_inside_rects(Shadow *s, - int x, - int y, - int bx, - int by, - Ecore_X_Rectangle *rects, - int num) -{ - int i, inside; - - if (!rects) return 0; - inside = 0; - for (i = 0; i < num; i++) - { - if ((x >= s->x + bx + rects[i].x) && - (y >= s->y + by + rects[i].y) && - (x < (int)(s->x + bx + rects[i].x + rects[i].width)) && - (y < (int)(s->y + by + rects[i].y + rects[i].height))) - { - inside = 1; - break; - } - } - free(rects); - return inside; -} - -static Window -_ecore_x_window_shadow_tree_at_xy_get_shadow(Shadow *s, - int bx, - int by, - int x, - int y, - Ecore_X_Window *skip, - int skip_num) -{ - Window child; - int i, j; - int wx, wy; - - wx = s->x + bx; - wy = s->y + by; - if (!((x >= wx) && (y >= wy) && (x < (wx + s->w)) && (y < (wy + s->h)))) - return 0; - - /* FIXME: get shape */ - { - int num; - Ecore_X_Rectangle *rects; - - num = 0; - rects = ecore_x_window_shape_rectangles_get(s->win, &num); - if (!_inside_rects(s, x, y, bx, by, rects, num)) return 0; - num = 0; - rects = ecore_x_window_shape_input_rectangles_get(s->win, &num); - if (!_inside_rects(s, x, y, bx, by, rects, num)) return 0; - } - - if (s->children) - { - int skipit = 0; - - for (i = s->children_num - 1; i >= 0; --i) - { - if (!s->children[i]) - continue; - - skipit = 0; - if (skip) - for (j = 0; j < skip_num; j++) - { - if (s->children[i]->win == skip[j]) - { - skipit = 1; - goto onward; - } - } - -onward: - if (!skipit) - if ((child = - _ecore_x_window_shadow_tree_at_xy_get_shadow(s-> - children[i - ], wx, wy, - x, y, skip, - skip_num))) - return child; - } - } - - return s->win; -} - -static Window -_ecore_x_window_shadow_tree_at_xy_get(Window base, - int bx, - int by, - int x, - int y, - Ecore_X_Window *skip, - int skip_num) -{ - Shadow *s; - - if (!shadow_base) - { - _ecore_x_window_tree_shadow_populate(); - if (!shadow_base) - return 0; - } - - s = _ecore_x_window_shadow_tree_find(base); - if (!s) - return 0; - - return _ecore_x_window_shadow_tree_at_xy_get_shadow(s, - bx, - by, - x, - y, - skip, - skip_num); -} - -/** - * Retrieves the top, visible window at the given location, - * but skips the windows in the list. This uses a shadow tree built from the - * window tree that is only updated the first time - * ecore_x_window_shadow_tree_at_xy_with_skip_get() is called, or the next time - * it is called after a ecore_x_window_shadow_tree_flush() - * @param base The base window to start searching from (normally root). - * @param x The given X position. - * @param y The given Y position. - * @return The window at that position. - * @ingroup Ecore_X_Window_Geometry_Group - */ -EAPI Ecore_X_Window -ecore_x_window_shadow_tree_at_xy_with_skip_get(Ecore_X_Window base, - int x, - int y, - Ecore_X_Window *skip, - int skip_num) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return _ecore_x_window_shadow_tree_at_xy_get(base, - 0, - 0, - x, - y, - skip, - skip_num); -} - -/** - * Retrieves the parent window a given window has. This uses the shadow window - * tree. - * @param root The root window of @p win - if 0, this will be automatically determined with extra processing overhead - * @param win The window to get the parent window of - * @return The parent window of @p win - * @ingroup Ecore_X_Window_Geometry_Group - */ -EAPI Ecore_X_Window -ecore_x_window_shadow_parent_get(Ecore_X_Window root __UNUSED__, - Ecore_X_Window win) -{ - Shadow *s; - int i; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!shadow_base) - { - _ecore_x_window_tree_shadow_populate(); - if (!shadow_base) - return 0; - } - - for (i = 0; i < shadow_num; i++) - { - if (!shadow_base[i]) - continue; - - s = _ecore_x_window_shadow_tree_find_shadow(shadow_base[i], win); - if (s) - { - if (!s->parent) - return 0; - - return s->parent->win; - } - } - return 0; -} - -/** - * Flushes the window shadow tree so nothing is stored. - * @ingroup Ecore_X_Window_Geometry_Group - */ -EAPI void -ecore_x_window_shadow_tree_flush(void) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - _ecore_x_window_tree_shadow_free(); -} - -/** - * Retrieves the root window a given window is on. - * @param win The window to get the root window of - * @return The root window of @p win - * @ingroup Ecore_X_Window_Geometry_Group - */ -EAPI Ecore_X_Window -ecore_x_window_root_get(Ecore_X_Window win) -{ - XWindowAttributes att; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!XGetWindowAttributes(_ecore_x_disp, win, &att)) - return 0; - - return att.root; -} - -static Window -_ecore_x_window_at_xy_get(Window base, - int bx, - int by, - int x, - int y, - Ecore_X_Window *skip, - int skip_num) -{ - Window *list = NULL; - Window parent_win = 0, child = 0, root_win = 0; - int i, j, wx, wy, ww, wh; - unsigned int num; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!ecore_x_window_visible_get(base)) - return 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_window_geometry_get(base, &wx, &wy, &ww, &wh); - wx += bx; - wy += by; - - if (!((x >= wx) && (y >= wy) && (x < (wx + ww)) && (y < (wy + wh)))) - return 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!XQueryTree(_ecore_x_disp, base, &root_win, &parent_win, &list, &num)) - return base; - - if (list) - { - int skipit = 0; - - for (i = num - 1; i >= 0; --i) - { - skipit = 0; - - if (skip) - for (j = 0; j < skip_num; j++) - { - if (list[i] == skip[j]) - { - skipit = 1; - goto onward; - } - } - -onward: - if (!skipit) - if ((child = - _ecore_x_window_at_xy_get(list[i], wx, wy, x, y, skip, - skip_num))) - { - XFree(list); - return child; - } - } - XFree(list); - } - - return base; -} - -/** - * Retrieves the top, visible window at the given location. - * @param x The given X position. - * @param y The given Y position. - * @return The window at that position. - * @ingroup Ecore_X_Window_Geometry_Group - */ -EAPI Ecore_X_Window -ecore_x_window_at_xy_get(int x, - int y) -{ - Ecore_X_Window win, root; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - /* FIXME: Proper function to determine current root/virtual root - * window missing here */ - root = DefaultRootWindow(_ecore_x_disp); - - ecore_x_grab(); - win = _ecore_x_window_at_xy_get(root, 0, 0, x, y, NULL, 0); - ecore_x_ungrab(); - - return win ? win : root; -} - -/** - * Retrieves the top, visible window at the given location, - * but skips the windows in the list. - * @param x The given X position. - * @param y The given Y position. - * @return The window at that position. - * @ingroup Ecore_X_Window_Geometry_Group - */ -EAPI Ecore_X_Window -ecore_x_window_at_xy_with_skip_get(int x, - int y, - Ecore_X_Window *skip, - int skip_num) -{ - Ecore_X_Window win, root; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - /* FIXME: Proper function to determine current root/virtual root - * window missing here */ - root = DefaultRootWindow(_ecore_x_disp); - - ecore_x_grab(); - win = _ecore_x_window_at_xy_get(root, 0, 0, x, y, skip, skip_num); - ecore_x_ungrab(); - - return win ? win : root; -} - -EAPI Ecore_X_Window -ecore_x_window_at_xy_begin_get(Ecore_X_Window begin, - int x, - int y) -{ - Ecore_X_Window win; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_grab(); - win = _ecore_x_window_at_xy_get(begin, 0, 0, x, y, NULL, 0); - ecore_x_ungrab(); - - return win ? win : begin; -} - -/** - * Retrieves the parent window of the given window. - * @param win The given window. - * @return The parent window of @p win. - * @ingroup Ecore_X_Window_Parent_Group - */ -EAPI Ecore_X_Window -ecore_x_window_parent_get(Ecore_X_Window win) -{ - Window root, parent, *children = NULL; - unsigned int num; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!XQueryTree(_ecore_x_disp, win, &root, &parent, &children, &num)) - return 0; - - if (children) - XFree(children); - - return parent; -} - -/** - * Sets the background color of the given window. - * @param win The given window - * @param r red value (0...65536, 16 bits) - * @param g green value (0...65536, 16 bits) - * @param b blue value (0...65536, 16 bits) - */ -EAPI void -ecore_x_window_background_color_set(Ecore_X_Window win, - unsigned short r, - unsigned short g, - unsigned short b) -{ - XSetWindowAttributes attr; - Colormap map; - XColor col; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - col.red = r; - col.green = g; - col.blue = b; - - map = DefaultColormap(_ecore_x_disp, DefaultScreen(_ecore_x_disp)); - XAllocColor(_ecore_x_disp, map, &col); - - attr.background_pixel = col.pixel; - XChangeWindowAttributes(_ecore_x_disp, win, CWBackPixel, &attr); -} - -EAPI void -ecore_x_window_gravity_set(Ecore_X_Window win, - Ecore_X_Gravity grav) -{ - XSetWindowAttributes att; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - att.win_gravity = grav; - XChangeWindowAttributes(_ecore_x_disp, win, CWWinGravity, &att); -} - -EAPI void -ecore_x_window_pixel_gravity_set(Ecore_X_Window win, - Ecore_X_Gravity grav) -{ - XSetWindowAttributes att; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - att.bit_gravity = grav; - XChangeWindowAttributes(_ecore_x_disp, win, CWBitGravity, &att); -} - -EAPI void -ecore_x_window_pixmap_set(Ecore_X_Window win, - Ecore_X_Pixmap pmap) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XSetWindowBackgroundPixmap(_ecore_x_disp, win, pmap); -} - -EAPI void -ecore_x_window_area_clear(Ecore_X_Window win, - int x, - int y, - int w, - int h) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XClearArea(_ecore_x_disp, win, x, y, w, h, False); -} - -EAPI void -ecore_x_window_area_expose(Ecore_X_Window win, - int x, - int y, - int w, - int h) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XClearArea(_ecore_x_disp, win, x, y, w, h, True); -} - -EAPI void -ecore_x_window_override_set(Ecore_X_Window win, - Eina_Bool override) -{ - XSetWindowAttributes att; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - att.override_redirect = override; - XChangeWindowAttributes(_ecore_x_disp, win, CWOverrideRedirect, &att); -} - -#ifdef ECORE_XRENDER -static Ecore_X_Window -_ecore_x_window_argb_internal_new(Ecore_X_Window parent, - int x, - int y, - int w, - int h, - Eina_Bool override, - Eina_Bool saveunder) -{ - Window win; - XSetWindowAttributes attr; - XWindowAttributes att; - XVisualInfo *xvi; - XVisualInfo vi_in; - int nvi, i, scr = 0; - XRenderPictFormat *fmt; - Visual *vis; - - if (parent == 0) - { - parent = DefaultRootWindow(_ecore_x_disp); - scr = DefaultScreen(_ecore_x_disp); - } - else - { - /* ewww - round trip */ - XGetWindowAttributes(_ecore_x_disp, parent, &att); - for (i = 0; i < ScreenCount(_ecore_x_disp); i++) - { - if (att.screen == ScreenOfDisplay(_ecore_x_disp, i)) - { - scr = i; - break; - } - } - } - - vi_in.screen = scr; - vi_in.depth = 32; - vi_in.class = TrueColor; - xvi = XGetVisualInfo(_ecore_x_disp, - VisualScreenMask | - VisualDepthMask | - VisualClassMask, - &vi_in, - &nvi); - if (!xvi) - return 0; - - vis = NULL; - for (i = 0; i < nvi; i++) - { - fmt = XRenderFindVisualFormat(_ecore_x_disp, xvi[i].visual); - if ((fmt->type == PictTypeDirect) && (fmt->direct.alphaMask)) - { - vis = xvi[i].visual; - break; - } - } - XFree (xvi); - - attr.backing_store = NotUseful; - attr.override_redirect = override; - attr.colormap = XCreateColormap(_ecore_x_disp, parent, - vis, AllocNone); - attr.border_pixel = 0; - attr.background_pixmap = None; - attr.bit_gravity = NorthWestGravity; - attr.win_gravity = NorthWestGravity; - attr.save_under = saveunder; - attr.do_not_propagate_mask = NoEventMask; - attr.event_mask = KeyPressMask | - KeyReleaseMask | - ButtonPressMask | - ButtonReleaseMask | - EnterWindowMask | - LeaveWindowMask | - PointerMotionMask | - ExposureMask | - VisibilityChangeMask | - StructureNotifyMask | - FocusChangeMask | - PropertyChangeMask | - ColormapChangeMask; - win = XCreateWindow(_ecore_x_disp, parent, - x, y, w, h, 0, - 32, - InputOutput, - vis, - CWBackingStore | - CWOverrideRedirect | - CWColormap | - CWBorderPixel | - CWBackPixmap | - CWSaveUnder | - CWDontPropagate | - CWEventMask | - CWBitGravity | - CWWinGravity, - &attr); - XFreeColormap(_ecore_x_disp, attr.colormap); - - if (parent == DefaultRootWindow(_ecore_x_disp)) - ecore_x_window_defaults_set(win); - - return win; -} - -#endif /* ifdef ECORE_XRENDER */ - -EAPI int -ecore_x_window_argb_get(Ecore_X_Window win) -{ -#ifdef ECORE_XRENDER - XWindowAttributes att; - XRenderPictFormat *fmt; - - att.visual = 0; - if (!XGetWindowAttributes(_ecore_x_disp, win, &att)) - return 0; - - fmt = XRenderFindVisualFormat(_ecore_x_disp, att.visual); - if (!fmt) - return 0; - - if ((fmt->type == PictTypeDirect) && (fmt->direct.alphaMask)) - return 1; - - return 0; -#else /* ifdef ECORE_XRENDER */ - return 0; -#endif /* ifdef ECORE_XRENDER */ -} - -/** - * Creates a new window. - * @param parent The parent window to use. If @p parent is @c 0, the root - * window of the default display is used. - * @param x X position. - * @param y Y position. - * @param w Width. - * @param h Height. - * @return The new window handle. - * @ingroup Ecore_X_Window_Create_Group - */ -EAPI Ecore_X_Window -ecore_x_window_manager_argb_new(Ecore_X_Window parent, - int x, - int y, - int w, - int h) -{ -#ifdef ECORE_XRENDER - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return _ecore_x_window_argb_internal_new(parent, x, y, w, h, 1, 0); -#else /* ifdef ECORE_XRENDER */ - return 0; -#endif /* ifdef ECORE_XRENDER */ -} - -/** - * Creates a new window. - * @param parent The parent window to use. If @p parent is @c 0, the root - * window of the default display is used. - * @param x X position. - * @param y Y position. - * @param w Width. - * @param h Height. - * @return The new window handle. - * @ingroup Ecore_X_Window_Create_Group - */ -EAPI Ecore_X_Window -ecore_x_window_argb_new(Ecore_X_Window parent, - int x, - int y, - int w, - int h) -{ -#ifdef ECORE_XRENDER - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return _ecore_x_window_argb_internal_new(parent, x, y, w, h, 0, 0); -#else /* ifdef ECORE_XRENDER */ - return 0; -#endif /* ifdef ECORE_XRENDER */ -} - -/** - * Creates a window with the override redirect attribute set to @c True. - * @param parent The parent window to use. If @p parent is @c 0, the root - * window of the default display is used. - * @param x X position. - * @param y Y position. - * @param w Width. - * @param h Height. - * @return The new window handle. - * @ingroup Ecore_X_Window_Create_Group - */ -EAPI Ecore_X_Window -ecore_x_window_override_argb_new(Ecore_X_Window parent, - int x, - int y, - int w, - int h) -{ -#ifdef ECORE_XRENDER - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return _ecore_x_window_argb_internal_new(parent, x, y, w, h, 1, 0); -#else /* ifdef ECORE_XRENDER */ - return 0; -#endif /* ifdef ECORE_XRENDER */ -} - diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window_prop.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window_prop.c deleted file mode 100644 index b581a0e..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window_prop.c +++ /dev/null @@ -1,752 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include -#endif /* ifdef HAVE_CONFIG_H */ - -#include -#include - -#include "Ecore.h" -#include "ecore_x_private.h" -#include "Ecore_X.h" -#include "Ecore_X_Atoms.h" -#include -#include - -#define _ATOM_SET_CARD32(win, atom, p_val, cnt) \ - XChangeProperty(_ecore_x_disp, win, atom, XA_CARDINAL, 32, PropModeReplace, \ - (unsigned char *)p_val, cnt) - -/* - * Set CARD32 (array) property - */ -EAPI void -ecore_x_window_prop_card32_set(Ecore_X_Window win, - Ecore_X_Atom atom, - unsigned int *val, - unsigned int num) -{ -#if SIZEOF_INT == SIZEOF_LONG - _ATOM_SET_CARD32(win, atom, val, num); -#else /* if SIZEOF_INT == SIZEOF_LONG */ - long *v2; - unsigned int i; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - v2 = malloc(num * sizeof(long)); - if (!v2) - return; - - for (i = 0; i < num; i++) - v2[i] = val[i]; - _ATOM_SET_CARD32(win, atom, v2, num); - free(v2); -#endif /* if SIZEOF_INT == SIZEOF_LONG */ -} - -/* - * Get CARD32 (array) property - * - * At most len items are returned in val. - * If the property was successfully fetched the number of items stored in - * val is returned, otherwise -1 is returned. - * Note: Return value 0 means that the property exists but has no elements. - */ -EAPI int -ecore_x_window_prop_card32_get(Ecore_X_Window win, - Ecore_X_Atom atom, - unsigned int *val, - unsigned int len) -{ - unsigned char *prop_ret; - Atom type_ret; - unsigned long bytes_after, num_ret; - int format_ret; - unsigned int i; - int num; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - prop_ret = NULL; - if (XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False, - XA_CARDINAL, &type_ret, &format_ret, &num_ret, - &bytes_after, &prop_ret) != Success) - return -1; - - if (type_ret != XA_CARDINAL || format_ret != 32) - num = -1; - else if (num_ret == 0 || !prop_ret) - num = 0; - else - { - if (num_ret < len) - len = num_ret; - - for (i = 0; i < len; i++) - val[i] = ((unsigned long *)prop_ret)[i]; - num = len; - } - - if (prop_ret) - XFree(prop_ret); - - return num; -} - -/* - * Get CARD32 (array) property of any length - * - * If the property was successfully fetched the number of items stored in - * val is returned, otherwise -1 is returned. - * Note: Return value 0 means that the property exists but has no elements. - */ -EAPI int -ecore_x_window_prop_card32_list_get(Ecore_X_Window win, - Ecore_X_Atom atom, - unsigned int **plst) -{ - unsigned char *prop_ret; - Atom type_ret; - unsigned long bytes_after, num_ret; - int format_ret; - unsigned int i, *val; - int num; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - *plst = NULL; - prop_ret = NULL; - if (XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False, - XA_CARDINAL, &type_ret, &format_ret, &num_ret, - &bytes_after, &prop_ret) != Success) - return -1; - - if ((type_ret != XA_CARDINAL) || (format_ret != 32)) - num = -1; - else if ((num_ret == 0) || (!prop_ret)) - num = 0; - else - { - val = malloc(num_ret * sizeof(unsigned int)); - if (!val) - { - if (prop_ret) XFree(prop_ret); - return -1; - } - for (i = 0; i < num_ret; i++) - val[i] = ((unsigned long *)prop_ret)[i]; - num = num_ret; - *plst = val; - } - - if (prop_ret) - XFree(prop_ret); - - return num; -} - -/* - * Set X ID (array) property - */ -EAPI void -ecore_x_window_prop_xid_set(Ecore_X_Window win, - Ecore_X_Atom atom, - Ecore_X_Atom type, - Ecore_X_ID *lst, - unsigned int num) -{ -#if SIZEOF_INT == SIZEOF_LONG - XChangeProperty(_ecore_x_disp, win, atom, type, 32, PropModeReplace, - (unsigned char *)lst, num); -#else /* if SIZEOF_INT == SIZEOF_LONG */ - unsigned long *pl; - unsigned int i; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - pl = malloc(num * sizeof(long)); - if (!pl) - return; - - for (i = 0; i < num; i++) - pl[i] = lst[i]; - XChangeProperty(_ecore_x_disp, win, atom, type, 32, PropModeReplace, - (unsigned char *)pl, num); - free(pl); -#endif /* if SIZEOF_INT == SIZEOF_LONG */ -} - -/* - * Get X ID (array) property - * - * At most len items are returned in val. - * If the property was successfully fetched the number of items stored in - * val is returned, otherwise -1 is returned. - * Note: Return value 0 means that the property exists but has no elements. - */ -EAPI int -ecore_x_window_prop_xid_get(Ecore_X_Window win, - Ecore_X_Atom atom, - Ecore_X_Atom type, - Ecore_X_ID *lst, - unsigned int len) -{ - unsigned char *prop_ret; - Atom type_ret; - unsigned long bytes_after, num_ret; - int format_ret; - int num; - unsigned i; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - prop_ret = NULL; - if (XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False, - type, &type_ret, &format_ret, &num_ret, - &bytes_after, &prop_ret) != Success) - return -1; - - if (type_ret != type || format_ret != 32) - num = -1; - else if (num_ret == 0 || !prop_ret) - num = 0; - else - { - if (num_ret < len) - len = num_ret; - - for (i = 0; i < len; i++) - lst[i] = ((unsigned long *)prop_ret)[i]; - num = len; - } - - if (prop_ret) - XFree(prop_ret); - - return num; -} - -/* - * Get X ID (array) property - * - * If the property was successfully fetched the number of items stored in - * val is returned, otherwise -1 is returned. - * The returned array must be freed with free(). - * Note: Return value 0 means that the property exists but has no elements. - */ -EAPI int -ecore_x_window_prop_xid_list_get(Ecore_X_Window win, - Ecore_X_Atom atom, - Ecore_X_Atom type, - Ecore_X_ID **val) -{ - unsigned char *prop_ret; - Atom type_ret; - unsigned long bytes_after, num_ret; - int format_ret; - Ecore_X_Atom *alst; - int num; - unsigned i; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - *val = NULL; - prop_ret = NULL; - if (XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False, - type, &type_ret, &format_ret, &num_ret, - &bytes_after, &prop_ret) != Success) - return -1; - - if (type_ret != type || format_ret != 32) - num = -1; - else if (num_ret == 0 || !prop_ret) - num = 0; - else - { - alst = malloc(num_ret * sizeof(Ecore_X_ID)); - for (i = 0; i < num_ret; i++) - alst[i] = ((unsigned long *)prop_ret)[i]; - num = num_ret; - *val = alst; - } - - if (prop_ret) - XFree(prop_ret); - - return num; -} - -/* - * Remove/add/toggle X ID list item. - */ -EAPI void -ecore_x_window_prop_xid_list_change(Ecore_X_Window win, - Ecore_X_Atom atom, - Ecore_X_Atom type, - Ecore_X_ID item, - int op) -{ - Ecore_X_ID *lst; - int i, num; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - num = ecore_x_window_prop_xid_list_get(win, atom, type, &lst); - if (num < 0) - { - return; /* Error - assuming invalid window */ - } - - /* Is it there? */ - for (i = 0; i < num; i++) - { - if (lst[i] == item) - break; - } - - if (i < num) - { - /* Was in list */ - if (op == ECORE_X_PROP_LIST_ADD) - goto done; /* Remove it */ - - num--; - for (; i < num; i++) - lst[i] = lst[i + 1]; - } - else - { - /* Was not in list */ - if (op == ECORE_X_PROP_LIST_REMOVE) - goto done; /* Add it */ - - num++; - lst = realloc(lst, num * sizeof(Ecore_X_ID)); - lst[i] = item; - } - - ecore_x_window_prop_xid_set(win, atom, type, lst, num); - -done: - if (lst) - free(lst); -} - -/* - * Set Atom (array) property - */ -EAPI void -ecore_x_window_prop_atom_set(Ecore_X_Window win, - Ecore_X_Atom atom, - Ecore_X_Atom *lst, - unsigned int num) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_window_prop_xid_set(win, atom, XA_ATOM, lst, num); -} - -/* - * Get Atom (array) property - * - * At most len items are returned in val. - * If the property was successfully fetched the number of items stored in - * val is returned, otherwise -1 is returned. - * Note: Return value 0 means that the property exists but has no elements. - */ -EAPI int -ecore_x_window_prop_atom_get(Ecore_X_Window win, - Ecore_X_Atom atom, - Ecore_X_Atom *lst, - unsigned int len) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return ecore_x_window_prop_xid_get(win, atom, XA_ATOM, lst, len); -} - -/* - * Get Atom (array) property - * - * If the property was successfully fetched the number of items stored in - * val is returned, otherwise -1 is returned. - * The returned array must be freed with free(). - * Note: Return value 0 means that the property exists but has no elements. - */ -EAPI int -ecore_x_window_prop_atom_list_get(Ecore_X_Window win, - Ecore_X_Atom atom, - Ecore_X_Atom **plst) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return ecore_x_window_prop_xid_list_get(win, atom, XA_ATOM, plst); -} - -/* - * Remove/add/toggle atom list item. - */ -EAPI void -ecore_x_window_prop_atom_list_change(Ecore_X_Window win, - Ecore_X_Atom atom, - Ecore_X_Atom item, - int op) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_window_prop_xid_list_change(win, atom, XA_ATOM, item, op); -} - -/* - * Set Window (array) property - */ -EAPI void -ecore_x_window_prop_window_set(Ecore_X_Window win, - Ecore_X_Atom atom, - Ecore_X_Window *lst, - unsigned int num) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_x_window_prop_xid_set(win, atom, XA_WINDOW, lst, num); -} - -/* - * Get Window (array) property - * - * At most len items are returned in val. - * If the property was successfully fetched the number of items stored in - * val is returned, otherwise -1 is returned. - * Note: Return value 0 means that the property exists but has no elements. - */ -EAPI int -ecore_x_window_prop_window_get(Ecore_X_Window win, - Ecore_X_Atom atom, - Ecore_X_Window *lst, - unsigned int len) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return ecore_x_window_prop_xid_get(win, atom, XA_WINDOW, lst, len); -} - -/* - * Get Window (array) property - * - * If the property was successfully fetched the number of items stored in - * val is returned, otherwise -1 is returned. - * The returned array must be freed with free(). - * Note: Return value 0 means that the property exists but has no elements. - */ -EAPI int -ecore_x_window_prop_window_list_get(Ecore_X_Window win, - Ecore_X_Atom atom, - Ecore_X_Window **plst) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - return ecore_x_window_prop_xid_list_get(win, atom, XA_WINDOW, plst); -} - -/** - * To be documented. - * - * FIXME: To be fixed. - */ -EAPI Ecore_X_Atom -ecore_x_window_prop_any_type(void) -{ - return AnyPropertyType; -} - -/** - * To be documented. - * - * FIXME: To be fixed. - */ -EAPI void -ecore_x_window_prop_property_set(Ecore_X_Window win, - Ecore_X_Atom property, - Ecore_X_Atom type, - int size, - void *data, - int number) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (win == 0) - win = DefaultRootWindow(_ecore_x_disp); - - if (size != 32) - XChangeProperty(_ecore_x_disp, - win, - property, - type, - size, - PropModeReplace, - (unsigned char *)data, - number); - else - { - unsigned long *dat; - int i, *ptr; - - dat = malloc(sizeof(unsigned long) * number); - if (dat) - { - for (ptr = (int *)data, i = 0; i < number; i++) - dat[i] = ptr[i]; - XChangeProperty(_ecore_x_disp, win, property, type, size, - PropModeReplace, (unsigned char *)dat, number); - free(dat); - } - } -} - -/** - * To be documented. - * - * FIXME: To be fixed. - */ -EAPI int -ecore_x_window_prop_property_get(Ecore_X_Window win, - Ecore_X_Atom property, - Ecore_X_Atom type, - int size __UNUSED__, - unsigned char **data, - int *num) -{ - Atom type_ret = 0; - int ret, size_ret = 0; - unsigned long num_ret = 0, bytes = 0, i; - unsigned char *prop_ret = NULL; - - /* make sure these are initialized */ - if (num) - *num = 0; - - if (data) - *data = NULL; - else /* we can't store the retrieved data, so just return */ - return 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!win) - win = DefaultRootWindow(_ecore_x_disp); - - ret = XGetWindowProperty(_ecore_x_disp, win, property, 0, LONG_MAX, - False, type, &type_ret, &size_ret, - &num_ret, &bytes, &prop_ret); - - if (ret != Success) - return 0; - - if (!num_ret) - { - XFree(prop_ret); - return 0; - } - - if (!(*data = malloc(num_ret * size_ret / 8))) - { - XFree(prop_ret); - return 0; - } - - switch (size_ret) { - case 8: - for (i = 0; i < num_ret; i++) - (*data)[i] = prop_ret[i]; - break; - - case 16: - for (i = 0; i < num_ret; i++) - ((unsigned short *)*data)[i] = ((unsigned short *)prop_ret)[i]; - break; - - case 32: - for (i = 0; i < num_ret; i++) - ((unsigned int *)*data)[i] = ((unsigned long *)prop_ret)[i]; - break; - } - - XFree(prop_ret); - - if (num) - *num = num_ret; - - return size_ret; -} - -EAPI void -ecore_x_window_prop_property_del(Ecore_X_Window win, - Ecore_X_Atom property) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XDeleteProperty(_ecore_x_disp, win, property); -} - -EAPI Ecore_X_Atom * -ecore_x_window_prop_list(Ecore_X_Window win, - int *num_ret) -{ - Ecore_X_Atom *atoms; - Atom *atom_ret; - int num = 0, i; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (num_ret) - *num_ret = 0; - - atom_ret = XListProperties(_ecore_x_disp, win, &num); - if (!atom_ret) - return NULL; - - atoms = malloc(num * sizeof(Ecore_X_Atom)); - if (atoms) - { - for (i = 0; i < num; i++) - atoms[i] = atom_ret[i]; - if (num_ret) - *num_ret = num; - } - - XFree(atom_ret); - return atoms; -} - -/** - * Set a window string property. - * @param win The window - * @param type The property - * @param str The string - * - * Set a window string property - */ -EAPI void -ecore_x_window_prop_string_set(Ecore_X_Window win, - Ecore_X_Atom type, - const char *str) -{ - XTextProperty xtp; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (win == 0) - win = DefaultRootWindow(_ecore_x_disp); - - xtp.value = (unsigned char *)str; - xtp.format = 8; - xtp.encoding = ECORE_X_ATOM_UTF8_STRING; - xtp.nitems = strlen(str); - XSetTextProperty(_ecore_x_disp, win, &xtp, type); -} - -/** - * Get a window string property. - * @param win The window - * @param type The property - * - * Return window string property of a window. String must be free'd when done. - */ -EAPI char * -ecore_x_window_prop_string_get(Ecore_X_Window win, - Ecore_X_Atom type) -{ - XTextProperty xtp; - char *str = NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (win == 0) - win = DefaultRootWindow(_ecore_x_disp); - - if (XGetTextProperty(_ecore_x_disp, win, &xtp, type)) - { - int items; - char **list = NULL; - Status s; - - if (xtp.encoding == ECORE_X_ATOM_UTF8_STRING) - str = strdup((char *)xtp.value); - else - { -#ifdef X_HAVE_UTF8_STRING - s = Xutf8TextPropertyToTextList(_ecore_x_disp, &xtp, - &list, &items); -#else /* ifdef X_HAVE_UTF8_STRING */ - s = XmbTextPropertyToTextList(_ecore_x_disp, &xtp, - &list, &items); -#endif /* ifdef X_HAVE_UTF8_STRING */ - if ((s == XLocaleNotSupported) || - (s == XNoMemory) || (s == XConverterNotFound)) - str = strdup((char *)xtp.value); - else if ((s >= Success) && (items > 0)) - str = strdup(list[0]); - - if (list) - XFreeStringList(list); - } - - XFree(xtp.value); - } - - return str; -} - -EAPI Eina_Bool -ecore_x_window_prop_protocol_isset(Ecore_X_Window win, - Ecore_X_WM_Protocol protocol) -{ - Atom proto, *protos = NULL; - int i, protos_count = 0; - Eina_Bool ret = EINA_FALSE; - - /* check for invalid values */ - if (protocol >= ECORE_X_WM_PROTOCOL_NUM) - return EINA_FALSE; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - proto = _ecore_x_atoms_wm_protocols[protocol]; - - if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count)) - return ret; - - for (i = 0; i < protos_count; i++) - if (protos[i] == proto) - { - ret = EINA_TRUE; - break; - } - - XFree(protos); - - return ret; -} - -/** - * To be documented. - * - * FIXME: To be fixed. - */ -EAPI Ecore_X_WM_Protocol * -ecore_x_window_prop_protocol_list_get(Ecore_X_Window win, - int *num_ret) -{ - Atom *protos = NULL; - int i, protos_count = 0; - Ecore_X_WM_Protocol *prot_ret = NULL; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count)) - return NULL; - - if ((!protos) || (protos_count <= 0)) - return NULL; - - prot_ret = calloc(1, protos_count * sizeof(Ecore_X_WM_Protocol)); - if (!prot_ret) - { - XFree(protos); - return NULL; - } - - for (i = 0; i < protos_count; i++) - { - Ecore_X_WM_Protocol j; - - prot_ret[i] = -1; - for (j = 0; j < ECORE_X_WM_PROTOCOL_NUM; j++) - { - if (_ecore_x_atoms_wm_protocols[j] == protos[i]) - prot_ret[i] = j; - } - } - XFree(protos); - *num_ret = protos_count; - return prot_ret; -} - diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window_shape.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window_shape.c deleted file mode 100644 index 71718cf..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window_shape.c +++ /dev/null @@ -1,658 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include -#endif /* ifdef HAVE_CONFIG_H */ - -#include - -#include "Ecore.h" -#include "ecore_x_private.h" -#include "Ecore_X.h" - -/** - * @defgroup Ecore_X_Window_Shape X Window Shape Functions - * - * These functions use the shape extension of the X server to change - * shape of given windows. - */ - -/** - * Sets the shape of the given window to that given by the pixmap @p mask. - * @param win The given window. - * @param mask A 2-bit depth pixmap that provides the new shape of the - * window. - * @ingroup Ecore_X_Window_Shape - */ -EAPI void -ecore_x_window_shape_mask_set(Ecore_X_Window win, - Ecore_X_Pixmap mask) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XShapeCombineMask(_ecore_x_disp, win, ShapeBounding, 0, 0, mask, ShapeSet); -} - -/** - * Sets the input shape of the given window to that given by the pixmap @p mask. - * @param win The given window. - * @param mask A 1-bit depth pixmap that provides the new input shape of the - * window. - * @ingroup Ecore_X_Window_Shape - */ -EAPI void -ecore_x_window_shape_input_mask_set(Ecore_X_Window win, - Ecore_X_Pixmap mask) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); -#ifdef ShapeInput - XShapeCombineMask(_ecore_x_disp, win, ShapeInput, 0, 0, mask, ShapeSet); -#else /* ifdef ShapeInput */ - return; - win = mask = 0; -#endif /* ifdef ShapeInput */ -} - -EAPI void -ecore_x_window_shape_window_set(Ecore_X_Window win, - Ecore_X_Window shape_win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XShapeCombineShape(_ecore_x_disp, - win, - ShapeBounding, - 0, - 0, - shape_win, - ShapeBounding, - ShapeSet); -} - -EAPI void -ecore_x_window_shape_input_window_set(Ecore_X_Window win, - Ecore_X_Window shape_win) -{ -#ifdef ShapeInput - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XShapeCombineShape(_ecore_x_disp, - win, - ShapeInput, - 0, - 0, - shape_win, - ShapeInput, - ShapeSet); -#else - return; - win = shape_win = 0; -#endif -} - -EAPI void -ecore_x_window_shape_window_set_xy(Ecore_X_Window win, - Ecore_X_Window shape_win, - int x, - int y) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XShapeCombineShape(_ecore_x_disp, - win, - ShapeBounding, - x, - y, - shape_win, - ShapeBounding, - ShapeSet); -} - -EAPI void -ecore_x_window_shape_input_window_set_xy(Ecore_X_Window win, - Ecore_X_Window shape_win, - int x, - int y) -{ -#ifdef ShapeInput - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XShapeCombineShape(_ecore_x_disp, - win, - ShapeInput, - x, - y, - shape_win, - ShapeInput, - ShapeSet); -#else - return; - win = shape_win = x = y = 0; -#endif -} - -EAPI void -ecore_x_window_shape_rectangle_set(Ecore_X_Window win, - int x, - int y, - int w, - int h) -{ - XRectangle rect; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - rect.x = x; - rect.y = y; - rect.width = w; - rect.height = h; - XShapeCombineRectangles(_ecore_x_disp, - win, - ShapeBounding, - 0, - 0, - &rect, - 1, - ShapeSet, - Unsorted); -} - -EAPI void -ecore_x_window_shape_input_rectangle_set(Ecore_X_Window win, - int x, - int y, - int w, - int h) -{ -#ifdef ShapeInput - XRectangle rect; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - rect.x = x; - rect.y = y; - rect.width = w; - rect.height = h; - XShapeCombineRectangles(_ecore_x_disp, - win, - ShapeInput, - 0, - 0, - &rect, - 1, - ShapeSet, - Unsorted); -#else - return; - win = x = y = w = h = 0; -#endif -} - -EAPI void -ecore_x_window_shape_rectangles_set(Ecore_X_Window win, - Ecore_X_Rectangle *rects, - int num) -{ -#ifdef ShapeInput - XRectangle *rect = NULL; - int i; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!rects) return; - if (num > 0) - { - rect = malloc(sizeof(XRectangle) * num); - if (!rect) return; - for (i = 0; i < num; i++) - { - rect[i].x = rects[i].x; - rect[i].y = rects[i].y; - rect[i].width = rects[i].width; - rect[i].height = rects[i].height; - } - } - XShapeCombineRectangles(_ecore_x_disp, - win, - ShapeBounding, - 0, - 0, - rect, - num, - ShapeSet, - Unsorted); - if (rect) free(rect); -#else - return; - win = rects = num = 0; -#endif -} - -EAPI void -ecore_x_window_shape_input_rectangles_set(Ecore_X_Window win, - Ecore_X_Rectangle *rects, - int num) -{ -#ifdef ShapeInput - XRectangle *rect = NULL; - int i; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!rects) return; - if (num > 0) - { - rect = malloc(sizeof(XRectangle) * num); - if (!rect) return; - for (i = 0; i < num; i++) - { - rect[i].x = rects[i].x; - rect[i].y = rects[i].y; - rect[i].width = rects[i].width; - rect[i].height = rects[i].height; - } - } - XShapeCombineRectangles(_ecore_x_disp, - win, - ShapeInput, - 0, - 0, - rect, - num, - ShapeSet, - Unsorted); - if (rect) free(rect); -#else - return; - win = rects = num = 0; -#endif -} - -EAPI void -ecore_x_window_shape_rectangle_subtract(Ecore_X_Window win, - int x, - int y, - int w, - int h) -{ - XRectangle rect; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - rect.x = x; - rect.y = y; - rect.width = w; - rect.height = h; - XShapeCombineRectangles(_ecore_x_disp, - win, - ShapeBounding, - 0, - 0, - &rect, - 1, - ShapeSubtract, - Unsorted); -} - -EAPI void -ecore_x_window_shape_input_rectangle_subtract(Ecore_X_Window win, - int x, - int y, - int w, - int h) -{ -#ifdef ShapeInput - XRectangle rect; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - rect.x = x; - rect.y = y; - rect.width = w; - rect.height = h; - XShapeCombineRectangles(_ecore_x_disp, - win, - ShapeInput, - 0, - 0, - &rect, - 1, - ShapeSubtract, - Unsorted); -#else - return; - win = x = y = w = h = 0; -#endif -} - -EAPI void -ecore_x_window_shape_window_add(Ecore_X_Window win, - Ecore_X_Window shape_win) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XShapeCombineShape(_ecore_x_disp, - win, - ShapeBounding, - 0, - 0, - shape_win, - ShapeBounding, - ShapeUnion); -} - -EAPI void -ecore_x_window_shape_window_add_xy(Ecore_X_Window win, - Ecore_X_Window shape_win, - int x, - int y) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XShapeCombineShape(_ecore_x_disp, - win, - ShapeBounding, - x, - y, - shape_win, - ShapeBounding, - ShapeUnion); -} - -EAPI void -ecore_x_window_shape_input_window_add_xy(Ecore_X_Window win, - Ecore_X_Window shape_win, - int x, - int y) -{ -#ifdef ShapeInput - LOGFN(__FILE__, __LINE__, __FUNCTION__); - XShapeCombineShape(_ecore_x_disp, - win, - ShapeInput, - x, - y, - shape_win, - ShapeInput, - ShapeUnion); -#else - return; - win = shape_win = x = y = 0; -#endif -} - -EAPI void -ecore_x_window_shape_rectangle_add(Ecore_X_Window win, - int x, - int y, - int w, - int h) -{ - XRectangle rect; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - rect.x = x; - rect.y = y; - rect.width = w; - rect.height = h; - XShapeCombineRectangles(_ecore_x_disp, - win, - ShapeBounding, - 0, - 0, - &rect, - 1, - ShapeUnion, - Unsorted); -} - -EAPI void -ecore_x_window_shape_input_rectangle_add(Ecore_X_Window win, - int x, - int y, - int w, - int h) -{ -#ifdef ShapeInput - XRectangle rect; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - rect.x = x; - rect.y = y; - rect.width = w; - rect.height = h; - XShapeCombineRectangles(_ecore_x_disp, - win, - ShapeInput, - 0, - 0, - &rect, - 1, - ShapeUnion, - Unsorted); -#else - return; - win = x = y = w = h = 0; -#endif -} - -EAPI void -ecore_x_window_shape_rectangle_clip(Ecore_X_Window win, - int x, - int y, - int w, - int h) -{ - XRectangle rect; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - rect.x = x; - rect.y = y; - rect.width = w; - rect.height = h; - XShapeCombineRectangles(_ecore_x_disp, - win, - ShapeBounding, - 0, - 0, - &rect, - 1, - ShapeIntersect, - Unsorted); -} - -EAPI void -ecore_x_window_shape_input_rectangle_clip(Ecore_X_Window win, - int x, - int y, - int w, - int h) -{ -#ifdef ShapeInput - XRectangle rect; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - rect.x = x; - rect.y = y; - rect.width = w; - rect.height = h; - XShapeCombineRectangles(_ecore_x_disp, - win, - ShapeInput, - 0, - 0, - &rect, - 1, - ShapeIntersect, - Unsorted); -#else - return; - win = x = y = w = h = 0; -#endif -} - -EAPI void -ecore_x_window_shape_rectangles_add(Ecore_X_Window win, - Ecore_X_Rectangle *rects, - int num) -{ - XRectangle *rect = NULL; - int i; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (num > 0) - { - rect = malloc(sizeof(XRectangle) * num); - if (!rect) return; - for (i = 0; i < num; i++) - { - rect[i].x = rects[i].x; - rect[i].y = rects[i].y; - rect[i].width = rects[i].width; - rect[i].height = rects[i].height; - } - } - - XShapeCombineRectangles(_ecore_x_disp, - win, - ShapeBounding, - 0, - 0, - rect, - num, - ShapeUnion, - Unsorted); - if (rect) free(rect); -} - -EAPI void -ecore_x_window_shape_input_rectangles_add(Ecore_X_Window win, - Ecore_X_Rectangle *rects, - int num) -{ -#ifdef ShapeInput - XRectangle *rect = NULL; - int i; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (num > 0) - { - rect = malloc(sizeof(XRectangle) * num); - if (!rect) return; - for (i = 0; i < num; i++) - { - rect[i].x = rects[i].x; - rect[i].y = rects[i].y; - rect[i].width = rects[i].width; - rect[i].height = rects[i].height; - } - } - - XShapeCombineRectangles(_ecore_x_disp, - win, - ShapeInput, - 0, - 0, - rect, - num, - ShapeUnion, - Unsorted); - if (rect) free(rect); -#else - return; - win = rects = num = 0; -#endif -} - -EAPI Ecore_X_Rectangle * -ecore_x_window_shape_rectangles_get(Ecore_X_Window win, - int *num_ret) -{ - XRectangle *rect; - Ecore_X_Rectangle *rects = NULL; - int i, num = 0, ord; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - rect = XShapeGetRectangles(_ecore_x_disp, win, ShapeBounding, &num, &ord); - if (rect) - { - if (num < 1) - { - XFree(rect); - if (num_ret) *num_ret = 0; - return NULL; - } - rects = malloc(sizeof(Ecore_X_Rectangle) * num); - if (!rects) - { - XFree(rect); - if (num_ret) *num_ret = 0; - return NULL; - } - for (i = 0; i < num; i++) - { - rects[i].x = rect[i].x; - rects[i].y = rect[i].y; - rects[i].width = rect[i].width; - rects[i].height = rect[i].height; - } - XFree(rect); - } - if (num_ret) *num_ret = num; - return rects; -} - -EAPI Ecore_X_Rectangle * -ecore_x_window_shape_input_rectangles_get(Ecore_X_Window win, - int *num_ret) -{ - Ecore_X_Rectangle *rects = NULL; -#ifdef ShapeInput - XRectangle *rect; - int i, num = 0, ord; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - rect = XShapeGetRectangles(_ecore_x_disp, win, ShapeInput, &num, &ord); - if (rect) - { - if (num < 1) - { - XFree(rect); - if (num_ret) *num_ret = 0; - return NULL; - } - rects = malloc(sizeof(Ecore_X_Rectangle) * num); - if (!rects) - { - XFree(rect); - if (num_ret) *num_ret = 0; - return NULL; - } - for (i = 0; i < num; i++) - { - rects[i].x = rect[i].x; - rects[i].y = rect[i].y; - rects[i].width = rect[i].width; - rects[i].height = rect[i].height; - } - XFree(rect); - } - if (num_ret) *num_ret = num; - return rects; -#else - // have to return fake shape input rect of size of window - Window dw; - unsigned int di; - - if (num_ret) *num_ret = 0; - rects = malloc(sizeof(Ecore_X_Rectangle)); - if (!rects) return NULL; - if (!XGetGeometry(_ecore_x_disp, win, &dw, - &(rects[0].x), &(rects[0].y), - &(rects[0].width), &(rects[0].height), - &di, &di)) - { - free(rects); - return NULL; - } - if (num_ret) *num_ret = 1; - return rects; -#endif -} - -EAPI void -ecore_x_window_shape_events_select(Ecore_X_Window win, - Eina_Bool on) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (on) - XShapeSelectInput(_ecore_x_disp, win, ShapeNotifyMask); - else - XShapeSelectInput(_ecore_x_disp, win, 0); -} - diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xi2.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xi2.c deleted file mode 100644 index fbfbd43..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xi2.c +++ /dev/null @@ -1,283 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include -#endif /* ifdef HAVE_CONFIG_H */ - -#include - -#include "Ecore.h" -#include "ecore_x_private.h" -#include "Ecore_X.h" - -#ifdef ECORE_XI2 -#include "Ecore_Input.h" -#endif /* ifdef ECORE_XI2 */ - -int _ecore_x_xi2_opcode = -1; - -#ifndef XIPointerEmulated -#define XIPointerEmulated (1 << 16) -#endif - -#ifdef ECORE_XI2 -static XIDeviceInfo *_ecore_x_xi2_devs = NULL; -static int _ecore_x_xi2_num = 0; -#endif /* ifdef ECORE_XI2 */ - -void -_ecore_x_input_init(void) -{ -#ifdef ECORE_XI2 - int event, error; - int major = 2, minor = 0; - - if (!XQueryExtension(_ecore_x_disp, "XInputExtension", - &_ecore_x_xi2_opcode, &event, &error)) - { - _ecore_x_xi2_opcode = -1; - return; - } - - if (XIQueryVersion(_ecore_x_disp, &major, &minor) == BadRequest) - { - _ecore_x_xi2_opcode = -1; - return; - } - - _ecore_x_xi2_devs = XIQueryDevice(_ecore_x_disp, XIAllDevices, - &_ecore_x_xi2_num); -#endif /* ifdef ECORE_XI2 */ -} - -void -_ecore_x_input_shutdown(void) -{ -#ifdef ECORE_XI2 - if (_ecore_x_xi2_devs) - { - XIFreeDeviceInfo(_ecore_x_xi2_devs); - _ecore_x_xi2_devs = NULL; - } - - _ecore_x_xi2_num = 0; - _ecore_x_xi2_opcode = -1; -#endif /* ifdef ECORE_XI2 */ -} - -void -_ecore_x_input_handler(XEvent *xevent) -{ -#ifdef ECORE_XI2 - XIDeviceEvent *evd = (XIDeviceEvent *)(xevent->xcookie.data); - int devid = evd->deviceid; - int i; - - if (_ecore_x_xi2_devs) - { - for (i = 0; i < _ecore_x_xi2_num; i++) - { - XIDeviceInfo *dev = &(_ecore_x_xi2_devs[i]); - - if (devid == dev->deviceid) - { - if (dev->use == XIMasterPointer) return; - if ((dev->use == XISlavePointer) && - (evd->flags & XIPointerEmulated)) return; - } - } - } - switch (xevent->xcookie.evtype) - { - case XI_Motion: - _ecore_mouse_move - (evd->time, - 0, // state - evd->event_x, evd->event_y, - evd->root_x, evd->root_y, - evd->event, - (evd->child ? evd->child : evd->event), - evd->root, - 1, // same_screen - devid, 1, 1, - 1.0, // pressure - 0.0, // angle - evd->event_x, evd->event_y, - evd->root_x, evd->root_y); - break; - - case XI_ButtonPress: - _ecore_mouse_button - (ECORE_EVENT_MOUSE_BUTTON_DOWN, - evd->time, - 0, // state - 0, // button - evd->event_x, evd->event_y, - evd->root_x, evd->root_y, - evd->event, - (evd->child ? evd->child : evd->event), - evd->root, - 1, // same_screen - devid, 1, 1, - 1.0, // pressure - 0.0, // angle - evd->event_x, evd->event_y, - evd->root_x, evd->root_y); - break; - - case XI_ButtonRelease: - _ecore_mouse_button - (ECORE_EVENT_MOUSE_BUTTON_UP, - evd->time, - 0, // state - 0, // button - evd->event_x, evd->event_y, - evd->root_x, evd->root_y, - evd->event, - (evd->child ? evd->child : evd->event), - evd->root, - 1, // same_screen - devid, 1, 1, - 1.0, // pressure - 0.0, // angle - evd->event_x, evd->event_y, - evd->root_x, evd->root_y); - break; - -#ifdef XI_TouchUpdate - case XI_TouchUpdate: - _ecore_mouse_move - (evd->time, - 0, // state - evd->event_x, evd->event_y, - evd->root_x, evd->root_y, - evd->event, - (evd->child ? evd->child : evd->event), - evd->root, - 1, // same_screen - devid, 1, 1, - 1.0, // pressure - 0.0, // angle - evd->event_x, evd->event_y, - evd->root_x, evd->root_y); - break; - -#endif -#ifdef XI_TouchBegin - case XI_TouchBegin: - _ecore_mouse_button - (ECORE_EVENT_MOUSE_BUTTON_DOWN, - evd->time, - 0, // state - 0, // button - evd->event_x, evd->event_y, - evd->root_x, evd->root_y, - evd->event, - (evd->child ? evd->child : evd->event), - evd->root, - 1, // same_screen - devid, 1, 1, - 1.0, // pressure - 0.0, // angle - evd->event_x, evd->event_y, - evd->root_x, evd->root_y); - break; - -#endif -#ifdef XI_TouchEnd - case XI_TouchEnd: - _ecore_mouse_button - (ECORE_EVENT_MOUSE_BUTTON_UP, - evd->time, - 0, // state - 0, // button - evd->event_x, evd->event_y, - evd->root_x, evd->root_y, - evd->event, - (evd->child ? evd->child : evd->event), - evd->root, - 1, // same_screen - devid, 1, 1, - 1.0, // pressure - 0.0, // angle - evd->event_x, evd->event_y, - evd->root_x, evd->root_y); - break; - -#endif - default: - break; - } -#endif /* ifdef ECORE_XI2 */ -} - -EAPI Eina_Bool -ecore_x_input_multi_select(Ecore_X_Window win) -{ -#ifdef ECORE_XI2 - int i; - Eina_Bool find = EINA_FALSE; - - if (!_ecore_x_xi2_devs) - return 0; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - for (i = 0; i < _ecore_x_xi2_num; i++) - { - XIDeviceInfo *dev = &(_ecore_x_xi2_devs[i]); - - if (dev->use == XIFloatingSlave) - { - XIEventMask eventmask; - unsigned char mask[4] = { 0 }; - - eventmask.deviceid = dev->deviceid; - eventmask.mask_len = sizeof(mask); - eventmask.mask = mask; - XISetMask(mask, XI_ButtonPress); - XISetMask(mask, XI_ButtonRelease); - XISetMask(mask, XI_Motion); - XISelectEvents(_ecore_x_disp, win, &eventmask, 1); - find = EINA_TRUE; - } - else if (dev->use == XISlavePointer) - { - XIDeviceInfo *atdev = NULL; - int j; - - for (j = 0; j < _ecore_x_xi2_num; j++) - { - if (_ecore_x_xi2_devs[j].deviceid == dev->attachment) - atdev = &(_ecore_x_xi2_devs[j]); - } - if (((atdev) && (atdev->use != XIMasterPointer)) || - (!atdev)) - { - XIEventMask eventmask; - unsigned char mask[4] = { 0 }; - - eventmask.deviceid = dev->deviceid; - eventmask.mask_len = sizeof(mask); - eventmask.mask = mask; - XISetMask(mask, XI_ButtonPress); - XISetMask(mask, XI_ButtonRelease); - XISetMask(mask, XI_Motion); -# ifdef XI_TouchUpdate - XISetMask(mask, XI_TouchUpdate); -# endif -# ifdef XI_TouchBegin - XISetMask(mask, XI_TouchBegin); -# endif -# ifdef XI_TouchEnd - XISetMask(mask, XI_TouchEnd); -# endif - XISelectEvents(_ecore_x_disp, win, &eventmask, 1); - find = EINA_TRUE; - } - } - } - - return find; -#else /* ifdef ECORE_XI2 */ - return EINA_FALSE; -#endif /* ifdef ECORE_XI2 */ -} - diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xinerama.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xinerama.c deleted file mode 100644 index f49a4d3..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xinerama.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Xinerama code - */ - -#ifdef HAVE_CONFIG_H -# include -#endif /* ifdef HAVE_CONFIG_H */ - -#include "Ecore.h" -#include "ecore_x_private.h" -#include "Ecore_X.h" -#include "Ecore_X_Atoms.h" - -#ifdef ECORE_XINERAMA -static XineramaScreenInfo *_xin_info = NULL; -static int _xin_scr_num = 0; -#endif /* ifdef ECORE_XINERAMA */ - -EAPI int -ecore_x_xinerama_screen_count_get(void) -{ -#ifdef ECORE_XINERAMA - int event_base, error_base; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (_xin_info) - XFree(_xin_info); - - _xin_info = NULL; - if (XineramaQueryExtension(_ecore_x_disp, &event_base, &error_base)) - { - _xin_info = XineramaQueryScreens(_ecore_x_disp, &_xin_scr_num); - if (_xin_info) - return _xin_scr_num; - } - -#endif /* ifdef ECORE_XINERAMA */ - return 0; -} - -EAPI Eina_Bool -ecore_x_xinerama_screen_geometry_get(int screen, - int *x, - int *y, - int *w, - int *h) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); -#ifdef ECORE_XINERAMA - if (_xin_info) - { - int i; - - for (i = 0; i < _xin_scr_num; i++) - { - if (_xin_info[i].screen_number == screen) - { - if (x) - *x = _xin_info[i].x_org; - - if (y) - *y = _xin_info[i].y_org; - - if (w) - *w = _xin_info[i].width; - - if (h) - *h = _xin_info[i].height; - - return EINA_TRUE; - } - } - } - -#endif /* ifdef ECORE_XINERAMA */ - if (x) - *x = 0; - - if (y) - *y = 0; - - if (w) - *w = DisplayWidth(_ecore_x_disp, 0); - - if (h) - *h = DisplayHeight(_ecore_x_disp, 0); - - return EINA_FALSE; - screen = 0; -} - -- cgit v1.1