Rui Miguel Silva Seabra <rms@1407.org>
Saumsung Electronics <tbd>
Samsung SAIT <tbd>
+Nicolas Aguirre <aguirre.nicolas@gmail.com>
+Brett Nash <nash@nash.id.au>
-Copyright (C) 2000 Carsten Haitzler and various contributors (see AUTHORS)
+Copyright notice for Ecore:
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to
-deal in the Software without restriction, including without limitation the
-rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-sell copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies of the Software, its documentation and marketing & publicity
-materials, and acknowledgment shall be given in the documentation, materials
-and software packages that this Software was used.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-THE AUTHORS 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.
+Copyright (C) 2000-2010 Carsten Haitzler and various contributors (see AUTHORS)
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-COMPILING and INSTALLING:
+Installation Instructions
+*************************
-If you got a official release tar archive do:
- ./configure
-
-( otherwise if you got this from enlightenment cvs do: ./autogen.sh )
-
-Then to compile:
- make
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
+Software Foundation, Inc.
-To install (run this as root, or the user who handles installs):
- make install
+This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
+Basic Installation
+==================
+
+These are generic installation instructions.
+
+ The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation. It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions. Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+ It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring. (Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.)
+
+ If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release. If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+ The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'. You only need
+`configure.ac' if you want to change it or regenerate `configure' using
+a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+ 1. `cd' to the directory containing the package's source code and type
+ `./configure' to configure the package for your system. If you're
+ using `csh' on an old version of System V, you might need to type
+ `sh ./configure' instead to prevent `csh' from trying to execute
+ `configure' itself.
+
+ Running `configure' takes awhile. While running, it prints some
+ messages telling which features it is checking for.
+
+ 2. Type `make' to compile the package.
+
+ 3. Optionally, type `make check' to run any self-tests that come with
+ the package.
+
+ 4. Type `make install' to install the programs and any data files and
+ documentation.
+
+ 5. You can remove the program binaries and object files from the
+ source code directory by typing `make clean'. To also remove the
+ files that `configure' created (so you can compile the package for
+ a different kind of computer), type `make distclean'. There is
+ also a `make maintainer-clean' target, but that is intended mainly
+ for the package's developers. If you use it, you may have to get
+ all sorts of other programs in order to regenerate files that came
+ with the distribution.
+
+Compilers and Options
+=====================
+
+Some systems require unusual options for compilation or linking that the
+`configure' script does not know about. Run `./configure --help' for
+details on some of the pertinent environment variables.
+
+ You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment. Here
+is an example:
+
+ ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
+
+ *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory. To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'. `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script. `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+ If you have to use a `make' that does not support the `VPATH'
+variable, you have to compile the package for one architecture at a
+time in the source code directory. After you have installed the
+package for one architecture, use `make distclean' before reconfiguring
+for another architecture.
+
+Installation Names
+==================
+
+By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc. You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX'.
+
+ You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files. If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+ In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files. Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+ If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System). The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+ For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+There may be some features `configure' cannot figure out automatically,
+but needs to determine by the type of machine the package will run on.
+Usually, assuming the package is built to be run on the _same_
+architectures, `configure' can figure that out, but if it prints a
+message saying it cannot guess the machine type, give it the
+`--build=TYPE' option. TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+ CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+ OS KERNEL-OS
+
+ See the file `config.sub' for the possible values of each field. If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+ If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+ If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+If you want to set default values for `configure' scripts to share, you
+can create a site shell script called `config.site' that gives default
+values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists. Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+Variables not defined in a site shell script can be set in the
+environment passed to `configure'. However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost. In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'. For example:
+
+ ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script). Here is a another example:
+
+ /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
+configuration-related scripts to be executed by `/bin/bash'.
+
+`configure' Invocation
+======================
+
+`configure' recognizes the following options to control how it operates.
+
+`--help'
+`-h'
+ Print a summary of the options to `configure', and exit.
+
+`--version'
+`-V'
+ Print the version of Autoconf used to generate the `configure'
+ script, and exit.
+
+`--cache-file=FILE'
+ Enable the cache: use and save the results of the tests in FILE,
+ traditionally `config.cache'. FILE defaults to `/dev/null' to
+ disable caching.
+
+`--config-cache'
+`-C'
+ Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+ Do not print messages saying which checks are being made. To
+ suppress all normal output, redirect it to `/dev/null' (any error
+ messages will still be shown).
+
+`--srcdir=DIR'
+ Look for the package's source code in directory DIR. Usually
+ `configure' can determine that directory automatically.
+
+`configure' also accepts some other, not widely useful, options. Run
+`configure --help' for more details.
-NOTE: You MUST make install Eet for it to run properly.
ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = doc src po
+SUBDIRS = doc src
+if HAVE_PO
+
+SUBDIRS += po
+
+endif
MAINTAINERCLEANFILES = \
ABOUT-NLS \
m4/progtest.m4 \
m4/stdint_h.m4 \
m4/uintmax_t.m4 \
-m4/ulonglong.m4 \
+m4/ulonglong.m4
+
+if HAVE_PO
+
+MAINTAINERCLEANFILES += \
po/boldquot.sed \
po/en@boldquot.header \
po/en@quot.header \
po/remove-potcdate.sin \
po/Rules-quot
+endif
+
bin_SCRIPTS =
-EXTRA_DIST = AUTHORS COPYING COPYING-PLAIN \
- autogen.sh ecore.supp \
- ecore.pc.in \
- ecore-con.pc.in \
- ecore-config.pc.in \
- ecore-directfb.pc.in\
- ecore-evas.pc.in \
- ecore-fb.pc.in \
- ecore-file.pc.in \
- ecore-imf.pc.in \
- ecore-imf-evas.pc.in \
- ecore-ipc.pc.in \
- ecore-x.pc.in \
- ecore-win32.pc.in \
- ecore-sdl.pc.in \
- ecore-cocoa.pc.in \
- ecore-input.pc.in \
- ecore-wince.pc.in \
- ecore.spec.in ecore.spec
+EXTRA_DIST = \
+AUTHORS \
+COPYING \
+autogen.sh \
+ecore.supp \
+ecore.pc.in \
+ecore-con.pc.in \
+ecore-config.pc.in \
+ecore-directfb.pc.in\
+ecore-evas.pc.in \
+ecore-fb.pc.in \
+ecore-file.pc.in \
+ecore-imf.pc.in \
+ecore-imf-evas.pc.in \
+ecore-ipc.pc.in \
+ecore-x.pc.in \
+ecore-win32.pc.in \
+ecore-sdl.pc.in \
+ecore-cocoa.pc.in \
+ecore-input.pc.in \
+ecore-wince.pc.in \
+ecore.spec.in \
+ecore.spec \
+m4/ac_abstract_socket.m4 \
+m4/ac_attribute.m4 \
+m4/check_x_extension.m4 \
+m4/ecore_check_module.m4 \
+m4/ecore_check_options.m4 \
+m4/efl_doxygen.m4 \
+m4/efl_path_max.m4 \
+m4/efl_tests.m4 \
+m4/efl_pthread.m4
+
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = ecore.pc
Ecore @VERSION@
+******************************************************************************
+
+ FOR ANY ISSUES PLEASE EMAIL:
+ enlightenment-devel@lists.sourceforge.net
+
+******************************************************************************
+
Requirements:
-------------
Must:
- libc libm
-
+ libc
+ libm
+ eina (1.0.0 or better)
+ (For windows you also need: evil)
+
Recommended:
- libX11 libXext libXcursor libXprint libXinerama libXrandr libXss libXrender
- libXcomposite libXfixes libXdamage libXdpms libXtest OpenSSL CURL
+ libX11
+ libXext
+ libXcursor
+ libXprint
+ libXinerama
+ libXrandr
+ libXss
+ libXrender
+ libXcomposite
+ libXfixes
+ libXdamage
+ libXdpms
+ libXtest
+ OpenSSL
+ CURL
+ evas (1.0.0 or better)
Optional:
- XCB SDL DirectFB
+ XCB
+ SDL
+ DirectFB
Ecore is a clean and tiny event loop library with many modules to do
lots of convenient things for a programmer, to save time and effort.
simple and other Ecore modules produce more events on the queue,
coming from other sources such as file descriptors etc.
+Ecore also help you work in a multi threaded environment and setup a
+thread pool that help you use the EFL on multi-cpu system. It help split
+the part that can't be called outside of the ecore main loop from the
+computation heavy function that could run on another CPU. Be aware that
+Evas and most of Ecore API is not thread safe and should only be called
+in the main loop. Eina and Eet could be used, if done carefully, in any
+heavy function on another cpu.
+
Ecore also lets you have functions called when file descriptors become
active for reading or writing, allowing for streamlined, non-blocking
IO.
./configure
make
-(as root unless youa re installing in your users directories):
+(as root unless you are installing in your users directories):
make install
-------------------------------------------------------------------------------
-BUILDING PACKAGES:
-
-RPM: To build rpm packages:
-
- sudo rpm -ta @PACKAGE@-@VERSION@.tar.gz
-
-You will find rpm packages in your system /usr/src/redhat/* dirs (note you may
-not need to use sudo or root if you have your own ~/.rpmrc. see rpm documents
-for more details)
-
-DEB: To build deb packages:
-
- tar zvf @PACKAGE@-@VERSION@.tar.gz
- cd @PACKAGE@-@VERSION@
- dpkg-buildpackage -us -uc -rfakeroot
- cd ..
- rm -rf @PACKAGE@-@VERSION@
-
-You will find all the debian source, binary etc. packages put in the directory
-where you first untarred the source tarball.
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
-m4_define([v_maj], [0])
-m4_define([v_min], [9])
-m4_define([v_mic], [9])
-m4_define([v_rev], m4_esyscmd([(svnversion . | grep -v exported || echo 0) | awk -F : '{printf("%s\n", $1);}' | tr -d ' :MSP\n']))
+m4_define([v_maj], [1])
+m4_define([v_min], [0])
+m4_define([v_mic], [0])
+m4_define([v_rev], m4_esyscmd([(svnversion "${SVN_REPO_PATH:-.}" | grep -v export || echo 0) | awk -F : '{printf("%s\n", $1);}' | tr -d ' :MSP\n']))
m4_if(v_rev, [0], [m4_define([v_rev], m4_esyscmd([git log 2> /dev/null | (grep -m1 git-svn-id || echo 0) | sed -e 's/.*@\([0-9]*\).*/\1/' | tr -d '\n']))])
##-- When released, remove the dnl on the below line
-dnl m4_undefine([v_rev])
+m4_undefine([v_rev])
##-- When doing snapshots - change soname. remove dnl on below line
-m4_define([relname], [ver-pre-svn-06])
-m4_define([v_rel], [-release relname])
+dnl m4_define([relname], [ver-pre-svn-07])
+dnl m4_define([v_rel], [-release relname])
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
-m4_ifdef([v_rev], [m4_define([v_ver], [v_maj.v_min.v_mic.v_rev])],
-[m4_define([v_ver], [v_maj.v_min.v_mic])])
+m4_ifdef([v_rev], [m4_define([v_ver], [v_maj.v_min.v_mic.v_rev])], [m4_define([v_ver], [v_maj.v_min.v_mic])])
m4_define([lt_rev], m4_eval(v_maj + v_min))
m4_define([lt_cur], v_mic)
m4_define([lt_age], v_min)
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
-AC_INIT([ecore], [v_ver], [enlightenment-devel@lists.sourceforge.net])
-release="ver-pre-svn-06"
+AC_INIT([ecore], [v_ver-alpha], [enlightenment-devel@lists.sourceforge.net])
AC_PREREQ([2.52])
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_MACRO_DIR([m4])
AC_SUBST(release_info)
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
+VMAJ=v_maj
+AC_SUBST(VMAJ)
+m4_ifdef([AM_GNU_GETTEXT_VERSION], [
AM_GNU_GETTEXT_VERSION([0.12.1])
+])
+
+m4_ifdef([AM_GNU_GETTEXT], [
AM_GNU_GETTEXT([external])
+po_makefile_in=po/Makefile.in
+AM_CONDITIONAL([HAVE_PO], [true])
+],[
+AM_CONDITIONAL([HAVE_PO], [false])
+])
+AC_SUBST(LTLIBINTL)
EFL_CHECK_PATH_MAX
want_ecore_evas_xrender_x11="no"
want_ecore_evas_opengl_x11="no"
want_ecore_evas_software_16_x11="no"
+want_ecore_evas_software_8_x11="no"
want_ecore_evas_software_xcb="no"
want_ecore_evas_xrender_xcb="no"
want_ecore_evas_software_gdi="no"
want_ecore_evas_xrender_x11="yes"
want_ecore_evas_opengl_x11="yes"
want_ecore_evas_software_16_x11="yes"
+ want_ecore_evas_software_8_x11="yes"
want_ecore_evas_software_xcb="yes"
want_ecore_evas_xrender_xcb="yes"
want_ecore_evas_software_sdl="yes"
if test "x${want_glib_integration_always}" = "xyes" ; then
AC_DEFINE([GLIB_INTEGRATION_ALWAYS], [1], [Always integrate glib if support compiled])
+ want_glib=yes
+fi
+
+want_g_main_loop=no
+AC_ARG_ENABLE(g-main-loop,
+ AC_HELP_STRING([--enable-g-main-loop], [ecore_main_loop based on g_main_loop]),
+ [want_g_main_loop=$enableval])
+
+if test "x${want_g_main_loop}" = "xyes" ; then
+ AC_DEFINE([USE_G_MAIN_LOOP], [1], [Use g_main_loop in ecore])
+ want_glib=yes
+fi
+
+if test "x${want_glib_integration_always}" = "xyes" -a "x${want_g_main_loop}" = "xyes"; then
+ AC_MSG_ERROR([--enable-glib-integration-always and --enable-glib-main-loop are mutually exclusive])
fi
# abstract sockets (ecore_con.c)
# Eina library
-PKG_CHECK_MODULES(EINA, [eina-0])
+PKG_CHECK_MODULES(EINA, [eina >= 1.0.0])
#FIXME check all the requirements when the eina move will be finished
-requirements_ecore="eina-0 ${requirements_ecore}"
-requirements_ecore_con="ecore eina-0 ${requirements_ecore_con}"
-requirements_ecore_config="ecore eina-0 ${requirements_ecore_config}"
-requirements_ecore_directfb="ecore eina-0 ${requirements_ecore_directfb}"
-requirements_ecore_evas="ecore eina-0 ${requirements_ecore_evas}"
-requirements_ecore_fb="ecore eina-0 ${requirements_ecore_fb}"
-requirements_ecore_file="ecore eina-0 ${requirements_ecore_file}"
-requirements_ecore_imf="ecore eina-0 ${requirements_ecore_imf}"
-requirements_ecore_imf_evas="ecore eina-0 ${requirements_ecore_imf_evas}"
-requirements_ecore_input="ecore eina-0 ${requirements_ecore_input}"
-requirements_ecore_input_evas="ecore eina-0 ${requirements_ecore_input_evas}"
-requirements_ecore_ipc="ecore eina-0 ${requirements_ecore_ipc}"
-requirements_ecore_cocoa="ecore eina-0 ${requirements_ecore_cocoa}"
-requirements_ecore_sdl="ecore eina-0 ${requirements_ecore_sdl}"
-requirements_ecore_win32="ecore eina-0 ${requirements_ecore_win32}"
-requirements_ecore_wince="ecore eina-0 ${requirements_ecore_wince}"
-requirements_ecore_x="ecore eina-0 ${requirements_ecore_x}"
+requirements_ecore="eina >= 1.0.0 ${requirements_ecore}"
+requirements_ecore_con="ecore >= 1.0.0 eina >= 1.0.0 ${requirements_ecore_con}"
+requirements_ecore_config="ecore >= 1.0.0 eina >= 1.0.0 ${requirements_ecore_config}"
+requirements_ecore_directfb="ecore >= 1.0.0 eina >= 1.0.0 ${requirements_ecore_directfb}"
+requirements_ecore_evas="ecore >= 1.0.0 eina >= 1.0.0 ${requirements_ecore_evas}"
+requirements_ecore_fb="ecore >= 1.0.0 eina >= 1.0.0 ${requirements_ecore_fb}"
+requirements_ecore_file="ecore >= 1.0.0 eina >= 1.0.0 ${requirements_ecore_file}"
+requirements_ecore_imf="ecore >= 1.0.0 eina >= 1.0.0 ${requirements_ecore_imf}"
+requirements_ecore_imf_evas="ecore >= 1.0.0 eina >= 1.0.0 ${requirements_ecore_imf_evas}"
+requirements_ecore_input="ecore >= 1.0.0 eina >= 1.0.0 ${requirements_ecore_input}"
+requirements_ecore_input_evas="ecore >= 1.0.0 eina >= 1.0.0 ${requirements_ecore_input_evas}"
+requirements_ecore_ipc="ecore >= 1.0.0 eina >= 1.0.0 ${requirements_ecore_ipc}"
+requirements_ecore_cocoa="ecore >= 1.0.0 eina >= 1.0.0 ${requirements_ecore_cocoa}"
+requirements_ecore_sdl="ecore >= 1.0.0 eina >= 1.0.0 ${requirements_ecore_sdl}"
+requirements_ecore_win32="ecore >= 1.0.0 eina >= 1.0.0 ${requirements_ecore_win32}"
+requirements_ecore_wince="ecore >= 1.0.0 eina >= 1.0.0 ${requirements_ecore_wince}"
+requirements_ecore_x="ecore >= 1.0.0 eina >= 1.0.0 ${requirements_ecore_x}"
# glib support (main loop integration)
# Eet library (ecore_config)
PKG_CHECK_MODULES([EET],
- [eet >= 1.0.0],
+ [eet >= 1.4.0],
[have_eet="yes"],
[have_eet="no"])
# Evas library (ecore_config, ecore_input_evas, ecore_imf_evas and ecore_evas)
-PKG_CHECK_MODULES([EVAS], [evas >= 0.9.9],
+PKG_CHECK_MODULES([EVAS], [evas >= 1.0.0],
[have_evas="yes"],
[have_evas="no"])
])
AC_SUBST(cocoa_ldflags)
+# check for epoll support
+AC_CHECK_HEADERS([sys/epoll.h])
+
# basic pthread support
EFL_CHECK_PTHREAD([no], [have_pthread="yes"], [have_pthread="no"])
# ecore_ipc
ECORE_CHECK_MODULE([ipc], [${want_ecore_ipc}], [Ipc], [${have_ecore_con}],
- [requirements_ecore_ipc="ecore-con ${requirements_ecore_ipc}"])
+ [requirements_ecore_ipc="ecore-con >= 1.0.0 ${requirements_ecore_ipc}"])
# ecore_file
ECORE_CHECK_MODULE([file], [${want_ecore_file}], [File])
ECORE_CHECK_NOTIFY_WIN32([${want_notify_win32}], [have_notify_win32="yes"], [have_notify_win32="no"])
if test "x${have_ecore_con}" = "xyes" ; then
- requirements_ecore_file="ecore-con ${requirements_ecore_file}"
+ requirements_ecore_file="ecore-con >= 1.0.0 ${requirements_ecore_file}"
fi
fi
fi
ECORE_CHECK_MODULE([config], [${want_ecore_config}], [Config], [${ecore_config_deps}],
- [requirements_ecore_config="ecore-ipc evas eet ${requirements_ecore_config}"])
+ [requirements_ecore_config="ecore-ipc >= 1.0.0 evas >= 1.0.0 eet >= 1.4.0 ${requirements_ecore_config}"])
# ecore_imf
fi
ECORE_CHECK_MODULE([imf-evas], [${want_ecore_imf}], [Imf_Evas], [${ecore_imf_evas_deps}],
- [requirements_ecore_imf_evas="ecore-imf evas ${requirements_ecore_imf_evas}"])
+ [requirements_ecore_imf_evas="ecore-imf >= 1.0.0 evas >= 1.0.0 ${requirements_ecore_imf_evas}"])
# ecore_input{_evas}
ECORE_CHECK_MODULE([input], [${want_ecore_input}], [Input])
ECORE_CHECK_MODULE([input-evas], [${want_ecore_input}], [Input_Evas], [${have_evas}],
- [requirements_ecore_input_evas="ecore-input evas ${requirements_ecore_input}"])
+ [requirements_ecore_input_evas="ecore-input >= 1.0.0 evas >= 1.0.0 ${requirements_ecore_input}"])
## Graphic systems
ECORE_CHECK_MODULE([x], [${want_ecore_x}], [X], [${ecore_x_deps}],
[
ecore_x_libs="$ecore_x_libs $x_libs"
- requirements_ecore_x="ecore-input ${requirements_ecore_x}"
+ requirements_ecore_x="ecore-input >= 1.0.0 ${requirements_ecore_x}"
])
# ecore_win32
ECORE_CHECK_MODULE([win32], [${want_ecore_win32}], [Win32], [${have_ecore_input}],
[
ecore_win32_libs="-lole32 -lgdi32"
- requirements_ecore_win32="ecore-input ${requirements_ecore_win32}"
+ requirements_ecore_win32="ecore-input >= 1.0.0 ${requirements_ecore_win32}"
])
AC_SUBST(ecore_win32_libs)
fi
ECORE_CHECK_MODULE([cocoa], [${want_ecore_cocoa}], [Cocoa], [${ecore_cocoa_deps}],
- [requirements_ecore_cocoa="ecore-input ${requirements_ecore_cocoa}"])
+ [requirements_ecore_cocoa="ecore-input >= 1.0.0 ${requirements_ecore_cocoa}"])
# ecore_sdl
fi
ECORE_CHECK_MODULE([sdl], [${want_ecore_sdl}], [Sdl], [${ecore_sdl_deps}],
- [requirements_ecore_sdl="ecore-input ${requirements_ecore_sdl}"])
+ [requirements_ecore_sdl="ecore-input >= 1.0.0 ${requirements_ecore_sdl}"])
# ecore_fb
ECORE_CHECK_MODULE([fb], [${want_ecore_fb}], [FB], [$have_fb])
# ecore_wince
ECORE_CHECK_MODULE([wince], [${want_ecore_wince}], [WinCE], [${have_ecore_input}],
- [requirements_ecore_win32="ecore-input ${requirements_ecore_win32}"])
+ [requirements_ecore_win32="ecore-input >= 1.0.0 ${requirements_ecore_win32}"])
## Ecore Evas
fi
ECORE_CHECK_MODULE([evas], [${want_ecore_evas}], [Evas], [${ecore_evas_deps}],
- [requirements_ecore_evas="ecore-input ecore-input-evas evas ${requirements_ecore_evas}"])
+ [requirements_ecore_evas="ecore-input >= 1.0.0 ecore-input-evas >= 1.0.0 evas >= 1.0.0 ${requirements_ecore_evas}"])
# ecore_evas_buffer
[Software Xlib 16 bits],
[${have_ecore_x_xlib}])
+ECORE_EVAS_CHECK_MODULE([software-8-x11],
+ [$want_ecore_evas_software_8_x11],
+ [Software 8bit X11],
+ $have_ecore_x_xcb)
+
+
# ecore_evas_xrender_xcb
ECORE_EVAS_CHECK_MODULE([xrender-xcb],
if test "x$have_ecore_evas_software_x11" = "xyes" -o \
"x$have_ecore_evas_xrender_x11" = "xyes" -o \
"x$have_ecore_evas_opengl_x11" = "xyes" -o \
+ "x$have_ecore_evas_software_8_x11" = "xyes" -o \
"x$have_ecore_evas_software_16_x11" = "xyes" -o \
"x$have_ecore_evas_software_xcb" = "xyes" -o \
"x$have_ecore_evas_xrender_xcb" = "xyes"; then
AC_DEFINE(BUILD_ECORE_EVAS_X11, 1, [Support for X Window Engines in Ecore_Evas])
- requirements_ecore_evas="ecore-x ${requirements_ecore_evas}"
+ requirements_ecore_evas="ecore-x >= 1.0.0 ${requirements_ecore_evas}"
fi
# ecore_evas_win32
"x${have_ecore_evas_opengl_glew}" = "xyes" -o \
"x${have_ecore_evas_software_16_ddraw}" = "xyes" ; then
AC_DEFINE(BUILD_ECORE_EVAS_WIN32, 1, [Support for Win32 Engine in Ecore_Evas])
- requirements_ecore_evas="ecore-win32 ${requirements_ecore_evas}"
+ requirements_ecore_evas="ecore-win32 >= 1.0.0 ${requirements_ecore_evas}"
fi
# ecore_evas_cocoa
[${want_ecore_evas_cocoa}],
[Cocoa],
[${have_ecore_cocoa}],
- [requirements_ecore_evas="ecore-cocoa ${requirements_ecore_evas}"])
+ [requirements_ecore_evas="ecore-cocoa >= 1.0.0 ${requirements_ecore_evas}"])
# ecore_evas_software_sdl
[${want_ecore_evas_software_sdl}],
[Software SDL],
[${have_ecore_sdl}],
- [requirements_ecore_evas="ecore-sdl ${requirements_ecore_evas}"])
+ [requirements_ecore_evas="ecore-sdl >= 1.0.0 ${requirements_ecore_evas}"])
# ecore_evas_gl_sdl
[${want_ecore_evas_gl_sdl}],
[OpenGL SDL],
[${have_ecore_sdl}],
- [requirements_ecore_evas="ecore-sdl ${requirements_ecore_evas}"])
+ [requirements_ecore_evas="ecore-sdl >= 1.0.0 ${requirements_ecore_evas}"])
# ecore_evas_directfb
[${want_ecore_evas_directfb}],
[DirectFB],
[${have_ecore_directfb}],
- [requirements_ecore_evas="ecore-directfb ${requirements_ecore_evas}"])
+ [requirements_ecore_evas="ecore-directfb >= 1.0.0 ${requirements_ecore_evas}"])
# ecore_evas_fb
[${want_ecore_evas_fb}],
[Linux Framebuffer],
[${have_ecore_fb}],
- [requirements_ecore_evas="ecore-fb ${requirements_ecore_evas}"])
+ [requirements_ecore_evas="ecore-fb >= 1.0.0 ${requirements_ecore_evas}"])
# ecore_evas_wince
[${want_ecore_evas_software_16_wince}],
[16 bpp Software Windows CE],
[${have_ecore_wince}],
- [requirements_ecore_evas="ecore-wince ${requirements_ecore_evas}"])
+ [requirements_ecore_evas="ecore-wince >= 1.0.0 ${requirements_ecore_evas}"])
src/tests/Makefile
README
ecore.spec
-po/Makefile.in
+$po_makefile_in
])
echo
echo " Thread support.............: $have_pthread"
echo " GLib support...............: $have_glib"
echo " Always integrate GLib......: $want_glib_integration_always"
+echo " Use g_main_loop............: $want_g_main_loop"
echo " Gathering memory statistic.: $have_mallinfo"
echo " Ecore_Con....................: $have_ecore_con"
if test "x$have_ecore_con" = "xyes" ; then
echo " OpenGL SDL.................: $have_ecore_evas_opengl_sdl"
echo " DirectFB...................: $have_ecore_evas_directfb"
echo " Software Framebuffer.......: $have_ecore_evas_fb"
+ echo " Software 8bit grayscale XCB: $have_ecore_evas_software_8_x11"
echo " Software 16bit X11.........: $have_ecore_evas_software_16_x11"
echo " Software 16bit DirectDraw..: $have_ecore_evas_software_16_ddraw"
echo " Software 16bit WinCE.......: $have_ecore_evas_software_16_wince"
-Revision 49550
-Last Changed Rev 49540
+Revision 51480
+Last Changed Rev 51475
@pkgconfig_requires_private@: @requirements_ecore_cocoa@
Version: @VERSION@
Libs: -L${libdir} -lecore_cocoa
-Cflags: -I${includedir}
+Cflags: -I${includedir}/ecore-@VMAJ@
@pkgconfig_requires_private@: @requirements_ecore_con@
Version: @VERSION@
Libs: -L${libdir} -lecore_con
-Cflags: -I${includedir}
+Cflags: -I${includedir}/ecore-@VMAJ@
@pkgconfig_requires_private@: @requirements_ecore_config@
Version: @VERSION@
Libs: -L${libdir} -lecore_config
-Cflags: -I${includedir}
+Cflags: -I${includedir}/ecore-@VMAJ@
@pkgconfig_requires_private@: @requirements_ecore_directfb@
Version: @VERSION@
Libs: -L${libdir} -lecore_directfb
-Cflags: -I${includedir}
+Cflags: -I${includedir}/ecore-@VMAJ@
@pkgconfig_requires_private@: @requirements_ecore_evas@
Version: @VERSION@
Libs: -L${libdir} @ecore_evas_libs@
-Cflags: -I${includedir}
+Cflags: -I${includedir}/ecore-@VMAJ@
@pkgconfig_requires_private@: @requirements_ecore_fb@
Version: @VERSION@
Libs: -L${libdir} -lecore_fb
-Cflags: -I${includedir}
+Cflags: -I${includedir}/ecore-@VMAJ@
@pkgconfig_requires_private@: @requirements_ecore_file@
Version: @VERSION@
Libs: -L${libdir} -lecore_file
-Cflags: -I${includedir}
+Cflags: -I${includedir}/ecore-@VMAJ@
@pkgconfig_requires_private@: @requirements_ecore_imf_evas@
Version: @VERSION@
Libs: -L${libdir} -lecore_imf_evas
-Cflags: -I${includedir}
+Cflags: -I${includedir}/ecore-@VMAJ@
@pkgconfig_requires_private@: @requirements_ecore_imf@
Version: @VERSION@
Libs: -L${libdir} -lecore_imf
-Cflags: -I${includedir}
+Cflags: -I${includedir}/ecore-@VMAJ@
@pkgconfig_requires_private@: @requirements_ecore_input_evas@
Version: @VERSION@
Libs: -L${libdir} -lecore_input_evas
-Cflags: -I${includedir}
+Cflags: -I${includedir}/ecore-@VMAJ@
@pkgconfig_requires_private@: @requirements_ecore_input@
Version: @VERSION@
Libs: -L${libdir} -lecore_input
-Cflags: -I${includedir}
+Cflags: -I${includedir}/ecore-@VMAJ@
@pkgconfig_requires_private@: @requirements_ecore_ipc@
Version: @VERSION@
Libs: -L${libdir} -lecore_ipc
-Cflags: -I${includedir}
+Cflags: -I${includedir}/ecore-@VMAJ@
@pkgconfig_requires_private@: @requirements_ecore_sdl@
Version: @VERSION@
Libs: -L${libdir} -lecore_sdl
-Cflags: -I${includedir}
+Cflags: -I${includedir}/ecore-@VMAJ@
Version: @VERSION@
Libs: -L${libdir} -lecore_win32
Libs.private: @ddraw_libs@ @direct3d_libs@
-Cflags: -I${includedir}
+Cflags: -I${includedir}/ecore-@VMAJ@
Version: @VERSION@
Libs: -L${libdir} -lecore_wince
Libs.private: @WIN32_LIBS@
-Cflags: -I${includedir}
+Cflags: -I${includedir}/ecore-@VMAJ@
Version: @VERSION@
Libs: -L${libdir} -lecore_x
Libs.private: @x_libs@ @ecore_x_libs_private@
-Cflags: -I${includedir} @have_ecore_x_xcb_define@
+Cflags: -I${includedir}/ecore-@VMAJ@ @have_ecore_x_xcb_define@
Version: @VERSION@
Libs: -L${libdir} -lecore
Libs.private: -lm
-Cflags: -I${includedir}
+Cflags: -I${includedir}/ecore-@VMAJ@
--- /dev/null
+dnl @synopsis AC_PATH_GENERIC(LIBRARY [, MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+dnl
+dnl Runs a LIBRARY-config script and defines LIBRARY_CFLAGS and LIBRARY_LIBS
+dnl
+dnl The script must support `--cflags' and `--libs' args.
+dnl If MINIMUM-VERSION is specified, the script must also support the
+dnl `--version' arg.
+dnl If the `--with-library-[exec-]prefix' arguments to ./configure are given,
+dnl it must also support `--prefix' and `--exec-prefix'.
+dnl (In other words, it must be like gtk-config.)
+dnl
+dnl For example:
+dnl
+dnl AC_PATH_GENERIC(Foo, 1.0.0)
+dnl
+dnl would run `foo-config --version' and check that it is at least 1.0.0
+dnl
+dnl If so, the following would then be defined:
+dnl
+dnl FOO_CFLAGS to `foo-config --cflags`
+dnl FOO_LIBS to `foo-config --libs`
+dnl
+dnl At present there is no support for additional "MODULES" (see AM_PATH_GTK)
+dnl (shamelessly stolen from gtk.m4 and then hacked around a fair amount)
+dnl
+dnl @author Angus Lees <gusl@cse.unsw.edu.au>
+
+AC_DEFUN([AC_PATH_GENERIC],
+[dnl
+dnl we're going to need uppercase, lowercase and user-friendly versions of the
+dnl string `LIBRARY'
+pushdef([UP], translit([$1], [a-z], [A-Z]))dnl
+pushdef([DOWN], translit([$1], [A-Z], [a-z]))dnl
+
+dnl
+dnl Get the cflags and libraries from the LIBRARY-config script
+dnl
+AC_ARG_WITH(DOWN-prefix,
+ [ --with-]DOWN[-prefix=PFX Prefix where $1 is installed (optional)],
+ DOWN[]_config_prefix="$withval", DOWN[]_config_prefix="")
+AC_ARG_WITH(DOWN-exec-prefix,
+ [ --with-]DOWN[-exec-prefix=PFX Exec prefix where $1 is installed (optional)],
+ DOWN[]_config_exec_prefix="$withval", DOWN[]_config_exec_prefix="")
+
+ if test x$DOWN[]_config_exec_prefix != x ; then
+ DOWN[]_config_args="$DOWN[]_config_args --exec-prefix=$DOWN[]_config_exec_prefix"
+ if test x${UP[]_CONFIG+set} != xset ; then
+ UP[]_CONFIG=$DOWN[]_config_exec_prefix/bin/DOWN-config
+ fi
+ fi
+ if test x$DOWN[]_config_prefix != x ; then
+ DOWN[]_config_args="$DOWN[]_config_args --prefix=$DOWN[]_config_prefix"
+ if test x${UP[]_CONFIG+set} != xset ; then
+ UP[]_CONFIG=$DOWN[]_config_prefix/bin/DOWN-config
+ fi
+ fi
+
+ AC_PATH_PROG(UP[]_CONFIG, DOWN-config, no)
+ ifelse([$2], ,
+ AC_MSG_CHECKING(for $1),
+ AC_MSG_CHECKING(for $1 - version >= $2)
+ )
+ no_[]DOWN=""
+ if test "$UP[]_CONFIG" = "no" ; then
+ no_[]DOWN=yes
+ else
+ UP[]_CFLAGS="`$UP[]_CONFIG $DOWN[]_config_args --cflags`"
+ UP[]_LIBS="`$UP[]_CONFIG $DOWN[]_config_args --libs`"
+ ifelse([$2], , ,[
+ DOWN[]_config_major_version=`$UP[]_CONFIG $DOWN[]_config_args \
+ --version | sed 's/[[^0-9]]*\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\).*/\1/'`
+ DOWN[]_config_minor_version=`$UP[]_CONFIG $DOWN[]_config_args \
+ --version | sed 's/[[^0-9]]*\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\).*/\2/'`
+ DOWN[]_config_micro_version=`$UP[]_CONFIG $DOWN[]_config_args \
+ --version | sed 's/[[^0-9]]*\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\).*/\3/'`
+ DOWN[]_wanted_major_version="regexp($2, [\<\([0-9]*\)], [\1])"
+ DOWN[]_wanted_minor_version="regexp($2, [\<\([0-9]*\)\.\([0-9]*\)], [\2])"
+ DOWN[]_wanted_micro_version="regexp($2, [\<\([0-9]*\).\([0-9]*\).\([0-9]*\)], [\3])"
+
+ # Compare wanted version to what config script returned.
+ # If I knew what library was being run, i'd probably also compile
+ # a test program at this point (which also extracted and tested
+ # the version in some library-specific way)
+ if test "$DOWN[]_config_major_version" -lt \
+ "$DOWN[]_wanted_major_version" \
+ -o \( "$DOWN[]_config_major_version" -eq \
+ "$DOWN[]_wanted_major_version" \
+ -a "$DOWN[]_config_minor_version" -lt \
+ "$DOWN[]_wanted_minor_version" \) \
+ -o \( "$DOWN[]_config_major_version" -eq \
+ "$DOWN[]_wanted_major_version" \
+ -a "$DOWN[]_config_minor_version" -eq \
+ "$DOWN[]_wanted_minor_version" \
+ -a "$DOWN[]_config_micro_version" -lt \
+ "$DOWN[]_wanted_micro_version" \) ; then
+ # older version found
+ no_[]DOWN=yes
+ echo -n "*** An old version of $1 "
+ echo -n "($DOWN[]_config_major_version"
+ echo -n ".$DOWN[]_config_minor_version"
+ echo ".$DOWN[]_config_micro_version) was found."
+ echo -n "*** You need a version of $1 newer than "
+ echo -n "$DOWN[]_wanted_major_version"
+ echo -n ".$DOWN[]_wanted_minor_version"
+ echo ".$DOWN[]_wanted_micro_version."
+ echo "***"
+ echo "*** If you have already installed a sufficiently new version, this error"
+ echo "*** probably means that the wrong copy of the DOWN-config shell script is"
+ echo "*** being found. The easiest way to fix this is to remove the old version"
+ echo "*** of $1, but you can also set the UP[]_CONFIG environment to point to the"
+ echo "*** correct copy of DOWN-config. (In this case, you will have to"
+ echo "*** modify your LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf"
+ echo "*** so that the correct libraries are found at run-time)"
+ fi
+ ])
+ fi
+ if test "x$no_[]DOWN" = x ; then
+ AC_MSG_RESULT(yes)
+ ifelse([$3], , :, [$3])
+ else
+ AC_MSG_RESULT(no)
+ if test "$UP[]_CONFIG" = "no" ; then
+ echo "*** The DOWN-config script installed by $1 could not be found"
+ echo "*** If $1 was installed in PREFIX, make sure PREFIX/bin is in"
+ echo "*** your path, or set the UP[]_CONFIG environment variable to the"
+ echo "*** full path to DOWN-config."
+ fi
+ UP[]_CFLAGS=""
+ UP[]_LIBS=""
+ ifelse([$4], , :, [$4])
+ fi
+ AC_SUBST(UP[]_CFLAGS)
+ AC_SUBST(UP[]_LIBS)
+
+ popdef([UP])
+ popdef([DOWN])
+])
PKG_CHECK_MODULES([TLS2], [gnutls >= 2.0.0],
[AC_DEFINE(USE_GNUTLS2, 1, [Use GnuTLS 2 or higher])],
[dummy="no"])
+ if test "x$_ecore_have_gnutls" = "xyes";then
+ AC_PATH_GENERIC([libgcrypt], [], [_ecore_have_gnutls="yes"], [_ecore_have_gnutls="no"])
+ if test "x${_ecore_have_gnutls}" = "xyes" ; then
+ TLS_CFLAGS+=" ${LIBGCRYPT_CFLAGS}"
+ TLS_LIBS+=" ${LIBGCRYPT_LIBS}"
+ fi
+ fi
+
fi
if test "x$_ecore_have_gnutls" = "xyes" ; then
fi
])
+if test "x${_ecore_have_gnutls}" = "xyes";then
+ _ecore_want_openssl=no
+fi
+
if test "x${_ecore_want_openssl}" = "xyes" -o "x${_ecore_want_openssl}" = "xauto"; then
PKG_CHECK_MODULES([SSL],
[openssl],
SAVE_CFLAGS=${CFLAGS}
CFLAGS="${CFLAGS} ${_efl_pthread_cflags}"
- SAVE_LDFLAGS=${LDFLAGS}
- LDFLAGS="${LDFLAGS} ${_efl_pthread_libs}"
+ SAVE_LIBS=${LIBS}
+ LIBS="${LIBS} ${_efl_pthread_libs}"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[
#include <pthread.h>
[_efl_have_pthread="yes"],
[_efl_have_pthread="no"])
CFLAGS=${SAVE_CFLAGS}
- LDFLAGS=${SAVE_LDFLAGS}
+ LIBS=${SAVE_LIBS}
fi
SAVE_CFLAGS=${CFLAGS}
CFLAGS="${CFLAGS} ${EFL_PTHREAD_CFLAGS}"
- SAVE_LDFLAGS=${LDFLAGS}
- LDFLAGS="${LDFLAGS} ${EFL_PTHREAD_LIBS}"
+ SAVE_LIBS=${LIBS}
+ LIBS="${LIBS} ${EFL_PTHREAD_LIBS}"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[
#include <pthread.h>
[_efl_have_pthread_spinlock="yes"],
[_efl_have_pthread_spinlock="no"])
CFLAGS=${SAVE_CFLAGS}
- LDFLAGS=${SAVE_LDFLAGS}
+ LIBS=${SAVE_LIBS}
fi
-cs de el fr it
+cs de el fr it pt
msgstr ""
"Project-Id-Version: ecore\n"
"Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n"
-"POT-Creation-Date: 2010-05-14 23:51+1000\n"
+"POT-Creation-Date: 2010-08-16 17:14+0900\n"
"PO-Revision-Date: 2009-10-27 19:35+0100\n"
"Last-Translator: quaker66 <quaker66@gmail.com>\n"
"Language-Team: cs <quaker66@gmail.com>\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-#: src/lib/ecore/ecore_getopt.c:91
+#: src/lib/ecore/ecore_getopt.c:87
msgid "Version:"
msgstr "Verze:"
-#: src/lib/ecore/ecore_getopt.c:99
+#: src/lib/ecore/ecore_getopt.c:95
msgid "Usage:"
msgstr "Použití:"
-#: src/lib/ecore/ecore_getopt.c:104
+#: src/lib/ecore/ecore_getopt.c:100
#, c-format
msgid "%s [options]\n"
msgstr "%s [volby]\n"
-#: src/lib/ecore/ecore_getopt.c:252
+#: src/lib/ecore/ecore_getopt.c:248
msgid "Copyright:"
msgstr "Copyright:"
-#: src/lib/ecore/ecore_getopt.c:263
+#: src/lib/ecore/ecore_getopt.c:259
msgid "License:"
msgstr "Licence:"
-#: src/lib/ecore/ecore_getopt.c:415
+#: src/lib/ecore/ecore_getopt.c:411
msgid "Type: "
msgstr "Typ: "
-#: src/lib/ecore/ecore_getopt.c:482
+#: src/lib/ecore/ecore_getopt.c:478
msgid "Default: "
msgstr "Výchozí: "
-#: src/lib/ecore/ecore_getopt.c:505
+#: src/lib/ecore/ecore_getopt.c:501
msgid "Choices: "
msgstr "Možnosti: "
-#: src/lib/ecore/ecore_getopt.c:602
+#: src/lib/ecore/ecore_getopt.c:598
msgid "Options:\n"
msgstr "Volby:\n"
-#: src/lib/ecore/ecore_getopt.c:722
+#: src/lib/ecore/ecore_getopt.c:718
#, c-format
msgid "ERROR: unknown option --%s.\n"
msgstr "CHYBA: neznámá volba --%s.\n"
-#: src/lib/ecore/ecore_getopt.c:724
+#: src/lib/ecore/ecore_getopt.c:720
#, c-format
msgid "ERROR: unknown option -%c.\n"
msgstr "CHYBA: neznámá volba -%c.\n"
-#: src/lib/ecore/ecore_getopt.c:780
+#: src/lib/ecore/ecore_getopt.c:776
msgid "ERROR: "
msgstr "CHYBA: "
-#: src/lib/ecore/ecore_getopt.c:857 src/lib/ecore/ecore_getopt.c:973
-#: src/lib/ecore/ecore_getopt.c:986 src/lib/ecore/ecore_getopt.c:998
-#: src/lib/ecore/ecore_getopt.c:1012 src/lib/ecore/ecore_getopt.c:1056
-#: src/lib/ecore/ecore_getopt.c:1165 src/lib/ecore/ecore_getopt.c:1202
+#: src/lib/ecore/ecore_getopt.c:853 src/lib/ecore/ecore_getopt.c:969
+#: src/lib/ecore/ecore_getopt.c:982 src/lib/ecore/ecore_getopt.c:994
+#: src/lib/ecore/ecore_getopt.c:1008 src/lib/ecore/ecore_getopt.c:1052
+#: src/lib/ecore/ecore_getopt.c:1161 src/lib/ecore/ecore_getopt.c:1198
msgid "value has no pointer set.\n"
msgstr "hodnota nemá nastaven pointer.\n"
-#: src/lib/ecore/ecore_getopt.c:886 src/lib/ecore/ecore_getopt.c:1076
+#: src/lib/ecore/ecore_getopt.c:882 src/lib/ecore/ecore_getopt.c:1072
#, c-format
msgid "unknown boolean value %s.\n"
msgstr "neznámá boolean hodnota %s.\n"
-#: src/lib/ecore/ecore_getopt.c:930 src/lib/ecore/ecore_getopt.c:1156
+#: src/lib/ecore/ecore_getopt.c:926 src/lib/ecore/ecore_getopt.c:1152
#, c-format
msgid "invalid number format %s\n"
msgstr "neznámý číselný formát %s\n"
-#: src/lib/ecore/ecore_getopt.c:1025
+#: src/lib/ecore/ecore_getopt.c:1021
#, c-format
msgid "invalid choice \"%s\". Valid values are: "
msgstr "neznámá volba \"%s\". Možné hodnoty jsou: "
-#: src/lib/ecore/ecore_getopt.c:1050
+#: src/lib/ecore/ecore_getopt.c:1046
msgid "missing parameter to append.\n"
msgstr "chybějící parametr k připojení.\n"
-#: src/lib/ecore/ecore_getopt.c:1146
+#: src/lib/ecore/ecore_getopt.c:1142
msgid "could not parse value.\n"
msgstr "nemůžu parsovat hodnotu.\n"
-#: src/lib/ecore/ecore_getopt.c:1195
+#: src/lib/ecore/ecore_getopt.c:1191
msgid "missing parameter.\n"
msgstr "chybějící parametr.\n"
-#: src/lib/ecore/ecore_getopt.c:1209
+#: src/lib/ecore/ecore_getopt.c:1205
msgid "missing callback function!\n"
msgstr "chybějící callback funkce!\n"
-#: src/lib/ecore/ecore_getopt.c:1232
+#: src/lib/ecore/ecore_getopt.c:1228
msgid "no version was defined.\n"
msgstr "nebyla definována verze.\n"
-#: src/lib/ecore/ecore_getopt.c:1246
+#: src/lib/ecore/ecore_getopt.c:1242
msgid "no copyright was defined.\n"
msgstr "nebyl definován copyright.\n"
-#: src/lib/ecore/ecore_getopt.c:1260
+#: src/lib/ecore/ecore_getopt.c:1256
msgid "no license was defined.\n"
msgstr "nebyla definována licence.\n"
-#: src/lib/ecore/ecore_getopt.c:1314
+#: src/lib/ecore/ecore_getopt.c:1310
#, c-format
msgid "ERROR: unknown option --%s, ignored.\n"
msgstr "CHYBA: neznámá volba --%s, ignoruji.\n"
-#: src/lib/ecore/ecore_getopt.c:1347
+#: src/lib/ecore/ecore_getopt.c:1343
#, c-format
msgid "ERROR: option --%s requires an argument!\n"
msgstr "CHYBA: volba --%s vyžaduje argument!\n"
-#: src/lib/ecore/ecore_getopt.c:1383
+#: src/lib/ecore/ecore_getopt.c:1379
#, c-format
msgid "ERROR: unknown option -%c, ignored.\n"
msgstr "CHYBA: neznámá volba -%c, ignoruji.\n"
-#: src/lib/ecore/ecore_getopt.c:1421
+#: src/lib/ecore/ecore_getopt.c:1417
#, c-format
msgid "ERROR: option -%c requires an argument!\n"
msgstr "CHYBA: volba -%c vyžaduje argument!\n"
-#: src/lib/ecore/ecore_getopt.c:1624
+#: src/lib/ecore/ecore_getopt.c:1620
msgid "ERROR: no parser provided.\n"
msgstr "CHYBA: nebyl poskytnut parser.\n"
-#: src/lib/ecore/ecore_getopt.c:1629
+#: src/lib/ecore/ecore_getopt.c:1625
msgid "ERROR: no values provided.\n"
msgstr "CHYBA: nebyly poskytnuty hodnoty.\n"
-#: src/lib/ecore/ecore_getopt.c:1638
+#: src/lib/ecore/ecore_getopt.c:1634
msgid "ERROR: no arguments provided.\n"
msgstr "CHYBA: nebyly poskytnuty argumenty.\n"
-#: src/lib/ecore/ecore_getopt.c:1664
+#: src/lib/ecore/ecore_getopt.c:1660
msgid "ERROR: invalid options found."
msgstr "CHYBA: nalezeny neplatné volby."
-#: src/lib/ecore/ecore_getopt.c:1670
+#: src/lib/ecore/ecore_getopt.c:1666
#, c-format
msgid " See --%s.\n"
msgstr " viz. --%s.\n"
-#: src/lib/ecore/ecore_getopt.c:1672
+#: src/lib/ecore/ecore_getopt.c:1668
#, c-format
msgid " See -%c.\n"
msgstr " viz. -%c.\n"
-#: src/lib/ecore/ecore_getopt.c:1709
+#: src/lib/ecore/ecore_getopt.c:1705
#, c-format
msgid "ERROR: incorrect geometry value '%s'\n"
msgstr "CHYBA: neplatná hodnota geometrie '%s'\n"
-#: src/lib/ecore/ecore_getopt.c:1732
+#: src/lib/ecore/ecore_getopt.c:1728
#, c-format
msgid "ERROR: incorrect size value '%s'\n"
msgstr "CHYBA: neplatná hodnota velikosti '%s'\n"
msgstr ""
"Project-Id-Version: ecore 0.9.9.063-2\n"
"Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n"
-"POT-Creation-Date: 2010-05-14 23:51+1000\n"
+"POT-Creation-Date: 2010-08-16 17:14+0900\n"
"PO-Revision-Date: 2010-01-03 21:52+GMT\n"
"Last-Translator: Chris Leick <c.leick@vollbio.de>\n"
"Language-Team: German <debian-l10n-german@lists.debian.org>\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-#: src/lib/ecore/ecore_getopt.c:91
+#: src/lib/ecore/ecore_getopt.c:87
msgid "Version:"
msgstr "Version:"
-#: src/lib/ecore/ecore_getopt.c:99
+#: src/lib/ecore/ecore_getopt.c:95
msgid "Usage:"
msgstr "Aufruf:"
-#: src/lib/ecore/ecore_getopt.c:104
+#: src/lib/ecore/ecore_getopt.c:100
#, c-format
msgid "%s [options]\n"
msgstr "%s [Optionen]\n"
-#: src/lib/ecore/ecore_getopt.c:252
+#: src/lib/ecore/ecore_getopt.c:248
msgid "Copyright:"
msgstr "Copyright:"
-#: src/lib/ecore/ecore_getopt.c:263
+#: src/lib/ecore/ecore_getopt.c:259
msgid "License:"
msgstr "Lizenz:"
-#: src/lib/ecore/ecore_getopt.c:415
+#: src/lib/ecore/ecore_getopt.c:411
msgid "Type: "
msgstr "Typ: "
-#: src/lib/ecore/ecore_getopt.c:482
+#: src/lib/ecore/ecore_getopt.c:478
msgid "Default: "
msgstr "Vorgabe: "
-#: src/lib/ecore/ecore_getopt.c:505
+#: src/lib/ecore/ecore_getopt.c:501
msgid "Choices: "
msgstr "Auswahlen: "
-#: src/lib/ecore/ecore_getopt.c:602
+#: src/lib/ecore/ecore_getopt.c:598
msgid "Options:\n"
msgstr "Optionen:\n"
-#: src/lib/ecore/ecore_getopt.c:722
+#: src/lib/ecore/ecore_getopt.c:718
#, c-format
msgid "ERROR: unknown option --%s.\n"
msgstr "FEHLER: Unbekannte Option --%s\n"
-#: src/lib/ecore/ecore_getopt.c:724
+#: src/lib/ecore/ecore_getopt.c:720
#, c-format
msgid "ERROR: unknown option -%c.\n"
msgstr "FEHLER: Unbekannte Option -%c\n"
-#: src/lib/ecore/ecore_getopt.c:780
+#: src/lib/ecore/ecore_getopt.c:776
msgid "ERROR: "
msgstr "FEHLER: "
-#: src/lib/ecore/ecore_getopt.c:857 src/lib/ecore/ecore_getopt.c:973
-#: src/lib/ecore/ecore_getopt.c:986 src/lib/ecore/ecore_getopt.c:998
-#: src/lib/ecore/ecore_getopt.c:1012 src/lib/ecore/ecore_getopt.c:1056
-#: src/lib/ecore/ecore_getopt.c:1165 src/lib/ecore/ecore_getopt.c:1202
+#: src/lib/ecore/ecore_getopt.c:853 src/lib/ecore/ecore_getopt.c:969
+#: src/lib/ecore/ecore_getopt.c:982 src/lib/ecore/ecore_getopt.c:994
+#: src/lib/ecore/ecore_getopt.c:1008 src/lib/ecore/ecore_getopt.c:1052
+#: src/lib/ecore/ecore_getopt.c:1161 src/lib/ecore/ecore_getopt.c:1198
msgid "value has no pointer set.\n"
msgstr "kein Zeiger auf Wert gesetzt\n"
-#: src/lib/ecore/ecore_getopt.c:886 src/lib/ecore/ecore_getopt.c:1076
+#: src/lib/ecore/ecore_getopt.c:882 src/lib/ecore/ecore_getopt.c:1072
#, c-format
msgid "unknown boolean value %s.\n"
msgstr "unbekannter boolescher Wert %s\n"
-#: src/lib/ecore/ecore_getopt.c:930 src/lib/ecore/ecore_getopt.c:1156
+#: src/lib/ecore/ecore_getopt.c:926 src/lib/ecore/ecore_getopt.c:1152
#, c-format
msgid "invalid number format %s\n"
msgstr "ungültiges Zahlenformat %s\n"
-#: src/lib/ecore/ecore_getopt.c:1025
+#: src/lib/ecore/ecore_getopt.c:1021
#, c-format
msgid "invalid choice \"%s\". Valid values are: "
msgstr "ungültige Auswahl »%s«. Gültige Werte sind: "
-#: src/lib/ecore/ecore_getopt.c:1050
+#: src/lib/ecore/ecore_getopt.c:1046
msgid "missing parameter to append.\n"
msgstr "fehlender Parameter zum Anhängen\n"
-#: src/lib/ecore/ecore_getopt.c:1146
+#: src/lib/ecore/ecore_getopt.c:1142
msgid "could not parse value.\n"
msgstr "Wert kann nicht ausgewertet werden\n"
-#: src/lib/ecore/ecore_getopt.c:1195
+#: src/lib/ecore/ecore_getopt.c:1191
msgid "missing parameter.\n"
msgstr "fehlender Parameter\n"
-#: src/lib/ecore/ecore_getopt.c:1209
+#: src/lib/ecore/ecore_getopt.c:1205
msgid "missing callback function!\n"
msgstr "fehlende Rückruffunktion!\n"
-#: src/lib/ecore/ecore_getopt.c:1232
+#: src/lib/ecore/ecore_getopt.c:1228
msgid "no version was defined.\n"
msgstr "es wurde keine Version definiert.\n"
-#: src/lib/ecore/ecore_getopt.c:1246
+#: src/lib/ecore/ecore_getopt.c:1242
msgid "no copyright was defined.\n"
msgstr "es wurde kein Copyright definiert.\n"
-#: src/lib/ecore/ecore_getopt.c:1260
+#: src/lib/ecore/ecore_getopt.c:1256
msgid "no license was defined.\n"
msgstr "es wurde keine Lizenz definiert.\n"
-#: src/lib/ecore/ecore_getopt.c:1314
+#: src/lib/ecore/ecore_getopt.c:1310
#, c-format
msgid "ERROR: unknown option --%s, ignored.\n"
msgstr "FEHLER: Unbekannte Option --%s, ignoriert\n"
-#: src/lib/ecore/ecore_getopt.c:1347
+#: src/lib/ecore/ecore_getopt.c:1343
#, c-format
msgid "ERROR: option --%s requires an argument!\n"
msgstr "FEHLER: Option --%s benötigt ein Argument!\n"
-#: src/lib/ecore/ecore_getopt.c:1383
+#: src/lib/ecore/ecore_getopt.c:1379
#, c-format
msgid "ERROR: unknown option -%c, ignored.\n"
msgstr "FEHLER: Unbekannte Option -%c, ignoriert\n"
-#: src/lib/ecore/ecore_getopt.c:1421
+#: src/lib/ecore/ecore_getopt.c:1417
#, c-format
msgid "ERROR: option -%c requires an argument!\n"
msgstr "FEHLER: Option -%c benötigt ein Argument!\n"
-#: src/lib/ecore/ecore_getopt.c:1624
+#: src/lib/ecore/ecore_getopt.c:1620
msgid "ERROR: no parser provided.\n"
msgstr "FEHLER: Kein Parser bereitgestellt\n"
-#: src/lib/ecore/ecore_getopt.c:1629
+#: src/lib/ecore/ecore_getopt.c:1625
msgid "ERROR: no values provided.\n"
msgstr "FEHLER: Keine Werte bereitgestellt\n"
-#: src/lib/ecore/ecore_getopt.c:1638
+#: src/lib/ecore/ecore_getopt.c:1634
msgid "ERROR: no arguments provided.\n"
msgstr "FEHLER: Keine Argumente bereitgestellt\n"
-#: src/lib/ecore/ecore_getopt.c:1664
+#: src/lib/ecore/ecore_getopt.c:1660
msgid "ERROR: invalid options found."
msgstr "FEHLER: Ungültige Optionen gefunden"
-#: src/lib/ecore/ecore_getopt.c:1670
+#: src/lib/ecore/ecore_getopt.c:1666
#, c-format
msgid " See --%s.\n"
msgstr " Siehe --%s\n"
-#: src/lib/ecore/ecore_getopt.c:1672
+#: src/lib/ecore/ecore_getopt.c:1668
#, c-format
msgid " See -%c.\n"
msgstr " Siehe -%c\n"
-#: src/lib/ecore/ecore_getopt.c:1709
+#: src/lib/ecore/ecore_getopt.c:1705
#, c-format
msgid "ERROR: incorrect geometry value '%s'\n"
msgstr "FEHLER: Falscher Geometriewert »%s«\n"
-#: src/lib/ecore/ecore_getopt.c:1732
+#: src/lib/ecore/ecore_getopt.c:1728
#, c-format
msgid "ERROR: incorrect size value '%s'\n"
msgstr "FEHLER: Falscher Größenwert »%s«\n"
msgstr ""
"Project-Id-Version: Ecore\n"
"Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n"
-"POT-Creation-Date: 2010-05-14 23:51+1000\n"
+"POT-Creation-Date: 2010-08-16 17:14+0900\n"
"PO-Revision-Date: 2009-12-15 00:56+0200\n"
"Last-Translator: Giorgos Koutsikos <ragecryx@yahoo.gr>\n"
"Language-Team: Greek\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-#: src/lib/ecore/ecore_getopt.c:91
+#: src/lib/ecore/ecore_getopt.c:87
msgid "Version:"
msgstr "Έκδοση:"
-#: src/lib/ecore/ecore_getopt.c:99
+#: src/lib/ecore/ecore_getopt.c:95
msgid "Usage:"
msgstr "Χρήση:"
-#: src/lib/ecore/ecore_getopt.c:104
+#: src/lib/ecore/ecore_getopt.c:100
#, c-format
msgid "%s [options]\n"
msgstr "%s [επιλογές]\n"
-#: src/lib/ecore/ecore_getopt.c:252
+#: src/lib/ecore/ecore_getopt.c:248
msgid "Copyright:"
msgstr "Πνευματικά δικαιώματα:"
-#: src/lib/ecore/ecore_getopt.c:263
+#: src/lib/ecore/ecore_getopt.c:259
msgid "License:"
msgstr "Άδεια:"
-#: src/lib/ecore/ecore_getopt.c:415
+#: src/lib/ecore/ecore_getopt.c:411
msgid "Type: "
msgstr "Τύπος:"
-#: src/lib/ecore/ecore_getopt.c:482
+#: src/lib/ecore/ecore_getopt.c:478
msgid "Default: "
msgstr "Προκαθορισμένο:"
-#: src/lib/ecore/ecore_getopt.c:505
+#: src/lib/ecore/ecore_getopt.c:501
msgid "Choices: "
msgstr "Επιλογές:"
-#: src/lib/ecore/ecore_getopt.c:602
+#: src/lib/ecore/ecore_getopt.c:598
msgid "Options:\n"
msgstr "Επιλογές:\n"
-#: src/lib/ecore/ecore_getopt.c:722
+#: src/lib/ecore/ecore_getopt.c:718
#, c-format
msgid "ERROR: unknown option --%s.\n"
msgstr "ΣΦΑΛΜΑ: άγνωστη παράμετρος --%s.\n"
-#: src/lib/ecore/ecore_getopt.c:724
+#: src/lib/ecore/ecore_getopt.c:720
#, c-format
msgid "ERROR: unknown option -%c.\n"
msgstr "ΣΦΑΛΜΑ: άγνωστη παράμετρος -%c.\n"
-#: src/lib/ecore/ecore_getopt.c:780
+#: src/lib/ecore/ecore_getopt.c:776
msgid "ERROR: "
msgstr "ΣΦΑΛΜΑ:"
-#: src/lib/ecore/ecore_getopt.c:857 src/lib/ecore/ecore_getopt.c:973
-#: src/lib/ecore/ecore_getopt.c:986 src/lib/ecore/ecore_getopt.c:998
-#: src/lib/ecore/ecore_getopt.c:1012 src/lib/ecore/ecore_getopt.c:1056
-#: src/lib/ecore/ecore_getopt.c:1165 src/lib/ecore/ecore_getopt.c:1202
+#: src/lib/ecore/ecore_getopt.c:853 src/lib/ecore/ecore_getopt.c:969
+#: src/lib/ecore/ecore_getopt.c:982 src/lib/ecore/ecore_getopt.c:994
+#: src/lib/ecore/ecore_getopt.c:1008 src/lib/ecore/ecore_getopt.c:1052
+#: src/lib/ecore/ecore_getopt.c:1161 src/lib/ecore/ecore_getopt.c:1198
msgid "value has no pointer set.\n"
msgstr "η τιμή δεν έχει δείκτη ορισμένο.\n"
-#: src/lib/ecore/ecore_getopt.c:886 src/lib/ecore/ecore_getopt.c:1076
+#: src/lib/ecore/ecore_getopt.c:882 src/lib/ecore/ecore_getopt.c:1072
#, c-format
msgid "unknown boolean value %s.\n"
msgstr "άγνωστη τιμή boolean %s.\n"
-#: src/lib/ecore/ecore_getopt.c:930 src/lib/ecore/ecore_getopt.c:1156
+#: src/lib/ecore/ecore_getopt.c:926 src/lib/ecore/ecore_getopt.c:1152
#, c-format
msgid "invalid number format %s\n"
msgstr "άγνωστη μορφή αριθμού %s\n"
-#: src/lib/ecore/ecore_getopt.c:1025
+#: src/lib/ecore/ecore_getopt.c:1021
#, c-format
msgid "invalid choice \"%s\". Valid values are: "
msgstr "μη-έγκυρη επιλογή \"%s\". Οι τιμές είναι: "
-#: src/lib/ecore/ecore_getopt.c:1050
+#: src/lib/ecore/ecore_getopt.c:1046
msgid "missing parameter to append.\n"
msgstr "ελλιπής παράμετρος προς επισύναψη.\n"
-#: src/lib/ecore/ecore_getopt.c:1146
+#: src/lib/ecore/ecore_getopt.c:1142
msgid "could not parse value.\n"
msgstr ""
-#: src/lib/ecore/ecore_getopt.c:1195
+#: src/lib/ecore/ecore_getopt.c:1191
msgid "missing parameter.\n"
msgstr "ελλιπής παράμετρος.\n"
-#: src/lib/ecore/ecore_getopt.c:1209
+#: src/lib/ecore/ecore_getopt.c:1205
msgid "missing callback function!\n"
msgstr ""
-#: src/lib/ecore/ecore_getopt.c:1232
+#: src/lib/ecore/ecore_getopt.c:1228
msgid "no version was defined.\n"
msgstr "δεν έχει οριστεί έκδοση.\n"
-#: src/lib/ecore/ecore_getopt.c:1246
+#: src/lib/ecore/ecore_getopt.c:1242
msgid "no copyright was defined.\n"
msgstr "δεν έχουν οριστεί πνευματικά δικαιώματα.\n"
-#: src/lib/ecore/ecore_getopt.c:1260
+#: src/lib/ecore/ecore_getopt.c:1256
msgid "no license was defined.\n"
msgstr "δεν έχει οριστεί άδεια.\n"
-#: src/lib/ecore/ecore_getopt.c:1314
+#: src/lib/ecore/ecore_getopt.c:1310
#, c-format
msgid "ERROR: unknown option --%s, ignored.\n"
msgstr ""
-#: src/lib/ecore/ecore_getopt.c:1347
+#: src/lib/ecore/ecore_getopt.c:1343
#, c-format
msgid "ERROR: option --%s requires an argument!\n"
msgstr ""
-#: src/lib/ecore/ecore_getopt.c:1383
+#: src/lib/ecore/ecore_getopt.c:1379
#, c-format
msgid "ERROR: unknown option -%c, ignored.\n"
msgstr ""
-#: src/lib/ecore/ecore_getopt.c:1421
+#: src/lib/ecore/ecore_getopt.c:1417
#, c-format
msgid "ERROR: option -%c requires an argument!\n"
msgstr ""
-#: src/lib/ecore/ecore_getopt.c:1624
+#: src/lib/ecore/ecore_getopt.c:1620
msgid "ERROR: no parser provided.\n"
msgstr ""
-#: src/lib/ecore/ecore_getopt.c:1629
+#: src/lib/ecore/ecore_getopt.c:1625
msgid "ERROR: no values provided.\n"
msgstr ""
-#: src/lib/ecore/ecore_getopt.c:1638
+#: src/lib/ecore/ecore_getopt.c:1634
msgid "ERROR: no arguments provided.\n"
msgstr ""
-#: src/lib/ecore/ecore_getopt.c:1664
+#: src/lib/ecore/ecore_getopt.c:1660
msgid "ERROR: invalid options found."
msgstr ""
-#: src/lib/ecore/ecore_getopt.c:1670
+#: src/lib/ecore/ecore_getopt.c:1666
#, c-format
msgid " See --%s.\n"
msgstr " Δες --%s.\n"
-#: src/lib/ecore/ecore_getopt.c:1672
+#: src/lib/ecore/ecore_getopt.c:1668
#, c-format
msgid " See -%c.\n"
msgstr " Δες -%c.\n"
-#: src/lib/ecore/ecore_getopt.c:1709
+#: src/lib/ecore/ecore_getopt.c:1705
#, c-format
msgid "ERROR: incorrect geometry value '%s'\n"
msgstr ""
-#: src/lib/ecore/ecore_getopt.c:1732
+#: src/lib/ecore/ecore_getopt.c:1728
#, c-format
msgid "ERROR: incorrect size value '%s'\n"
msgstr ""
msgstr ""
"Project-Id-Version: Ecore\n"
"Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n"
-"POT-Creation-Date: 2010-05-14 23:51+1000\n"
-"PO-Revision-Date: 2010-03-13 14:04+0400\n"
+"POT-Creation-Date: 2010-08-16 17:14+0900\n"
+"PO-Revision-Date: 2010-07-11 11:01+0400\n"
"Last-Translator: batden <batden@orange.fr>\n"
"Language-Team: Enlightenment French Team <pourunmondesansgourou@gmail.com>\n"
"MIME-Version: 1.0\n"
"X-Poedit-Country: FRANCE\n"
"X-Poedit-SourceCharset: utf-8\n"
-#: src/lib/ecore/ecore_getopt.c:91
+#: src/lib/ecore/ecore_getopt.c:87
msgid "Version:"
msgstr "Version :"
-#: src/lib/ecore/ecore_getopt.c:99
+#: src/lib/ecore/ecore_getopt.c:95
msgid "Usage:"
msgstr "Usage :"
-#: src/lib/ecore/ecore_getopt.c:104
+#: src/lib/ecore/ecore_getopt.c:100
#, c-format
msgid "%s [options]\n"
msgstr "%s [options]\n"
-#: src/lib/ecore/ecore_getopt.c:252
+#: src/lib/ecore/ecore_getopt.c:248
msgid "Copyright:"
msgstr "Copyright :"
-#: src/lib/ecore/ecore_getopt.c:263
+#: src/lib/ecore/ecore_getopt.c:259
msgid "License:"
msgstr "Licence :"
-#: src/lib/ecore/ecore_getopt.c:415
+#: src/lib/ecore/ecore_getopt.c:411
msgid "Type: "
msgstr "Type : "
-#: src/lib/ecore/ecore_getopt.c:482
+#: src/lib/ecore/ecore_getopt.c:478
msgid "Default: "
msgstr "Par défaut :"
-#: src/lib/ecore/ecore_getopt.c:505
+#: src/lib/ecore/ecore_getopt.c:501
msgid "Choices: "
msgstr "Choix :"
-#: src/lib/ecore/ecore_getopt.c:602
+#: src/lib/ecore/ecore_getopt.c:598
msgid "Options:\n"
msgstr "Options :\n"
-#: src/lib/ecore/ecore_getopt.c:722
+#: src/lib/ecore/ecore_getopt.c:718
#, c-format
msgid "ERROR: unknown option --%s.\n"
msgstr "ERREUR : option inconnue --%s.\n"
-#: src/lib/ecore/ecore_getopt.c:724
+#: src/lib/ecore/ecore_getopt.c:720
#, c-format
msgid "ERROR: unknown option -%c.\n"
msgstr "ERREUR : option inconnue -%c.\n"
-#: src/lib/ecore/ecore_getopt.c:780
+#: src/lib/ecore/ecore_getopt.c:776
msgid "ERROR: "
msgstr "ERREUR :"
-#: src/lib/ecore/ecore_getopt.c:857 src/lib/ecore/ecore_getopt.c:973
-#: src/lib/ecore/ecore_getopt.c:986 src/lib/ecore/ecore_getopt.c:998
-#: src/lib/ecore/ecore_getopt.c:1012 src/lib/ecore/ecore_getopt.c:1056
-#: src/lib/ecore/ecore_getopt.c:1165 src/lib/ecore/ecore_getopt.c:1202
+#: src/lib/ecore/ecore_getopt.c:853 src/lib/ecore/ecore_getopt.c:969
+#: src/lib/ecore/ecore_getopt.c:982 src/lib/ecore/ecore_getopt.c:994
+#: src/lib/ecore/ecore_getopt.c:1008 src/lib/ecore/ecore_getopt.c:1052
+#: src/lib/ecore/ecore_getopt.c:1161 src/lib/ecore/ecore_getopt.c:1198
msgid "value has no pointer set.\n"
msgstr "la valeur n'a aucun pointeur défini.\n"
-#: src/lib/ecore/ecore_getopt.c:886 src/lib/ecore/ecore_getopt.c:1076
+#: src/lib/ecore/ecore_getopt.c:882 src/lib/ecore/ecore_getopt.c:1072
#, c-format
msgid "unknown boolean value %s.\n"
msgstr "valeur booléenne inconnue %s.\n"
-#: src/lib/ecore/ecore_getopt.c:930 src/lib/ecore/ecore_getopt.c:1156
+#: src/lib/ecore/ecore_getopt.c:926 src/lib/ecore/ecore_getopt.c:1152
#, c-format
msgid "invalid number format %s\n"
msgstr "format du nombre non valide %s\n"
-#: src/lib/ecore/ecore_getopt.c:1025
+#: src/lib/ecore/ecore_getopt.c:1021
#, c-format
msgid "invalid choice \"%s\". Valid values are: "
-msgstr "choix non valide \"%s\". Les valeurs valides sont : "
+msgstr "choix non valide « %s ». Les valeurs valides sont : "
-#: src/lib/ecore/ecore_getopt.c:1050
+#: src/lib/ecore/ecore_getopt.c:1046
msgid "missing parameter to append.\n"
msgstr "paramètre manquant à ajouter.\n"
-#: src/lib/ecore/ecore_getopt.c:1146
+#: src/lib/ecore/ecore_getopt.c:1142
msgid "could not parse value.\n"
msgstr "analyse de la valeur impossible.\n"
-#: src/lib/ecore/ecore_getopt.c:1195
+#: src/lib/ecore/ecore_getopt.c:1191
msgid "missing parameter.\n"
msgstr "paramètre manquant.\n"
-#: src/lib/ecore/ecore_getopt.c:1209
+#: src/lib/ecore/ecore_getopt.c:1205
msgid "missing callback function!\n"
msgstr "fonction de rappel manquante !\n"
-#: src/lib/ecore/ecore_getopt.c:1232
+#: src/lib/ecore/ecore_getopt.c:1228
msgid "no version was defined.\n"
msgstr "aucune version n'est définie.\n"
-#: src/lib/ecore/ecore_getopt.c:1246
+#: src/lib/ecore/ecore_getopt.c:1242
msgid "no copyright was defined.\n"
msgstr "aucun copyright n'est défini.\n"
-#: src/lib/ecore/ecore_getopt.c:1260
+#: src/lib/ecore/ecore_getopt.c:1256
msgid "no license was defined.\n"
msgstr "aucune licence n'est définie.\n"
-#: src/lib/ecore/ecore_getopt.c:1314
+#: src/lib/ecore/ecore_getopt.c:1310
#, c-format
msgid "ERROR: unknown option --%s, ignored.\n"
msgstr "ERREUR : option inconnue --%s, non prise en compte.\n"
-#: src/lib/ecore/ecore_getopt.c:1347
+#: src/lib/ecore/ecore_getopt.c:1343
#, c-format
msgid "ERROR: option --%s requires an argument!\n"
msgstr "ERREUR : l'option --%s requiert un argument !\n"
-#: src/lib/ecore/ecore_getopt.c:1383
+#: src/lib/ecore/ecore_getopt.c:1379
#, c-format
msgid "ERROR: unknown option -%c, ignored.\n"
msgstr "ERREUR : option inconnue -%c, non prise en compte.\n"
-#: src/lib/ecore/ecore_getopt.c:1421
+#: src/lib/ecore/ecore_getopt.c:1417
#, c-format
msgid "ERROR: option -%c requires an argument!\n"
msgstr "ERREUR : l'option -%c requiert un argument !\n"
-#: src/lib/ecore/ecore_getopt.c:1624
+#: src/lib/ecore/ecore_getopt.c:1620
msgid "ERROR: no parser provided.\n"
msgstr "ERREUR : aucun analyseur n'est fourni.\n"
-#: src/lib/ecore/ecore_getopt.c:1629
+#: src/lib/ecore/ecore_getopt.c:1625
msgid "ERROR: no values provided.\n"
msgstr "ERREUR : aucune valeur n'est fournie.\n"
-#: src/lib/ecore/ecore_getopt.c:1638
+#: src/lib/ecore/ecore_getopt.c:1634
msgid "ERROR: no arguments provided.\n"
msgstr "ERREUR : aucun argument n'est fourni.\n"
-#: src/lib/ecore/ecore_getopt.c:1664
+#: src/lib/ecore/ecore_getopt.c:1660
msgid "ERROR: invalid options found."
msgstr "ERREUR : options non valides détectées."
-#: src/lib/ecore/ecore_getopt.c:1670
+#: src/lib/ecore/ecore_getopt.c:1666
#, c-format
msgid " See --%s.\n"
msgstr " Voir --%s.\n"
-#: src/lib/ecore/ecore_getopt.c:1672
+#: src/lib/ecore/ecore_getopt.c:1668
#, c-format
msgid " See -%c.\n"
msgstr " Voir -%c.\n"
-#: src/lib/ecore/ecore_getopt.c:1709
+#: src/lib/ecore/ecore_getopt.c:1705
#, c-format
msgid "ERROR: incorrect geometry value '%s'\n"
-msgstr "ERREUR : valeur géométrique incorrecte '%s'\n"
+msgstr "ERREUR : valeur géométrique incorrecte « %s »\n"
-#: src/lib/ecore/ecore_getopt.c:1732
+#: src/lib/ecore/ecore_getopt.c:1728
#, c-format
msgid "ERROR: incorrect size value '%s'\n"
-msgstr "ERREUR : valeur de taille incorrecte '%s'\n"
+msgstr "ERREUR : valeur de taille incorrecte « %s »\n"
#~ msgid ""
#~ "\n"
msgstr ""
"Project-Id-Version: Ecore\n"
"Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n"
-"POT-Creation-Date: 2010-05-14 23:51+1000\n"
+"POT-Creation-Date: 2010-08-16 17:14+0900\n"
"PO-Revision-Date: 2009-10-27 19:36+0100\n"
"Last-Translator: quaker66 <quaker66@gmail.com>\n"
"Language-Team: none\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-#: src/lib/ecore/ecore_getopt.c:91
+#: src/lib/ecore/ecore_getopt.c:87
msgid "Version:"
msgstr "Versione:"
-#: src/lib/ecore/ecore_getopt.c:99
+#: src/lib/ecore/ecore_getopt.c:95
msgid "Usage:"
msgstr "Uso:"
-#: src/lib/ecore/ecore_getopt.c:104
+#: src/lib/ecore/ecore_getopt.c:100
#, c-format
msgid "%s [options]\n"
msgstr "%s [opzioni]\n"
-#: src/lib/ecore/ecore_getopt.c:252
+#: src/lib/ecore/ecore_getopt.c:248
msgid "Copyright:"
msgstr "Copyright:"
-#: src/lib/ecore/ecore_getopt.c:263
+#: src/lib/ecore/ecore_getopt.c:259
msgid "License:"
msgstr "Licenza:"
-#: src/lib/ecore/ecore_getopt.c:415
+#: src/lib/ecore/ecore_getopt.c:411
msgid "Type: "
msgstr "Tipo: "
-#: src/lib/ecore/ecore_getopt.c:482
+#: src/lib/ecore/ecore_getopt.c:478
msgid "Default: "
msgstr "Predefinito:"
-#: src/lib/ecore/ecore_getopt.c:505
+#: src/lib/ecore/ecore_getopt.c:501
msgid "Choices: "
msgstr "Scelte:"
-#: src/lib/ecore/ecore_getopt.c:602
+#: src/lib/ecore/ecore_getopt.c:598
msgid "Options:\n"
msgstr "Opzioni:\n"
-#: src/lib/ecore/ecore_getopt.c:722
+#: src/lib/ecore/ecore_getopt.c:718
#, c-format
msgid "ERROR: unknown option --%s.\n"
msgstr "ERRORE: opzione sconosciuta --%s.\n"
-#: src/lib/ecore/ecore_getopt.c:724
+#: src/lib/ecore/ecore_getopt.c:720
#, c-format
msgid "ERROR: unknown option -%c.\n"
msgstr "ERRORE: opzione sconosciuta -%c.\n"
-#: src/lib/ecore/ecore_getopt.c:780
+#: src/lib/ecore/ecore_getopt.c:776
msgid "ERROR: "
msgstr "ERRORE:"
-#: src/lib/ecore/ecore_getopt.c:857 src/lib/ecore/ecore_getopt.c:973
-#: src/lib/ecore/ecore_getopt.c:986 src/lib/ecore/ecore_getopt.c:998
-#: src/lib/ecore/ecore_getopt.c:1012 src/lib/ecore/ecore_getopt.c:1056
-#: src/lib/ecore/ecore_getopt.c:1165 src/lib/ecore/ecore_getopt.c:1202
+#: src/lib/ecore/ecore_getopt.c:853 src/lib/ecore/ecore_getopt.c:969
+#: src/lib/ecore/ecore_getopt.c:982 src/lib/ecore/ecore_getopt.c:994
+#: src/lib/ecore/ecore_getopt.c:1008 src/lib/ecore/ecore_getopt.c:1052
+#: src/lib/ecore/ecore_getopt.c:1161 src/lib/ecore/ecore_getopt.c:1198
msgid "value has no pointer set.\n"
msgstr "il valore non ha puntatori impostati.\n"
-#: src/lib/ecore/ecore_getopt.c:886 src/lib/ecore/ecore_getopt.c:1076
+#: src/lib/ecore/ecore_getopt.c:882 src/lib/ecore/ecore_getopt.c:1072
#, c-format
msgid "unknown boolean value %s.\n"
msgstr "valore booleano sconosciuto %s.\n"
-#: src/lib/ecore/ecore_getopt.c:930 src/lib/ecore/ecore_getopt.c:1156
+#: src/lib/ecore/ecore_getopt.c:926 src/lib/ecore/ecore_getopt.c:1152
#, c-format
msgid "invalid number format %s\n"
msgstr "formato numero non valido %s\n"
-#: src/lib/ecore/ecore_getopt.c:1025
+#: src/lib/ecore/ecore_getopt.c:1021
#, c-format
msgid "invalid choice \"%s\". Valid values are: "
msgstr "scelta non valida \"%s\". I valori ammessi sono: "
-#: src/lib/ecore/ecore_getopt.c:1050
+#: src/lib/ecore/ecore_getopt.c:1046
msgid "missing parameter to append.\n"
msgstr "parametro da appendere mancante.\n"
-#: src/lib/ecore/ecore_getopt.c:1146
+#: src/lib/ecore/ecore_getopt.c:1142
msgid "could not parse value.\n"
msgstr "impossibile il parsing del valore.\n"
-#: src/lib/ecore/ecore_getopt.c:1195
+#: src/lib/ecore/ecore_getopt.c:1191
msgid "missing parameter.\n"
msgstr "parametro mancante.\n"
-#: src/lib/ecore/ecore_getopt.c:1209
+#: src/lib/ecore/ecore_getopt.c:1205
msgid "missing callback function!\n"
msgstr "funzione callback mancante!\n"
-#: src/lib/ecore/ecore_getopt.c:1232
+#: src/lib/ecore/ecore_getopt.c:1228
msgid "no version was defined.\n"
msgstr "nessuna versione definita.\n"
-#: src/lib/ecore/ecore_getopt.c:1246
+#: src/lib/ecore/ecore_getopt.c:1242
msgid "no copyright was defined.\n"
msgstr "nessun copyright definito.\n"
-#: src/lib/ecore/ecore_getopt.c:1260
+#: src/lib/ecore/ecore_getopt.c:1256
msgid "no license was defined.\n"
msgstr "nessuna licenza definita.\n"
-#: src/lib/ecore/ecore_getopt.c:1314
+#: src/lib/ecore/ecore_getopt.c:1310
#, c-format
msgid "ERROR: unknown option --%s, ignored.\n"
msgstr "ERRORE: opzione sconosciuta --%s, ignorata.\n"
-#: src/lib/ecore/ecore_getopt.c:1347
+#: src/lib/ecore/ecore_getopt.c:1343
#, c-format
msgid "ERROR: option --%s requires an argument!\n"
msgstr "ERRORE: l'opzione --%s richiede un argomento!\n"
-#: src/lib/ecore/ecore_getopt.c:1383
+#: src/lib/ecore/ecore_getopt.c:1379
#, c-format
msgid "ERROR: unknown option -%c, ignored.\n"
msgstr "ERRORE: opzione sconosciuta -%c, ignorata.\n"
-#: src/lib/ecore/ecore_getopt.c:1421
+#: src/lib/ecore/ecore_getopt.c:1417
#, c-format
msgid "ERROR: option -%c requires an argument!\n"
msgstr "ERRORE: l'opzione -%c richiede un argomento!\n"
-#: src/lib/ecore/ecore_getopt.c:1624
+#: src/lib/ecore/ecore_getopt.c:1620
msgid "ERROR: no parser provided.\n"
msgstr "ERRORE: nessun parser fornito.\n"
-#: src/lib/ecore/ecore_getopt.c:1629
+#: src/lib/ecore/ecore_getopt.c:1625
msgid "ERROR: no values provided.\n"
msgstr "ERRORE: nessun valore fornito.\n"
-#: src/lib/ecore/ecore_getopt.c:1638
+#: src/lib/ecore/ecore_getopt.c:1634
msgid "ERROR: no arguments provided.\n"
msgstr "ERRORE: nessun argomento fornito.\n"
-#: src/lib/ecore/ecore_getopt.c:1664
+#: src/lib/ecore/ecore_getopt.c:1660
msgid "ERROR: invalid options found."
msgstr "ERRORE: trovate opzioni non valide."
-#: src/lib/ecore/ecore_getopt.c:1670
+#: src/lib/ecore/ecore_getopt.c:1666
#, c-format
msgid " See --%s.\n"
msgstr " Vedere --%s.\n"
-#: src/lib/ecore/ecore_getopt.c:1672
+#: src/lib/ecore/ecore_getopt.c:1668
#, c-format
msgid " See -%c.\n"
msgstr " Vedere -%c.\n"
-#: src/lib/ecore/ecore_getopt.c:1709
+#: src/lib/ecore/ecore_getopt.c:1705
#, c-format
msgid "ERROR: incorrect geometry value '%s'\n"
msgstr "ERRORE: valore geometrico non corretto '%s'\n"
-#: src/lib/ecore/ecore_getopt.c:1732
+#: src/lib/ecore/ecore_getopt.c:1728
#, c-format
msgid "ERROR: incorrect size value '%s'\n"
msgstr "ERRORE: valore dimensione non corretto '%s'\n"
--- /dev/null
+# Portuguese translation for ecore
+# This file is distributed under the same license as the enlightenment package.
+# Sérgio Marques <smarquespt@gmail.com>, 2010
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: ecore\n"
+"Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n"
+"POT-Creation-Date: 2010-08-16 17:14+0900\n"
+"PO-Revision-Date: 2010-08-11 18:57-0000\n"
+"Last-Translator: Sérgio Marques <smarquespt@gmail.com>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n > 1);\n"
+"X-Poedit-Language: Portuguese\n"
+"X-Poedit-Country: Portugal\n"
+
+#: src/lib/ecore/ecore_getopt.c:87
+msgid "Version:"
+msgstr "Versão:"
+
+#: src/lib/ecore/ecore_getopt.c:95
+msgid "Usage:"
+msgstr "Utilização:"
+
+#: src/lib/ecore/ecore_getopt.c:100
+#, c-format
+msgid "%s [options]\n"
+msgstr "%s [opções]\n"
+
+#: src/lib/ecore/ecore_getopt.c:248
+msgid "Copyright:"
+msgstr "Direitos de autor:"
+
+#: src/lib/ecore/ecore_getopt.c:259
+msgid "License:"
+msgstr "Licença:"
+
+#: src/lib/ecore/ecore_getopt.c:411
+msgid "Type: "
+msgstr "Tipo:"
+
+#: src/lib/ecore/ecore_getopt.c:478
+msgid "Default: "
+msgstr "Omissão:"
+
+#: src/lib/ecore/ecore_getopt.c:501
+msgid "Choices: "
+msgstr "Escolhas:"
+
+#: src/lib/ecore/ecore_getopt.c:598
+msgid "Options:\n"
+msgstr "Opções:\n"
+
+#: src/lib/ecore/ecore_getopt.c:718
+#, c-format
+msgid "ERROR: unknown option --%s.\n"
+msgstr "ERRO: opção desconhecida --%s.\n"
+
+#: src/lib/ecore/ecore_getopt.c:720
+#, c-format
+msgid "ERROR: unknown option -%c.\n"
+msgstr "ERRO: opção desconhecida -%c.\n"
+
+#: src/lib/ecore/ecore_getopt.c:776
+msgid "ERROR: "
+msgstr "ERRO: "
+
+#: src/lib/ecore/ecore_getopt.c:853 src/lib/ecore/ecore_getopt.c:969
+#: src/lib/ecore/ecore_getopt.c:982 src/lib/ecore/ecore_getopt.c:994
+#: src/lib/ecore/ecore_getopt.c:1008 src/lib/ecore/ecore_getopt.c:1052
+#: src/lib/ecore/ecore_getopt.c:1161 src/lib/ecore/ecore_getopt.c:1198
+msgid "value has no pointer set.\n"
+msgstr "o valor não está definido.\n"
+
+#: src/lib/ecore/ecore_getopt.c:882 src/lib/ecore/ecore_getopt.c:1072
+#, c-format
+msgid "unknown boolean value %s.\n"
+msgstr "valor booleano desconhecido %s.\n"
+
+#: src/lib/ecore/ecore_getopt.c:926 src/lib/ecore/ecore_getopt.c:1152
+#, c-format
+msgid "invalid number format %s\n"
+msgstr "formato do número inválido %s\n"
+
+#: src/lib/ecore/ecore_getopt.c:1021
+#, c-format
+msgid "invalid choice \"%s\". Valid values are: "
+msgstr "escolha inválida \"%s\". O valores possíveis são:"
+
+#: src/lib/ecore/ecore_getopt.c:1046
+msgid "missing parameter to append.\n"
+msgstr "faltam os parâmetros a anexar.\n"
+
+#: src/lib/ecore/ecore_getopt.c:1142
+msgid "could not parse value.\n"
+msgstr "incapaz de analisar o valor.\n"
+
+#: src/lib/ecore/ecore_getopt.c:1191
+msgid "missing parameter.\n"
+msgstr "parâmetro em falta.\n"
+
+#: src/lib/ecore/ecore_getopt.c:1205
+msgid "missing callback function!\n"
+msgstr "função de chamada em falta!\n"
+
+#: src/lib/ecore/ecore_getopt.c:1228
+msgid "no version was defined.\n"
+msgstr "nenhuma versão definida.\n"
+
+#: src/lib/ecore/ecore_getopt.c:1242
+msgid "no copyright was defined.\n"
+msgstr "direitos de autor não definidos.\n"
+
+#: src/lib/ecore/ecore_getopt.c:1256
+msgid "no license was defined.\n"
+msgstr "licença não definida.\n"
+
+#: src/lib/ecore/ecore_getopt.c:1310
+#, c-format
+msgid "ERROR: unknown option --%s, ignored.\n"
+msgstr "ERRO: opção desconhecida --%s, ignorada.\n"
+
+#: src/lib/ecore/ecore_getopt.c:1343
+#, c-format
+msgid "ERROR: option --%s requires an argument!\n"
+msgstr "ERRO: a opção --%s requer um argumento!\n"
+
+#: src/lib/ecore/ecore_getopt.c:1379
+#, c-format
+msgid "ERROR: unknown option -%c, ignored.\n"
+msgstr "ERRO: opção desconhecida --%c, ignorada.\n"
+
+#: src/lib/ecore/ecore_getopt.c:1417
+#, c-format
+msgid "ERROR: option -%c requires an argument!\n"
+msgstr "ERRO: a opção --%c requer um argumento!\n"
+
+#: src/lib/ecore/ecore_getopt.c:1620
+msgid "ERROR: no parser provided.\n"
+msgstr "ERRO: nenhum analisador fornecido.\n"
+
+#: src/lib/ecore/ecore_getopt.c:1625
+msgid "ERROR: no values provided.\n"
+msgstr "ERRO: nenhum valor fornecido.\n"
+
+#: src/lib/ecore/ecore_getopt.c:1634
+msgid "ERROR: no arguments provided.\n"
+msgstr "ERRO: nehum argumento fornecido.\n"
+
+#: src/lib/ecore/ecore_getopt.c:1660
+msgid "ERROR: invalid options found."
+msgstr "ERRO: foram encontradas opções inválidas."
+
+#: src/lib/ecore/ecore_getopt.c:1666
+#, c-format
+msgid " See --%s.\n"
+msgstr " Veja --%s.\n"
+
+#: src/lib/ecore/ecore_getopt.c:1668
+#, c-format
+msgid " See -%c.\n"
+msgstr " Veja -%c.\n"
+
+#: src/lib/ecore/ecore_getopt.c:1705
+#, c-format
+msgid "ERROR: incorrect geometry value '%s'\n"
+msgstr "ERRO: valor geométrico incorrecto '%s'\n"
+
+#: src/lib/ecore/ecore_getopt.c:1728
+#, c-format
+msgid "ERROR: incorrect size value '%s'\n"
+msgstr "ERRO: tamanho incorrecto '%s'\n"
-DPACKAGE_BIN_DIR=\"$(bindir)\" \
-DPACKAGE_LIB_DIR=\"$(libdir)\" \
-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
-@EINA_CFLAGS@ \
-@EET_CFLAGS@
+@EINA_CFLAGS@ @EVAS_CFLAGS@ @EET_CFLAGS@
bin_PROGRAMS = $(ECORE_CONFIG_PROG)
$(ECORE_CONFIG_LIB) \
$(top_builddir)/src/lib/ecore_ipc/libecore_ipc.la \
$(top_builddir)/src/lib/ecore_con/libecore_con.la \
-$(top_builddir)/src/lib/ecore/libecore.la
+$(top_builddir)/src/lib/ecore/libecore.la \
+@EINA_LIBS@ @EVAS_LIBS@ @EET_LIBS@
ecore_config_DEPENDENCIES = \
$(top_builddir)/src/lib/ecore_ipc/libecore_ipc.la \
extern "C" {
#endif
-#define ECORE_VERSION_MAJOR 0
-#define ECORE_VERSION_MINOR 9
+#define ECORE_VERSION_MAJOR 1
+#define ECORE_VERSION_MINOR 0
typedef struct _Ecore_Version
{
EAPI extern Ecore_Version *ecore_version;
-#define ECORE_CALLBACK_CANCEL 0 /**< Return value to remove a callback */
-#define ECORE_CALLBACK_RENEW 1 /**< Return value to keep a callback */
+#define ECORE_CALLBACK_CANCEL EINA_FALSE /**< Return value to remove a callback */
+#define ECORE_CALLBACK_RENEW EINA_TRUE /**< Return value to keep a callback */
+
+#define ECORE_CALLBACK_PASS_ON EINA_TRUE /**< Return value to pass event to next handler */
+#define ECORE_CALLBACK_DONE EINA_FALSE /**< Return value to stop event handling */
#define ECORE_EVENT_NONE 0
#define ECORE_EVENT_SIGNAL_USER 1 /**< User signal event */
typedef struct _Ecore_Exe_Event_Data Ecore_Exe_Event_Data; /**< Data from a child process */
typedef struct _Ecore_Thread Ecore_Thread;
+ /**
+ * @typedef Ecore_Data_Cb Ecore_Data_Cb
+ * A callback which is used to return data to the main function
+ */
+ typedef void *(*Ecore_Data_Cb) (void *data);
+ /**
+ * @typedef Ecore_Filter_Cb
+ * A callback used for filtering events from the main loop.
+ */
+ typedef Eina_Bool (*Ecore_Filter_Cb) (void *data, void *loop_data, int type, void *event);
+ /**
+ * @typedef Ecore_Eselect_Function Ecore_Eselect_Function
+ * A function which can be used to replace select() in the main loop
+ */
+ typedef int (*Ecore_Select_Function)(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
+ /**
+ * @typedef Ecore_End_Cb Ecore_End_Cb
+ * This is the callback which is called at the end of a function, usually for cleanup purposes.
+ */
+ typedef void (*Ecore_End_Cb) (void *user_data, void *func_data);
+ /**
+ * @typedef Ecore_Pipe_Cb Ecore_Pipe_Cb
+ * The callback that data written to the pipe is sent to.
+ */
+ typedef void (*Ecore_Pipe_Cb) (void *data, void *buffer, unsigned int nbyte);
+ /**
+ * @typedef Ecore_Exe_Cb Ecore_Exe_Cb
+ * A callback to run with the associated @ref Ecore_Exe, usually for cleanup purposes.
+ */
+ typedef void (*Ecore_Exe_Cb)(void *data, const Ecore_Exe *exe);
+ /**
+ * @typedef Ecore_Event_Handler_Cb Ecore_Event_Handler_Cb
+ * A callback used by the main loop to handle events of a specified type.
+ */
+ typedef Eina_Bool (*Ecore_Event_Handler_Cb) (void *data, int type, void *event);
+ /**
+ * @typedef Ecore_Thread_Heavy_Cb Ecore_Thread_Heavy_Cb
+ * A callback used to run cpu intensive or blocking I/O operations.
+ */
+ typedef void (*Ecore_Thread_Heavy_Cb) (Ecore_Thread *thread, void *data);
+ /**
+ * @typedef Ecore_Thread_Notify_Cb Ecore_Thread_Notify_Cb
+ * A callback used by the main loop to receive data sent by an @ref Ecore_Thread.
+ */
+ typedef void (*Ecore_Thread_Notify_Cb) (Ecore_Thread *thread, void *msg_data, void *data);
+ /**
+ * @typedef Ecore_Task_Cb Ecore_Task_Cb
+ * A callback run for a task (timer, idler, poller, animater, etc)
+ */
+ typedef Eina_Bool (*Ecore_Task_Cb) (void *data);
+ /**
+ * @typedef Ecore_Cb Ecore_Cb
+ * A generic callback called as a hook when a certain point in execution is reached.
+ */
+ typedef void (*Ecore_Cb) (void *data);
+ /**
+ * @typedef Ecore_Fd_Cb Ecore_Fd_Cb
+ * A callback used by an @ref Ecore_Fd_Handler.
+ */
+ typedef Eina_Bool (*Ecore_Fd_Cb) (void *data, Ecore_Fd_Handler *fd_handler);
+ /**
+ * @typedef Ecore_Fd_Prep_Cb Ecore_Fd_Prep_Cb
+ * A callback used by an @ref Ecore_Fd_Handler.
+ */
+ typedef void (*Ecore_Fd_Prep_Cb) (void *data, Ecore_Fd_Handler *fd_handler);
+ /**
+ * @typedef Ecore_Fd_Win32_Cb Ecore_Fd_Win32_Cb
+ * A callback used by an @ref Ecore_Win32_Handler.
+ */
+ typedef Eina_Bool (*Ecore_Fd_Win32_Cb) (void *data, Ecore_Win32_Handler *wh);
+
+
typedef struct _Ecore_Job Ecore_Job; /**< A job handle */
struct _Ecore_Event_Signal_User /** User signal event */
EAPI void ecore_app_args_get(int *argc, char ***argv);
EAPI void ecore_app_restart(void);
- EAPI Ecore_Event_Handler *ecore_event_handler_add(int type, int (*func) (void *data, int type, void *event), const void *data);
+ EAPI Ecore_Event_Handler *ecore_event_handler_add(int type, Ecore_Event_Handler_Cb func, const void *data);
EAPI void *ecore_event_handler_del(Ecore_Event_Handler *event_handler);
- EAPI Ecore_Event *ecore_event_add(int type, void *ev, void (*func_free) (void *data, void *ev), void *data);
+ EAPI Ecore_Event *ecore_event_add(int type, void *ev, Ecore_End_Cb func_free, void *data);
EAPI void *ecore_event_del(Ecore_Event *event);
EAPI int ecore_event_type_new(void);
- EAPI Ecore_Event_Filter *ecore_event_filter_add(void * (*func_start) (void *data), int (*func_filter) (void *data, void *loop_data, int type, void *event), void (*func_end) (void *data, void *loop_data), const void *data);
+ EAPI Ecore_Event_Filter *ecore_event_filter_add(Ecore_Data_Cb func_start, Ecore_Filter_Cb func_filter, Ecore_End_Cb func_end, const void *data);
EAPI void *ecore_event_filter_del(Ecore_Event_Filter *ef);
EAPI int ecore_event_current_type_get(void);
EAPI void *ecore_event_current_event_get(void);
EAPI int ecore_exe_run_priority_get(void);
EAPI Ecore_Exe *ecore_exe_run(const char *exe_cmd, const void *data);
EAPI Ecore_Exe *ecore_exe_pipe_run(const char *exe_cmd, Ecore_Exe_Flags flags, const void *data);
- EAPI void ecore_exe_callback_pre_free_set(Ecore_Exe *exe, void (*func)(void *data, const Ecore_Exe *exe));
+ EAPI void ecore_exe_callback_pre_free_set(Ecore_Exe *exe, Ecore_Exe_Cb func);
EAPI Eina_Bool ecore_exe_send(Ecore_Exe *exe, const void *data, int size);
EAPI void ecore_exe_close_stdin(Ecore_Exe *exe);
EAPI void ecore_exe_auto_limits_set(Ecore_Exe *exe, int start_bytes, int end_bytes, int start_lines, int end_lines);
EAPI void ecore_exe_signal(Ecore_Exe *exe, int num);
EAPI void ecore_exe_hup(Ecore_Exe *exe);
- EAPI Ecore_Idler *ecore_idler_add(int (*func) (void *data), const void *data);
+ EAPI Ecore_Idler *ecore_idler_add(Ecore_Task_Cb func, const void *data);
EAPI void *ecore_idler_del(Ecore_Idler *idler);
- EAPI Ecore_Idle_Enterer *ecore_idle_enterer_add(int (*func) (void *data), const void *data);
- EAPI Ecore_Idle_Enterer *ecore_idle_enterer_before_add(int (*func) (void *data), const void *data);
+ EAPI Ecore_Idle_Enterer *ecore_idle_enterer_add(Ecore_Task_Cb func, const void *data);
+ EAPI Ecore_Idle_Enterer *ecore_idle_enterer_before_add(Ecore_Task_Cb func, const void *data);
EAPI void *ecore_idle_enterer_del(Ecore_Idle_Enterer *idle_enterer);
- EAPI Ecore_Idle_Exiter *ecore_idle_exiter_add(int (*func) (void *data), const void *data);
+ EAPI Ecore_Idle_Exiter *ecore_idle_exiter_add(Ecore_Task_Cb func, const void *data);
EAPI void *ecore_idle_exiter_del(Ecore_Idle_Exiter *idle_exiter);
EAPI void ecore_main_loop_iterate(void);
- EAPI void ecore_main_loop_select_func_set(int (*func)(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout));
+ EAPI void ecore_main_loop_select_func_set(Ecore_Select_Function func);
EAPI void *ecore_main_loop_select_func_get(void);
EAPI Eina_Bool ecore_main_loop_glib_integrate(void);
EAPI void ecore_main_loop_begin(void);
EAPI void ecore_main_loop_quit(void);
- EAPI Ecore_Fd_Handler *ecore_main_fd_handler_add(int fd, Ecore_Fd_Handler_Flags flags, int (*func) (void *data, Ecore_Fd_Handler *fd_handler), const void *data, int (*buf_func) (void *buf_data, Ecore_Fd_Handler *fd_handler), const void *buf_data);
- EAPI void ecore_main_fd_handler_prepare_callback_set(Ecore_Fd_Handler *fd_handler, void (*func) (void *data, Ecore_Fd_Handler *fd_handler), const void *data);
+ EAPI Ecore_Fd_Handler *ecore_main_fd_handler_add(int fd, Ecore_Fd_Handler_Flags flags, Ecore_Fd_Cb func, const void *data,
+ Ecore_Fd_Cb buf_func, const void *buf_data);
+ EAPI void ecore_main_fd_handler_prepare_callback_set(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Prep_Cb func, const void *data);
EAPI void *ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler);
EAPI int ecore_main_fd_handler_fd_get(Ecore_Fd_Handler *fd_handler);
EAPI int ecore_main_fd_handler_active_get(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags);
EAPI void ecore_main_fd_handler_active_set(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags);
- EAPI Ecore_Win32_Handler *ecore_main_win32_handler_add(void *h, int (*func) (void *data, Ecore_Win32_Handler *wh), const void *data);
+ EAPI Ecore_Win32_Handler *ecore_main_win32_handler_add(void *h, Ecore_Fd_Win32_Cb func, const void *data);
EAPI void *ecore_main_win32_handler_del(Ecore_Win32_Handler *win32_handler);
- EAPI Ecore_Pipe *ecore_pipe_add(void (*handler) (void *data, void *buffer, unsigned int nbyte), const void *data);
+ EAPI Ecore_Pipe *ecore_pipe_add(Ecore_Pipe_Cb handler, const void *data);
EAPI void *ecore_pipe_del(Ecore_Pipe *p);
- EAPI int ecore_pipe_write(Ecore_Pipe *p, const void *buffer, unsigned int nbytes);
+ EAPI Eina_Bool ecore_pipe_write(Ecore_Pipe *p, const void *buffer, unsigned int nbytes);
EAPI void ecore_pipe_write_close(Ecore_Pipe *p);
EAPI void ecore_pipe_read_close(Ecore_Pipe *p);
- EAPI Ecore_Thread *ecore_thread_run(void (*func_heavy)(void *data), void (*func_end)(void *data), void (*func_cancel)(void *data), const void *data);
+
+
+ EAPI Ecore_Thread *ecore_thread_run(Ecore_Cb,
+ Ecore_Cb,
+ Ecore_Cb,
+ const void *data);
+ EAPI Ecore_Thread *ecore_long_run(Ecore_Thread_Heavy_Cb,
+ Ecore_Thread_Notify_Cb,
+ Ecore_Cb,
+ Ecore_Cb,
+ const void *data,
+ Eina_Bool try_no_queue);
EAPI Eina_Bool ecore_thread_cancel(Ecore_Thread *thread);
+ EAPI Eina_Bool ecore_thread_check(Ecore_Thread *thread);
+ EAPI Eina_Bool ecore_thread_notify(Ecore_Thread *thread, const void *msg_data);
+ EAPI int ecore_thread_active_get(void);
+ EAPI int ecore_thread_pending_get(void);
+ EAPI int ecore_thread_pending_long_get(void);
+ EAPI int ecore_thread_pending_total_get(void);
+ EAPI int ecore_thread_max_get(void);
+ EAPI void ecore_thread_max_set(int num);
+ EAPI void ecore_thread_max_reset(void);
+ EAPI int ecore_thread_available_get(void);
+
+ EAPI Eina_Bool ecore_thread_local_data_add(Ecore_Thread *thread, const char *key, void *value, Eina_Free_Cb cb, Eina_Bool direct);
+ EAPI void *ecore_thread_local_data_set(Ecore_Thread *thread, const char *key, void *value, Eina_Free_Cb cb);
+ EAPI void *ecore_thread_local_data_find(Ecore_Thread *thread, const char *key);
+ EAPI Eina_Bool ecore_thread_local_data_del(Ecore_Thread *thread, const char *key);
+
+ EAPI Eina_Bool ecore_thread_global_data_add(const char *key, void *value, Eina_Free_Cb cb, Eina_Bool direct);
+ EAPI void *ecore_thread_global_data_set(const char *key, void *value, Eina_Free_Cb cb);
+ EAPI void *ecore_thread_global_data_find(const char *key);
+ EAPI Eina_Bool ecore_thread_global_data_del(const char *key);
+ EAPI void *ecore_thread_global_data_wait(const char *key, double seconds);
+
+
+
EAPI double ecore_time_get(void);
EAPI double ecore_loop_time_get(void);
- EAPI Ecore_Timer *ecore_timer_add(double in, int (*func) (void *data), const void *data);
- EAPI Ecore_Timer *ecore_timer_loop_add(double in, int (*func) (void *data), const void *data);
+ EAPI Ecore_Timer *ecore_timer_add(double in, Ecore_Task_Cb func, const void *data);
+ EAPI Ecore_Timer *ecore_timer_loop_add(double in, Ecore_Task_Cb func, const void *data);
EAPI void *ecore_timer_del(Ecore_Timer *timer);
EAPI void ecore_timer_interval_set(Ecore_Timer *timer, double in);
EAPI double ecore_timer_interval_get(Ecore_Timer *timer);
EAPI double ecore_timer_precision_get(void);
EAPI void ecore_timer_precision_set(double precision);
- EAPI Ecore_Animator *ecore_animator_add(int (*func) (void *data), const void *data);
+ EAPI Ecore_Animator *ecore_animator_add(Ecore_Task_Cb func, const void *data);
EAPI void *ecore_animator_del(Ecore_Animator *animator);
EAPI void ecore_animator_freeze(Ecore_Animator *animator);
EAPI void ecore_animator_thaw(Ecore_Animator *animator);
EAPI double ecore_poller_poll_interval_get(Ecore_Poller_Type type);
EAPI Eina_Bool ecore_poller_poller_interval_set(Ecore_Poller *poller, int interval);
EAPI int ecore_poller_poller_interval_get(Ecore_Poller *poller);
- EAPI Ecore_Poller *ecore_poller_add(Ecore_Poller_Type type, int interval, int (*func) (void *data), const void *data);
+ EAPI Ecore_Poller *ecore_poller_add(Ecore_Poller_Type type, int interval, Ecore_Task_Cb func, const void *data);
EAPI void *ecore_poller_del(Ecore_Poller *poller);
- EAPI Ecore_Job *ecore_job_add(void (*func) (void *data), const void *data);
+ EAPI Ecore_Job *ecore_job_add(Ecore_Cb func, const void *data);
EAPI void *ecore_job_del(Ecore_Job *job);
#ifdef __cplusplus
#define ECORE_GETOPT_STORE_DEF_UINT(shortname, longname, help, default_value) \
ECORE_GETOPT_STORE_DEF(shortname, longname, help, \
ECORE_GETOPT_TYPE_UINT, \
- {.uintv, default_value})
+ {.uintv = default_value})
#define ECORE_GETOPT_STORE_DEF_ULONG(shortname, longname, help, default_value) \
ECORE_GETOPT_STORE_DEF(shortname, longname, help, \
ECORE_GETOPT_TYPE_ULONG, \
ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \
ECORE_GETOPT_TYPE_UINT, \
arg_requirement, \
- {.uintv, default_value})
+ {.uintv = default_value})
#define ECORE_GETOPT_STORE_FULL_ULONG(shortname, longname, help, metavar, arg_requirement, default_value) \
ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \
ECORE_GETOPT_TYPE_ULONG, \
AM_CFLAGS = @WIN32_CFLAGS@ @EFL_PTHREAD_CFLAGS@
lib_LTLIBRARIES = libecore.la
-include_HEADERS = \
+includes_HEADERS = \
Ecore.h \
Ecore_Getopt.h
+includesdir = $(includedir)/ecore-@VMAJ@
libecore_la_SOURCES = \
ecore.c \
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
if (Global < (Local)) \
Global = Local;
-static int _ecore_memory_statistic(void *data);
+static Eina_Bool _ecore_memory_statistic(void *data);
static int _ecore_memory_max_total = 0;
static int _ecore_memory_max_free = 0;
static pid_t _ecore_memory_pid = 0;
}
if (getenv("ECORE_FPS_DEBUG")) _ecore_fps_debug = 1;
if (_ecore_fps_debug) _ecore_fps_debug_init();
+ _ecore_main_loop_init();
_ecore_signal_init();
_ecore_exe_init();
_ecore_thread_init();
}
#endif
-#ifdef GLIB_INTEGRATION_ALWAYS
+#if defined(GLIB_INTEGRATION_ALWAYS)
if (_ecore_glib_always_integrate) ecore_main_loop_glib_integrate();
#endif
_ecore_event_shutdown();
_ecore_main_shutdown();
_ecore_signal_shutdown();
+ _ecore_main_loop_shutdown();
#if HAVE_MALLINFO
if (getenv("ECORE_MEM_STAT"))
}
#if HAVE_MALLINFO
-static int
+static Eina_Bool
_ecore_memory_statistic(__UNUSED__ void *data)
{
struct mallinfo mi;
KEEP_MAX(_ecore_memory_max_total, mi.uordblks);
KEEP_MAX(_ecore_memory_max_free, mi.fordblks);
- return 1;
+ return ECORE_CALLBACK_RENEW;
}
#endif
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
EINA_INLIST;
ECORE_MAGIC;
- int (*func) (void *data);
+ Ecore_Task_Cb func;
void *data;
Eina_Bool delete_me : 1;
};
-static int _ecore_animator(void *data);
+static Eina_Bool _ecore_animator(void *data);
static Ecore_Timer *timer = NULL;
static int animators_delete_me = 0;
* automatically making any references/handles for it invalid.
*/
EAPI Ecore_Animator *
-ecore_animator_add(int (*func) (void *data), const void *data)
+ecore_animator_add(Ecore_Task_Cb func, const void *data)
{
Ecore_Animator *animator;
}
}
-static int
+static Eina_Bool
_ecore_animator(void *data __UNUSED__)
{
Ecore_Animator *animator;
if (!animators)
{
timer = NULL;
- return 0;
+ return ECORE_CALLBACK_CANCEL;
}
- return 1;
+ return ECORE_CALLBACK_RENEW;
}
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
EINA_INLIST;
ECORE_MAGIC;
int type;
- int (*func) (void *data, int type, void *event);
- void *data;
+ Ecore_Event_Handler_Cb func;
+ void *data;
int references;
Eina_Bool delete_me : 1;
};
{
EINA_INLIST;
ECORE_MAGIC;
- void *(*func_start) (void *data);
- int (*func_filter) (void *data, void *loop_data, int type, void *event);
- void (*func_end) (void *data, void *loop_data);
+ Ecore_Data_Cb func_start;
+ Ecore_Filter_Cb func_filter;
+ Ecore_End_Cb func_end;
void *loop_data;
void *data;
int references;
ECORE_MAGIC;
int type;
void *event;
- void (*func_free) (void *data, void *ev);
+ Ecore_End_Cb func_free;
void *data;
int references;
Eina_Bool delete_me : 1;
* been called, will not be.
*/
EAPI Ecore_Event_Handler *
-ecore_event_handler_add(int type, int (*func) (void *data, int type, void *event), const void *data)
+ecore_event_handler_add(int type, Ecore_Event_Handler_Cb func, const void *data)
{
Ecore_Event_Handler *eh;
"ecore_event_handler_del");
return NULL;
}
+ EINA_SAFETY_ON_TRUE_RETURN_VAL(event_handler->delete_me, NULL);
event_handler->delete_me = 1;
event_handlers_delete_list = eina_list_append(event_handlers_delete_list, event_handler);
return event_handler->data;
* func_free is passed @p data as its data parameter.
*/
EAPI Ecore_Event *
-ecore_event_add(int type, void *ev, void (*func_free) (void *data, void *ev), void *data)
+ecore_event_add(int type, void *ev, Ecore_End_Cb func_free, void *data)
{
/* if (!ev) return NULL;*/
if (type <= ECORE_EVENT_NONE) return NULL;
ECORE_MAGIC_FAIL(event, ECORE_MAGIC_EVENT, "ecore_event_del");
return NULL;
}
+ EINA_SAFETY_ON_TRUE_RETURN_VAL(event->delete_me, NULL);
event->delete_me = 1;
return event->data;
}
* and @p data pointer to clean up.
*/
EAPI Ecore_Event_Filter *
-ecore_event_filter_add(void * (*func_start) (void *data), int (*func_filter) (void *data, void *loop_data, int type, void *event), void (*func_end) (void *data, void *loop_data), const void *data)
+ecore_event_filter_add(Ecore_Data_Cb func_start, Ecore_Filter_Cb func_filter, Ecore_End_Cb func_end, const void *data)
{
Ecore_Event_Filter *ef;
ECORE_MAGIC_FAIL(ef, ECORE_MAGIC_EVENT_FILTER, "ecore_event_filter_del");
return NULL;
}
+ EINA_SAFETY_ON_TRUE_RETURN_VAL(ef->delete_me, NULL);
ef->delete_me = 1;
event_filters_delete_me = 1;
return ef->data;
}
Ecore_Event *
-_ecore_event_add(int type, void *ev, void (*func_free) (void *data, void *ev), void *data)
+_ecore_event_add(int type, void *ev, Ecore_End_Cb func_free, void *data)
{
Ecore_Event *e;
Ecore_Event_Handler *eh = event_handler_current;
if (!eh->delete_me)
{
- int ret;
+ Eina_Bool ret;
handle_count++;
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
Ecore_Timer *doomsday_clock; /* The Timer of Death. Muahahahaha. */
void *doomsday_clock_dead; /* data for the doomsday clock */
- void (*pre_free_cb)(void *data, const Ecore_Exe *exe);
+ Ecore_Exe_Cb pre_free_cb;
};
};
static inline void _ecore_exe_exec_it(const char *exe_cmd, Ecore_Exe_Flags flags);
-static int _ecore_exe_data_generic_handler(void *data, Ecore_Fd_Handler *fd_handler, Ecore_Exe_Flags flags);
-static int _ecore_exe_data_error_handler(void *data, Ecore_Fd_Handler *fd_handler);
-static int _ecore_exe_data_read_handler(void *data, Ecore_Fd_Handler *fd_handler);
-static int _ecore_exe_data_write_handler(void *data, Ecore_Fd_Handler *fd_handler);
+static Eina_Bool _ecore_exe_data_generic_handler(void *data, Ecore_Fd_Handler *fd_handler, Ecore_Exe_Flags flags);
+static Eina_Bool _ecore_exe_data_error_handler(void *data, Ecore_Fd_Handler *fd_handler);
+static Eina_Bool _ecore_exe_data_read_handler(void *data, Ecore_Fd_Handler *fd_handler);
+static Eina_Bool _ecore_exe_data_write_handler(void *data, Ecore_Fd_Handler *fd_handler);
static void _ecore_exe_flush(Ecore_Exe * exe);
static void _ecore_exe_event_exe_data_free(void *data __UNUSED__, void *ev);
static Ecore_Exe *_ecore_exe_is_it_alive(pid_t pid);
-static int _ecore_exe_make_sure_its_dead(void *data);
-static int _ecore_exe_make_sure_its_really_dead(void *data);
+static Eina_Bool _ecore_exe_make_sure_its_dead(void *data);
+static Eina_Bool _ecore_exe_make_sure_its_really_dead(void *data);
static Ecore_Exe_Event_Add *_ecore_exe_event_add_new(void);
static void _ecore_exe_event_add_free(void *data, void *ev);
static void _ecore_exe_dead_attach(Ecore_Exe *exe);
* @param func The function to call before @a exe is freed.
*/
EAPI void
-ecore_exe_callback_pre_free_set(Ecore_Exe *exe, void (*func)(void *data, const Ecore_Exe *exe))
+ecore_exe_callback_pre_free_set(Ecore_Exe *exe, Ecore_Exe_Cb func)
{
if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
{
if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
{
ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_send");
- return 0;
+ return EINA_FALSE;
}
if (exe->close_stdin)
{
ERR("Ecore_Exe %p stdin is closed! Cannot send %d bytes from %p",
exe, size, data);
- return 0;
+ return EINA_FALSE;
}
if (exe->child_fd_write == -1)
{
ERR("Ecore_Exe %p created without ECORE_EXE_PIPE_WRITE! "
"Cannot send %d bytes from %p", exe, size, data);
- return 0;
+ return EINA_FALSE;
}
buf = realloc(exe->write_data_buf, exe->write_data_size + size);
- if (buf == NULL) return 0;
+ if (buf == NULL) return EINA_FALSE;
exe->write_data_buf = buf;
memcpy((char *)exe->write_data_buf + exe->write_data_size, data, size);
if (exe->write_fd_handler)
ecore_main_fd_handler_active_set(exe->write_fd_handler, ECORE_FD_WRITE);
- return 1;
+ return EINA_TRUE;
}
/**
return exe;
}
-static int
+static Eina_Bool
_ecore_exe_make_sure_its_dead(void *data)
{
struct _ecore_exe_dead_exe *dead;
free(dead);
}
}
- return 0;
+ return ECORE_CALLBACK_CANCEL;
}
-static int
+static Eina_Bool
_ecore_exe_make_sure_its_really_dead(void *data)
{
struct _ecore_exe_dead_exe *dead;
IF_FREE(dead->cmd);
free(dead);
}
- return 0;
+ return ECORE_CALLBACK_CANCEL;
}
void
if (shell == NULL)
{ /* Find users preferred shell. */
shell = getenv("SHELL");
- if (shell == 0)
+ if (shell == NULL)
shell = "/bin/sh";
}
errno = 0;
return;
}
-static int
+static Eina_Bool
_ecore_exe_data_generic_handler(void *data, Ecore_Fd_Handler *fd_handler, Ecore_Exe_Flags flags)
{
Ecore_Exe *exe;
}
}
- return 1;
+ return ECORE_CALLBACK_RENEW;
}
-static int
+static Eina_Bool
_ecore_exe_data_error_handler(void *data, Ecore_Fd_Handler *fd_handler)
{
return _ecore_exe_data_generic_handler(data, fd_handler,
ECORE_EXE_PIPE_ERROR);
}
-static int
+static Eina_Bool
_ecore_exe_data_read_handler(void *data, Ecore_Fd_Handler *fd_handler)
{
return _ecore_exe_data_generic_handler(data, fd_handler,
ECORE_EXE_PIPE_READ);
}
-static int
+static Eina_Bool
_ecore_exe_data_write_handler(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
{
Ecore_Exe *exe;
IF_FREE(exe->write_data_buf);
}
- return 1;
+ return ECORE_CALLBACK_RENEW;
}
static void
/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
-/*
* TODO:
* - manage I/O pipes (several ones, and stdin)
* - manage SetConsoleCtrlHandler ?
Eina_Bool close_stdin : 1;
Eina_Bool is_suspended : 1;
- void (*pre_free_cb)(void *data, const Ecore_Exe *exe);
+ Ecore_Exe_Cb pre_free_cb;
};
static Ecore_Exe *exes = NULL;
static int _ecore_exe_win32_pipe_thread_generic_cb(void *data, Ecore_Exe_Flags flags);
static DWORD WINAPI _ecore_exe_win32_pipe_thread_read_cb(void *data);
static DWORD WINAPI _ecore_exe_win32_pipe_thread_error_cb(void *data);
-static int _ecore_exe_close_cb(void *data, Ecore_Win32_Handler *wh);
+static Eina_Bool _ecore_exe_close_cb(void *data, Ecore_Win32_Handler *wh);
static void _ecore_exe_pipe_read_cb(void *data, void *buf, unsigned int size);
static int _ecore_exe_pipe_write_cb(void *data, Ecore_Win32_Handler *wh);
static void _ecore_exe_pipe_error_cb(void *data, void *buf, unsigned int size);
}
EAPI void
-ecore_exe_callback_pre_free_set(Ecore_Exe *exe, void (*func)(void *data, const Ecore_Exe *exe))
+ecore_exe_callback_pre_free_set(Ecore_Exe *exe, Ecore_Exe_Cb func)
{
if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE))
{
ecore_exe_event_data_free(e);
}
-static int
+static Eina_Bool
_ecore_exe_close_cb(void *data, Ecore_Win32_Handler *wh __UNUSED__)
{
Ecore_Exe_Event_Del *e;
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <glib.h>
static Eina_Bool _ecore_glib_active = EINA_FALSE;
-static int (*_ecore_glib_select_original)(int, fd_set*, fd_set*, fd_set*, struct timeval *);
+static Ecore_Select_Function _ecore_glib_select_original;
static GCond *_ecore_glib_cond = NULL;
static GPollFD *_ecore_glib_fds = NULL;
static size_t _ecore_glib_fds_size = 0;
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
{
EINA_INLIST;
ECORE_MAGIC;
- int (*func) (void *data);
+ Ecore_Task_Cb func;
void *data;
int references;
Eina_Bool delete_me : 1;
* @ingroup Idle_Group
*/
EAPI Ecore_Idle_Enterer *
-ecore_idle_enterer_add(int (*func) (void *data), const void *data)
+ecore_idle_enterer_add(Ecore_Task_Cb func, const void *data)
{
Ecore_Idle_Enterer *ie;
* @ingroup Idle_Group
*/
EAPI Ecore_Idle_Enterer *
-ecore_idle_enterer_before_add(int (*func) (void *data), const void *data)
+ecore_idle_enterer_before_add(Ecore_Task_Cb func, const void *data)
{
Ecore_Idle_Enterer *ie;
"ecore_idle_enterer_del");
return NULL;
}
+ EINA_SAFETY_ON_TRUE_RETURN_VAL(idle_enterer->delete_me, NULL);
idle_enterer->delete_me = 1;
idle_enterers_delete_me = 1;
return idle_enterer->data;
if (!ie->delete_me)
{
ie->references++;
- if (!ie->func(ie->data)) ecore_idle_enterer_del(ie);
+ if (!ie->func(ie->data))
+ {
+ if (!ie->delete_me) ecore_idle_enterer_del(ie);
+ }
ie->references--;
}
if (idle_enterer_current) /* may have changed in recursive main loops */
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
{
EINA_INLIST;
ECORE_MAGIC;
- int (*func) (void *data);
+ Ecore_Task_Cb func;
void *data;
int references;
Eina_Bool delete_me : 1;
* @ingroup Idle_Group
*/
EAPI Ecore_Idle_Exiter *
-ecore_idle_exiter_add(int (*func) (void *data), const void *data)
+ecore_idle_exiter_add(Ecore_Task_Cb func, const void *data)
{
Ecore_Idle_Exiter *ie;
"ecore_idle_exiter_del");
return NULL;
}
+ EINA_SAFETY_ON_TRUE_RETURN_VAL(idle_exiter->delete_me, NULL);
idle_exiter->delete_me = 1;
idle_exiters_delete_me = 1;
return idle_exiter->data;
if (!ie->delete_me)
{
ie->references++;
- if (!ie->func(ie->data)) ecore_idle_exiter_del(ie);
+ if (!ie->func(ie->data))
+ {
+ if (!ie->delete_me) ecore_idle_exiter_del(ie);
+ }
ie->references--;
}
if (idle_exiter_current) /* may have changed in recursive main loops */
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
{
EINA_INLIST;
ECORE_MAGIC;
- int (*func) (void *data);
+ Ecore_Task_Cb func;
void *data;
int references;
Eina_Bool delete_me : 1;
* Idlers are useful for progressively prossessing data without blocking.
*/
EAPI Ecore_Idler *
-ecore_idler_add(int (*func) (void *data), const void *data)
+ecore_idler_add(Ecore_Task_Cb func, const void *data)
{
Ecore_Idler *ie;
"ecore_idler_del");
return NULL;
}
+ EINA_SAFETY_ON_TRUE_RETURN_VAL(idler->delete_me, NULL);
idler->delete_me = 1;
idlers_delete_me = 1;
return idler->data;
if (!ie->delete_me)
{
ie->references++;
- if (!ie->func(ie->data)) ecore_idler_del(ie);
+ if (!ie->func(ie->data))
+ {
+ if (!ie->delete_me) ecore_idler_del(ie);
+ }
ie->references--;
}
if (idler_current) /* may have changed in recursive main loops */
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "Ecore.h"
#include "ecore_private.h"
-static int _ecore_job_event_handler(void *data, int type, void *ev);
+static Eina_Bool _ecore_job_event_handler(void *data, int type, void *ev);
static void _ecore_job_event_free(void *data, void *ev);
static int ecore_event_job_type = 0;
{
ECORE_MAGIC;
Ecore_Event *event;
- void (*func) (void *data);
+ Ecore_Cb func;
void *data;
};
* @note Once the job has been executed, the job handle is invalid.
*/
EAPI Ecore_Job *
-ecore_job_add(void (*func) (void *data), const void *data)
+ecore_job_add(Ecore_Cb func, const void *data)
{
Ecore_Job *job;
return data;
}
-static int
+static Eina_Bool
_ecore_job_event_handler(void *data __UNUSED__, int type __UNUSED__, void *ev)
{
Ecore_Job *job;
job = ev;
job->func(job->data);
- return 0;
+ return ECORE_CALLBACK_CANCEL;
}
static void
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "Ecore.h"
#include "ecore_private.h"
+#ifdef HAVE_SYS_EPOLL_H
+# define HAVE_EPOLL
+# include <sys/epoll.h>
+#endif
+
+#ifdef USE_G_MAIN_LOOP
+#include <glib.h>
+#endif
struct _Ecore_Fd_Handler
{
ECORE_MAGIC;
int fd;
Ecore_Fd_Handler_Flags flags;
- int (*func) (void *data, Ecore_Fd_Handler *fd_handler);
+ Ecore_Fd_Cb func;
void *data;
- int (*buf_func) (void *data, Ecore_Fd_Handler *fd_handler);
+ Ecore_Fd_Cb buf_func;
void *buf_data;
- void (*prep_func) (void *data, Ecore_Fd_Handler *fd_handler);
+ Ecore_Fd_Prep_Cb prep_func;
void *prep_data;
int references;
Eina_Bool read_active : 1;
EINA_INLIST;
ECORE_MAGIC;
HANDLE h;
- int (*func) (void *data, Ecore_Win32_Handler *win32_handler);
+ Ecore_Fd_Win32_Cb func;
void *data;
int references;
Eina_Bool delete_me : 1;
static int _ecore_main_select(double timeout);
+static void _ecore_main_prepare_handlers(void);
static void _ecore_main_fd_handlers_cleanup(void);
#ifndef _WIN32
static void _ecore_main_fd_handlers_bads_rem(void);
#endif
static void _ecore_main_fd_handlers_call(void);
static int _ecore_main_fd_handlers_buf_call(void);
+#ifndef USE_G_MAIN_LOOP
static void _ecore_main_loop_iterate_internal(int once_only);
+#endif
#ifdef _WIN32
static int _ecore_main_win32_select(int nfds, fd_set *readfds, fd_set *writefds,
#endif
#ifdef _WIN32
-static int (*main_loop_select)(int , fd_set *, fd_set *, fd_set *, struct timeval *) = _ecore_main_win32_select;
+static Ecore_Select_Function main_loop_select = _ecore_main_win32_select;
#else
-static int (*main_loop_select)(int , fd_set *, fd_set *, fd_set *, struct timeval *) = select;
+static Ecore_Select_Function main_loop_select = select;
#endif
static double t1 = 0.0;
static double t2 = 0.0;
+#ifdef HAVE_EPOLL
+static int epoll_fd = -1;
+#endif
+
+#ifdef USE_G_MAIN_LOOP
+static GSource *ecore_epoll_source;
+static GPollFD ecore_epoll_fd;
+static guint ecore_epoll_id;
+static GMainLoop* ecore_main_loop;
+static gboolean ecore_idling;
+static gboolean ecore_fds_ready;
+#endif
+
+static inline int _ecore_poll_events_from_fdh(Ecore_Fd_Handler *fdh)
+{
+ int events = 0;
+#ifdef HAVE_EPOLL
+ if (fdh->flags & ECORE_FD_READ) events |= EPOLLIN;
+ if (fdh->flags & ECORE_FD_WRITE) events |= EPOLLOUT;
+ if (fdh->flags & ECORE_FD_ERROR) events |= EPOLLERR;
+#endif
+ return events;
+}
+
+static inline int _ecore_main_fdh_epoll_add(Ecore_Fd_Handler *fdh)
+{
+ int r = 0;
+#ifdef HAVE_EPOLL
+ struct epoll_event ev = {0};
+
+ ev.events = _ecore_poll_events_from_fdh(fdh);
+ ev.data.ptr = fdh;
+ INF("adding poll on %d %08x", fdh->fd, ev.events);
+ r = epoll_ctl(epoll_fd, EPOLL_CTL_ADD, fdh->fd, &ev);
+#endif
+ return r;
+}
+
+static inline void _ecore_main_fdh_epoll_del(Ecore_Fd_Handler *fdh)
+{
+#ifdef HAVE_EPOLL
+ struct epoll_event ev = {0};
+
+ INF("removing poll on %d", fdh->fd);
+ /* could get an EBADF if somebody closed the FD before removing it */
+ if ((epoll_ctl(epoll_fd, EPOLL_CTL_DEL, fdh->fd, &ev) < 0) &&
+ (errno != EBADF))
+ {
+ ERR("Failed to delete epoll fd %d! (errno=%d)", fdh->fd, errno);
+ }
+#endif
+}
+
+static inline int _ecore_main_fdh_epoll_modify(Ecore_Fd_Handler *fdh)
+{
+ int r = 0;
+#ifdef HAVE_EPOLL
+ struct epoll_event ev = {0};
+
+ ev.events = _ecore_poll_events_from_fdh(fdh);
+ ev.data.ptr = fdh;
+ INF("modifing epoll on %d to %08x", fdh->fd, ev.events);
+ r = epoll_ctl(epoll_fd, EPOLL_CTL_MOD, fdh->fd, &ev);
+#endif
+ return r;
+}
+
+#ifdef HAVE_EPOLL
+static inline int _ecore_main_fdh_epoll_mark_active(void)
+{
+ struct epoll_event ev[32] = {0};
+ int i, ret;
+
+ ret = epoll_wait(epoll_fd, ev, sizeof(ev) / sizeof(struct epoll_event), 0);
+ if (ret < 0)
+ {
+ if (errno == EINTR) return -1;
+ ERR("epoll_wait failed %d", errno);
+ return -1;
+ }
+
+ for (i = 0; i < ret; i++)
+ {
+ Ecore_Fd_Handler *fdh;
+
+ fdh = ev[i].data.ptr;
+ if (!ECORE_MAGIC_CHECK(fdh, ECORE_MAGIC_FD_HANDLER))
+ {
+ ECORE_MAGIC_FAIL(fdh, ECORE_MAGIC_FD_HANDLER,
+ "_ecore_main_fdh_epoll_mark_active");
+ continue;
+ }
+ if (fdh->delete_me)
+ {
+ ERR("deleted fd in epoll");
+ continue;
+ }
+ if (ev->events & EPOLLIN)
+ fdh->read_active = 1;
+ if (ev->events & EPOLLOUT)
+ fdh->write_active = 1;
+ if (ev->events & EPOLLERR)
+ fdh->error_active = 1;
+ }
+
+ return ret;
+}
+#endif
+
+#ifdef USE_G_MAIN_LOOP
+
+/* like we are about to enter main_loop_select in _ecore_main_select */
+static gboolean
+_ecore_main_gsource_prepare(GSource *source, gint *next_time)
+{
+ double t = _ecore_timer_next_get();
+ gboolean running;
+
+ INF("enter, next timeout in %.1f", t);
+ in_main_loop++;
+
+ if (!ecore_idling)
+ {
+ while (_ecore_timer_call(_ecore_loop_time));
+ _ecore_timer_cleanup();
+
+ /* when idling, busy loop checking the fds only */
+ if (!ecore_idling) _ecore_idle_enterer_call();
+ }
+
+ /* don't check fds if somebody quit */
+ running = g_main_loop_is_running(ecore_main_loop);
+ if (running)
+ {
+ /* only set idling state in dispatch */
+ if (ecore_idling && !_ecore_idler_exist())
+ {
+ if (_ecore_timers_exists())
+ {
+ double t = _ecore_timer_next_get();
+ *next_time = (t / 1000.0);
+ }
+ else
+ *next_time = -1;
+ }
+ else
+ *next_time = 0;
+
+ _ecore_main_prepare_handlers();
+ }
+
+ in_main_loop--;
+ INF("leave, timeout = %d", *next_time);
+
+ /* ready if we're not running (about to quit) */
+ return !running;
+}
+
+static gboolean
+_ecore_main_gsource_check(GSource *source)
+{
+ INF("enter");
+ in_main_loop++;
+
+ ecore_fds_ready = (_ecore_main_fdh_epoll_mark_active() > 0);
+ _ecore_main_fd_handlers_cleanup();
+
+ _ecore_loop_time = ecore_time_get();
+ _ecore_timer_enable_new();
+
+ in_main_loop--;
+ INF("leave");
+
+ return TRUE; /* always dispatch */
+}
+
+/* like we just came out of main_loop_select in _ecore_main_select */
+static gboolean
+_ecore_main_gsource_dispatch(GSource *source, GSourceFunc callback, gpointer user_data)
+{
+ gboolean events_ready, timers_ready, idlers_ready, signals_ready;
+ double next_time = _ecore_timer_next_get();
+
+ events_ready = _ecore_event_exist();
+ timers_ready = _ecore_timers_exists() && (0.0 <= next_time);
+ idlers_ready = _ecore_idler_exist();
+ signals_ready = (_ecore_signal_count_get() > 0);
+
+ in_main_loop++;
+ INF("enter idling=%d fds=%d events=%d signals=%d timers=%d (next=%.2f) idlers=%d",
+ ecore_idling, ecore_fds_ready, events_ready, signals_ready,
+ _ecore_timers_exists(), next_time, idlers_ready);
+
+ if (ecore_idling && events_ready)
+ {
+ INF("calling idle exiters");
+ _ecore_idle_exiter_call();
+ ecore_idling = 0;
+ }
+ else if (!ecore_idling && !events_ready)
+ {
+ INF("start idling");
+ ecore_idling = 1;
+ }
+
+ if (ecore_idling)
+ {
+ INF("calling idler");
+ _ecore_idler_call();
+
+ events_ready = _ecore_event_exist();
+ timers_ready = _ecore_timers_exists() && (0.0 <= next_time);
+ idlers_ready = _ecore_idler_exist();
+
+ if ((ecore_fds_ready || events_ready || timers_ready || idlers_ready || signals_ready))
+ {
+ INF("calling idle exiters");
+ _ecore_idle_exiter_call();
+ ecore_idling = 0;
+ }
+ }
+
+ /* process events */
+ if (!ecore_idling)
+ {
+ INF("work");
+ _ecore_main_fd_handlers_call();
+ _ecore_main_fd_handlers_buf_call();
+ while (_ecore_signal_count_get()) _ecore_signal_call();
+ _ecore_event_call();
+ _ecore_main_fd_handlers_cleanup();
+ }
+
+ in_main_loop--;
+
+ INF("leave");
+
+ return TRUE; /* what should be returned here? */
+}
+
+static void
+_ecore_main_gsource_finalize(GSource *source)
+{
+ INF("finalize");
+}
+
+static GSourceFuncs ecore_gsource_funcs = {
+ .prepare = _ecore_main_gsource_prepare,
+ .check = _ecore_main_gsource_check,
+ .dispatch = _ecore_main_gsource_dispatch,
+ .finalize = _ecore_main_gsource_finalize,
+};
+
+#endif
+
+void
+_ecore_main_loop_init(void)
+{
+ INF("enter");
+#ifdef HAVE_EPOLL
+ epoll_fd = epoll_create(1);
+ if (epoll_fd < 0)
+ CRIT("Failed to create epoll fd!");
+#endif
+
+#ifdef USE_G_MAIN_LOOP
+ ecore_epoll_source = g_source_new(&ecore_gsource_funcs, sizeof (GSource));
+ if (!ecore_epoll_source)
+ CRIT("Failed to create glib source for epoll!");
+ ecore_epoll_fd.fd = epoll_fd;
+ ecore_epoll_fd.events = G_IO_IN;
+ ecore_epoll_fd.revents = 0;
+ g_source_add_poll(ecore_epoll_source, &ecore_epoll_fd);
+ ecore_epoll_id = g_source_attach(ecore_epoll_source, NULL);
+ if (ecore_epoll_id <= 0)
+ CRIT("Failed to attach glib source to default context");
+#endif
+ INF("leave");
+}
+
+void
+_ecore_main_loop_shutdown(void)
+{
+#ifdef USE_G_MAIN_LOOP
+ g_source_destroy(ecore_epoll_source);
+#endif
+
+#ifdef HAVE_EPOLL
+ close(epoll_fd);
+#endif
+}
+
+
/**
* @defgroup Ecore_Main_Loop_Group Main Loop Functions
*
EAPI void
ecore_main_loop_iterate(void)
{
+#ifndef USE_G_MAIN_LOOP
_ecore_main_loop_iterate_internal(1);
+#else
+ g_main_context_iteration(NULL, 1);
+#endif
}
/**
EAPI void
ecore_main_loop_begin(void)
{
+#ifndef USE_G_MAIN_LOOP
in_main_loop++;
while (do_quit == 0) _ecore_main_loop_iterate_internal(0);
do_quit = 0;
in_main_loop--;
+#else
+ ecore_main_loop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(ecore_main_loop);
+#endif
}
/**
EAPI void
ecore_main_loop_quit(void)
{
+#ifndef USE_G_MAIN_LOOP
do_quit = 1;
+#else
+ INF("enter");
+ g_main_loop_quit(ecore_main_loop);
+ INF("leave");
+#endif
}
/**
* @ingroup Ecore_Main_Loop_Group
*/
EAPI void
-ecore_main_loop_select_func_set(int (*func) (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout))
+ecore_main_loop_select_func_set(Ecore_Select_Function func)
{
main_loop_select = func;
}
* @ingroup Ecore_FD_Handler_Group
*/
EAPI Ecore_Fd_Handler *
-ecore_main_fd_handler_add(int fd, Ecore_Fd_Handler_Flags flags, int (*func) (void *data, Ecore_Fd_Handler *fd_handler), const void *data, int (*buf_func) (void *buf_data, Ecore_Fd_Handler *fd_handler), const void *buf_data)
+ecore_main_fd_handler_add(int fd, Ecore_Fd_Handler_Flags flags, Ecore_Fd_Cb func, const void *data,
+ Ecore_Fd_Cb buf_func, const void *buf_data)
{
Ecore_Fd_Handler *fdh;
ECORE_MAGIC_SET(fdh, ECORE_MAGIC_FD_HANDLER);
fdh->fd = fd;
fdh->flags = flags;
+ if (0 > _ecore_main_fdh_epoll_add(fdh))
+ {
+ ERR("Failed to add epoll fd %d (errno = %d)!", fd, errno);
+ free(fdh);
+ return NULL;
+ }
fdh->read_active = 0;
fdh->write_active = 0;
fdh->error_active = 0;
#ifdef _WIN32
EAPI Ecore_Win32_Handler *
-ecore_main_win32_handler_add(void *h,
- int (*func) (void *data, Ecore_Win32_Handler *wh),
- const void *data)
+ecore_main_win32_handler_add(void *h, Ecore_Fd_Win32_Cb func, const void *data)
{
Ecore_Win32_Handler *wh;
}
#else
EAPI Ecore_Win32_Handler *
-ecore_main_win32_handler_add(void *h __UNUSED__,
- int (*func) (void *data, Ecore_Win32_Handler *wh) __UNUSED__,
+ecore_main_win32_handler_add(void *h __UNUSED__, Ecore_Fd_Win32_Cb func __UNUSED__,
const void *data __UNUSED__)
{
return NULL;
* @return The data pointer set using @ref ecore_main_fd_handler_add,
* for @p fd_handler on success. @c NULL otherwise.
* @ingroup Ecore_FD_Handler_Group
+ *
+ * Beware that if the fd is already closed, ecore may complain if it uses
+ * epoll internally, and that in some rare cases this may be able to cause
+ * crashes and instability. Remember to delete your fd handlers before the
+ * fd's they listen to are closed.
*/
EAPI void *
ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler)
}
fd_handler->delete_me = 1;
fd_handlers_delete_me = 1;
+ _ecore_main_fdh_epoll_del(fd_handler);
return fd_handler->data;
}
#endif
EAPI void
-ecore_main_fd_handler_prepare_callback_set(Ecore_Fd_Handler *fd_handler, void (*func) (void *data, Ecore_Fd_Handler *fd_handler), const void *data)
+ecore_main_fd_handler_prepare_callback_set(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Prep_Cb func, const void *data)
{
if (!ECORE_MAGIC_CHECK(fd_handler, ECORE_MAGIC_FD_HANDLER))
{
return;
}
fd_handler->flags = flags;
+ if (0 > _ecore_main_fdh_epoll_modify(fd_handler))
+ {
+ ERR("Failed to mod epoll fd %d!", fd_handler->fd);
+ }
}
void
#endif
}
+static void
+_ecore_main_prepare_handlers(void)
+{
+ Ecore_Fd_Handler *fdh;
+
+ /* call the prepare callback for all handlers */
+ EINA_INLIST_FOREACH(fd_handlers, fdh)
+ {
+ if (!fdh->delete_me && fdh->prep_func)
+ {
+ fdh->references++;
+ fdh->prep_func (fdh->prep_data, fdh);
+ fdh->references--;
+ }
+ }
+}
+
static int
_ecore_main_select(double timeout)
{
fd_set rfds, wfds, exfds;
int max_fd;
int ret;
- Ecore_Fd_Handler *fdh;
t = NULL;
if ((!finite(timeout)) || (timeout == 0.0)) /* finite() tests for NaN, too big, too small, and infinity. */
FD_ZERO(&exfds);
/* call the prepare callback for all handlers */
- EINA_INLIST_FOREACH(fd_handlers, fdh)
- {
- if (!fdh->delete_me && fdh->prep_func)
- {
- fdh->references++;
- fdh->prep_func (fdh->prep_data, fdh);
- fdh->references--;
- }
- }
+ _ecore_main_prepare_handlers();
+#ifndef HAVE_EPOLL
+ Ecore_Fd_Handler *fdh;
+
EINA_INLIST_FOREACH(fd_handlers, fdh)
{
if (!fdh->delete_me)
}
}
}
+#else /* HAVE_EPOLL */
+ /* polling on the epoll fd will wake when an fd in the epoll set is active */
+ FD_SET(epoll_fd, &rfds);
+ max_fd = epoll_fd;
+#endif /* HAVE_EPOLL */
+
if (_ecore_signal_count_get()) return -1;
ret = main_loop_select(max_fd + 1, &rfds, &wfds, &exfds, t);
{
#ifndef _WIN32
if (errno == EINTR) return -1;
- else if (errno == EBADF)
- _ecore_main_fd_handlers_bads_rem();
+ else if (errno == EBADF) _ecore_main_fd_handlers_bads_rem();
#endif
}
if (ret > 0)
{
+#ifdef HAVE_EPOLL
+ _ecore_main_fdh_epoll_mark_active();
+#else /* HAVE_EPOLL */
+ Ecore_Fd_Handler *fdh;
+
EINA_INLIST_FOREACH(fd_handlers, fdh)
- if (!fdh->delete_me)
- {
- if (FD_ISSET(fdh->fd, &rfds))
- fdh->read_active = 1;
- if (FD_ISSET(fdh->fd, &wfds))
- fdh->write_active = 1;
- if (FD_ISSET(fdh->fd, &exfds))
- fdh->error_active = 1;
- }
+ {
+ if (!fdh->delete_me)
+ {
+ if (FD_ISSET(fdh->fd, &rfds))
+ fdh->read_active = 1;
+ if (FD_ISSET(fdh->fd, &wfds))
+ fdh->write_active = 1;
+ if (FD_ISSET(fdh->fd, &exfds))
+ fdh->error_active = 1;
+ }
+ }
+#endif /* HAVE_EPOLL */
_ecore_main_fd_handlers_cleanup();
#ifdef _WIN32
_ecore_main_win32_handlers_cleanup();
deleted_in_use++;
continue;
}
-
+
fd_handlers = (Ecore_Fd_Handler *)
- eina_inlist_remove(EINA_INLIST_GET(fd_handlers),
- EINA_INLIST_GET(fdh));
+ eina_inlist_remove(EINA_INLIST_GET(fd_handlers),
+ EINA_INLIST_GET(fdh));
ECORE_MAGIC_SET(fdh, ECORE_MAGIC_NONE);
free(fdh);
}
deleted_in_use++;
continue;
}
-
+
win32_handlers = (Ecore_Win32_Handler *)
- eina_inlist_remove(EINA_INLIST_GET(win32_handlers),
- EINA_INLIST_GET(wh));
+ eina_inlist_remove(EINA_INLIST_GET(win32_handlers),
+ EINA_INLIST_GET(wh));
ECORE_MAGIC_SET(wh, ECORE_MAGIC_NONE);
free(wh);
}
return ret;
}
+#ifndef USE_G_MAIN_LOOP
static void
_ecore_main_loop_iterate_internal(int once_only)
{
if (once_only) _ecore_idle_enterer_call();
in_main_loop--;
}
+#endif
#ifdef _WIN32
static int
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
int fd_write;
Ecore_Fd_Handler *fd_handler;
const void *data;
- void (*handler) (void *data, void *buffer, unsigned int nbyte);
+ Ecore_Pipe_Cb handler;
unsigned int len;
size_t already_read;
void *passed_data;
};
-static int _ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler);
+static Eina_Bool _ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler);
/**
* @defgroup Ecore_Pipe_Group Pipe wrapper
* @ingroup Ecore_Pipe_Group
*/
EAPI Ecore_Pipe *
-ecore_pipe_add(void (*handler) (void *data, void *buffer, unsigned int nbyte),
- const void *data)
+ecore_pipe_add(Ecore_Pipe_Cb handler, const void *data)
{
Ecore_Pipe *p;
int fds[2];
* @return Returns EINA_TRUE on a successful write, EINA_FALSE on an error
* @ingroup Ecore_Pipe_Group
*/
-EAPI int
+EAPI Eina_Bool
ecore_pipe_write(Ecore_Pipe *p, const void *buffer, unsigned int nbytes)
{
ssize_t ret;
/* Private function */
-static int
+static Eina_Bool
_ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
{
Ecore_Pipe *p;
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
ECORE_MAGIC;
int ibit;
unsigned char delete_me : 1;
- int (*func) (void *data);
+ Ecore_Task_Cb func;
void *data;
};
};
static void _ecore_poller_next_tick_eval(void);
-static int _ecore_poller_cb_timer(void *data);
+static Eina_Bool _ecore_poller_cb_timer(void *data);
static void
_ecore_poller_next_tick_eval(void)
poll_cur_interval = interval;
}
-static int
+static Eina_Bool
_ecore_poller_cb_timer(void *data __UNUSED__)
{
int i;
/* if the timer was deleted then there is no point returning 1 - ambiguous
* if we do as it im plies "keep running me" but we have been deleted
* anyway */
- if (!timer) return 0;
+ if (!timer) return ECORE_CALLBACK_CANCEL;
/* adjust interval */
ecore_timer_interval_set(timer, poll_cur_interval);
- return 1;
+ return ECORE_CALLBACK_RENEW;
}
/**
* invalid.
*/
EAPI Ecore_Poller *
-ecore_poller_add(Ecore_Poller_Type type __UNUSED__, int interval, int (*func) (void *data), const void *data)
+ecore_poller_add(Ecore_Poller_Type type __UNUSED__, int interval, Ecore_Task_Cb func, const void *data)
{
Ecore_Poller *poller;
int ibit;
* a poll rate without deleting and re-creating a poller.
* @ingroup Ecore_Poller_Group
*/
-EAPI Eina_Bool
+EAPI Eina_Bool
ecore_poller_poller_interval_set(Ecore_Poller *poller, int interval)
{
int ibit;
{
ECORE_MAGIC_FAIL(poller, ECORE_MAGIC_POLLER,
"ecore_poller_poller_interval_set");
- return 0;
+ return EINA_FALSE;
}
/* interval MUST be a power of 2, so enforce it */
if (ibit > 15) ibit = 15;
/* if interval specified is the same as interval set, return true without wasting time */
if (poller->ibit == ibit)
- return 1;
+ return EINA_TRUE;
pollers[poller->ibit] = (Ecore_Poller *) eina_inlist_remove(EINA_INLIST_GET(pollers[poller->ibit]), EINA_INLIST_GET(poller));
poller->ibit = ibit;
pollers[poller->ibit] = (Ecore_Poller *) eina_inlist_prepend(EINA_INLIST_GET(pollers[poller->ibit]), EINA_INLIST_GET(poller));
just_added_poller++;
else
_ecore_poller_next_tick_eval();
- return 1;
+ return EINA_TRUE;
}
/**
void _ecore_event_shutdown(void);
int _ecore_event_exist(void);
-Ecore_Event *_ecore_event_add(int type, void *ev, void (*func_free) (void *data, void *ev), void *data);
+Ecore_Event *_ecore_event_add(int type, void *ev, Ecore_End_Cb func_free, void *data);
void _ecore_event_call(void);
Ecore_Timer *_ecore_exe_doomsday_clock_get(Ecore_Exe *exe);
void _ecore_job_init(void);
void _ecore_job_shutdown(void);
+void _ecore_main_loop_init(void);
+void _ecore_main_loop_shutdown(void);
+
extern int _ecore_fps_debug;
extern double _ecore_loop_time;
extern Eina_Bool _ecore_glib_always_integrate;
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
static void _ecore_signal_callback_sigrt(int sig, siginfo_t *si, void *foo);
#endif
-static int _ecore_signal_exe_exit_delay(void *data);
+static Eina_Bool _ecore_signal_exe_exit_delay(void *data);
//#define MAXSIGQ 256 // 32k
#define MAXSIGQ 64 // 8k
}
#endif
-static int
+static Eina_Bool
_ecore_signal_exe_exit_delay(void *data)
{
Ecore_Exe_Event_Del *e;
_ecore_event_add(ECORE_EXE_EVENT_DEL, e,
_ecore_exe_event_del_free, NULL);
}
- return 0;
+ return ECORE_CALLBACK_CANCEL;
}
#include "Ecore.h"
#include "ecore_private.h"
-#ifdef EFL_HAVE_PTHREAD
typedef struct _Ecore_Pthread_Worker Ecore_Pthread_Worker;
-typedef struct _Ecore_Pthread_Data Ecore_Pthread_Data;
typedef struct _Ecore_Pthread Ecore_Pthread;
+typedef struct _Ecore_Thread_Data Ecore_Thread_Data;
-struct _Ecore_Pthread_Worker
+struct _Ecore_Thread_Data
{
- void (*func_heavy)(void *data);
- void (*func_end)(void *data);
- void (*func_cancel)(void *data);
-
- const void *data;
+ void *data;
+ Eina_Free_Cb cb;
+};
- Eina_Bool cancel : 1;
+struct _Ecore_Pthread_Worker
+{
+ union
+ {
+ struct
+ {
+ Ecore_Cb func_blocking;
+ } short_run;
+ struct
+ {
+ Ecore_Thread_Heavy_Cb func_heavy;
+ Ecore_Thread_Notify_Cb func_notify;
+ Ecore_Pipe *notify;
+ } long_run;
+ } u;
+
+ Ecore_Cb func_cancel;
+ Ecore_Cb func_end;
+ #ifdef EFL_HAVE_PTHREAD
+ pthread_t self;
+ Eina_Hash *hash;
+ pthread_cond_t cond;
+ pthread_mutex_t mutex;
+ #endif
+
+ const void *data;
+
+ Eina_Bool cancel : 1;
+ Eina_Bool long_run : 1;
};
+#ifdef EFL_HAVE_PTHREAD
+typedef struct _Ecore_Pthread_Data Ecore_Pthread_Data;
+
struct _Ecore_Pthread_Data
{
Ecore_Pipe *p;
+ void *data;
pthread_t thread;
};
#endif
#ifdef EFL_HAVE_PTHREAD
static int _ecore_thread_count = 0;
-static Eina_List *_ecore_thread_data = NULL;
-static Eina_List *_ecore_thread = NULL;
+
+static Eina_List *_ecore_active_job_threads = NULL;
+static Eina_List *_ecore_pending_job_threads = NULL;
+static Eina_List *_ecore_pending_job_threads_long = NULL;
static Ecore_Event_Handler *del_handler = NULL;
+static pthread_mutex_t _ecore_pending_job_threads_mutex = PTHREAD_MUTEX_INITIALIZER;
-static pthread_mutex_t _mutex = PTHREAD_MUTEX_INITIALIZER;
+static Eina_Hash *_ecore_thread_global_hash = NULL;
+static pthread_rwlock_t _ecore_thread_global_hash_lock = PTHREAD_RWLOCK_INITIALIZER;
+static pthread_mutex_t _ecore_thread_global_hash_mutex = PTHREAD_MUTEX_INITIALIZER;
+static pthread_cond_t _ecore_thread_global_hash_cond = PTHREAD_COND_INITIALIZER;
+static pthread_t main_loop_thread = 0;
+
+static void
+_ecore_thread_data_free(void *data)
+{
+ Ecore_Thread_Data *d = data;
+
+ if (d->cb) d->cb(d->data);
+ free(d);
+}
static void
_ecore_thread_pipe_free(void *data __UNUSED__, void *event)
ecore_pipe_del(p);
}
-static int
+static Eina_Bool
_ecore_thread_pipe_del(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
{
- /* This is a hack to delay pipe destruction until we are out of it's internal loop. */
- return 0;
+ /* This is a hack to delay pipe destruction until we are out of its internal loop. */
+ return ECORE_CALLBACK_CANCEL;
}
static void
{
Ecore_Pipe *p;
- if (pthread_join(pth->thread, (void**) &p) != 0)
+ if (pthread_join(pth->thread, (void **) &p) != 0)
return ;
- _ecore_thread = eina_list_remove(_ecore_thread, pth);
+ _ecore_active_job_threads = eina_list_remove(_ecore_active_job_threads, pth);
ecore_event_add(ECORE_THREAD_PIPE_DEL, pth->p, _ecore_thread_pipe_free, NULL);
+ free(pth);
}
-static void *
-_ecore_thread_worker(Ecore_Pthread_Data *pth)
+static void
+_ecore_thread_handler(void *data __UNUSED__, void *buffer, unsigned int nbyte)
{
Ecore_Pthread_Worker *work;
- pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
- pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
+ if (nbyte != sizeof (Ecore_Pthread_Worker *)) return ;
- pthread_mutex_lock(&_mutex);
- _ecore_thread_count++;
- pthread_mutex_unlock(&_mutex);
+ work = *(Ecore_Pthread_Worker **)buffer;
- on_error:
+ if (work->cancel)
+ {
+ if (work->func_cancel)
+ work->func_cancel((void *) work->data);
+ }
+ else
+ {
+ if (work->func_end)
+ work->func_end((void *) work->data);
+ }
+
+ if (work->long_run)
+ ecore_pipe_del(work->u.long_run.notify);
+ pthread_cond_destroy(&work->cond);
+ pthread_mutex_destroy(&work->mutex);
+ if (work->hash)
+ eina_hash_free(work->hash);
+ free(work);
+}
+
+static void
+_ecore_notify_handler(void *data, void *buffer, unsigned int nbyte)
+{
+ Ecore_Pthread_Worker *work = data;
+ void *user_data;
+
+ if (nbyte != sizeof (Ecore_Pthread_Worker *)) return ;
+
+ user_data = *(void **)buffer;
+
+ if (work->u.long_run.func_notify)
+ work->u.long_run.func_notify((Ecore_Thread *) work, user_data, (void *) work->data);
+}
+
+static void
+_ecore_short_job(Ecore_Pipe *end_pipe)
+{
+ Ecore_Pthread_Worker *work;
- while (_ecore_thread_data)
+ while (_ecore_pending_job_threads)
{
- pthread_mutex_lock(&_mutex);
+ pthread_mutex_lock(&_ecore_pending_job_threads_mutex);
- if (!_ecore_thread_data)
- {
- pthread_mutex_unlock(&_mutex);
- break;
- }
+ if (!_ecore_pending_job_threads)
+ {
+ pthread_mutex_unlock(&_ecore_pending_job_threads_mutex);
+ break;
+ }
- work = eina_list_data_get(_ecore_thread_data);
- _ecore_thread_data = eina_list_remove_list(_ecore_thread_data, _ecore_thread_data);
+ work = eina_list_data_get(_ecore_pending_job_threads);
+ _ecore_pending_job_threads = eina_list_remove_list(_ecore_pending_job_threads, _ecore_pending_job_threads);
- pthread_mutex_unlock(&_mutex);
+ pthread_mutex_unlock(&_ecore_pending_job_threads_mutex);
- work->func_heavy((void*) work->data);
+ if (!work->cancel)
+ work->u.short_run.func_blocking((void *) work->data);
- ecore_pipe_write(pth->p, &work, sizeof (Ecore_Pthread_Worker*));
+ ecore_pipe_write(end_pipe, &work, sizeof (Ecore_Pthread_Worker *));
}
+}
+
+static void
+_ecore_long_job(Ecore_Pipe *end_pipe, pthread_t thread)
+{
+ Ecore_Pthread_Worker *work;
- pthread_mutex_lock(&_mutex);
- if (_ecore_thread_data)
+ while (_ecore_pending_job_threads_long)
{
- pthread_mutex_unlock(&_mutex);
- goto on_error;
+ pthread_mutex_lock(&_ecore_pending_job_threads_mutex);
+
+ if (!_ecore_pending_job_threads_long)
+ {
+ pthread_mutex_unlock(&_ecore_pending_job_threads_mutex);
+ break;
+ }
+
+ work = eina_list_data_get(_ecore_pending_job_threads_long);
+ _ecore_pending_job_threads_long = eina_list_remove_list(_ecore_pending_job_threads_long, _ecore_pending_job_threads_long);
+
+ pthread_mutex_unlock(&_ecore_pending_job_threads_mutex);
+
+ work->self = thread;
+ if (!work->cancel)
+ work->u.long_run.func_heavy((Ecore_Thread *) work, (void *) work->data);
+
+ ecore_pipe_write(end_pipe, &work, sizeof (Ecore_Pthread_Worker *));
}
- _ecore_thread_count--;
+}
- pthread_mutex_unlock(&_mutex);
+static void *
+_ecore_direct_worker(Ecore_Pthread_Worker *work)
+{
+ Ecore_Pthread_Data *pth;
+
+ pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
+ pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
+
+ pth = malloc(sizeof (Ecore_Pthread_Data));
+ if (!pth) return NULL;
+
+ pth->p = ecore_pipe_add(_ecore_thread_handler, NULL);
+ if (!pth->p)
+ {
+ free(pth);
+ return NULL;
+ }
+ pth->thread = pthread_self();
+
+ work->self = pth->thread;
+ work->u.long_run.func_heavy((Ecore_Thread *) work, (void *) work->data);
+
+ ecore_pipe_write(pth->p, &work, sizeof (Ecore_Pthread_Worker *));
work = malloc(sizeof (Ecore_Pthread_Worker));
- if (!work) return NULL;
+ if (!work)
+ {
+ ecore_pipe_del(pth->p);
+ free(pth);
+ return NULL;
+ }
work->data = pth;
- work->func_heavy = NULL;
- work->func_end = (void*) _ecore_thread_end;
+ work->u.short_run.func_blocking = NULL;
+ work->func_end = (void *) _ecore_thread_end;
work->func_cancel = NULL;
work->cancel = EINA_FALSE;
+ work->long_run = EINA_FALSE;
+ work->hash = NULL;
+ pthread_cond_init(&work->cond, NULL);
+ pthread_mutex_init(&work->mutex, NULL);
- ecore_pipe_write(pth->p, &work, sizeof (Ecore_Pthread_Worker*));
+ ecore_pipe_write(pth->p, &work, sizeof (Ecore_Pthread_Worker *));
return pth->p;
}
-static void
-_ecore_thread_handler(void *data __UNUSED__, void *buffer, unsigned int nbyte)
+static void *
+_ecore_thread_worker(Ecore_Pthread_Data *pth)
{
Ecore_Pthread_Worker *work;
- if (nbyte != sizeof (Ecore_Pthread_Worker*)) return ;
+ pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
+ pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
- work = *(Ecore_Pthread_Worker**)buffer;
+ pthread_mutex_lock(&_ecore_pending_job_threads_mutex);
+ _ecore_thread_count++;
+ pthread_mutex_unlock(&_ecore_pending_job_threads_mutex);
- if (work->cancel)
+ on_error:
+ if (_ecore_pending_job_threads) _ecore_short_job(pth->p);
+ if (_ecore_pending_job_threads_long) _ecore_long_job(pth->p, pth->thread);
+
+ /* FIXME: Check if there is long running task todo, and switch to long run handler. */
+
+ pthread_mutex_lock(&_ecore_pending_job_threads_mutex);
+ if (_ecore_pending_job_threads)
{
- if (work->func_cancel)
- work->func_cancel((void*) work->data);
+ pthread_mutex_unlock(&_ecore_pending_job_threads_mutex);
+ goto on_error;
}
- else
+ if (_ecore_pending_job_threads_long)
{
- work->func_end((void*) work->data);
+ pthread_mutex_unlock(&_ecore_pending_job_threads_mutex);
+ goto on_error;
}
- free(work);
+ _ecore_thread_count--;
+
+ pthread_mutex_unlock(&_ecore_pending_job_threads_mutex);
+
+ work = malloc(sizeof (Ecore_Pthread_Worker));
+ if (!work) return NULL;
+
+ work->data = pth;
+ work->u.short_run.func_blocking = NULL;
+ work->func_end = (void *) _ecore_thread_end;
+ work->func_cancel = NULL;
+ work->cancel = EINA_FALSE;
+ work->long_run = EINA_FALSE;
+ work->hash = NULL;
+ pthread_cond_init(&work->cond, NULL);
+ pthread_mutex_init(&work->mutex, NULL);
+
+ ecore_pipe_write(pth->p, &work, sizeof (Ecore_Pthread_Worker *));
+
+ return pth->p;
}
+
#endif
void
ECORE_THREAD_PIPE_DEL = ecore_event_type_new();
#ifdef EFL_HAVE_PTHREAD
del_handler = ecore_event_handler_add(ECORE_THREAD_PIPE_DEL, _ecore_thread_pipe_del, NULL);
+ main_loop_thread = pthread_self();
#endif
}
Ecore_Pthread_Worker *work;
Ecore_Pthread_Data *pth;
- pthread_mutex_lock(&_mutex);
+ pthread_mutex_lock(&_ecore_pending_job_threads_mutex);
- EINA_LIST_FREE(_ecore_thread_data, work)
+ EINA_LIST_FREE(_ecore_pending_job_threads, work)
{
- if (work->func_cancel)
- work->func_cancel((void*)work->data);
- free(work);
+ if (work->func_cancel)
+ work->func_cancel((void *)work->data);
+ free(work);
}
- pthread_mutex_unlock(&_mutex);
+ pthread_mutex_unlock(&_ecore_pending_job_threads_mutex);
- EINA_LIST_FREE(_ecore_thread, pth)
+ EINA_LIST_FREE(_ecore_active_job_threads, pth)
{
- Ecore_Pipe *p;
+ Ecore_Pipe *p;
- pthread_cancel(pth->thread);
- pthread_join(pth->thread, (void **) &p);
+ pthread_cancel(pth->thread);
+ pthread_join(pth->thread, (void **) &p);
- ecore_pipe_del(pth->p);
+ ecore_pipe_del(pth->p);
}
-
+ if (_ecore_thread_global_hash)
+ eina_hash_free(_ecore_thread_global_hash);
ecore_event_handler_del(del_handler);
del_handler = NULL;
+ main_loop_thread = 0;
#endif
}
+/**
+ * @addtogroup Ecore_Thread Ecore Thread Functions
+ * These functions allow for ecore-managed threads which integrate with ecore's main loop.
+ * @{
+ */
-/*
- * ecore_thread_run provide a facility for easily managing heavy task in a
- * parallel thread. You should provide two function, the first one, func_heavy,
- * that will do the heavy work in another thread (so you should not use the
- * EFL in it except Eina if you are carefull), and the second one, func_end,
- * that will be called in Ecore main loop when func_heavy is done. So you
- * can use all the EFL inside this function.
+/**
+ * @brief Run some blocking code in a parrallel thread to avoid locking the main loop.
+ * @param func_blocking The function that should run in another thread.
+ * @param func_end The function that will be called in the main loop if the thread terminate correctly.
+ * @param func_cancel The function that will be called in the main loop if the thread is cancelled.
+ * @param data User context data to pass to all callback.
+ * @return A reference to the newly created thread instance, or NULL if it failed.
+ *
+ * ecore_thread_run provide a facility for easily managing blocking task in a
+ * parallel thread. You should provide three function. The first one, func_blocking,
+ * that will do the blocking work in another thread (so you should not use the
+ * EFL in it except Eina if you are carefull). The second one, func_end,
+ * that will be called in Ecore main loop when func_blocking is done. So you
+ * can use all the EFL inside this function. The last one, func_cancel, will
+ * be called in the main loop if the thread is cancelled or could not run at all.
*
* Be aware, that you can't make assumption on the result order of func_end
* after many call to ecore_thread_run, as we start as much thread as the
* host CPU can handle.
*/
EAPI Ecore_Thread *
-ecore_thread_run(void (*func_heavy)(void *data),
- void (*func_end)(void *data),
- void (*func_cancel)(void *data),
- const void *data)
+ecore_thread_run(Ecore_Cb func_blocking,
+ Ecore_Cb func_end,
+ Ecore_Cb func_cancel,
+ const void *data)
{
#ifdef EFL_HAVE_PTHREAD
Ecore_Pthread_Worker *work;
- Ecore_Pthread_Data *pth;
+ Ecore_Pthread_Data *pth = NULL;
+
+ if (!func_blocking) return NULL;
work = malloc(sizeof (Ecore_Pthread_Worker));
if (!work)
{
- func_cancel((void*) data);
- return NULL;
+ func_cancel((void *) data);
+ return NULL;
}
- work->func_heavy = func_heavy;
+ work->u.short_run.func_blocking = func_blocking;
+ work->hash = NULL;
+ pthread_cond_init(&work->cond, NULL);
+ pthread_mutex_init(&work->mutex, NULL);
work->func_end = func_end;
work->func_cancel = func_cancel;
work->cancel = EINA_FALSE;
+ work->long_run = EINA_FALSE;
work->data = data;
- pthread_mutex_lock(&_mutex);
- _ecore_thread_data = eina_list_append(_ecore_thread_data, work);
+ pthread_mutex_lock(&_ecore_pending_job_threads_mutex);
+ _ecore_pending_job_threads = eina_list_append(_ecore_pending_job_threads, work);
if (_ecore_thread_count == _ecore_thread_count_max)
{
- pthread_mutex_unlock(&_mutex);
- return (Ecore_Thread*) work;
+ pthread_mutex_unlock(&_ecore_pending_job_threads_mutex);
+ return (Ecore_Thread *) work;
}
- pthread_mutex_unlock(&_mutex);
+ pthread_mutex_unlock(&_ecore_pending_job_threads_mutex);
/* One more thread could be created. */
pth = malloc(sizeof (Ecore_Pthread_Data));
- if (!pth)
- goto on_error;
+ if (!pth) goto on_error;
pth->p = ecore_pipe_add(_ecore_thread_handler, NULL);
+ if (!pth->p) goto on_error;
- if (pthread_create(&pth->thread, NULL, (void*) _ecore_thread_worker, pth) == 0)
- return (Ecore_Thread*) work;
+ if (pthread_create(&pth->thread, NULL, (void *) _ecore_thread_worker, pth) == 0)
+ return (Ecore_Thread *) work;
on_error:
+ if (pth)
+ {
+ if (pth->p) ecore_pipe_del(pth->p);
+ free(pth);
+ }
+
if (_ecore_thread_count == 0)
{
- if (work->func_cancel)
- work->func_cancel((void*) work->data);
- free(work);
+ if (work->func_cancel)
+ work->func_cancel((void *) work->data);
+ free(work);
+ work = NULL;
}
- return NULL;
+ return (Ecore_Thread *) work;
#else
/*
If no thread and as we don't want to break app that rely on this
facility, we will lock the interface until we are done.
*/
- func_heavy((void *)data);
+ func_blocking((void *)data);
func_end((void *)data);
return NULL;
#endif
}
-/*
+/**
+ * @brief Cancel a running thread.
+ * @param thread The thread to cancel.
+ * @return Will return EINA_TRUE if the thread has been cancelled,
+ * EINA_FALSE if it is pending.
+ *
* ecore_thread_cancel give the possibility to cancel a task still running. It
* will return EINA_FALSE, if the destruction is delayed or EINA_TRUE if it is
* cancelled after this call.
ecore_thread_cancel(Ecore_Thread *thread)
{
#ifdef EFL_HAVE_PTHREAD
- Ecore_Pthread_Worker *work;
+ Ecore_Pthread_Worker *work = (Ecore_Pthread_Worker*) thread;
Eina_List *l;
- pthread_mutex_lock(&_mutex);
+ if (!work)
+ return EINA_TRUE;
+
+ pthread_mutex_lock(&_ecore_pending_job_threads_mutex);
- EINA_LIST_FOREACH(_ecore_thread_data, l, work)
- if ((void*) work == (void*) thread)
- {
- _ecore_thread_data = eina_list_remove_list(_ecore_thread_data, l);
+ if (main_loop_thread == pthread_self())
+ EINA_LIST_FOREACH(_ecore_pending_job_threads, l, work)
+ if ((void *) work == (void *) thread)
+ {
+ _ecore_pending_job_threads = eina_list_remove_list(_ecore_pending_job_threads, l);
- pthread_mutex_unlock(&_mutex);
+ pthread_mutex_unlock(&_ecore_pending_job_threads_mutex);
- if (work->func_cancel)
- work->func_cancel((void*) work->data);
- free(work);
+ if (work->func_cancel)
+ work->func_cancel((void *) work->data);
+ free(work);
- return EINA_TRUE;
- }
+ return EINA_TRUE;
+ }
- pthread_mutex_unlock(&_mutex);
+ pthread_mutex_unlock(&_ecore_pending_job_threads_mutex);
/* Delay the destruction */
- ((Ecore_Pthread_Worker*)thread)->cancel = EINA_TRUE;
+ ((Ecore_Pthread_Worker *)thread)->cancel = EINA_TRUE;
return EINA_FALSE;
#else
return EINA_TRUE;
#endif
}
+
+/**
+ * @brief Tell if a thread was canceled or not.
+ * @param thread The thread to test.
+ * @return EINA_TRUE if the thread is cancelled,
+ * EINA_FALSE if it is not.
+ *
+ * You can use this function in main loop and in the thread.
+ */
+EAPI Eina_Bool
+ecore_thread_check(Ecore_Thread *thread)
+{
+ Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *) thread;
+
+ if (!worker) return EINA_TRUE;
+ return worker->cancel;
+}
+
+/**
+ * @brief Run some heavy code in a parrallel thread to avoid locking the main loop.
+ * @param func_heavy The function that should run in another thread.
+ * @param func_notify The function that will receive the data send by func_heavy in the main loop.
+ * @param func_end The function that will be called in the main loop if the thread terminate correctly.
+ * @param func_cancel The function that will be called in the main loop if the thread is cancelled.
+ * @param data User context data to pass to all callback.
+ * @param try_no_queue If you wan't to run outside of the thread pool.
+ * @return A reference to the newly created thread instance, or NULL if it failed.
+ *
+ * ecore_long_run provide a facility for easily managing heavy task in a
+ * parallel thread. You should provide four functions. The first one, func_heavy,
+ * that will do the heavy work in another thread (so you should not use the
+ * EFL in it except Eina and Eet if you are carefull). The second one, func_notify,
+ * will receive the data send from the thread function (func_heavy) by ecore_thread_notify
+ * in the main loop (and so, can use all the EFL). Tje third, func_end,
+ * that will be called in Ecore main loop when func_heavy is done. So you
+ * can use all the EFL inside this function. The last one, func_cancel, will
+ * be called in the main loop also, if the thread is cancelled or could not run at all.
+ *
+ * Be aware, that you can't make assumption on the result order of func_end
+ * after many call to ecore_long_run, as we start as much thread as the
+ * host CPU can handle.
+ *
+ * If you set try_no_queue, it will try to run outside of the thread pool, this can bring
+ * the CPU down, so be carefull with that. Of course if it can't start a new thread, it will
+ * try to use one from the pool.
+ */
+EAPI Ecore_Thread *ecore_long_run(Ecore_Thread_Heavy_Cb func_heavy,
+ Ecore_Thread_Notify_Cb func_notify,
+ Ecore_Cb func_end,
+ Ecore_Cb func_cancel,
+ const void *data,
+ Eina_Bool try_no_queue)
+{
+
+#ifdef EFL_HAVE_PTHREAD
+ Ecore_Pthread_Worker *worker;
+ Ecore_Pthread_Data *pth = NULL;
+
+ if (!func_heavy) return NULL;
+
+ worker = malloc(sizeof (Ecore_Pthread_Worker));
+ if (!worker) goto on_error;
+
+ worker->u.long_run.func_heavy = func_heavy;
+ worker->u.long_run.func_notify = func_notify;
+ worker->hash = NULL;
+ pthread_cond_init(&worker->cond, NULL);
+ pthread_mutex_init(&worker->mutex, NULL);
+ worker->func_cancel = func_cancel;
+ worker->func_end = func_end;
+ worker->data = data;
+ worker->cancel = EINA_FALSE;
+ worker->long_run = EINA_TRUE;
+
+ worker->u.long_run.notify = ecore_pipe_add(_ecore_notify_handler, worker);
+
+ if (!try_no_queue)
+ {
+ pthread_t t;
+
+ if (pthread_create(&t, NULL, (void *) _ecore_direct_worker, worker) == 0)
+ return (Ecore_Thread *) worker;
+ }
+
+ pthread_mutex_lock(&_ecore_pending_job_threads_mutex);
+ _ecore_pending_job_threads_long = eina_list_append(_ecore_pending_job_threads_long, worker);
+
+ if (_ecore_thread_count == _ecore_thread_count_max)
+ {
+ pthread_mutex_unlock(&_ecore_pending_job_threads_mutex);
+ return (Ecore_Thread *) worker;
+ }
+
+ pthread_mutex_unlock(&_ecore_pending_job_threads_mutex);
+
+ /* One more thread could be created. */
+ pth = malloc(sizeof (Ecore_Pthread_Data));
+ if (!pth) goto on_error;
+
+ pth->p = ecore_pipe_add(_ecore_thread_handler, NULL);
+ if (pth->p) goto on_error;
+
+ if (pthread_create(&pth->thread, NULL, (void *) _ecore_thread_worker, pth) == 0)
+ return (Ecore_Thread *) worker;
+
+ on_error:
+ if (pth)
+ {
+ if (pth->p) ecore_pipe_del(pth->p);
+ free(pth);
+ }
+
+ if (_ecore_thread_count == 0)
+ {
+ if (func_cancel) func_cancel((void *) data);
+
+ if (worker)
+ {
+ ecore_pipe_del(worker->u.long_run.notify);
+ free(worker);
+ worker = NULL;
+ }
+ }
+
+ return (Ecore_Thread *) worker;
+#else
+ Ecore_Pthread_Worker worker;
+
+ (void) try_no_queue;
+
+ /*
+ If no thread and as we don't want to break app that rely on this
+ facility, we will lock the interface until we are done.
+ */
+ worker.u.long_run.func_heavy = func_heavy;
+ worker.u.long_run.func_notify = func_notify;
+ worker.u.long_run.notify = NULL;
+ worker.func_cancel = func_cancel;
+ worker.func_end = func_end;
+ worker.data = data;
+ worker.cancel = EINA_FALSE;
+ worker.long_run = EINA_TRUE;
+
+ func_heavy((Ecore_Thread *) &worker, (void *)data);
+
+ if (worker.cancel) func_cancel((void *)data);
+ else func_end((void *)data);
+
+ return NULL;
+#endif
+}
+
+/**
+ * @brief Send data to main loop from worker thread.
+ * @param thread The current Ecore_Thread context to send data from
+ * @param data Data to be transmitted to the main loop
+ * @return EINA_TRUE if data was successfully send to main loop,
+ * EINA_FALSE if anything goes wrong.
+ *
+ * After a succesfull call, the data should be considered owned
+ * by the main loop.
+ *
+ * You should use this function only in the func_heavy call.
+ */
+EAPI Eina_Bool
+ecore_thread_notify(Ecore_Thread *thread, const void *data)
+{
+ Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *) thread;
+
+ if (!worker) return EINA_FALSE;
+ if (!worker->long_run) return EINA_FALSE;
+
+#ifdef EFL_HAVE_PTHREAD
+ if (worker->self != pthread_self()) return EINA_FALSE;
+
+ ecore_pipe_write(worker->u.long_run.notify, &data, sizeof (void *));
+
+ return EINA_TRUE;
+#else
+ worker->u.long_run.func_notify(thread, (void*) data, (void*) worker->data);
+
+ return EINA_TRUE;
+#endif
+}
+
+/**
+ * @brief Get number of active thread jobs
+ * @return Number of active threads running jobs
+ * This returns the number of threads currently running jobs through the
+ * ecore_thread api.
+ */
+EAPI int
+ecore_thread_active_get(void)
+{
+#ifdef EFL_HAVE_PTHREAD
+ return _ecore_thread_count;
+#else
+ return 0;
+#endif
+}
+
+/**
+ * @brief Get number of pending (short) thread jobs
+ * @return Number of pending threads running "short" jobs
+ * This returns the number of threads currently running jobs through the
+ * ecore_thread_run api call.
+ */
+EAPI int
+ecore_thread_pending_get(void)
+{
+ int ret;
+#ifdef EFL_HAVE_PTHREAD
+ pthread_mutex_lock(&_ecore_pending_job_threads_mutex);
+ ret = eina_list_count(_ecore_pending_job_threads);
+ pthread_mutex_unlock(&_ecore_pending_job_threads_mutex);
+ return ret;
+#else
+ return 0;
+#endif
+}
+
+/**
+ * @brief Get number of pending long thread jobs
+ * @return Number of pending threads running "long" jobs
+ * This returns the number of threads currently running jobs through the
+ * ecore_long_run api call.
+ */
+EAPI int
+ecore_thread_pending_long_get(void)
+{
+ int ret;
+#ifdef EFL_HAVE_PTHREAD
+ pthread_mutex_lock(&_ecore_pending_job_threads_mutex);
+ ret = eina_list_count(_ecore_pending_job_threads_long);
+ pthread_mutex_unlock(&_ecore_pending_job_threads_mutex);
+ return ret;
+#else
+ return 0;
+#endif
+}
+
+/**
+ * @brief Get number of pending thread jobs
+ * @return Number of pending threads running jobs
+ * This returns the number of threads currently running jobs through the
+ * ecore_thread_run and ecore_long_run api calls combined.
+ */
+EAPI int
+ecore_thread_pending_total_get(void)
+{
+ int ret;
+#ifdef EFL_HAVE_PTHREAD
+ pthread_mutex_lock(&_ecore_pending_job_threads_mutex);
+ ret = eina_list_count(_ecore_pending_job_threads) + eina_list_count(_ecore_pending_job_threads_long);
+ pthread_mutex_unlock(&_ecore_pending_job_threads_mutex);
+ return ret;
+#else
+ return 0;
+#endif
+}
+
+/**
+ * @brief Get the max number of threads that can run simultaneously
+ * @return Max number of threads ecore will run
+ * This returns the total number of threads that ecore will attempt to run
+ * simultaneously.
+ */
+EAPI int
+ecore_thread_max_get(void)
+{
+ return _ecore_thread_count_max;
+}
+
+/**
+ * @brief Set the max number of threads that can run simultaneously
+ * @param num The new maximum
+ * This sets the maximum number of threads that ecore will try to run
+ * simultaneously. This number cannot be < 1 or >= 2x the number of active cpus.
+ */
+EAPI void
+ecore_thread_max_set(int num)
+{
+ if (num < 1) return;
+ /* avoid doing something hilarious by blocking dumb users */
+ if (num >= (2 * eina_cpu_count())) return;
+
+ _ecore_thread_count_max = num;
+}
+
+/**
+ * @brief Reset the max number of threads that can run simultaneously
+ * This resets the maximum number of threads that ecore will try to run
+ * simultaneously to the number of active cpus.
+ */
+EAPI void
+ecore_thread_max_reset(void)
+{
+ _ecore_thread_count_max = eina_cpu_count();
+}
+
+/**
+ * @brief Get the number of threads which are available to be used
+ * @return The number of available threads
+ * This returns the number of threads slots that ecore has currently available.
+ * Assuming that you haven't changed the max number of threads with @ref ecore_thread_max_set
+ * this should be equal to (num_cpus - (active_running + active_long_running))
+ */
+EAPI int
+ecore_thread_available_get(void)
+{
+ int ret;
+#ifdef EFL_HAVE_PTHREAD
+ pthread_mutex_lock(&_ecore_pending_job_threads_mutex);
+ ret = _ecore_thread_count_max - _ecore_thread_count;
+ pthread_mutex_unlock(&_ecore_pending_job_threads_mutex);
+ return ret;
+#else
+ return 0;
+#endif
+}
+
+/**
+ * @brief Add data to the thread for subsequent use
+ * @param thread The thread context to add to
+ * @param key The name string to add the data with
+ * @param value The data to add
+ * @param cb The callback to free the data with
+ * @param direct If true, this will not copy the key string (like eina_hash_direct_add)
+ * @return EINA_TRUE on success, EINA_FALSE on failure
+ * This adds data to the thread context, allowing the thread
+ * to retrieve and use it without complicated mutexing. This function can only be called by a
+ * *_run thread INSIDE the thread and will return EINA_FALSE in any case but success.
+ * All data added to the thread will be freed with its associated callback (if present)
+ * upon thread termination. If no callback is specified, it is expected that the user will free the
+ * data, but this is most likely not what you want.
+ */
+EAPI Eina_Bool
+ecore_thread_local_data_add(Ecore_Thread *thread, const char *key, void *value, Eina_Free_Cb cb, Eina_Bool direct)
+{
+ Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *) thread;
+ Ecore_Thread_Data *d;
+ Eina_Bool ret;
+
+ if ((!thread) || (!key) || (!value))
+ return EINA_FALSE;
+#ifdef EFL_HAVE_PTHREAD
+ if (worker->self != pthread_self()) return EINA_FALSE;
+
+ if (!worker->hash)
+ worker->hash = eina_hash_string_small_new(_ecore_thread_data_free);
+
+ if (!worker->hash)
+ return EINA_FALSE;
+
+ if (!(d = malloc(sizeof(Ecore_Thread_Data))))
+ return EINA_FALSE;
+
+ d->data = value;
+ d->cb = cb;
+
+ if (direct)
+ ret = eina_hash_direct_add(worker->hash, key, d);
+ else
+ ret = eina_hash_add(worker->hash, key, d);
+ pthread_cond_broadcast(&worker->cond);
+ return ret;
+#else
+ return EINA_TRUE;
+#endif
+}
+
+/**
+ * @brief Modify data in the thread, or add if not found
+ * @param thread The thread context
+ * @param key The name string to add the data with
+ * @param value The data to add
+ * @param cb The callback to free the data with
+ * @param direct If true, this will not copy the key string (like eina_hash_direct_add)
+ * @return The old data associated with @p key on success if modified, NULL if added
+ * This adds/modifies data in the thread context, adding only if modify fails.
+ * This function can only be called by a *_run thread INSIDE the thread.
+ * All data added to the thread pool will be freed with its associated callback (if present)
+ * upon thread termination. If no callback is specified, it is expected that the user will free the
+ * data, but this is most likely not what you want.
+ */
+EAPI void *
+ecore_thread_local_data_set(Ecore_Thread *thread, const char *key, void *value, Eina_Free_Cb cb)
+{
+ Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *) thread;
+ Ecore_Thread_Data *d, *r;
+ void *ret;
+ if ((!thread) || (!key) || (!value))
+ return NULL;
+#ifdef EFL_HAVE_PTHREAD
+ if (worker->self != pthread_self()) return NULL;
+
+ if (!worker->hash)
+ worker->hash = eina_hash_string_small_new(_ecore_thread_data_free);
+
+ if (!worker->hash)
+ return NULL;
+
+ if (!(d = malloc(sizeof(Ecore_Thread_Data))))
+ return NULL;
+
+ d->data = value;
+ d->cb = cb;
+
+ r = eina_hash_set(worker->hash, key, d);
+ pthread_cond_broadcast(&worker->cond);
+ ret = r->data;
+ free(r);
+ return ret;
+#else
+ return NULL;
+#endif
+}
+
+/**
+ * @brief Find data in the thread's data
+ * @param thread The thread context
+ * @param key The name string the data is associated with
+ * @return The value, or NULL on error
+ * This finds data in the thread context that has been previously added with @ref ecore_thread_local_data_add
+ * This function can only be called by a *_run thread INSIDE the thread, and will return NULL
+ * in any case but success.
+ */
+
+EAPI void *
+ecore_thread_local_data_find(Ecore_Thread *thread, const char *key)
+{
+ Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *) thread;
+ Ecore_Thread_Data *d;
+
+ if ((!thread) || (!key))
+ return NULL;
+#ifdef EFL_HAVE_PTHREAD
+ if (worker->self != pthread_self()) return NULL;
+
+ if (!worker->hash)
+ return NULL;
+
+ d = eina_hash_find(worker->hash, key);
+ return d->data;
+#else
+ return NULL;
+#endif
+}
+
+/**
+ * @brief Delete data from the thread's data
+ * @param thread The thread context
+ * @param key The name string the data is associated with
+ * @return EINA_TRUE on success, EINA_FALSE on failure
+ * This deletes the data pointer from the thread context which was previously added with @ref ecore_thread_local_data_add
+ * This function can only be called by a *_run thread INSIDE the thread, and will return EINA_FALSE
+ * in any case but success. Note that this WILL free the data if a callback was specified.
+ */
+EAPI Eina_Bool
+ecore_thread_local_data_del(Ecore_Thread *thread, const char *key)
+{
+ Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *) thread;
+ Ecore_Thread_Data *d;
+ if ((!thread) || (!key))
+ return EINA_FALSE;
+#ifdef EFL_HAVE_PTHREAD
+ if (worker->self != pthread_self()) return EINA_FALSE;
+
+ if (!worker->hash)
+ return EINA_FALSE;
+ if ((d = eina_hash_find(worker->hash, key)))
+ _ecore_thread_data_free(d);
+ return eina_hash_del_by_key(worker->hash, key);
+#else
+ return EINA_TRUE;
+#endif
+}
+
+/**
+ * @brief Add data to the global data
+ * @param key The name string to add the data with
+ * @param value The data to add
+ * @param cb The optional callback to free the data with once ecore is shut down
+ * @param direct If true, this will not copy the key string (like eina_hash_direct_add)
+ * @return EINA_TRUE on success, EINA_FALSE on failure
+ * This adds data to the global thread data, and will return EINA_FALSE in any case but success.
+ * All data added to global can be manually freed, or a callback can be provided with @p cb which will
+ * be called upon ecore_thread shutting down. Note that if you have manually freed data that a callback
+ * was specified for, you will most likely encounter a segv later on.
+ */
+EAPI Eina_Bool
+ecore_thread_global_data_add(const char *key, void *value, Eina_Free_Cb cb, Eina_Bool direct)
+{
+ Eina_Bool ret;
+ Ecore_Thread_Data *d;
+
+ if ((!key) || (!value))
+ return EINA_FALSE;
+#ifdef EFL_HAVE_PTHREAD
+ pthread_rwlock_wrlock(&_ecore_thread_global_hash_lock);
+ if (!_ecore_thread_global_hash)
+ _ecore_thread_global_hash = eina_hash_string_small_new(_ecore_thread_data_free);
+ pthread_rwlock_unlock(&_ecore_thread_global_hash_lock);
+
+ if (!(d = malloc(sizeof(Ecore_Thread_Data))))
+ return EINA_FALSE;
+
+ d->data = value;
+ d->cb = cb;
+
+ if (!_ecore_thread_global_hash)
+ return EINA_FALSE;
+ pthread_rwlock_wrlock(&_ecore_thread_global_hash_lock);
+ if (direct)
+ ret = eina_hash_direct_add(_ecore_thread_global_hash, key, d);
+ else
+ ret = eina_hash_add(_ecore_thread_global_hash, key, d);
+ pthread_rwlock_unlock(&_ecore_thread_global_hash_lock);
+ pthread_cond_broadcast(&_ecore_thread_global_hash_cond);
+ return ret;
+#else
+ return EINA_TRUE;
+#endif
+}
+
+/**
+ * @brief Add data to the global data
+ * @param key The name string to add the data with
+ * @param value The data to add
+ * @param cb The optional callback to free the data with once ecore is shut down
+ * @return An @ref Ecore_Thread_Data on success, NULL on failure
+ * This adds data to the global thread data and returns NULL, or replaces the previous data
+ * associated with @p key and returning the previous data if it existed. To see if an error occurred,
+ * one must use eina_error_get.
+ * All data added to global can be manually freed, or a callback can be provided with @p cb which will
+ * be called upon ecore_thread shutting down. Note that if you have manually freed data that a callback
+ * was specified for, you will most likely encounter a segv later on.
+ */
+EAPI void *
+ecore_thread_global_data_set(const char *key, void *value, Eina_Free_Cb cb)
+{
+ Ecore_Thread_Data *d, *r;
+ void *ret;
+
+ if ((!key) || (!value))
+ return NULL;
+#ifdef EFL_HAVE_PTHREAD
+ pthread_rwlock_wrlock(&_ecore_thread_global_hash_lock);
+ if (!_ecore_thread_global_hash)
+ _ecore_thread_global_hash = eina_hash_string_small_new(_ecore_thread_data_free);
+ pthread_rwlock_unlock(&_ecore_thread_global_hash_lock);
+
+ if (!_ecore_thread_global_hash)
+ return NULL;
+
+ if (!(d = malloc(sizeof(Ecore_Thread_Data))))
+ return NULL;
+
+ d->data = value;
+ d->cb = cb;
+
+ pthread_rwlock_wrlock(&_ecore_thread_global_hash_lock);
+ r = eina_hash_set(_ecore_thread_global_hash, key, d);
+ pthread_rwlock_unlock(&_ecore_thread_global_hash_lock);
+ pthread_cond_broadcast(&_ecore_thread_global_hash_cond);
+
+ ret = r->data;
+ free(r);
+ return ret;
+#else
+ return NULL;
+#endif
+}
+
+/**
+ * @brief Find data in the global data
+ * @param key The name string the data is associated with
+ * @return The value, or NULL on error
+ * This finds data in the global data that has been previously added with @ref ecore_thread_global_data_add
+ * This function will return NULL in any case but success.
+ * All data added to global can be manually freed, or a callback can be provided with @p cb which will
+ * be called upon ecore_thread shutting down. Note that if you have manually freed data that a callback
+ * was specified for, you will most likely encounter a segv later on.
+ * @note Keep in mind that the data returned can be used by multiple threads at a time, so you will most likely want to mutex
+ * if you will be doing anything with it.
+ */
+
+EAPI void *
+ecore_thread_global_data_find(const char *key)
+{
+ Ecore_Thread_Data *ret;
+ if (!key)
+ return NULL;
+#ifdef EFL_HAVE_PTHREAD
+ if (!_ecore_thread_global_hash) return NULL;
+
+ pthread_rwlock_rdlock(&_ecore_thread_global_hash_lock);
+ ret = eina_hash_find(_ecore_thread_global_hash, key);
+ pthread_rwlock_unlock(&_ecore_thread_global_hash_lock);
+ return ret->data;
+#else
+ return NULL;
+#endif
+}
+
+/**
+ * @brief Delete data from the global data
+ * @param key The name string the data is associated with
+ * @return EINA_TRUE on success, EINA_FALSE on failure
+ * This deletes the data pointer from the global data which was previously added with @ref ecore_thread_global_data_add
+ * This function will return EINA_FALSE in any case but success.
+ * Note that this WILL free the data if an @c Eina_Free_Cb was specified when the data was added.
+ */
+EAPI Eina_Bool
+ecore_thread_global_data_del(const char *key)
+{
+ Eina_Bool ret;
+ Ecore_Thread_Data *d;
+
+ if (!key)
+ return EINA_FALSE;
+#ifdef EFL_HAVE_PTHREAD
+ if (!_ecore_thread_global_hash)
+ return EINA_FALSE;
+
+ pthread_rwlock_wrlock(&_ecore_thread_global_hash_lock);
+ if ((d = eina_hash_find(_ecore_thread_global_hash, key)))
+ _ecore_thread_data_free(d);
+ ret = eina_hash_del_by_key(_ecore_thread_global_hash, key);
+ pthread_rwlock_unlock(&_ecore_thread_global_hash_lock);
+ return ret;
+#else
+ return EINA_TRUE;
+#endif
+}
+
+/**
+ * @brief Find data in the global data and optionally wait for the data if not found
+ * @param key The name string the data is associated with
+ * @param seconds The amount of time in seconds to wait for the data. If 0, the call will be async and not wait for data.
+ * If < 0 the call will wait indefinitely for the data.
+ * @return The value, or NULL on failure
+ * This finds data in the global data that has been previously added with @ref ecore_thread_global_data_add
+ * This function will return NULL in any case but success.
+ * Use @p seconds to specify the amount of time to wait. Use > 0 for an actual wait time, 0 to not wait, and < 0 to wait indefinitely.
+ * @note Keep in mind that the data returned can be used by multiple threads at a time, so you will most likely want to mutex
+ * if you will be doing anything with it.
+ */
+EAPI void *
+ecore_thread_global_data_wait(const char *key, double seconds)
+{
+ double time = 0;
+ Ecore_Thread_Data *ret = NULL;
+ if (!key)
+ return NULL;
+#ifdef EFL_HAVE_PTHREAD
+ if (!_ecore_thread_global_hash)
+ return NULL;
+ if (seconds > 0)
+ time = ecore_time_get() + seconds;
+
+ while (1)
+ {
+ struct timespec t = { 0, 0 };
+
+ t.tv_sec = (long int)time;
+ t.tv_nsec = (long int)((time - (double)t.tv_sec) * 1000000000);
+ pthread_rwlock_rdlock(&_ecore_thread_global_hash_lock);
+ ret = eina_hash_find(_ecore_thread_global_hash, key);
+ pthread_rwlock_unlock(&_ecore_thread_global_hash_lock);
+ if ((ret) || (!seconds) || ((seconds > 0) && (time <= ecore_time_get())))
+ break;
+ pthread_mutex_lock(&_ecore_thread_global_hash_mutex);
+ pthread_cond_timedwait(&_ecore_thread_global_hash_cond, &_ecore_thread_global_hash_mutex, &t);
+ pthread_mutex_unlock(&_ecore_thread_global_hash_mutex);
+ }
+ if (ret) return ret->data;
+ return NULL;
+#else
+ return NULL;
+#endif
+}
+
+/**
+ * @}
+ */
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
double in;
double at;
double pending;
- int (*func) (void *data);
+ Ecore_Task_Cb func;
void *data;
int references;
};
-static void _ecore_timer_set(Ecore_Timer *timer, double at, double in, int (*func) (void *data), void *data);
+static void _ecore_timer_set(Ecore_Timer *timer, double at, double in, Ecore_Task_Cb func, void *data);
static int timers_added = 0;
static int timers_delete_me = 0;
* invalid.
*/
EAPI Ecore_Timer *
-ecore_timer_add(double in, int (*func) (void *data), const void *data)
+ecore_timer_add(double in, Ecore_Task_Cb func, const void *data)
{
double now;
Ecore_Timer *timer;
* ecore_timer_add() for more details.
*/
EAPI Ecore_Timer *
-ecore_timer_loop_add(double in, int (*func) (void *data), const void *data)
+ecore_timer_loop_add(double in, Ecore_Task_Cb func, const void *data)
{
double now;
Ecore_Timer *timer;
return data;
}
- if (timer->delete_me) return timer->data;
- timers_delete_me++;
+ EINA_SAFETY_ON_TRUE_RETURN_VAL(timer->delete_me, NULL);
timer->delete_me = 1;
+ timers_delete_me++;
return timer->data;
}
_ecore_timer_cleanup(void)
{
Ecore_Timer *l;
- int in_use = 0;
+ int in_use = 0, todo = timers_delete_me, done = 0;
if (!timers_delete_me) return;
for (l = timers; l;)
ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE);
free(timer);
timers_delete_me--;
+ done++;
if (timers_delete_me == 0) return;
}
}
ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE);
free(timer);
timers_delete_me--;
+ done++;
if (timers_delete_me == 0) return;
}
}
if ((!in_use) && (timers_delete_me))
{
- ERR("%d timers to delete, but they were not found! reset counter.",
- timers_delete_me);
+ ERR("%d timers to delete, but they were not found!"
+ "Stats: todo=%d, done=%d, pending=%d, in_use=%d. "
+ "reset counter.",
+ timers_delete_me, todo, done, todo - done, in_use);
timers_delete_me = 0;
}
}
}
timer->references++;
- if (!timer->func(timer->data)) ecore_timer_del(timer);
+ if (!timer->func(timer->data))
+ {
+ if (!timer->delete_me) ecore_timer_del(timer);
+ }
timer->references--;
if (timer_current) /* may have changed in recursive main loops */
}
static void
-_ecore_timer_set(Ecore_Timer *timer, double at, double in, int (*func) (void *data), void *data)
+_ecore_timer_set(Ecore_Timer *timer, double at, double in, Ecore_Task_Cb func, void *data)
{
Ecore_Timer *t2;
-/*
-* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
-*/
-
#ifndef _ECORE_COCOA_H
#define _ECORE_COCOA_H
if BUILD_ECORE_COCOA
lib_LTLIBRARIES = libecore_cocoa.la
-include_HEADERS = \
+includes_HEADERS = \
Ecore_Cocoa.h \
Ecore_Cocoa_Keys.h
+includesdir = $(includedir)/ecore-@VMAJ@
libecore_cocoa_la_SOURCES = \
ecore_cocoa.m \
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
#ifndef _ECORE_CON_H
#define _ECORE_CON_H
* It is used regardless of whether the program is acting as a server or
* client itself.
*
- * To create a listening server, call @c ecore_con_server_add().
+ * To create a listening server call @c ecore_con_server_add(), optionally using
+ * an ECORE_CON_USE_* encryption type OR'ed with the type for encryption.
*
* To connect to a server, call @c ecore_con_server_connect(). Data can
* then be sent to the server using the @c ecore_con_server_send().
- *
- * Whenever a client connection is made to an @c Ecore_Con_Server, a
- * @c ECORE_CON_CLIENT_ADD event is emitted. Any event callbacks that are
- * called receive a @c Ecore_Con_Client object, which represents a
- * connection that that particular client.
- *
+ *
* Functions are described in the following groupings:
* @li @ref Ecore_Con_Lib_Group
* @li @ref Ecore_Con_Server_Group
* @li @ref Ecore_Con_Client_Group
* @li @ref Ecore_Con_Url_Group
+ *
+ * Events are described in @ref Ecore_Con_Events_Group.
+ */
+
+
+/**
+ * @addtogroup Ecore_Con_Events_Group Events
+ *
+ * @li @ref ECORE_CON_CLIENT_ADD: Whenever a client connection is made to an
+ * @c Ecore_Con_Server, an event of this type is emitted, allowing the
+ * retrieval of the client's ip with @ref ecore_con_client_ip_get and
+ * associating data with the client using ecore_con_client_data_set.
+ * @li @ref ECORE_CON_EVENT_CLIENT_DEL: Whenever a client connection to an
+ * @c Ecore_Con_Server, an event of this type is emitted. The contents of
+ * the data with this event are variable, but if the client object in the data
+ * is non-null, it must be freed with @ref ecore_con_client_del.
+ * @li @ref ECORE_CON_EVENT_SERVER_ADD: Whenever a server object is created
+ * with @ref ecore_con_server_connect, an event of this type is emitted,
+ * allowing for data to be serialized and sent to the server using
+ * @ref ecore_con_server_send. At this point, the http handshake has
+ * occurred.
+ * @li @ref ECORE_CON_EVENT_SERVER_DEL: Whenever a server object is destroyed,
+ * usually by the server connection being refused or dropped, an event of this
+ * type is emitted. The contents of the data with this event are variable,
+ * but if the server object in the data is non-null, it must be freed
+ * with @ref ecore_con_server_del.
+ * @li @ref ECORE_CON_EVENT_CLIENT_DATA: Whenever a client connects to your server
+ * object and sends data, an event of this type is emitted. The data will contain both
+ * the size and contents of the message sent by the client. It should be noted that
+ * data within this object is transient, so it must be duplicated in order to be
+ * retained. This event will continue to occur until the client has stopped sending its
+ * message, so a good option for storing this data is an Eina_Strbuf. Once the message has
+ * been recieved in full, the client object must be freed with @ref ecore_con_client_free.
+ * @li @ref ECORE_CON_EVENT_SERVER_DATA: Whenever your server object connects to its destination
+ * and receives data, an event of this type is emitted. The data will contain both
+ * the size and contents of the message sent by the server. It should be noted that
+ * data within this object is transient, so it must be duplicated in order to be
+ * retained. This event will continue to occur until the server has stopped sending its
+ * message, so a good option for storing this data is an Eina_Strbuf. Once the message has
+ * been recieved in full, the server object must be freed with @ref ecore_con_server_free.
+ *
*/
#ifdef __cplusplus
extern "C" {
#endif
- typedef struct _Ecore_Con_Server Ecore_Con_Server; /**< A connection handle */
- typedef struct _Ecore_Con_Client Ecore_Con_Client; /**< A connection handle */
- typedef struct _Ecore_Con_Url Ecore_Con_Url;
- typedef struct _Ecore_Con_Info Ecore_Con_Info;
-
- typedef void (*Ecore_Con_Info_Cb)(void *data, Ecore_Con_Info *infos);
-
- typedef enum _Ecore_Con_Type
- {
- ECORE_CON_LOCAL_USER = 0,
- ECORE_CON_LOCAL_SYSTEM = 1,
- ECORE_CON_LOCAL_ABSTRACT = 2,
- ECORE_CON_REMOTE_TCP = 3,
- ECORE_CON_REMOTE_MCAST = 4,
- ECORE_CON_REMOTE_UDP = 5,
- ECORE_CON_REMOTE_BROADCAST = 6,
- ECORE_CON_REMOTE_NODELAY = 7,
-
- ECORE_CON_USE_SSL2 = (1 << 4),
- ECORE_CON_USE_SSL3 = (1 << 5),
- ECORE_CON_USE_TLS = (1 << 6)
- } Ecore_Con_Type;
+/** @typedef Ecore_Con_Server
+ * A connection handle to a server
+ */
+typedef struct _Ecore_Con_Server Ecore_Con_Server;
+/** @typedef Ecore_Con_Client
+ * A connection handle to a client
+ */
+typedef struct _Ecore_Con_Client Ecore_Con_Client;
+/** @typedef Ecore_Con_Url
+ * A handle to an http upload/download object
+ */
+typedef struct _Ecore_Con_Url Ecore_Con_Url;
+
+/**
+ * @typedef Ecore_Con_Dns_Cb
+ * A callback type for use with @ref ecore_con_lookup.
+ */
+typedef void (*Ecore_Con_Dns_Cb)(const char *canonname,
+ const char *ip,
+ struct sockaddr *addr,
+ int addrlen,
+ void *data);
+
+/**
+ * @typedef Ecore_Con_Type
+ * @enum _Ecore_Con_Type
+ * Types for an ecore_con client/server object. A correct way to set this type is
+ * with an ECORE_CON_$TYPE, optionally OR'ed with an ECORE_CON_$USE if encryption is desired,
+ * and LOAD_CERT if the previously loaded certificate should be used.
+ * @example ECORE_CON_REMOTE_TCP | ECORE_CON_USE_TLS | ECORE_CON_LOAD_CERT
+ */
+typedef enum _Ecore_Con_Type
+{
+ /** Socket in ~/.ecore */
+ ECORE_CON_LOCAL_USER = 0,
+ /** Socket in /tmp */
+ ECORE_CON_LOCAL_SYSTEM = 1,
+ /** Abstract socket */
+ ECORE_CON_LOCAL_ABSTRACT = 2,
+ /** Remote server using TCP */
+ ECORE_CON_REMOTE_TCP = 3,
+ /** Remote multicast server */
+ ECORE_CON_REMOTE_MCAST = 4,
+ /** Remote server using UDP */
+ ECORE_CON_REMOTE_UDP = 5,
+ /** Remote broadcast using UDP */
+ ECORE_CON_REMOTE_BROADCAST = 6,
+ ECORE_CON_REMOTE_NODELAY = 7,
+ /** Use SSL2: UNSUPPORTED. **/
+ ECORE_CON_USE_SSL2 = (1 << 4),
+ /** Use SSL3 */
+ ECORE_CON_USE_SSL3 = (1 << 5),
+ /** Use TLS */
+ ECORE_CON_USE_TLS = (1 << 6),
+ /** Attempt to use the previously loaded certificate */
+ ECORE_CON_LOAD_CERT = (1 << 7)
+} Ecore_Con_Type;
#define ECORE_CON_USE_SSL ECORE_CON_USE_SSL2
#define ECORE_CON_REMOTE_SYSTEM ECORE_CON_REMOTE_TCP
- typedef enum _Ecore_Con_Url_Time
- {
- ECORE_CON_URL_TIME_NONE = 0,
- ECORE_CON_URL_TIME_IFMODSINCE,
- ECORE_CON_URL_TIME_IFUNMODSINCE,
- ECORE_CON_URL_TIME_LASTMOD
- } Ecore_Con_Url_Time;
-
- typedef struct _Ecore_Con_Event_Client_Add Ecore_Con_Event_Client_Add;
- typedef struct _Ecore_Con_Event_Client_Del Ecore_Con_Event_Client_Del;
- typedef struct _Ecore_Con_Event_Server_Add Ecore_Con_Event_Server_Add;
- typedef struct _Ecore_Con_Event_Server_Del Ecore_Con_Event_Server_Del;
- typedef struct _Ecore_Con_Event_Client_Data Ecore_Con_Event_Client_Data;
- typedef struct _Ecore_Con_Event_Server_Data Ecore_Con_Event_Server_Data;
- typedef struct _Ecore_Con_Event_Url_Data Ecore_Con_Event_Url_Data;
- typedef struct _Ecore_Con_Event_Url_Complete Ecore_Con_Event_Url_Complete;
- typedef struct _Ecore_Con_Event_Url_Progress Ecore_Con_Event_Url_Progress;
-
- struct _Ecore_Con_Event_Client_Add
- {
- Ecore_Con_Client *client;
- };
-
- struct _Ecore_Con_Event_Client_Del
- {
- Ecore_Con_Client *client;
- };
-
- struct _Ecore_Con_Event_Server_Add
- {
- Ecore_Con_Server *server;
- };
-
- struct _Ecore_Con_Event_Server_Del
- {
- Ecore_Con_Server *server;
- };
-
- struct _Ecore_Con_Event_Client_Data
- {
- Ecore_Con_Client *client;
- void *data;
- int size;
- };
-
- struct _Ecore_Con_Event_Server_Data
- {
- Ecore_Con_Server *server;
- void *data;
- int size;
- };
-
- struct _Ecore_Con_Event_Url_Data
- {
- Ecore_Con_Url *url_con;
- int size;
- unsigned char data[1];
- };
-
- struct _Ecore_Con_Event_Url_Complete
- {
- Ecore_Con_Url *url_con;
- int status;
- };
-
- struct _Ecore_Con_Event_Url_Progress
- {
- Ecore_Con_Url *url_con;
- struct {
- double total;
- double now;
- } down;
- struct {
- double total;
- double now;
- } up;
- };
-
- EAPI extern int ECORE_CON_EVENT_CLIENT_ADD;
- EAPI extern int ECORE_CON_EVENT_CLIENT_DEL;
- EAPI extern int ECORE_CON_EVENT_SERVER_ADD;
- EAPI extern int ECORE_CON_EVENT_SERVER_DEL;
- EAPI extern int ECORE_CON_EVENT_CLIENT_DATA;
- EAPI extern int ECORE_CON_EVENT_SERVER_DATA;
- EAPI extern int ECORE_CON_EVENT_URL_DATA;
- EAPI extern int ECORE_CON_EVENT_URL_COMPLETE;
- EAPI extern int ECORE_CON_EVENT_URL_PROGRESS;
-
- EAPI int ecore_con_init(void);
- EAPI int ecore_con_shutdown(void);
-
- EAPI Ecore_Con_Server *ecore_con_server_add(Ecore_Con_Type type, const char *name, int port, const void *data);
-
- EAPI Ecore_Con_Server *ecore_con_server_connect(Ecore_Con_Type type, const char *name, int port, const void *data);
- EAPI void *ecore_con_server_del(Ecore_Con_Server *svr);
- EAPI void *ecore_con_server_data_get(Ecore_Con_Server *svr);
- EAPI int ecore_con_server_connected_get(Ecore_Con_Server *svr);
- EAPI Eina_List *ecore_con_server_clients_get(Ecore_Con_Server *svr);
- EAPI int ecore_con_server_send(Ecore_Con_Server *svr, const void *data, int size);
- EAPI void ecore_con_server_client_limit_set(Ecore_Con_Server *svr, int client_limit, char reject_excess_clients);
- EAPI char *ecore_con_server_ip_get(Ecore_Con_Server *svr);
- EAPI void ecore_con_server_flush(Ecore_Con_Server *svr);
-
- EAPI int ecore_con_client_send(Ecore_Con_Client *cl, const void *data, int size);
- EAPI Ecore_Con_Server *ecore_con_client_server_get(Ecore_Con_Client *cl);
- EAPI void *ecore_con_client_del(Ecore_Con_Client *cl);
- EAPI void ecore_con_client_data_set(Ecore_Con_Client *cl, const void *data);
- EAPI void *ecore_con_client_data_get(Ecore_Con_Client *cl);
- EAPI char *ecore_con_client_ip_get(Ecore_Con_Client *cl);
- EAPI void ecore_con_client_flush(Ecore_Con_Client *cl);
-
- EAPI int ecore_con_ssl_available_get(void);
-
- EAPI int ecore_con_url_init(void);
- EAPI int ecore_con_url_shutdown(void);
- EAPI Ecore_Con_Url *ecore_con_url_new(const char *url);
- EAPI Ecore_Con_Url *ecore_con_url_custom_new(const char *url, const char *custom_request);
- EAPI void ecore_con_url_destroy(Ecore_Con_Url *url_con);
- EAPI void ecore_con_url_data_set(Ecore_Con_Url *url_con, void *data);
- EAPI void *ecore_con_url_data_get(Ecore_Con_Url *url_con);
- EAPI void ecore_con_url_additional_header_add(Ecore_Con_Url *url_con, const char *key, const char *value);
- EAPI void ecore_con_url_additional_headers_clear(Ecore_Con_Url *url_con);
- EAPI const Eina_List *ecore_con_url_response_headers_get(Ecore_Con_Url *url_con);
- EAPI int ecore_con_url_url_set(Ecore_Con_Url *url_con, const char *url);
- EAPI void ecore_con_url_fd_set(Ecore_Con_Url *url_con, int fd);
- EAPI int ecore_con_url_received_bytes_get(Ecore_Con_Url *url_con);
- EAPI int ecore_con_url_httpauth_set(Ecore_Con_Url *url_con, const char *username, const char *password, Eina_Bool safe);
- EAPI int ecore_con_url_send(Ecore_Con_Url *url_con, const void *data, size_t length, const char *content_type);
- EAPI void ecore_con_url_time(Ecore_Con_Url *url_con, Ecore_Con_Url_Time condition, time_t tm);
-
- EAPI int ecore_con_info_get(Ecore_Con_Server *svr, Ecore_Con_Info_Cb done_cb, void *data, struct addrinfo *hints);
-
- EAPI int ecore_con_url_ftp_upload(Ecore_Con_Url *url_con, const char *filename, const char *user, const char *pass, const char *upload_dir);
- EAPI void ecore_con_url_verbose_set(Ecore_Con_Url *url_con, int verbose);
- EAPI void ecore_con_url_ftp_use_epsv_set(Ecore_Con_Url *url_con, int use_epsv);
- EAPI int ecore_con_url_http_post_send(Ecore_Con_Url *url_con, void *curl_httppost);
+/**
+ * @typedef Ecore_Con_Url_Time
+ * @enum _Ecore_Con_Url_Time
+ * The type of time in the object
+ */
+typedef enum _Ecore_Con_Url_Time
+{
+ ECORE_CON_URL_TIME_NONE = 0,
+ ECORE_CON_URL_TIME_IFMODSINCE,
+ ECORE_CON_URL_TIME_IFUNMODSINCE,
+ ECORE_CON_URL_TIME_LASTMOD
+} Ecore_Con_Url_Time;
+
+/**
+ * @addtogroup Ecore_Con_Events_Group Events
+ * @{
+ */
+
+/** @typedef Ecore_Con_Event_Client_Add
+ * Used as the @p data param for the corresponding event
+ */
+typedef struct _Ecore_Con_Event_Client_Add Ecore_Con_Event_Client_Add;
+/** @typedef Ecore_Con_Event_Client_Del
+ * Used as the @p data param for the corresponding event
+ */
+typedef struct _Ecore_Con_Event_Client_Del Ecore_Con_Event_Client_Del;
+/** @typedef Ecore_Con_Event_Server_Add
+ * Used as the @p data param for the corresponding event
+ */
+typedef struct _Ecore_Con_Event_Server_Add Ecore_Con_Event_Server_Add;
+/** @typedef Ecore_Con_Event_Server_Del
+ * Used as the @p data param for the corresponding event
+ */
+typedef struct _Ecore_Con_Event_Server_Del Ecore_Con_Event_Server_Del;
+/** @typedef Ecore_Con_Event_Client_Data
+ * Used as the @p data param for the corresponding event
+ */
+typedef struct _Ecore_Con_Event_Client_Data Ecore_Con_Event_Client_Data;
+/** @typedef Ecore_Con_Event_Server_Data
+ * Used as the @p data param for the corresponding event
+ */
+typedef struct _Ecore_Con_Event_Server_Data Ecore_Con_Event_Server_Data;
+/** @typedef Ecore_Con_Event_Url_Data
+ * Used as the @p data param for the corresponding event
+ */
+typedef struct _Ecore_Con_Event_Url_Data Ecore_Con_Event_Url_Data;
+/** @typedef Ecore_Con_Event_Url_Complete
+ * Used as the @p data param for the corresponding event
+ */
+typedef struct _Ecore_Con_Event_Url_Complete Ecore_Con_Event_Url_Complete;
+/** @typedef Ecore_Con_Event_Url_Progress
+ * Used as the @p data param for the corresponding event
+ */
+typedef struct _Ecore_Con_Event_Url_Progress Ecore_Con_Event_Url_Progress;
+
+/**
+ * @struct _Ecore_Con_Event_Client_Add
+ * Used as the @p data param for the @ref ECORE_CON_EVENT_CLIENT_ADD event
+ */
+struct _Ecore_Con_Event_Client_Add
+{
+ Ecore_Con_Client *client; /** the client that connected */
+};
+
+/**
+ * @struct _Ecore_Con_Event_Client_Del
+ * Used as the @p data param for the @ref ECORE_CON_EVENT_CLIENT_DEL event
+ */
+struct _Ecore_Con_Event_Client_Del
+{
+ Ecore_Con_Client *client; /** the client that was lost */
+};
+
+/**
+ * @struct _Ecore_Con_Event_Server_Add
+ * Used as the @p data param for the @ref ECORE_CON_EVENT_SERVER_ADD event
+ */
+struct _Ecore_Con_Event_Server_Add
+{
+ Ecore_Con_Server *server; /** the server that was connected to */
+};
+
+/**
+ * @struct _Ecore_Con_Event_Server_Del
+ * Used as the @p data param for the @ref ECORE_CON_EVENT_SERVER_DEL event
+ */
+struct _Ecore_Con_Event_Server_Del
+{
+ Ecore_Con_Server *server; /** the client that was lost */
+};
+
+/**
+ * @struct _Ecore_Con_Event_Client_Data
+ * Used as the @p data param for the @ref ECORE_CON_EVENT_CLIENT_DATA event
+ */
+struct _Ecore_Con_Event_Client_Data
+{
+ /** the client that connected */
+ Ecore_Con_Client *client;
+ /** the data that the client sent */
+ void *data;
+ /** the length of the data sent */
+ int size;
+};
+
+/**
+ * @struct _Ecore_Con_Event_Server_Data
+ * Used as the @p data param for the @ref ECORE_CON_EVENT_SERVER_DATA event
+ */
+struct _Ecore_Con_Event_Server_Data
+{
+ /** the server that was connected to */
+ Ecore_Con_Server *server;
+ /** the data that the server sent */
+ void *data;
+ /** the length of the data sent */
+ int size;
+};
+
+/**
+ * @struct _Ecore_Con_Event_Url_Data
+ * Used as the @p data param for the @ref ECORE_CON_EVENT_URL_DATA event
+ */
+struct _Ecore_Con_Event_Url_Data
+{
+ Ecore_Con_Url *url_con;
+ int size;
+ unsigned char data[1];
+};
+
+/**
+ * @struct _Ecore_Con_Event_Url_Complete
+ * Used as the @p data param for the @ref ECORE_CON_EVENT_URL_COMPLETE event
+ */
+struct _Ecore_Con_Event_Url_Complete
+{
+ Ecore_Con_Url *url_con;
+ int status;
+};
+
+/**
+ * @struct _Ecore_Con_Event_Url_Progress
+ * Used as the @p data param for the @ref ECORE_CON_EVENT_URL_PROGRESS event
+ */
+struct _Ecore_Con_Event_Url_Progress
+{
+ Ecore_Con_Url *url_con;
+ struct
+ {
+ double total;
+ double now;
+ } down;
+ struct
+ {
+ double total;
+ double now;
+ } up;
+};
+
+/** A client has connected to the server */
+EAPI extern int ECORE_CON_EVENT_CLIENT_ADD;
+/** A client has disconnected from the server */
+EAPI extern int ECORE_CON_EVENT_CLIENT_DEL;
+/** A server was created */
+EAPI extern int ECORE_CON_EVENT_SERVER_ADD;
+/** A server connection was lost */
+EAPI extern int ECORE_CON_EVENT_SERVER_DEL;
+/** A client connected to the server has sent data */
+EAPI extern int ECORE_CON_EVENT_CLIENT_DATA;
+/** A server connection object has data */
+EAPI extern int ECORE_CON_EVENT_SERVER_DATA;
+/** A URL object has data */
+EAPI extern int ECORE_CON_EVENT_URL_DATA;
+/** A URL object has completed its transfer to and from the server and can be reused */
+EAPI extern int ECORE_CON_EVENT_URL_COMPLETE;
+/** A URL object has made progress in its transfer */
+EAPI extern int ECORE_CON_EVENT_URL_PROGRESS;
+/**
+ * @}
+ */
+EAPI int ecore_con_init(void);
+EAPI int ecore_con_shutdown(void);
+EAPI Eina_Bool ecore_con_server_ssl_cert_add(const char *cert);
+EAPI Eina_Bool ecore_con_client_ssl_cert_add(const char *cert_file,
+ const char *crl_file,
+ const char *key_file);
+
+EAPI Ecore_Con_Server *ecore_con_server_add(Ecore_Con_Type type,
+ const char *name, int port,
+ const void *data);
+
+EAPI Ecore_Con_Server *ecore_con_server_connect(Ecore_Con_Type type,
+ const char *name, int port,
+ const void *data);
+EAPI void * ecore_con_server_del(Ecore_Con_Server *svr);
+EAPI void * ecore_con_server_data_get(Ecore_Con_Server *svr);
+EAPI void * ecore_con_server_data_set(Ecore_Con_Server *svr,
+ void *data);
+EAPI int ecore_con_server_connected_get(Ecore_Con_Server *svr);
+EAPI Eina_List * ecore_con_server_clients_get(Ecore_Con_Server *svr);
+EAPI int ecore_con_server_send(Ecore_Con_Server *svr,
+ const void *data,
+ int size);
+EAPI void ecore_con_server_client_limit_set(
+ Ecore_Con_Server *svr,
+ int client_limit,
+ char
+ reject_excess_clients);
+EAPI const char * ecore_con_server_ip_get(Ecore_Con_Server *svr);
+EAPI void ecore_con_server_flush(Ecore_Con_Server *svr);
+
+EAPI int ecore_con_client_send(Ecore_Con_Client *cl,
+ const void *data,
+ int size);
+EAPI Ecore_Con_Server *ecore_con_client_server_get(Ecore_Con_Client *cl);
+EAPI void * ecore_con_client_del(Ecore_Con_Client *cl);
+EAPI void ecore_con_client_data_set(Ecore_Con_Client *cl,
+ const void *data);
+EAPI void * ecore_con_client_data_get(Ecore_Con_Client *cl);
+EAPI const char * ecore_con_client_ip_get(Ecore_Con_Client *cl);
+EAPI void ecore_con_client_flush(Ecore_Con_Client *cl);
+
+EAPI int ecore_con_ssl_available_get(void);
+
+EAPI int ecore_con_url_init(void);
+EAPI int ecore_con_url_shutdown(void);
+EAPI Ecore_Con_Url * ecore_con_url_new(const char *url);
+EAPI Ecore_Con_Url * ecore_con_url_custom_new(const char *url,
+ const char *custom_request);
+EAPI void ecore_con_url_destroy(Ecore_Con_Url *url_con);
+EAPI void ecore_con_url_data_set(Ecore_Con_Url *url_con,
+ void *data);
+EAPI void * ecore_con_url_data_get(Ecore_Con_Url *url_con);
+EAPI void ecore_con_url_additional_header_add(
+ Ecore_Con_Url *url_con,
+ const char *key,
+ const char *value);
+EAPI void ecore_con_url_additional_headers_clear(
+ Ecore_Con_Url *url_con);
+EAPI const Eina_List * ecore_con_url_response_headers_get(
+ Ecore_Con_Url *url_con);
+EAPI int ecore_con_url_url_set(Ecore_Con_Url *url_con,
+ const char *url);
+EAPI void ecore_con_url_fd_set(Ecore_Con_Url *url_con, int fd);
+EAPI int ecore_con_url_received_bytes_get(Ecore_Con_Url *url_con);
+EAPI int ecore_con_url_httpauth_set(Ecore_Con_Url *url_con,
+ const char *username,
+ const char *password,
+ Eina_Bool safe);
+EAPI int ecore_con_url_send(Ecore_Con_Url *url_con,
+ const void *data, size_t length,
+ const char *content_type);
+EAPI void ecore_con_url_time(Ecore_Con_Url *url_con,
+ Ecore_Con_Url_Time condition,
+ time_t tm);
+
+EAPI Eina_Bool ecore_con_lookup(const char *name,
+ Ecore_Con_Dns_Cb done_cb,
+ const void *data);
+
+EAPI int ecore_con_url_ftp_upload(Ecore_Con_Url *url_con,
+ const char *filename,
+ const char *user,
+ const char *pass,
+ const char *upload_dir);
+EAPI void ecore_con_url_verbose_set(Ecore_Con_Url *url_con,
+ int verbose);
+EAPI void ecore_con_url_ftp_use_epsv_set(Ecore_Con_Url *url_con,
+ int use_epsv);
+EAPI int ecore_con_url_http_post_send(Ecore_Con_Url *url_con,
+ void *curl_httppost);
#ifdef __cplusplus
}
if BUILD_ECORE_CON
lib_LTLIBRARIES = libecore_con.la
-include_HEADERS = \
-Ecore_Con.h
+includes_HEADERS = Ecore_Con.h
+includesdir = $(includedir)/ecore-@VMAJ@
libecore_con_la_SOURCES = \
ecore_con.c \
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "Ecore_Con.h"
#include "ecore_con_private.h"
-static void _ecore_con_cb_tcp_connect(void *data, Ecore_Con_Info *info);
-static void _ecore_con_cb_udp_connect(void *data, Ecore_Con_Info *info);
-static void _ecore_con_cb_tcp_listen(void *data, Ecore_Con_Info *info);
-static void _ecore_con_cb_udp_listen(void *data, Ecore_Con_Info *info);
+static void _ecore_con_cb_tcp_connect(void *data, Ecore_Con_Info *info);
+static void _ecore_con_cb_udp_connect(void *data, Ecore_Con_Info *info);
+static void _ecore_con_cb_tcp_listen(void *data, Ecore_Con_Info *info);
+static void _ecore_con_cb_udp_listen(void *data, Ecore_Con_Info *info);
-static void _ecore_con_server_free(Ecore_Con_Server *svr);
-static void _ecore_con_client_free(Ecore_Con_Client *cl);
+static void _ecore_con_server_free(Ecore_Con_Server *svr);
+static void _ecore_con_client_free(Ecore_Con_Client *cl);
-static int _ecore_con_svr_handler(void *data, Ecore_Fd_Handler *fd_handler);
-static int _ecore_con_cl_handler(void *data, Ecore_Fd_Handler *fd_handler);
-static int _ecore_con_cl_udp_handler(void *data, Ecore_Fd_Handler *fd_handler);
-static int _ecore_con_svr_udp_handler(void *data, Ecore_Fd_Handler *fd_handler);
-static int _ecore_con_svr_cl_handler(void *data, Ecore_Fd_Handler *fd_handler);
+static Eina_Bool _ecore_con_svr_handler(void *data,
+ Ecore_Fd_Handler *fd_handler);
+static Eina_Bool _ecore_con_cl_handler(void *data, Ecore_Fd_Handler *fd_handler);
+static Eina_Bool _ecore_con_cl_udp_handler(void *data,
+ Ecore_Fd_Handler *fd_handler);
+static Eina_Bool _ecore_con_svr_udp_handler(void *data,
+ Ecore_Fd_Handler *fd_handler);
+static Eina_Bool _ecore_con_svr_cl_handler(void *data,
+ Ecore_Fd_Handler *fd_handler);
-static void _ecore_con_server_flush(Ecore_Con_Server *svr);
-static void _ecore_con_client_flush(Ecore_Con_Client *cl);
+static void _ecore_con_server_flush(Ecore_Con_Server *svr);
+static void _ecore_con_client_flush(Ecore_Con_Client *cl);
-static void _ecore_con_event_client_add_free(void *data, void *ev);
-static void _ecore_con_event_client_del_free(void *data, void *ev);
-static void _ecore_con_event_client_data_free(void *data, void *ev);
-static void _ecore_con_event_server_add_free(void *data, void *ev);
-static void _ecore_con_event_server_del_free(void *data, void *ev);
-static void _ecore_con_event_server_data_free(void *data, void *ev);
+static void _ecore_con_event_client_add_free(void *data, void *ev);
+static void _ecore_con_event_client_del_free(void *data, void *ev);
+static void _ecore_con_event_client_data_free(void *data, void *ev);
+static void _ecore_con_event_server_add_free(void *data, void *ev);
+static void _ecore_con_event_server_del_free(void *data, void *ev);
+static void _ecore_con_event_server_data_free(void *data, void *ev);
+
+static void _ecore_con_lookup_done(void *data, Ecore_Con_Info *infos);
EAPI int ECORE_CON_EVENT_CLIENT_ADD = 0;
EAPI int ECORE_CON_EVENT_CLIENT_DEL = 0;
int _ecore_con_log_dom = -1;
/**
- * @defgroup Ecore_Con_Lib_Group Ecore Connection Library Functions
+ * @addtogroup Ecore_Con_Lib_Group Ecore Connection Library Functions
*
* Utility functions that set up and shut down the Ecore Connection
* library.
+ * @{
*/
/**
* Initialises the Ecore_Con library.
* @return Number of times the library has been initialised without being
* shut down.
- * @ingroup Ecore_Con_Lib_Group
*/
EAPI int
ecore_con_init(void)
{
if (++_ecore_con_init_count != 1)
- return _ecore_con_init_count;
+ return _ecore_con_init_count;
#ifdef HAVE_EVIL
if (!evil_init())
- return --_ecore_con_init_count;
+ return --_ecore_con_init_count;
+
#endif
if (!ecore_init())
- return --_ecore_con_init_count;
+ return --_ecore_con_init_count;
- _ecore_con_log_dom = eina_log_domain_register("EcoreCon", ECORE_CON_DEFAULT_LOG_COLOR);
+ _ecore_con_log_dom = eina_log_domain_register("EcoreCon",
+ ECORE_CON_DEFAULT_LOG_COLOR);
if(_ecore_con_log_dom < 0)
{
- EINA_LOG_ERR("Impossible to create a log domain for Ecore Con.");
- ecore_shutdown();
- return --_ecore_con_init_count;
+ EINA_LOG_ERR("Impossible to create a log domain for Ecore Con.");
+ ecore_shutdown();
+ return --_ecore_con_init_count;
}
+
ECORE_CON_EVENT_CLIENT_ADD = ecore_event_type_new();
ECORE_CON_EVENT_CLIENT_DEL = ecore_event_type_new();
ECORE_CON_EVENT_SERVER_ADD = ecore_event_type_new();
* Shuts down the Ecore_Con library.
* @return Number of times the library has been initialised without being
* shut down.
- * @ingroup Ecore_Con_Lib_Group
*/
EAPI int
ecore_con_shutdown(void)
{
if (--_ecore_con_init_count != 0)
- return _ecore_con_init_count;
+ return _ecore_con_init_count;
while (servers)
- _ecore_con_server_free(eina_list_data_get(servers));
+ _ecore_con_server_free(eina_list_data_get(servers));
ecore_con_info_shutdown();
ecore_con_ssl_shutdown();
return _ecore_con_init_count;
}
+/** @} */
+
/**
- * @defgroup Ecore_Con_Server_Group Ecore Connection Server Functions
+ * @addtogroup Ecore_Con_Server_Group Ecore Connection Server Functions
*
* Functions that operate on Ecore server objects.
+ * @{
*/
/**
* @param data Data to associate with the created Ecore_Con_Server
* object.
* @return A new Ecore_Con_Server.
- * @ingroup Ecore_Con_Server_Group
*/
EAPI Ecore_Con_Server *
ecore_con_server_add(Ecore_Con_Type compl_type, const char *name, int port,
- const void *data)
+ const void *data)
{
- Ecore_Con_Server *svr;
- Ecore_Con_Type type;
+ Ecore_Con_Server *svr;
+ Ecore_Con_Type type;
+
+ if (port < 0 || !name)
+ return NULL; /* local user socket: FILE: ~/.ecore/[name]/[port] */
- if (port < 0 || !name) return NULL;
- /* local user socket: FILE: ~/.ecore/[name]/[port] */
/* local system socket: FILE: /tmp/.ecore_service|[name]|[port] */
/* remote system socket: TCP/IP: [name]:[port] */
svr = calloc(1, sizeof(Ecore_Con_Server));
- if (!svr) return NULL;
+ if (!svr)
+ return NULL;
svr->name = strdup(name);
- if (!svr->name) goto error;
+ if (!svr->name)
+ goto error;
+
svr->type = compl_type;
svr->port = port;
svr->data = (void *)data;
type = compl_type & ECORE_CON_TYPE;
- if ((type == ECORE_CON_LOCAL_USER) ||
+ if ((type == ECORE_CON_LOCAL_USER) ||
(type == ECORE_CON_LOCAL_SYSTEM) ||
(type == ECORE_CON_LOCAL_ABSTRACT))
- {
- /* Local */
- if (!ecore_con_local_listen(svr, _ecore_con_svr_handler, svr)) goto error;
- }
-
- if ((type == ECORE_CON_REMOTE_TCP) ||
+ /* Local */
+ if (!ecore_con_local_listen(svr, _ecore_con_svr_handler, svr))
+ goto error;
+
+ if ((type == ECORE_CON_REMOTE_TCP) ||
(type == ECORE_CON_REMOTE_NODELAY))
{
/* TCP */
- if (!ecore_con_info_tcp_listen(svr, _ecore_con_cb_tcp_listen, svr)) goto error;
+ if (!ecore_con_info_tcp_listen(svr, _ecore_con_cb_tcp_listen,
+ svr))
+ goto error;
}
else if ((type == ECORE_CON_REMOTE_MCAST) ||
(type == ECORE_CON_REMOTE_UDP))
- {
- /* UDP and MCAST */
- if (!ecore_con_info_udp_listen(svr, _ecore_con_cb_udp_listen, svr)) goto error;
- }
-
+ /* UDP and MCAST */
+ if (!ecore_con_info_udp_listen(svr, _ecore_con_cb_udp_listen,
+ svr))
+ goto error;
+
servers = eina_list_append(servers, svr);
ECORE_MAGIC_SET(svr, ECORE_MAGIC_CON_SERVER);
return svr;
- error:
- if (svr->name) free(svr->name);
- if (svr->path) free(svr->path);
+error:
+ if (svr->name)
+ free(svr->name);
+
+ if (svr->path)
+ free(svr->path);
+
#ifndef _WIN32
- if (svr->fd >= 0) close(svr->fd);
- if (svr->fd_handler) ecore_main_fd_handler_del(svr->fd_handler);
- if (svr->write_buf) free(svr->write_buf);
- if (svr->ip) free(svr->ip);
+ if (svr->fd >= 0)
+ close(svr->fd);
+
+ if (svr->fd_handler)
+ ecore_main_fd_handler_del(svr->fd_handler);
+
+ if (svr->write_buf)
+ free(svr->write_buf);
+
+ if (svr->ip)
+ free(svr->ip);
+
#endif
- ecore_con_ssl_server_shutdown(svr);
+ ecore_con_ssl_server_shutdown(svr);
free(svr);
return NULL;
}
/**
- * Creates a server object to represent the server listening at the
- * given port.
+ * Creates a connection to the specified server and returns an associated object.
*
- * The socket to which the server connects depends on the connection type:
+ * The socket to which the connection is made depends on the connection type:
* @li If @a compl_type is @c ECORE_CON_LOCAL_USER, the function will
- * connect to the server listening on the Unix socket
+ * connect to the server at the Unix socket
* "~/.ecore/[name]/[port]".
* @li If @a compl_type is @c ECORE_CON_LOCAL_SYSTEM, the function will
- * connect to the server listening on the Unix socket
+ * connect to the server at the Unix socket
* "/tmp/.ecore_service|[name]|[port]".
* @li If @a compl_type is @c ECORE_CON_REMOTE_TCP, the function will
- * connect to the server listening on the TCP port "[name]:[port]".
+ * connect to the server at the TCP port "[name]:[port]".
*
* @param compl_type The connection type.
* @param name Name used when determining what socket to connect to.
* @param data Data to associate with the created Ecore_Con_Server
* object.
* @return A new Ecore_Con_Server.
- * @ingroup Ecore_Con_Server_Group
*/
EAPI Ecore_Con_Server *
ecore_con_server_connect(Ecore_Con_Type compl_type, const char *name, int port,
- const void *data)
+ const void *data)
{
- Ecore_Con_Server *svr;
- Ecore_Con_Type type;
+ Ecore_Con_Server *svr;
+ Ecore_Con_Type type;
+
+ if (!name)
+ return NULL; /* local user socket: FILE: ~/.ecore/[name]/[port] */
- if (!name) return NULL;
- /* local user socket: FILE: ~/.ecore/[name]/[port] */
/* local system socket: FILE: /tmp/.ecore_service|[name]|[port] */
/* remote system socket: TCP/IP: [name]:[port] */
svr = calloc(1, sizeof(Ecore_Con_Server));
- if (!svr) return NULL;
+ if (!svr)
+ return NULL;
svr->name = strdup(name);
- if (!svr->name) goto error;
+ if (!svr->name)
+ goto error;
+
svr->type = compl_type;
svr->port = port;
svr->data = (void *)data;
type = compl_type & ECORE_CON_TYPE;
- if (((type == ECORE_CON_REMOTE_TCP) ||
+ if (((type == ECORE_CON_REMOTE_TCP) ||
(type == ECORE_CON_REMOTE_NODELAY) ||
- (type == ECORE_CON_REMOTE_UDP) ||
+ (type == ECORE_CON_REMOTE_UDP) ||
(type == ECORE_CON_REMOTE_BROADCAST)) &&
(port < 0))
- goto error;
-
- if ((type == ECORE_CON_LOCAL_USER) ||
+ goto error;
+
+ if ((type == ECORE_CON_LOCAL_USER) ||
(type == ECORE_CON_LOCAL_SYSTEM) ||
(type == ECORE_CON_LOCAL_ABSTRACT))
- {
- /* Local */
- if (!ecore_con_local_connect(svr, _ecore_con_cl_handler, svr, _ecore_con_event_server_add_free)) goto error;
- }
+ /* Local */
+ if (!ecore_con_local_connect(svr, _ecore_con_cl_handler, svr,
+ _ecore_con_event_server_add_free))
+ goto
+ error;
- if ((type == ECORE_CON_REMOTE_TCP) ||
+ if ((type == ECORE_CON_REMOTE_TCP) ||
(type == ECORE_CON_REMOTE_NODELAY))
{
/* TCP */
- if (!ecore_con_info_tcp_connect(svr, _ecore_con_cb_tcp_connect, svr)) goto error;
+ if (!ecore_con_info_tcp_connect(svr, _ecore_con_cb_tcp_connect,
+ svr))
+ goto error;
}
- else if ((type == ECORE_CON_REMOTE_UDP) ||
+ else if ((type == ECORE_CON_REMOTE_UDP) ||
(type == ECORE_CON_REMOTE_BROADCAST))
- {
- /* UDP and MCAST */
- if (!ecore_con_info_udp_connect(svr, _ecore_con_cb_udp_connect, svr)) goto error;
- }
+ /* UDP and MCAST */
+ if (!ecore_con_info_udp_connect(svr, _ecore_con_cb_udp_connect,
+ svr))
+ goto error;
servers = eina_list_append(servers, svr);
ECORE_MAGIC_SET(svr, ECORE_MAGIC_CON_SERVER);
return svr;
- error:
- if (svr->name) free(svr->name);
- if (svr->path) free(svr->path);
- if (svr->fd >= 0) close(svr->fd);
- if (svr->fd_handler) ecore_main_fd_handler_del(svr->fd_handler);
+error:
+ if (svr->name)
+ free(svr->name);
+
+ if (svr->path)
+ free(svr->path);
+
+ if (svr->fd >= 0)
+ close(svr->fd);
+
+ if (svr->fd_handler)
+ ecore_main_fd_handler_del(svr->fd_handler);
+
ecore_con_ssl_server_shutdown(svr);
free(svr);
return NULL;
* Closes the connection and frees the given server.
* @param svr The given server.
* @return Data associated with the server when it was created.
- * @ingroup Ecore_Con_Server_Group
+ * @see ecore_con_server_add, ecore_con_server_connect
*/
EAPI void *
ecore_con_server_del(Ecore_Con_Server *svr)
if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
{
- ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_del");
- return NULL;
+ ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_del");
+ return NULL;
}
- if (svr->delete_me) return NULL;
+
+ if (svr->delete_me)
+ return NULL;
data = svr->data;
svr->data = NULL;
svr->delete_me = 1;
if (svr->event_count > 0)
{
- if (svr->fd_handler)
- {
- ecore_main_fd_handler_del(svr->fd_handler);
- svr->fd_handler = NULL;
- }
+ if (svr->fd_handler)
+ {
+ ecore_main_fd_handler_del(svr->fd_handler);
+ svr->fd_handler = NULL;
+ }
}
else
- {
- _ecore_con_server_free(svr);
- }
+ _ecore_con_server_free(svr);
+
return data;
}
* Retrieves the data associated with the given server.
* @param svr The given server.
* @return The associated data.
- * @ingroup Ecore_Con_Server_Group
*/
EAPI void *
ecore_con_server_data_get(Ecore_Con_Server *svr)
{
if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
{
- ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_data_get");
- return NULL;
+ ECORE_MAGIC_FAIL(svr,
+ ECORE_MAGIC_CON_SERVER,
+ "ecore_con_server_data_get");
+ return NULL;
}
+
return svr->data;
}
/**
+ * Sets the data associated with the given server.
+ * @param svr The given server.
+ * @param data The data to associate with @p svr
+ * @return The previously associated data, if any.
+ */
+EAPI void *
+ecore_con_server_data_set(Ecore_Con_Server *svr, void *data)
+{
+ void *ret = NULL;
+
+ if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
+ {
+ ECORE_MAGIC_FAIL(svr,
+ ECORE_MAGIC_CON_SERVER,
+ "ecore_con_server_data_get");
+ return NULL;
+ }
+
+ ret = svr->data;
+ svr->data = data;
+ return ret;
+}
+
+/**
* Retrieves whether the given server is currently connected.
* @todo Check that this function does what the documenter believes it does.
* @param svr The given server.
* @return @c 1 if the server is connected. @c 0 otherwise.
- * @ingroup Ecore_Con_Server_Group
*/
EAPI int
ecore_con_server_connected_get(Ecore_Con_Server *svr)
{
if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
{
- ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_connected_get");
- return 0;
+ ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER,
+ "ecore_con_server_connected_get");
+ return 0;
}
- if (svr->connecting) return 0;
+
+ if (svr->connecting)
+ return 0;
+
return 1;
}
* Retrieves the current list of clients.
* @param svr The given server.
* @return The list of clients on this server.
- * @ingroup Ecore_Con_Server_Group
*/
EAPI Eina_List *
ecore_con_server_clients_get(Ecore_Con_Server *svr)
{
if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
{
- ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_clients_get");
- return NULL;
+ ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER,
+ "ecore_con_server_clients_get");
+ return NULL;
}
+
return svr->clients;
}
* @param size Length of the data, in bytes, to send.
* @return The number of bytes sent. @c 0 will be returned if there is an
* error.
- * @ingroup Ecore_Con_Server_Group
*/
EAPI int
ecore_con_server_send(Ecore_Con_Server *svr, const void *data, int size)
{
if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
{
- ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_send");
- return 0;
+ ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_send");
+ return 0;
}
- if (svr->dead) return 0;
- if (!data) return 0;
- if (size < 1) return 0;
+
+ if (svr->dead)
+ return 0;
+
+ if (!data)
+ return 0;
+
+ if (size < 1)
+ return 0;
+
if (svr->fd_handler)
- ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ | ECORE_FD_WRITE);
+ ecore_main_fd_handler_active_set(
+ svr->fd_handler, ECORE_FD_READ | ECORE_FD_WRITE);
+
if (svr->write_buf)
{
- unsigned char *newbuf;
+ unsigned char *newbuf;
+
+ newbuf = realloc(svr->write_buf, svr->write_buf_size + size);
+ if (newbuf)
+ svr->write_buf = newbuf;
+ else
+ return 0;
- newbuf = realloc(svr->write_buf, svr->write_buf_size + size);
- if (newbuf) svr->write_buf = newbuf;
- else return 0;
- memcpy(svr->write_buf + svr->write_buf_size, data, size);
- svr->write_buf_size += size;
+ memcpy(svr->write_buf + svr->write_buf_size, data, size);
+ svr->write_buf_size += size;
}
else
{
- svr->write_buf = malloc(size);
- if (!svr->write_buf) return 0;
- svr->write_buf_size = size;
- memcpy(svr->write_buf, data, size);
+ svr->write_buf = malloc(size);
+ if (!svr->write_buf)
+ return 0;
+
+ svr->write_buf_size = size;
+ memcpy(svr->write_buf, data, size);
}
+
return size;
}
* drops. This causes the kernel to queue up to 4096
* connections (or your kernel's limit, whichever is
* lower).
- * @ingroup Ecore_Con_Server_Group
*/
EAPI void
-ecore_con_server_client_limit_set(Ecore_Con_Server *svr, int client_limit, char reject_excess_clients)
+ecore_con_server_client_limit_set(Ecore_Con_Server *svr, int client_limit,
+ char reject_excess_clients)
{
if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
{
- ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_client_limit_set");
- return;
+ ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER,
+ "ecore_con_server_client_limit_set");
+ return;
}
+
svr->client_limit = client_limit;
svr->reject_excess_clients = reject_excess_clients;
}
* the connected server in the form "XXX.YYY.ZZZ.AAA" IP notation.
* This string should not be modified or trusted to stay valid after
* deletion for the @p svr object. If no IP is known NULL is returned.
- * @ingroup Ecore_Con_Server_Group
*/
-EAPI char *
+EAPI const char *
ecore_con_server_ip_get(Ecore_Con_Server *svr)
{
if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
{
- ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_ip_get");
- return NULL;
+ ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_ip_get");
+ return NULL;
}
+
return svr->ip;
}
* Flushes all pending data to the given server. Will return when done.
*
* @param svr The given server.
- * @ingroup Ecore_Con_Server_Group
*/
EAPI void
ecore_con_server_flush(Ecore_Con_Server *svr)
{
if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER))
{
- ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_flush");
- return;
+ ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_flush");
+ return;
}
+
_ecore_con_server_flush(svr);
}
/**
- * @defgroup Ecore_Con_Client_Group Ecore Connection Client Functions
+ * Add an ssl certificate for use in ecore_con_server functions.
+ *
+ * Use this function to add a SSL PEM certificate.
+ * Simply specify the cert here to make it available,
+ * then OR the @ref ECORE_CON_LOAD_CERT flag into the @ref ecore_con_server_connect
+ * call to use it. If there is an error loading the certificate upon creating
+ * the connection, an error will be automatically logged.
+ * @param cert The path to the certificate.
+ * @return EINA_FALSE if the file cannot be loaded,
+ * otherwise EINA_TRUE.
+ * @note Currently certificate verification is not implemented.
+ */
+
+EAPI Eina_Bool
+ecore_con_server_ssl_cert_add(const char *cert)
+{
+
+ if (!eina_str_has_extension(cert, "pem"))
+ return EINA_FALSE;
+
+ return ecore_con_ssl_server_cert_add(cert);
+}
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup Ecore_Con_Client_Group Ecore Connection Client Functions
*
* Functions that operate on Ecore connection client objects.
+ * @{
*/
/**
* @param size Length of the data, in bytes, to send.
* @return The number of bytes sent. @c 0 will be returned if there is an
* error.
- * @ingroup Ecore_Con_Client_Group
*/
EAPI int
ecore_con_client_send(Ecore_Con_Client *cl, const void *data, int size)
{
if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT))
{
- ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_send");
- return 0;
+ ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_send");
+ return 0;
}
- if (cl->dead) return 0;
- if (!data) return 0;
- if (size < 1) return 0;
+
+ if (cl->dead)
+ return 0;
+
+ if (!data)
+ return 0;
+
+ if (size < 1)
+ return 0;
+
if (cl->fd_handler)
- ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_READ | ECORE_FD_WRITE);
+ ecore_main_fd_handler_active_set(
+ cl->fd_handler, ECORE_FD_READ | ECORE_FD_WRITE);
- if(cl->server && cl->server->type == ECORE_CON_REMOTE_UDP)
- {
- sendto(cl->server->fd, data, size, 0, (struct sockaddr *) cl->client_addr, cl->client_addr_len);
- }
+ if(cl->server && ((cl->server->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_UDP))
+ sendto(cl->server->fd, data, size, 0, (struct sockaddr *)cl->client_addr,
+ cl->client_addr_len);
else if (cl->buf)
{
- unsigned char *newbuf;
+ unsigned char *newbuf;
- newbuf = realloc(cl->buf, cl->buf_size + size);
- if (newbuf) cl->buf = newbuf;
- else return 0;
- memcpy(cl->buf + cl->buf_size, data, size);
- cl->buf_size += size;
+ newbuf = realloc(cl->buf, cl->buf_size + size);
+ if (newbuf)
+ cl->buf = newbuf;
+ else
+ return 0;
+
+ memcpy(cl->buf + cl->buf_size, data, size);
+ cl->buf_size += size;
}
else
{
- cl->buf = malloc(size);
- if (!cl->buf) return 0;
- cl->buf_size = size;
- memcpy(cl->buf, data, size);
+ cl->buf = malloc(size);
+ if (!cl->buf)
+ return 0;
+
+ cl->buf_size = size;
+ memcpy(cl->buf, data, size);
}
+
return size;
}
* connected to.
* @param cl The given client.
* @return The server that the client connected to.
- * @ingroup Ecore_Con_Client_Group
*/
EAPI Ecore_Con_Server *
ecore_con_client_server_get(Ecore_Con_Client *cl)
{
if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT))
{
- ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_server_get");
- return NULL;
+ ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT,
+ "ecore_con_client_server_get");
+ return NULL;
}
+
return cl->server;
}
* Closes the connection and frees memory allocated to the given client.
* @param cl The given client.
* @return Data associated with the client.
- * @ingroup Ecore_Con_Client_Group
*/
EAPI void *
ecore_con_client_del(Ecore_Con_Client *cl)
if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT))
{
- ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_del");
- return NULL;
+ ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_del");
+ return NULL;
}
- if(cl->client_addr && cl->server && (cl->server->type == ECORE_CON_REMOTE_UDP ||
- cl->server->type == ECORE_CON_REMOTE_MCAST))
- free(cl->client_addr);
+ if (cl->client_addr && cl->server &&
+ (((cl->server->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_UDP) ||
+ ((cl->server->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_MCAST)))
+ free(cl->client_addr);
data = cl->data;
cl->delete_me = 1;
if (cl->event_count > 0)
{
- if (cl->fd_handler)
- {
- ecore_main_fd_handler_del(cl->fd_handler);
- cl->fd_handler = NULL;
- }
+ if (cl->fd_handler)
+ {
+ ecore_main_fd_handler_del(cl->fd_handler);
+ cl->fd_handler = NULL;
+ }
}
else
{
if (cl->server)
- cl->server->clients = eina_list_remove(cl->server->clients, cl);
- _ecore_con_client_free(cl);
+ cl->server->clients = eina_list_remove(
+ cl->server->clients, cl);
+
+ _ecore_con_client_free(cl);
}
+
return data;
}
* Sets the data associated with the given client to @p data.
* @param cl The given client.
* @param data What to set the data to.
- * @ingroup Ecore_Con_Client_Group
*/
EAPI void
ecore_con_client_data_set(Ecore_Con_Client *cl, const void *data)
{
if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT))
{
- ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_data_set");
- return;
+ ECORE_MAGIC_FAIL(cl,
+ ECORE_MAGIC_CON_CLIENT,
+ "ecore_con_client_data_set");
+ return;
}
+
cl->data = (void *)data;
}
* Retrieves the data associated with the given client.
* @param cl The given client.
* @return The data associated with @p cl.
- * @ingroup Ecore_Con_Client_Group
*/
EAPI void *
ecore_con_client_data_get(Ecore_Con_Client *cl)
{
if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT))
{
- ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_data_get");
- return NULL;
+ ECORE_MAGIC_FAIL(cl,
+ ECORE_MAGIC_CON_CLIENT,
+ "ecore_con_client_data_get");
+ return NULL;
}
+
return cl->data;
}
* the connected client in the form "XXX.YYY.ZZZ.AAA" IP notation.
* This string should not be modified or trusted to stay valid after
* deletion for the @p cl object. If no IP is known NULL is returned.
- * @ingroup Ecore_Con_Client_Group
*/
-EAPI char *
+EAPI const char *
ecore_con_client_ip_get(Ecore_Con_Client *cl)
{
if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT))
{
- ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_ip_get");
- return NULL;
+ ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_ip_get");
+ return NULL;
}
+
return cl->ip;
}
* Flushes all pending data to the given client. Will return when done.
*
* @param cl The given client.
- * @ingroup Ecore_Con_Client_Group
*/
EAPI void
ecore_con_client_flush(Ecore_Con_Client *cl)
{
if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT))
{
- ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_flush");
- return;
+ ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_flush");
+ return;
}
+
_ecore_con_client_flush(cl);
}
+/**
+ * @brief Add an ssl certificate for use in ecore_con_client functions.
+ *
+ * Use this function to add a SSL PEM certificate.
+ * Simply specify the cert here to make it available,
+ * then OR the @ref ECORE_CON_LOAD_CERT flag into the @ref ecore_con_server_add
+ * call to use it. If there is an error loading the certificate upon creating
+ * the connection, an error will be automatically logged.
+ * @param cert_file The path to the certificate.
+ * @param crl_file The path to the CRL file
+ * @param key_file The path to the private key file. If not specified, the private key
+ * from the cert will be loaded.
+ * @return EINA_FALSE if the file cannot be loaded,
+ * otherwise EINA_TRUE.
+ * @note Currently CRL file adding and certificate verification is not implemented,
+ * so specifying it here has no effect.
+ */
+
+EAPI Eina_Bool
+ecore_con_client_ssl_cert_add(const char *cert_file,
+ const char *crl_file,
+ const char *key_file)
+{
+
+ if (!eina_str_has_extension(cert_file, "pem"))
+ return EINA_FALSE;
+
+ return ecore_con_ssl_client_cert_add(cert_file, crl_file, key_file);
+}
+
+/**
+ * @}
+ */
+
+/**
+ * Do an asynchronous DNS lookup.
+ *
+ * This function performs a DNS lookup on the hostname specified by @p name, then
+ * calls @p done_cb with
+ *
+ * @params name IP address or server name to translate.
+ * @params done_cb Callback to notify when done.
+ * @params data User data to be given to done_cb.
+ * @return EINA_TRUE if the request did not fail to be set up, EINA_FALSE if it failed.
+ */
+EAPI Eina_Bool
+ecore_con_lookup(const char *name, Ecore_Con_Dns_Cb done_cb, const void *data)
+{
+ Ecore_Con_Server *svr;
+ Ecore_Con_Lookup *lk;
+ struct addrinfo hints;
+
+ if (!name || !done_cb)
+ return EINA_FALSE;
+
+ svr = calloc(1, sizeof(Ecore_Con_Server));
+ if (!svr)
+ return EINA_FALSE;
+
+ lk = malloc(sizeof (Ecore_Con_Lookup));
+ if (!lk)
+ {
+ free(svr);
+ return EINA_FALSE;
+ }
+
+ lk->done_cb = done_cb;
+ lk->data = data;
+
+ svr->name = strdup(name);
+ if (!svr->name)
+ goto on_error;
+
+ svr->type = ECORE_CON_REMOTE_TCP;
+ svr->port = 1025;
+ svr->data = lk;
+ svr->created = 1;
+ svr->reject_excess_clients = 0;
+ svr->client_limit = -1;
+ svr->clients = NULL;
+ svr->ppid = getpid();
+
+ memset(&hints, 0, sizeof(struct addrinfo));
+ hints.ai_family = AF_INET6;
+ hints.ai_socktype = SOCK_STREAM;
+ hints.ai_flags = AI_CANONNAME;
+ hints.ai_protocol = IPPROTO_TCP;
+ hints.ai_canonname = NULL;
+ hints.ai_next = NULL;
+ hints.ai_addr = NULL;
+
+ if (ecore_con_info_get(svr, _ecore_con_lookup_done, svr,
+ &hints))
+ return EINA_TRUE;
+
+ free(svr->name);
+on_error:
+ free(lk);
+ free(svr);
+ return EINA_FALSE;
+}
+
static void
_ecore_con_server_free(Ecore_Con_Server *svr)
{
t_start = ecore_time_get();
while ((svr->write_buf) && (!svr->dead))
{
- _ecore_con_server_flush(svr);
- t = ecore_time_get();
- if ((t - t_start) > 0.5)
- {
- WRN("ECORE_CON: EEK - stuck in _ecore_con_server_free() trying\n"
- " to flush data out from the server, and have been for\n"
- " %1.1f seconds. This is taking too long. Aborting flush.",
- (t - t_start));
- break;
- }
+ _ecore_con_server_flush(svr);
+ t = ecore_time_get();
+ if ((t - t_start) > 0.5)
+ {
+ WRN("ECORE_CON: EEK - stuck in _ecore_con_server_free() trying\n"
+ " to flush data out from the server, and have been for\n"
+ " %1.1f seconds. This is taking too long. Aborting flush.",
+ (t - t_start));
+ break;
+ }
}
- if (svr->write_buf) free(svr->write_buf);
+ if (svr->write_buf)
+ free(svr->write_buf);
+
EINA_LIST_FREE(svr->clients, cl)
- _ecore_con_client_free(cl);
+ _ecore_con_client_free(cl);
if ((svr->created) && (svr->path) && (svr->ppid == getpid()))
- unlink(svr->path);
- if (svr->fd >= 0) close(svr->fd);
+ unlink(
+ svr->path);
+
+ if (svr->fd >= 0)
+ close(svr->fd);
+
ecore_con_ssl_server_shutdown(svr);
- if (svr->name) free(svr->name);
- if (svr->path) free(svr->path);
- if (svr->ip) free(svr->ip);
- if (svr->fd_handler) ecore_main_fd_handler_del(svr->fd_handler);
+ if (svr->name)
+ free(svr->name);
+
+ if (svr->path)
+ free(svr->path);
+
+ if (svr->ip)
+ free(svr->ip);
+
+ if (svr->fd_handler)
+ ecore_main_fd_handler_del(svr->fd_handler);
+
servers = eina_list_remove(servers, svr);
free(svr);
}
t_start = ecore_time_get();
while ((cl->buf) && (!cl->dead))
{
- _ecore_con_client_flush(cl);
- t = ecore_time_get();
- if ((t - t_start) > 0.5)
- {
- WRN("EEK - stuck in _ecore_con_client_free() trying\n"
- " to flush data out from the client, and have been for\n"
- " %1.1f seconds. This is taking too long. Aborting flush.",
- (t - t_start));
- break;
- }
+ _ecore_con_client_flush(cl);
+ t = ecore_time_get();
+ if ((t - t_start) > 0.5)
+ {
+ WRN("EEK - stuck in _ecore_con_client_free() trying\n"
+ " to flush data out from the client, and have been for\n"
+ " %1.1f seconds. This is taking too long. Aborting flush.",
+ (t - t_start));
+ break;
+ }
}
- if (cl->buf) free(cl->buf);
- if (cl->fd >= 0) close(cl->fd);
- if (cl->fd_handler) ecore_main_fd_handler_del(cl->fd_handler);
- if (cl->ip) free(cl->ip);
- free(cl);
+ if (cl->buf)
+ free(cl->buf);
+
+ if (cl->fd >= 0)
+ close(cl->fd);
+
+ if (cl->fd_handler)
+ ecore_main_fd_handler_del(cl->fd_handler);
+
+ if (cl->ip)
+ free(cl->ip);
+
+ free(cl);
}
static void
{
if (!svr->delete_me)
{
- Ecore_Con_Event_Server_Del *e;
-
- e = calloc(1, sizeof(Ecore_Con_Event_Server_Del));
- if (e)
- {
- svr->event_count++;
- e->server = svr;
- ecore_event_add(ECORE_CON_EVENT_SERVER_DEL, e,
- _ecore_con_event_server_del_free, NULL);
- }
+ Ecore_Con_Event_Server_Del *e;
+
+ e = calloc(1, sizeof(Ecore_Con_Event_Server_Del));
+ if (e)
+ {
+ svr->event_count++;
+ e->server = svr;
+ ecore_event_add(ECORE_CON_EVENT_SERVER_DEL, e,
+ _ecore_con_event_server_del_free, NULL);
+ }
}
svr->dead = 1;
- if (svr->fd_handler) ecore_main_fd_handler_del(svr->fd_handler);
+ if (svr->fd_handler)
+ ecore_main_fd_handler_del(svr->fd_handler);
+
svr->fd_handler = NULL;
}
svr = data;
- if(!net_info) goto error;
+ if(!net_info)
+ goto error;
+
+ svr->fd = socket(net_info->info.ai_family, net_info->info.ai_socktype,
+ net_info->info.ai_protocol);
+ if (svr->fd < 0)
+ goto error;
+
+ if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0)
+ goto error;
+
+ if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0)
+ goto error;
- svr->fd = socket(net_info->info.ai_family, net_info->info.ai_socktype, net_info->info.ai_protocol);
- if (svr->fd < 0) goto error;
- if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0) goto error;
- if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0) goto error;
lin.l_onoff = 1;
lin.l_linger = 0;
- if (setsockopt(svr->fd, SOL_SOCKET, SO_LINGER, (const void *)&lin, sizeof(struct linger)) < 0) goto error;
- if (svr->type == ECORE_CON_REMOTE_NODELAY)
+ if (setsockopt(svr->fd, SOL_SOCKET, SO_LINGER, (const void *)&lin,
+ sizeof(struct linger)) < 0)
+ goto error;
+
+ if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_NODELAY)
{
- int flag = 1;
+ int flag = 1;
- if (setsockopt(svr->fd, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, sizeof(int)) < 0)
- goto error;
+ if (setsockopt(svr->fd, IPPROTO_TCP, TCP_NODELAY, (char *)&flag,
+ sizeof(int)) < 0)
+ goto error;
}
- if (bind(svr->fd, net_info->info.ai_addr, net_info->info.ai_addrlen) < 0) goto error;
- if (listen(svr->fd, 4096) < 0) goto error;
+
+ if (bind(svr->fd, net_info->info.ai_addr,
+ net_info->info.ai_addrlen) < 0)
+ goto error;
+
+ if (listen(svr->fd, 4096) < 0)
+ goto error;
+
svr->fd_handler =
- ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ,
- _ecore_con_svr_handler, svr, NULL, NULL);
- if (!svr->fd_handler) goto error;
+ ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ,
+ _ecore_con_svr_handler, svr, NULL, NULL);
+ if (!svr->fd_handler)
+ goto error;
return;
- error:
+error:
ecore_con_ssl_server_shutdown(svr);
kill_server(svr);
}
type = svr->type;
type &= ECORE_CON_TYPE;
- if (!net_info) goto error;
+ if (!net_info)
+ goto error;
- svr->fd = socket(net_info->info.ai_family, net_info->info.ai_socktype, net_info->info.ai_protocol);
- if(svr->fd < 0) goto error;
+ svr->fd = socket(net_info->info.ai_family, net_info->info.ai_socktype,
+ net_info->info.ai_protocol);
+ if(svr->fd < 0)
+ goto error;
if (type == ECORE_CON_REMOTE_MCAST)
{
- if (net_info->info.ai_family == AF_INET)
- {
- if (!inet_pton(net_info->info.ai_family, net_info->ip, &mreq.imr_multiaddr)) goto error;
- mreq.imr_interface.s_addr = htonl(INADDR_ANY);
- if (setsockopt(svr->fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (const void *)&mreq,sizeof(mreq)) != 0) goto error;
- }
- else if (net_info->info.ai_family == AF_INET6)
- {
- if (!inet_pton(net_info->info.ai_family, net_info->ip, &mreq6.ipv6mr_multiaddr)) goto error;
- mreq6.ipv6mr_interface = htonl(INADDR_ANY);
- if (setsockopt(svr->fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (const void *)&mreq6,sizeof(mreq6)) != 0) goto error;
- }
- if (setsockopt(svr->fd, SOL_SOCKET, SO_REUSEADDR, (const void *)&on, sizeof(on)) != 0) goto error;
+ if (net_info->info.ai_family == AF_INET)
+ {
+ if (!inet_pton(net_info->info.ai_family, net_info->ip,
+ &mreq.imr_multiaddr))
+ goto error;
+
+ mreq.imr_interface.s_addr = htonl(INADDR_ANY);
+ if (setsockopt(svr->fd, IPPROTO_IP, IP_ADD_MEMBERSHIP,
+ (const void *)&mreq,sizeof(mreq)) != 0)
+ goto error;
+ }
+ else if (net_info->info.ai_family == AF_INET6)
+ {
+ if (!inet_pton(net_info->info.ai_family, net_info->ip,
+ &mreq6.ipv6mr_multiaddr))
+ goto error;
+
+ mreq6.ipv6mr_interface = htonl(INADDR_ANY);
+ if (setsockopt(svr->fd, IPPROTO_IP, IP_ADD_MEMBERSHIP,
+ (const void *)&mreq6,sizeof(mreq6)) != 0)
+ goto error;
+ }
+
+ if (setsockopt(svr->fd, SOL_SOCKET, SO_REUSEADDR, (const void *)&on,
+ sizeof(on)) != 0)
+ goto error;
}
- if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0) goto error;
- if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0) goto error;
- if (bind(svr->fd, net_info->info.ai_addr, net_info->info.ai_addrlen) < 0) goto error;
+ if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0)
+ goto error;
+
+ if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0)
+ goto error;
+
+ if (bind(svr->fd, net_info->info.ai_addr,
+ net_info->info.ai_addrlen) < 0)
+ goto error;
+
svr->fd_handler =
- ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ,
- _ecore_con_svr_udp_handler, svr, NULL, NULL);
- if (!svr->fd_handler) goto error;
+ ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ,
+ _ecore_con_svr_udp_handler, svr, NULL, NULL);
+ if (!svr->fd_handler)
+ goto error;
+
svr->ip = strdup(net_info->ip);
return;
- error:
+error:
ecore_con_ssl_server_shutdown(svr);
kill_server(svr);
}
static void
_ecore_con_cb_tcp_connect(void *data, Ecore_Con_Info *net_info)
{
- Ecore_Con_Server *svr;
- int res;
- int curstate = 0;
+ Ecore_Con_Server *svr;
+ int res;
+ int curstate = 0;
svr = data;
- if (!net_info) goto error;
- svr->fd = socket(net_info->info.ai_family, net_info->info.ai_socktype, net_info->info.ai_protocol);
- if (svr->fd < 0) goto error;
- if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0) goto error;
- if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0) goto error;
- if (setsockopt(svr->fd, SOL_SOCKET, SO_REUSEADDR, (const void *)&curstate, sizeof(curstate)) < 0)
- goto error;
- if (svr->type == ECORE_CON_REMOTE_NODELAY)
+ if (!net_info)
+ goto error;
+
+ svr->fd = socket(net_info->info.ai_family, net_info->info.ai_socktype,
+ net_info->info.ai_protocol);
+ if (svr->fd < 0)
+ goto error;
+
+ if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0)
+ goto error;
+
+ if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0)
+ goto error;
+
+ if (setsockopt(svr->fd, SOL_SOCKET, SO_REUSEADDR, (const void *)&curstate,
+ sizeof(curstate)) < 0)
+ goto error;
+
+ if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_NODELAY)
{
- int flag = 1;
+ int flag = 1;
- if (setsockopt(svr->fd, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, sizeof(int)) < 0)
- goto error;
+ if (setsockopt(svr->fd, IPPROTO_TCP, TCP_NODELAY, (char *)&flag,
+ sizeof(int)) < 0)
+ goto error;
}
+
res = connect(svr->fd, net_info->info.ai_addr, net_info->info.ai_addrlen);
#ifdef _WIN32
if (res == SOCKET_ERROR)
{
- if (WSAGetLastError() != WSAEINPROGRESS)
- goto error;
+ if (WSAGetLastError() != WSAEINPROGRESS)
+ goto error;
+
#else
if (res < 0)
{
- if (errno != EINPROGRESS)
- goto error;
+ if (errno != EINPROGRESS)
+ goto error;
+
#endif
- svr->connecting = 1;
- svr->fd_handler =
- ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ | ECORE_FD_WRITE,
- _ecore_con_cl_handler, svr, NULL, NULL);
+ svr->connecting = 1;
+ svr->fd_handler =
+ ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ | ECORE_FD_WRITE,
+ _ecore_con_cl_handler, svr, NULL, NULL);
}
else
- svr->fd_handler =
- ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ,
- _ecore_con_cl_handler, svr, NULL, NULL);
+ svr->fd_handler =
+ ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ,
+ _ecore_con_cl_handler, svr, NULL, NULL);
if (svr->type & ECORE_CON_SSL)
- if (ecore_con_ssl_server_init(svr))
- goto error;
+ if (ecore_con_ssl_server_init(svr))
+ goto error;
+
+ if (!svr->fd_handler)
+ goto error;
- if (!svr->fd_handler) goto error;
svr->ip = strdup(net_info->ip);
return;
- error:
+error:
ecore_con_ssl_server_shutdown(svr);
kill_server(svr);
}
static void
_ecore_con_cb_udp_connect(void *data, Ecore_Con_Info *net_info)
{
- Ecore_Con_Server *svr;
- int curstate = 0;
- int broadcast = 1;
+ Ecore_Con_Server *svr;
+ int curstate = 0;
+ int broadcast = 1;
svr = data;
- if (!net_info) goto error;
- svr->fd = socket(net_info->info.ai_family, net_info->info.ai_socktype, net_info->info.ai_protocol);
- if (svr->fd < 0) goto error;
- if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0) goto error;
- if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0) goto error;
+ if (!net_info)
+ goto error;
- if(svr->type == ECORE_CON_REMOTE_BROADCAST)
+ svr->fd = socket(net_info->info.ai_family, net_info->info.ai_socktype,
+ net_info->info.ai_protocol);
+ if (svr->fd < 0)
+ goto error;
+
+ if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0)
+ goto error;
+
+ if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0)
+ goto error;
+
+ if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_BROADCAST)
{
- if (setsockopt(svr->fd, SOL_SOCKET, SO_BROADCAST, (const void *)&broadcast, sizeof(broadcast)) < 0) goto error;
+ if (setsockopt(svr->fd, SOL_SOCKET, SO_BROADCAST,
+ (const void *)&broadcast,
+ sizeof(broadcast)) < 0)
+ goto error;
}
+ else if (setsockopt(svr->fd, SOL_SOCKET, SO_REUSEADDR,
+ (const void *)&curstate,
+ sizeof(curstate)) < 0)
+ goto error;
+
+ if (connect(svr->fd, net_info->info.ai_addr,
+ net_info->info.ai_addrlen) < 0)
+ goto error;
else
- {
- if (setsockopt(svr->fd, SOL_SOCKET, SO_REUSEADDR, (const void *)&curstate, sizeof(curstate)) < 0) goto error;
- }
+ svr->fd_handler =
+ ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ | ECORE_FD_WRITE,
+ _ecore_con_cl_udp_handler, svr, NULL, NULL);
+
+ if (!svr->fd_handler)
+ goto error;
- if (connect(svr->fd, net_info->info.ai_addr, net_info->info.ai_addrlen) < 0)
- goto error;
- else
- svr->fd_handler =
- ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ | ECORE_FD_WRITE,
- _ecore_con_cl_udp_handler, svr, NULL, NULL);
- if (!svr->fd_handler) goto error;
svr->ip = strdup(net_info->ip);
return;
- error:
+error:
ecore_con_ssl_server_shutdown(svr);
- kill_server(svr);
+ kill_server(svr);
}
static Ecore_Con_State
svr_try_connect_plain(Ecore_Con_Server *svr)
{
- int res;
- int so_err = 0;
+ int res;
+ int so_err = 0;
unsigned int size = sizeof(int);
res = getsockopt(svr->fd, SOL_SOCKET, SO_ERROR, (void *)&so_err, &size);
#ifdef _WIN32
if (res == SOCKET_ERROR)
- so_err = -1;
+ so_err = -1;
if (so_err == WSAEINPROGRESS && !svr->dead)
- return ECORE_CON_INPROGRESS;
+ return ECORE_CON_INPROGRESS;
+
#else
if (res < 0)
- so_err = -1;
+ so_err = -1;
if (so_err == EINPROGRESS && !svr->dead)
- return ECORE_CON_INPROGRESS;
+ return ECORE_CON_INPROGRESS;
+
#endif
if (so_err != 0)
{
- /* we lost our server! */
- kill_server(svr);
- return ECORE_CON_DISCONNECTED;
+ /* we lost our server! */
+ kill_server(svr);
+ return ECORE_CON_DISCONNECTED;
}
else
{
- if (!svr->delete_me)
- {
- /* we got our server! */
- Ecore_Con_Event_Server_Add *e;
-
- svr->connecting = 0;
- e = calloc(1, sizeof(Ecore_Con_Event_Server_Add));
- if (e)
- {
- svr->event_count++;
- e->server = svr;
- ecore_event_add(ECORE_CON_EVENT_SERVER_ADD, e,
- _ecore_con_event_server_add_free, NULL);
- }
- }
- if (svr->fd_handler)
- {
- if (!svr->write_buf)
- ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ);
- }
+ if (!svr->delete_me)
+ {
+ /* we got our server! */
+ Ecore_Con_Event_Server_Add *e;
+
+ svr->connecting = 0;
+ e = calloc(1, sizeof(Ecore_Con_Event_Server_Add));
+ if (e)
+ {
+ svr->event_count++;
+ e->server = svr;
+ ecore_event_add(ECORE_CON_EVENT_SERVER_ADD, e,
+ _ecore_con_event_server_add_free, NULL);
+ }
+ }
+
+ if (svr->fd_handler)
+ if (!svr->write_buf)
+ ecore_main_fd_handler_active_set(svr->fd_handler,
+ ECORE_FD_READ);
+
}
if (!svr->dead)
- return ECORE_CON_CONNECTED;
+ return ECORE_CON_CONNECTED;
else
- return ECORE_CON_DISCONNECTED;
+ return ECORE_CON_DISCONNECTED;
}
/* returns 1 on success, 0 on failure */
static Ecore_Con_State svr_try_connect(Ecore_Con_Server *svr)
{
- if (!(svr->type & ECORE_CON_SSL))
- return svr_try_connect_plain(svr);
- else
- {
- switch (ecore_con_ssl_server_try(svr)) {
- case ECORE_CON_CONNECTED:
- return svr_try_connect_plain(svr);
- case ECORE_CON_DISCONNECTED:
- kill_server(svr);
- return ECORE_CON_DISCONNECTED;
- default:
- return ECORE_CON_INPROGRESS;
- }
- }
+ if (!(svr->type & ECORE_CON_SSL))
+ return svr_try_connect_plain(svr);
+ else
+ {
+ switch (ecore_con_ssl_server_try(svr)) {
+ case ECORE_CON_CONNECTED:
+ return svr_try_connect_plain(svr);
+
+ case ECORE_CON_DISCONNECTED:
+ kill_server(svr);
+ return ECORE_CON_DISCONNECTED;
+
+ default:
+ return ECORE_CON_INPROGRESS;
+ }
+ }
}
static char *
/* show v4mapped address in pretty form */
if (client_addr->sa_family == AF_INET6)
{
- struct sockaddr_in6 *sa6;
-
- sa6 = (struct sockaddr_in6 *) client_addr;
- if (IN6_IS_ADDR_V4MAPPED(&sa6->sin6_addr))
- {
- snprintf(ipbuf, sizeof (ipbuf), "%u.%u.%u.%u",
- sa6->sin6_addr.s6_addr[12],
- sa6->sin6_addr.s6_addr[13],
- sa6->sin6_addr.s6_addr[14],
- sa6->sin6_addr.s6_addr[15]);
- return strdup(ipbuf);
- }
+ struct sockaddr_in6 *sa6;
+
+ sa6 = (struct sockaddr_in6 *)client_addr;
+ if (IN6_IS_ADDR_V4MAPPED(&sa6->sin6_addr))
+ {
+ snprintf(ipbuf, sizeof (ipbuf), "%u.%u.%u.%u",
+ sa6->sin6_addr.s6_addr[12],
+ sa6->sin6_addr.s6_addr[13],
+ sa6->sin6_addr.s6_addr[14],
+ sa6->sin6_addr.s6_addr[15]);
+ return strdup(ipbuf);
+ }
}
if (getnameinfo(client_addr, size,
- ipbuf, sizeof (ipbuf), NULL, 0, NI_NUMERICHOST))
- return strdup("0.0.0.0");
+ ipbuf, sizeof (ipbuf), NULL, 0,
+ NI_NUMERICHOST))
+ return strdup("0.0.0.0");
ipbuf[sizeof (ipbuf) - 1] = 0;
return strdup(ipbuf);
}
-static int
+static Eina_Bool
_ecore_con_svr_handler(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
{
- Ecore_Con_Server *svr;
- int new_fd;
- unsigned char incoming[256];
- size_t size_in;
+ Ecore_Con_Server *svr;
+ int new_fd;
+ unsigned char incoming[256];
+ size_t size_in;
svr = data;
- if (svr->dead) return 1;
- if (svr->delete_me) return 1;
+ if (svr->dead)
+ return ECORE_CALLBACK_RENEW;
+
+ if (svr->delete_me)
+ return ECORE_CALLBACK_RENEW;
+
if ((svr->client_limit >= 0) && (!svr->reject_excess_clients))
- {
- if (eina_list_count(svr->clients) >= (unsigned int)svr->client_limit)
- return 1;
- }
+ if (eina_list_count(svr->clients) >=
+ (unsigned int)svr->client_limit)
+ return ECORE_CALLBACK_RENEW;
+
/* a new client */
+
size_in = sizeof(incoming);
memset(&incoming, 0, size_in);
new_fd = accept(svr->fd, (struct sockaddr *)&incoming, (socklen_t *)&size_in);
if (new_fd >= 0)
{
- Ecore_Con_Client *cl;
-
- if ((svr->client_limit >= 0) && (svr->reject_excess_clients))
- {
- if (eina_list_count(svr->clients) >= (unsigned int)svr->client_limit)
- {
- close(new_fd);
- return 1;
- }
- }
-
- cl = calloc(1, sizeof(Ecore_Con_Client));
- if (!cl)
- {
- close(new_fd);
- return 1;
- }
-
- fcntl(new_fd, F_SETFL, O_NONBLOCK);
- fcntl(new_fd, F_SETFD, FD_CLOEXEC);
- cl->fd = new_fd;
- cl->server = svr;
-
- if ((svr->type & ECORE_CON_SSL) &&
- (ecore_con_ssl_client_init(cl)))
- {
- close(new_fd);
- ecore_con_ssl_client_shutdown(cl);
- return 1;
- }
-
- cl->fd_handler =
- ecore_main_fd_handler_add(cl->fd, ECORE_FD_READ,
- _ecore_con_svr_cl_handler, cl, NULL, NULL);
- ECORE_MAGIC_SET(cl, ECORE_MAGIC_CON_CLIENT);
- svr->clients = eina_list_append(svr->clients, cl);
- if (!svr->path)
- cl->ip = _ecore_con_pretty_ip((struct sockaddr *) &incoming, size_in);
- if (!cl->delete_me)
- {
- Ecore_Con_Event_Client_Add *e;
-
- e = calloc(1, sizeof(Ecore_Con_Event_Client_Add));
- if (e)
- {
- cl->event_count++;
- e->client = cl;
- ecore_event_add(ECORE_CON_EVENT_CLIENT_ADD, e,
- _ecore_con_event_client_add_free, NULL);
- }
- }
+ Ecore_Con_Client *cl;
+
+ if ((svr->client_limit >= 0) && (svr->reject_excess_clients))
+ if (eina_list_count(svr->clients) >= (unsigned int)svr->client_limit)
+ {
+ close(new_fd);
+ return ECORE_CALLBACK_RENEW;
+ }
+
+ cl = calloc(1, sizeof(Ecore_Con_Client));
+ if (!cl)
+ {
+ close(new_fd);
+ return ECORE_CALLBACK_RENEW;
+ }
+
+ fcntl(new_fd, F_SETFL, O_NONBLOCK);
+ fcntl(new_fd, F_SETFD, FD_CLOEXEC);
+ cl->fd = new_fd;
+ cl->server = svr;
+
+ if ((svr->type & ECORE_CON_SSL) &&
+ (ecore_con_ssl_client_init(cl)))
+ {
+ close(new_fd);
+ ecore_con_ssl_client_shutdown(cl);
+ return ECORE_CALLBACK_RENEW;
+ }
+
+ cl->fd_handler =
+ ecore_main_fd_handler_add(cl->fd, ECORE_FD_READ,
+ _ecore_con_svr_cl_handler, cl, NULL, NULL);
+ ECORE_MAGIC_SET(cl, ECORE_MAGIC_CON_CLIENT);
+ svr->clients = eina_list_append(svr->clients, cl);
+ if (!svr->path)
+ cl->ip = _ecore_con_pretty_ip(
+ (struct sockaddr *)&incoming, size_in);
+
+ if (!cl->delete_me)
+ {
+ Ecore_Con_Event_Client_Add *e;
+
+ e = calloc(1, sizeof(Ecore_Con_Event_Client_Add));
+ if (e)
+ {
+ cl->event_count++;
+ e->client = cl;
+ ecore_event_add(ECORE_CON_EVENT_CLIENT_ADD, e,
+ _ecore_con_event_client_add_free, NULL);
+ }
+ }
}
- return 1;
+
+ return ECORE_CALLBACK_RENEW;
}
-static int
+static Eina_Bool
_ecore_con_cl_handler(void *data, Ecore_Fd_Handler *fd_handler)
{
- Ecore_Con_Server *svr;
+ Ecore_Con_Server *svr;
svr = data;
- if (svr->dead) return 1;
- if (svr->delete_me) return 1;
+ if (svr->dead)
+ return ECORE_CALLBACK_RENEW;
+
+ if (svr->delete_me)
+ return ECORE_CALLBACK_RENEW;
+
if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ))
{
- unsigned char *inbuf = NULL;
- int inbuf_num = 0;
-
- if (svr->connecting && (svr_try_connect(svr) != ECORE_CON_CONNECTED))
- return 1;
-
- for (;;)
- {
- int num;
- int lost_server = 1;
- unsigned char buf[READBUFSIZ];
-
- if (!(svr->type & ECORE_CON_SSL))
- {
- if (((num = read(svr->fd, buf, READBUFSIZ)) < 0) &&
- (errno == EAGAIN))
- lost_server = 0;
- }
- else
- if (!(num = ecore_con_ssl_server_read(svr, buf, READBUFSIZ)))
- lost_server = 0;
-
- if (num < 1)
- {
- if (inbuf && !svr->delete_me)
- {
- Ecore_Con_Event_Server_Data *e;
-
- e = calloc(1, sizeof(Ecore_Con_Event_Server_Data));
- if (e)
- {
- svr->event_count++;
- e->server = svr;
- e->data = inbuf;
- e->size = inbuf_num;
- ecore_event_add(ECORE_CON_EVENT_SERVER_DATA, e,
- _ecore_con_event_server_data_free,
- NULL);
- }
- }
- if (lost_server) kill_server(svr);
- break;
- }
-
- inbuf = realloc(inbuf, inbuf_num + num);
- memcpy(inbuf + inbuf_num, buf, num);
- inbuf_num += num;
- }
+ unsigned char *inbuf = NULL;
+ int inbuf_num = 0;
+ int tries;
+
+ if (svr->connecting &&
+ (svr_try_connect(svr) !=
+ ECORE_CON_CONNECTED))
+ return ECORE_CALLBACK_RENEW;
+
+ for (tries = 0; tries < 16; tries++)
+ {
+ int num;
+ int lost_server = 1;
+ unsigned char buf[READBUFSIZ];
+
+ if (!(svr->type & ECORE_CON_SSL))
+ {
+ if ((num = read(svr->fd, buf, READBUFSIZ)) <= 0)
+ if ((num < 0) && (errno == EAGAIN))
+ lost_server = 0;
+
+ }
+ else if (!(num =
+ ecore_con_ssl_server_read(svr, buf,
+ READBUFSIZ)))
+ lost_server = 0;
+
+ if (num < 1)
+ {
+ if (inbuf && !svr->delete_me)
+ {
+ Ecore_Con_Event_Server_Data *e;
+
+ e = calloc(1, sizeof(Ecore_Con_Event_Server_Data));
+ if (e)
+ {
+ svr->event_count++;
+ e->server = svr;
+ e->data = inbuf;
+ e->size = inbuf_num;
+ ecore_event_add(ECORE_CON_EVENT_SERVER_DATA, e,
+ _ecore_con_event_server_data_free,
+ NULL);
+ }
+ }
+
+ if (lost_server)
+ kill_server(svr);
+
+ break;
+ }
+
+ inbuf = realloc(inbuf, inbuf_num + num);
+ memcpy(inbuf + inbuf_num, buf, num);
+ inbuf_num += num;
+ }
/* #if USE_OPENSSL */
-/* if (svr->fd_handler) */
-/* { */
-/* if (svr->ssl && ssl_err == SSL_ERROR_WANT_READ) */
-/* ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ); */
-/* else if (svr->ssl && ssl_err == SSL_ERROR_WANT_WRITE) */
-/* ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_WRITE); */
-/* } */
+/* if (svr->fd_handler) */
+/* { */
+/* if (svr->ssl && ssl_err == SSL_ERROR_WANT_READ) */
+/* ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ); */
+/* else if (svr->ssl && ssl_err == SSL_ERROR_WANT_WRITE) */
+/* ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_WRITE); */
+/* } */
/* #endif */
}
else if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_WRITE))
{
- if (svr->connecting && !svr_try_connect (svr))
- return 1;
- _ecore_con_server_flush(svr);
+ if (svr->connecting &&
+ !svr_try_connect (svr))
+ return ECORE_CALLBACK_RENEW;
+
+ _ecore_con_server_flush(svr);
}
- return 1;
+ return ECORE_CALLBACK_RENEW;
}
-static int
+static Eina_Bool
_ecore_con_cl_udp_handler(void *data, Ecore_Fd_Handler *fd_handler)
{
- Ecore_Con_Server *svr;
+ Ecore_Con_Server *svr;
svr = data;
- if (svr->dead) return 1;
- if (svr->delete_me) return 1;
+ if (svr->dead)
+ return ECORE_CALLBACK_RENEW;
+
+ if (svr->delete_me)
+ return ECORE_CALLBACK_RENEW;
+
if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ))
{
- unsigned char buf[65536];
- int num = 0;
-
- errno = 0;
- num = read(svr->fd, buf, 65536);
- if (num > 0)
- {
- if (!svr->delete_me)
- {
- Ecore_Con_Event_Server_Data *e;
- unsigned char *inbuf;
-
- inbuf = malloc(num);
- if(inbuf == NULL)
- return 1;
- memcpy(inbuf, buf, num);
-
- e = calloc(1, sizeof(Ecore_Con_Event_Server_Data));
- if (e)
- {
- svr->event_count++;
- e->server = svr;
- e->data = inbuf;
- e->size = num;
- ecore_event_add(ECORE_CON_EVENT_SERVER_DATA, e,
- _ecore_con_event_server_data_free,
- NULL);
- }
- }
- }
+ unsigned char buf[65536];
+ int num = 0;
+
+ errno = 0;
+ num = read(svr->fd, buf, 65536);
+ if (num > 0)
+ {
+ if (!svr->delete_me)
+ {
+ Ecore_Con_Event_Server_Data *e;
+ unsigned char *inbuf;
+
+ inbuf = malloc(num);
+ if(inbuf == NULL)
+ return 1;
+
+ memcpy(inbuf, buf, num);
+
+ e = calloc(1, sizeof(Ecore_Con_Event_Server_Data));
+ if (e)
+ {
+ svr->event_count++;
+ e->server = svr;
+ e->data = inbuf;
+ e->size = num;
+ ecore_event_add(ECORE_CON_EVENT_SERVER_DATA, e,
+ _ecore_con_event_server_data_free,
+ NULL);
+ }
+ }
+ }
+ else if ((errno == EIO) || (errno == EBADF) ||
+ (errno == EPIPE) || (errno == EINVAL) ||
+ (errno == ENOSPC) || (errno == ECONNREFUSED))
+ kill_server(svr);
}
- else if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_WRITE))
- _ecore_con_server_flush(svr);
+ else if (ecore_main_fd_handler_active_get(fd_handler,
+ ECORE_FD_WRITE))
+ _ecore_con_server_flush(svr);
- return 1;
+ return ECORE_CALLBACK_RENEW;
}
-static int
+static Eina_Bool
_ecore_con_svr_udp_handler(void *data, Ecore_Fd_Handler *fd_handler)
{
- Ecore_Con_Server *svr;
+ Ecore_Con_Server *svr;
Ecore_Con_Client *cl = NULL;
svr = data;
- if (svr->dead) return 1;
- if (svr->delete_me) return 1;
+ if (svr->dead)
+ return ECORE_CALLBACK_RENEW;
+
+ if (svr->delete_me)
+ return ECORE_CALLBACK_RENEW;
+
if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ))
{
- unsigned char buf[READBUFSIZ];
- unsigned char client_addr[256];
- unsigned int client_addr_len = sizeof(client_addr);
- int num;
+ unsigned char buf[READBUFSIZ];
+ unsigned char client_addr[256];
+ unsigned int client_addr_len = sizeof(client_addr);
+ int num;
- errno = 0;
+ errno = 0;
#ifdef _WIN32
- num = fcntl(svr->fd, F_SETFL, O_NONBLOCK);
- if (num >= 0)
- num = recvfrom(svr->fd, buf, sizeof(buf), 0, (struct sockaddr*) &client_addr, &client_addr_len);
+ num = fcntl(svr->fd, F_SETFL, O_NONBLOCK);
+ if (num >= 0)
+ num =
+ recvfrom(svr->fd, buf, sizeof(buf), 0,
+ (struct sockaddr *)&client_addr,
+ &client_addr_len);
+
#else
- num = recvfrom(svr->fd, buf, sizeof(buf), MSG_DONTWAIT, (struct sockaddr*) &client_addr, &client_addr_len);
+ num =
+ recvfrom(svr->fd, buf, sizeof(buf), MSG_DONTWAIT,
+ (struct sockaddr *)&client_addr,
+ &client_addr_len);
#endif
- if (num > 0)
- {
- if (!svr->delete_me)
- {
- Ecore_Con_Event_Client_Data *e;
- unsigned char *inbuf;
-
- /* Create a new client for use in the client data event */
- cl = calloc(1, sizeof(Ecore_Con_Client));
- if(cl == NULL)
- return 1;
- cl->buf = NULL;
- cl->fd = 0;
- cl->fd_handler = NULL;
- cl->server = svr;
- cl->client_addr = calloc(1, client_addr_len);
- cl->client_addr_len = client_addr_len;
- if(cl->client_addr == NULL)
- {
- free(cl);
- return 1;
- }
- memcpy(cl->client_addr, &client_addr, client_addr_len);
- ECORE_MAGIC_SET(cl, ECORE_MAGIC_CON_CLIENT);
- svr->clients = eina_list_append(svr->clients, cl);
-
- cl->ip = _ecore_con_pretty_ip(cl->client_addr, cl->client_addr_len);
-
- inbuf = malloc(num);
- if(inbuf == NULL)
- {
- free(cl->client_addr);
- free(cl);
- return 1;
- }
-
- memcpy(inbuf, buf, num);
-
- e = calloc(1, sizeof(Ecore_Con_Event_Client_Data));
- if (e)
- {
- svr->event_count++;
- e->client = cl;
- e->data = inbuf;
- e->size = num;
- ecore_event_add(ECORE_CON_EVENT_CLIENT_DATA, e,
- _ecore_con_event_client_data_free,
- NULL);
- }
-
- if(!cl->delete_me)
- {
- Ecore_Con_Event_Client_Add *add;
-
- add = calloc(1, sizeof(Ecore_Con_Event_Client_Add));
- if(add)
- {
- /*cl->event_count++;*/
- add->client = cl;
- ecore_event_add(ECORE_CON_EVENT_CLIENT_ADD, add,
- _ecore_con_event_client_add_free, NULL);
- }
- }
- }
- if ((errno == EIO) || (errno == EBADF) ||
- (errno == EPIPE) || (errno == EINVAL) ||
- (errno == ENOSPC) || (num == 0)/* is num == 0 right? */)
- {
- if (!svr->delete_me)
- {
- /* we lost our client! */
- Ecore_Con_Event_Client_Del *e;
-
- e = calloc(1, sizeof(Ecore_Con_Event_Client_Del));
- if (e)
- {
- svr->event_count++;
- e->client = cl;
- ecore_event_add(ECORE_CON_EVENT_CLIENT_DEL, e,
- _ecore_con_event_client_del_free,
- NULL);
- }
- }
- svr->dead = 1;
- if (svr->fd_handler)
- ecore_main_fd_handler_del(svr->fd_handler);
- svr->fd_handler = NULL;
- }
- }
+ if (num > 0)
+ {
+ if (!svr->delete_me)
+ {
+ Ecore_Con_Event_Client_Data *e;
+ unsigned char *inbuf;
+
+ /* Create a new client for use in the client data event */
+ cl = calloc(1, sizeof(Ecore_Con_Client));
+ if(cl == NULL)
+ return ECORE_CALLBACK_RENEW;
+
+ cl->buf = NULL;
+ cl->fd = 0;
+ cl->fd_handler = NULL;
+ cl->server = svr;
+ cl->client_addr = calloc(1, client_addr_len);
+ cl->client_addr_len = client_addr_len;
+ if(cl->client_addr == NULL)
+ {
+ free(cl);
+ return ECORE_CALLBACK_RENEW;
+ }
+
+ memcpy(cl->client_addr, &client_addr, client_addr_len);
+ ECORE_MAGIC_SET(cl, ECORE_MAGIC_CON_CLIENT);
+ svr->clients = eina_list_append(svr->clients, cl);
+
+ cl->ip = _ecore_con_pretty_ip(cl->client_addr,
+ cl->client_addr_len);
+
+ inbuf = malloc(num);
+ if(inbuf == NULL)
+ {
+ free(cl->client_addr);
+ free(cl);
+ return ECORE_CALLBACK_RENEW;
+ }
+
+ memcpy(inbuf, buf, num);
+
+ e = calloc(1, sizeof(Ecore_Con_Event_Client_Data));
+ if (e)
+ {
+ svr->event_count++;
+ e->client = cl;
+ e->data = inbuf;
+ e->size = num;
+ ecore_event_add(ECORE_CON_EVENT_CLIENT_DATA, e,
+ _ecore_con_event_client_data_free,
+ NULL);
+ }
+
+ if(!cl->delete_me)
+ {
+ Ecore_Con_Event_Client_Add *add;
+
+ add = calloc(1, sizeof(Ecore_Con_Event_Client_Add));
+ if(add)
+ {
+/*cl->event_count++;*/
+ add->client = cl;
+ ecore_event_add(ECORE_CON_EVENT_CLIENT_ADD,
+ add,
+ _ecore_con_event_client_add_free,
+ NULL);
+ }
+ }
+ }
+ }
+ else if ((errno == EIO) || (errno == EBADF) ||
+ (errno == EPIPE) || (errno == EINVAL) ||
+ (errno == ENOSPC) || (errno == ECONNREFUSED))
+ {
+ if (!svr->delete_me)
+ {
+ /* we lost our client! */
+ Ecore_Con_Event_Client_Del *e;
+
+ e = calloc(1, sizeof(Ecore_Con_Event_Client_Del));
+ if (e)
+ {
+ svr->event_count++;
+ /* be explicit here */
+ e->client = NULL;
+ ecore_event_add(ECORE_CON_EVENT_CLIENT_DEL, e,
+ _ecore_con_event_client_del_free,
+ NULL);
+ }
+ }
+
+ svr->dead = 1;
+ if (svr->fd_handler)
+ ecore_main_fd_handler_del(svr->fd_handler);
+
+ svr->fd_handler = NULL;
+ }
}
- else if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_WRITE))
- _ecore_con_client_flush(cl);
- return 1;
+ else if (ecore_main_fd_handler_active_get(fd_handler,
+ ECORE_FD_WRITE))
+ _ecore_con_client_flush(cl);
+
+ return ECORE_CALLBACK_RENEW;
}
-static int
+static Eina_Bool
_ecore_con_svr_cl_handler(void *data, Ecore_Fd_Handler *fd_handler)
{
- Ecore_Con_Client *cl;
+ Ecore_Con_Client *cl;
cl = data;
- if (cl->dead) return 1;
- if (cl->delete_me) return 1;
+ if (cl->dead)
+ return ECORE_CALLBACK_RENEW;
+
+ if (cl->delete_me)
+ return ECORE_CALLBACK_RENEW;
+
if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ))
{
- unsigned char *inbuf = NULL;
- int inbuf_num = 0;
- int lost_client = 1;
-
- for (;;)
- {
- unsigned char buf[65536];
- int num;
-
- errno = 0;
-
- if (!(cl->server->type & ECORE_CON_SSL))
- {
- if (((num = read(cl->fd, buf, 65536)) < 0) &&
- (errno == EAGAIN))
- lost_client = 0;
- }
- else
- if (!(num = ecore_con_ssl_client_read(cl, buf, 65536)))
- lost_client = 0;
-
- if (num < 1)
- {
- if (inbuf && !cl->delete_me)
- {
- Ecore_Con_Event_Client_Data *e;
-
- e = calloc(1, sizeof(Ecore_Con_Event_Client_Data));
- if (e)
- {
- cl->event_count++;
- e->client = cl;
- e->data = inbuf;
- e->size = inbuf_num;
- ecore_event_add(ECORE_CON_EVENT_CLIENT_DATA, e,
- _ecore_con_event_client_data_free,
- NULL);
- }
- }
-
- if (lost_client)
- {
- if (!cl->delete_me)
- {
- /* we lost our client! */
- Ecore_Con_Event_Client_Del *e;
-
- e = calloc(1, sizeof(Ecore_Con_Event_Client_Del));
- if (e)
- {
- cl->event_count++;
- e->client = cl;
- ecore_event_add(ECORE_CON_EVENT_CLIENT_DEL, e,
- _ecore_con_event_client_del_free,
- NULL);
- }
- }
- cl->dead = 1;
- if (cl->fd_handler)
- ecore_main_fd_handler_del(cl->fd_handler);
- cl->fd_handler = NULL;
- }
- break;
- }
- else
- {
- inbuf = realloc(inbuf, inbuf_num + num);
- memcpy(inbuf + inbuf_num, buf, num);
- inbuf_num += num;
- }
- }
+ unsigned char *inbuf = NULL;
+ int inbuf_num = 0;
+ int tries;
+
+ for (tries = 0; tries < 16; tries++)
+ {
+ int num;
+ int lost_client = 1;
+ unsigned char buf[READBUFSIZ];
+
+ errno = 0;
+
+ if (!(cl->server->type & ECORE_CON_SSL))
+ {
+ if ((num = read(cl->fd, buf, READBUFSIZ)) <= 0)
+ if ((num < 0) && (errno == EAGAIN))
+ lost_client = 0;
+
+ }
+ else if (!(num =
+ ecore_con_ssl_client_read(cl, buf,
+ READBUFSIZ)))
+ lost_client = 0;
+
+ if (num < 1)
+ {
+ if (inbuf && !cl->delete_me)
+ {
+ Ecore_Con_Event_Client_Data *e;
+
+ e = calloc(1, sizeof(Ecore_Con_Event_Client_Data));
+ if (e)
+ {
+ cl->event_count++;
+ e->client = cl;
+ e->data = inbuf;
+ e->size = inbuf_num;
+ ecore_event_add(ECORE_CON_EVENT_CLIENT_DATA, e,
+ _ecore_con_event_client_data_free,
+ NULL);
+ }
+ }
+
+ if (lost_client)
+ {
+ if (!cl->delete_me)
+ {
+ /* we lost our client! */
+ Ecore_Con_Event_Client_Del *e;
+
+ e = calloc(1, sizeof(Ecore_Con_Event_Client_Del));
+ if (e)
+ {
+ cl->event_count++;
+ e->client = cl;
+ ecore_event_add(
+ ECORE_CON_EVENT_CLIENT_DEL,
+ e,
+ _ecore_con_event_client_del_free,
+ NULL);
+ }
+ }
+
+ cl->dead = 1;
+ if (cl->fd_handler)
+ ecore_main_fd_handler_del(cl->fd_handler);
+
+ cl->fd_handler = NULL;
+ }
+
+ break;
+ }
+ else
+ {
+ inbuf = realloc(inbuf, inbuf_num + num);
+ memcpy(inbuf + inbuf_num, buf, num);
+ inbuf_num += num;
+ }
+ }
}
- else if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_WRITE))
- _ecore_con_client_flush(cl);
- return 1;
+ else if (ecore_main_fd_handler_active_get(fd_handler,
+ ECORE_FD_WRITE))
+ _ecore_con_client_flush(cl);
+
+ return ECORE_CALLBACK_RENEW;
}
static void
{
int count, num;
- if (!svr->write_buf) return;
+ if (!svr->write_buf)
+ return;
/* check whether we need to write anything at all.
* we must not write zero bytes with SSL_write() since it
num = svr->write_buf_size - svr->write_buf_offset;
if (!(svr->type & ECORE_CON_SSL))
- count = write(svr->fd, svr->write_buf + svr->write_buf_offset, num);
+ count = write(
+ svr->fd, svr->write_buf + svr->write_buf_offset, num);
else
- count = ecore_con_ssl_server_write(svr, svr->write_buf + svr->write_buf_offset, num);
+ count = ecore_con_ssl_server_write(
+ svr, svr->write_buf + svr->write_buf_offset, num);
- if (count < 0)
+ if (count < 1)
{
- /* we lost our server! */
- kill_server(svr);
- return;
+ /* we lost our server! */
+ kill_server(svr);
+ return;
}
svr->write_buf_offset += count;
if (svr->write_buf_offset >= svr->write_buf_size)
{
- svr->write_buf_size = 0;
- svr->write_buf_offset = 0;
- free(svr->write_buf);
- svr->write_buf = NULL;
- if (svr->fd_handler)
- ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ);
+ svr->write_buf_size = 0;
+ svr->write_buf_offset = 0;
+ free(svr->write_buf);
+ svr->write_buf = NULL;
+ if (svr->fd_handler)
+ ecore_main_fd_handler_active_set(svr->fd_handler,
+ ECORE_FD_READ);
}
}
{
int count, num;
- if (!cl->buf) return;
+ if (!cl->buf)
+ return;
+
num = cl->buf_size - cl->buf_offset;
if (!(cl->server->type & ECORE_CON_SSL))
- count = write(cl->fd, cl->buf + cl->buf_offset, num);
+ count = write(
+ cl->fd, cl->buf + cl->buf_offset, num);
else
- count = ecore_con_ssl_client_write(cl, cl->buf + cl->buf_offset, num);
+ count = ecore_con_ssl_client_write(cl, cl->buf + cl->buf_offset, num);
+
if (count < 1)
{
- if ((errno == EIO) || (errno == EBADF) || (errno == EPIPE) ||
- (errno == EINVAL) || (errno == ENOSPC))
- {
- if (!cl->delete_me)
- {
- /* we lost our client! */
- Ecore_Con_Event_Client_Del *e;
-
- e = calloc(1, sizeof(Ecore_Con_Event_Client_Del));
- if (e)
- {
- cl->event_count++;
- e->client = cl;
- ecore_event_add(ECORE_CON_EVENT_CLIENT_DEL, e,
- _ecore_con_event_client_del_free, NULL);
- }
- cl->dead = 1;
- if (cl->fd_handler)
- ecore_main_fd_handler_del(cl->fd_handler);
- cl->fd_handler = NULL;
- }
- }
- return;
+ if ((errno == EIO) || (errno == EBADF) || (errno == EPIPE) ||
+ (errno == EINVAL) || (errno == ENOSPC) || (errno == ECONNREFUSED))
+ if (!cl->delete_me)
+ {
+ /* we lost our client! */
+ Ecore_Con_Event_Client_Del *e;
+
+ e = calloc(1, sizeof(Ecore_Con_Event_Client_Del));
+ if (e)
+ {
+ cl->event_count++;
+ e->client = cl;
+ ecore_event_add(ECORE_CON_EVENT_CLIENT_DEL, e,
+ _ecore_con_event_client_del_free, NULL);
+ }
+
+ cl->dead = 1;
+ if (cl->fd_handler)
+ ecore_main_fd_handler_del(cl->fd_handler);
+
+ cl->fd_handler = NULL;
+ }
+
+ return;
}
+
cl->buf_offset += count;
if (cl->buf_offset >= cl->buf_size)
{
- cl->buf_size = 0;
- cl->buf_offset = 0;
- free(cl->buf);
- cl->buf = NULL;
- if (cl->fd_handler)
- ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_READ);
+ cl->buf_size = 0;
+ cl->buf_offset = 0;
+ free(cl->buf);
+ cl->buf = NULL;
+ if (cl->fd_handler)
+ ecore_main_fd_handler_active_set(cl->fd_handler,
+ ECORE_FD_READ);
}
}
e = ev;
e->client->event_count--;
- if ((e->client->event_count == 0) && (e->client->delete_me))
- ecore_con_client_del(e->client);
+ if ((e->client->event_count == 0) &&
+ (e->client->delete_me))
+ ecore_con_client_del(e->client);
+
free(e);
}
e = ev;
e->client->event_count--;
- if ((e->client->event_count == 0) && (e->client->delete_me))
- ecore_con_client_del(e->client);
- free(e);
+ if ((e->client->event_count == 0) &&
+ (e->client->delete_me))
+ ecore_con_client_del(e->client);
+
+ free(e);
}
static void
e = ev;
e->client->event_count--;
- if (e->data) free(e->data);
+ if (e->data)
+ free(e->data);
+
if (((e->client->event_count == 0) && (e->client->delete_me)) ||
- ((e->client->server && (e->client->server->type == ECORE_CON_REMOTE_UDP ||
- e->client->server->type == ECORE_CON_REMOTE_MCAST))))
- ecore_con_client_del(e->client);
+ ((e->client->server &&
+ ((e->client->server->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_UDP ||
+ (e->client->server->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_MCAST))))
+ ecore_con_client_del(e->client);
+
free(e);
}
e = ev;
e->server->event_count--;
- if ((e->server->event_count == 0) && (e->server->delete_me))
- _ecore_con_server_free(e->server);
+ if ((e->server->event_count == 0) &&
+ (e->server->delete_me))
+ _ecore_con_server_free(e->server);
+
free(e);
}
e = ev;
e->server->event_count--;
- if ((e->server->event_count == 0) && (e->server->delete_me))
- _ecore_con_server_free(e->server);
- free(e);
+ if ((e->server->event_count == 0) &&
+ (e->server->delete_me))
+ _ecore_con_server_free(e->server);
+
+ free(e);
}
static void
e = ev;
e->server->event_count--;
- if (e->data) free(e->data);
- if ((e->server->event_count == 0) && (e->server->delete_me))
- _ecore_con_server_free(e->server);
+ if (e->data)
+ free(e->data);
+
+ if ((e->server->event_count == 0) &&
+ (e->server->delete_me))
+ _ecore_con_server_free(e->server);
+
free(e);
}
+
+static void
+_ecore_con_lookup_done(void *data, Ecore_Con_Info *infos)
+{
+ Ecore_Con_Server *svr;
+ Ecore_Con_Lookup *lk;
+
+ svr = data;
+ lk = svr->data;
+
+ if (infos)
+ lk->done_cb(infos->info.ai_canonname, infos->ip,
+ infos->info.ai_addr, infos->info.ai_addrlen,
+ (void *)lk->data);
+ else
+ lk->done_cb(NULL, NULL, NULL, 0, (void *)lk->data);
+
+ free(svr->name);
+ free(lk);
+ free(svr);
+}
+
struct in6_addr v6;
} addr;
- Eina_Bool byaddr;
+ Eina_Bool byaddr : 1;
+ Eina_Bool isv6 : 1;
};
static ares_channel info_channel;
static Ecore_Timer *tm = NULL;
static fd_set info_readers, info_writers;
-static void _ecore_con_info_ares_nameinfo(Ecore_Con_CAres *arg, int status, int timeouts, char *node, char *service);
-static void _ecore_con_info_ares_host_cb(Ecore_Con_CAres *arg, int status, int timeouts, struct hostent *hostent);
-static int _ecore_con_info_cares_fd_cb(void *data, Ecore_Fd_Handler *fd_handler);
-static int _ecore_con_info_cares_timeout_cb(void *data);
-static void _ecore_con_info_cares_clean(void);
+static void _ecore_con_info_ares_nameinfo(Ecore_Con_CAres *arg, int status,
+ int timeouts, char *node,
+ char *service);
+static void _ecore_con_info_ares_host_cb(Ecore_Con_CAres *arg, int status,
+ int timeouts,
+ struct hostent *hostent);
+static Eina_Bool _ecore_con_info_cares_fd_cb(void *data,
+ Ecore_Fd_Handler *fd_handler);
+static Eina_Bool _ecore_con_info_cares_timeout_cb(void *data);
+static void _ecore_con_info_cares_clean(void);
int
ecore_con_info_init(void)
{
if (info_init == 0)
{
- if (ares_library_init(ARES_LIB_INIT_ALL) != 0)
- return 0;
- if (ares_init(&info_channel) != ARES_SUCCESS)
- {
- ares_library_cleanup();
- return 0;
- }
+ if (ares_library_init(ARES_LIB_INIT_ALL) != 0)
+ return 0;
+
+ if (ares_init(&info_channel) != ARES_SUCCESS)
+ {
+ ares_library_cleanup();
+ return 0;
+ }
}
info_init++;
info_init--;
if (info_init == 0)
{
- /* Cancel all ongoing request */
- ares_cancel(info_channel);
- ares_destroy(info_channel);
+ /* Cancel all ongoing request */
+ ares_cancel(info_channel);
+ ares_destroy(info_channel);
- /* Destroy FD handler here. */
- /* Shutdown ares */
- ares_library_cleanup();
+ /* Destroy FD handler here. */
+ /* Shutdown ares */
+ ares_library_cleanup();
}
+
return info_init;
}
int
ecore_con_info_tcp_connect(Ecore_Con_Server *svr,
- Ecore_Con_Info_Cb done_cb,
- void *data)
+ Ecore_Con_Info_Cb done_cb,
+ void *data)
{
struct addrinfo hints;
memset(&hints, 0, sizeof(struct addrinfo));
- hints.ai_family = AF_UNSPEC;
+ hints.ai_family = AF_INET6;
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_CANONNAME;
hints.ai_protocol = IPPROTO_TCP;
int
ecore_con_info_tcp_listen(Ecore_Con_Server *svr,
- Ecore_Con_Info_Cb done_cb,
- void *data)
+ Ecore_Con_Info_Cb done_cb,
+ void *data)
{
struct addrinfo hints;
memset(&hints, 0, sizeof(struct addrinfo));
- hints.ai_family = AF_UNSPEC;
+ hints.ai_family = AF_INET6;
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_PASSIVE;
hints.ai_protocol = IPPROTO_TCP;
int
ecore_con_info_udp_connect(Ecore_Con_Server *svr,
- Ecore_Con_Info_Cb done_cb,
- void *data)
+ Ecore_Con_Info_Cb done_cb,
+ void *data)
{
struct addrinfo hints;
memset(&hints, 0, sizeof(struct addrinfo));
- hints.ai_family = AF_UNSPEC;
+ hints.ai_family = AF_INET6;
hints.ai_socktype = SOCK_DGRAM;
hints.ai_flags = AI_CANONNAME;
hints.ai_protocol = IPPROTO_UDP;
int
ecore_con_info_udp_listen(Ecore_Con_Server *svr,
- Ecore_Con_Info_Cb done_cb,
- void *data)
+ Ecore_Con_Info_Cb done_cb,
+ void *data)
{
struct addrinfo hints;
memset(&hints, 0, sizeof(struct addrinfo));
- hints.ai_family = AF_UNSPEC;
+ hints.ai_family = AF_INET6;
hints.ai_socktype = SOCK_DGRAM;
hints.ai_flags = AI_PASSIVE;
hints.ai_protocol = IPPROTO_UDP;
int
ecore_con_info_mcast_listen(Ecore_Con_Server *svr,
- Ecore_Con_Info_Cb done_cb,
- void *data)
+ Ecore_Con_Info_Cb done_cb,
+ void *data)
{
struct addrinfo hints;
memset(&hints, 0, sizeof(struct addrinfo));
- hints.ai_family = AF_UNSPEC;
+ hints.ai_family = AF_INET6;
hints.ai_socktype = SOCK_DGRAM;
hints.ai_flags = 0;
hints.ai_protocol = IPPROTO_UDP;
return ecore_con_info_get(svr, done_cb, data, &hints);
}
+static Eina_Bool
+_ecore_con_info_ares_getnameinfo(Ecore_Con_CAres *arg,
+ int addrtype, const char *name,
+ struct sockaddr *addr, int addrlen)
+{
+ int length = 0;
+
+ if (name)
+ length = strlen(name) + 1;
+ else
+ length = 1;
+
+ arg->result = malloc(sizeof (Ecore_Con_Info) + length);
+ if (!arg->result)
+ return EINA_FALSE;
+
+ /* FIXME: What to do when hint is not set ? */
+ arg->result->info.ai_flags = arg->hints.ai_flags;
+ arg->result->info.ai_socktype = arg->hints.ai_socktype;
+ arg->result->info.ai_protocol = arg->hints.ai_protocol;
+
+ arg->result->info.ai_family = addrtype;
+ arg->result->info.ai_addrlen = addrlen;
+ arg->result->info.ai_addr = addr;
+ arg->result->info.ai_canonname = (char *)(arg->result + 1);
+
+ if (!name)
+ *arg->result->info.ai_canonname = '\0';
+ else
+ strcpy(arg->result->info.ai_canonname, name);
+
+ arg->result->info.ai_next = NULL;
+
+ ares_getnameinfo(
+ info_channel, addr, addrlen,
+ ARES_NI_NUMERICSERV | ARES_NI_NUMERICHOST |
+ ARES_NI_LOOKUPSERVICE | ARES_NI_LOOKUPHOST,
+ (ares_nameinfo_callback)_ecore_con_info_ares_nameinfo, arg);
+
+ return EINA_TRUE;
+}
+
+
EAPI int
ecore_con_info_get(Ecore_Con_Server *svr,
- Ecore_Con_Info_Cb done_cb,
- void *data,
- struct addrinfo *hints)
+ Ecore_Con_Info_Cb done_cb,
+ void *data,
+ struct addrinfo *hints)
{
Ecore_Con_CAres *cares;
- int ai_family = AF_UNSPEC;
+ int ai_family = AF_INET6;
cares = calloc(1, sizeof (Ecore_Con_CAres));
- if (!cares) return 0;
+ if (!cares)
+ return 0;
cares->svr = svr;
cares->done_cb = done_cb;
if (hints)
{
- ai_family = hints->ai_family;
- memcpy(&cares->hints, hints, sizeof (struct addrinfo));
+ ai_family = hints->ai_family;
+ memcpy(&cares->hints, hints, sizeof (struct addrinfo));
}
if (inet_pton(AF_INET, svr->name, &cares->addr.v4) == 1)
{
- cares->byaddr = EINA_TRUE;
- ares_gethostbyaddr(info_channel, &cares->addr.v4, sizeof (cares->addr.v4), AF_INET, (ares_host_callback) _ecore_con_info_ares_host_cb, cares);
+ cares->byaddr = EINA_TRUE;
+ cares->isv6 = EINA_FALSE;
+ ares_gethostbyaddr(info_channel, &cares->addr.v4,
+ sizeof (cares->addr.v4),
+ AF_INET,
+ (ares_host_callback)_ecore_con_info_ares_host_cb,
+ cares);
}
else if (inet_pton(AF_INET6, svr->name, &cares->addr.v6) == 1)
{
- cares->byaddr = EINA_TRUE;
- ares_gethostbyaddr(info_channel, &cares->addr.v6, sizeof (cares->addr.v6), AF_INET6, (ares_host_callback) _ecore_con_info_ares_host_cb, cares);
+ cares->byaddr = EINA_TRUE;
+ cares->isv6 = EINA_TRUE;
+ ares_gethostbyaddr(info_channel, &cares->addr.v6,
+ sizeof (cares->addr.v6),
+ AF_INET6,
+ (ares_host_callback)_ecore_con_info_ares_host_cb,
+ cares);
}
else
{
- cares->byaddr = EINA_FALSE;
- ares_gethostbyname(info_channel, svr->name, ai_family, (ares_host_callback) _ecore_con_info_ares_host_cb, cares);
+ cares->byaddr = EINA_FALSE;
+ ares_gethostbyname(info_channel, svr->name, ai_family,
+ (ares_host_callback)_ecore_con_info_ares_host_cb,
+ cares);
}
_ecore_con_info_cares_clean();
fdl.fd = fd;
- search = eina_list_search_unsorted(info_fds, (Eina_Compare_Cb) _ecore_con_info_fds_search, &fdl);
+ search = eina_list_search_unsorted(
+ info_fds, (Eina_Compare_Cb)_ecore_con_info_fds_search, &fdl);
if (search)
{
- search->active = active;
- return EINA_TRUE;
+ search->active = active;
+ return EINA_TRUE;
}
+
return EINA_FALSE;
}
active++;
for (i = 0; i < nfds; ++i)
{
- int flags = 0;
-
- if (FD_ISSET(i, &readers)) flags |= ECORE_FD_READ;
- if (FD_ISSET(i, &writers)) flags |= ECORE_FD_WRITE;
-
- if (flags)
- {
- if (!_ecore_con_info_fds_lookup(i))
- {
- ecf = malloc(sizeof (Ecore_Con_FD));
- if (ecf)
- {
- ecf->fd = i;
- ecf->active = active;
- ecf->handler = ecore_main_fd_handler_add(i, ECORE_FD_WRITE | ECORE_FD_READ,
- _ecore_con_info_cares_fd_cb,
- NULL, NULL, NULL);
- info_fds = eina_list_append(info_fds, ecf);
- }
- }
- }
+ int flags = 0;
+
+ if (FD_ISSET(i, &readers))
+ flags |= ECORE_FD_READ;
+
+ if (FD_ISSET(i, &writers))
+ flags |= ECORE_FD_WRITE;
+
+ if (flags)
+ if (!_ecore_con_info_fds_lookup(i))
+ {
+ ecf = malloc(sizeof (Ecore_Con_FD));
+ if (ecf)
+ {
+ ecf->fd = i;
+ ecf->active = active;
+ ecf->handler = ecore_main_fd_handler_add(
+ i, ECORE_FD_WRITE | ECORE_FD_READ,
+ _ecore_con_info_cares_fd_cb,
+ NULL, NULL, NULL);
+ info_fds = eina_list_append(info_fds, ecf);
+ }
+ }
+
}
info_readers = readers;
info_writers = writers;
EINA_LIST_FOREACH_SAFE(info_fds, l, l_next, ecf)
- {
- if (ecf->active != active)
- {
- ecore_main_fd_handler_del(ecf->handler);
- free(ecf);
- info_fds = eina_list_remove_list(info_fds, l);
- }
- }
+ {
+ if (ecf->active != active)
+ {
+ ecore_main_fd_handler_del(ecf->handler);
+ free(ecf);
+ info_fds = eina_list_remove_list(info_fds, l);
+ }
+ }
if (!info_fds)
{
- if (tm) ecore_timer_del(tm);
- tm = NULL;
+ if (tm)
+ ecore_timer_del(tm);
+
+ tm = NULL;
}
else
{
- struct timeval tv;
+ struct timeval tv;
- ares_timeout(info_channel, NULL, &tv);
+ ares_timeout(info_channel, NULL, &tv);
- if (tm)
- ecore_timer_delay(tm, tv.tv_sec);
- else
- tm = ecore_timer_add((double) tv.tv_sec, _ecore_con_info_cares_timeout_cb, NULL);
+ if (tm)
+ ecore_timer_delay(tm, tv.tv_sec);
+ else
+ tm =
+ ecore_timer_add((double)tv.tv_sec,
+ _ecore_con_info_cares_timeout_cb,
+ NULL);
}
}
-static int
+static Eina_Bool
_ecore_con_info_cares_timeout_cb(void *data)
{
ares_process(info_channel, &info_readers, &info_writers);
_ecore_con_info_cares_clean();
- return 1;
+ return ECORE_CALLBACK_RENEW;
}
-static int
+static Eina_Bool
_ecore_con_info_cares_fd_cb(void *data, Ecore_Fd_Handler *fd_handler)
{
ares_process(info_channel, &info_readers, &info_writers);
_ecore_con_info_cares_clean();
- return 1;
+ return ECORE_CALLBACK_RENEW;
}
static void
-_ecore_con_info_ares_host_cb(Ecore_Con_CAres *arg, int status, int timeouts, struct hostent *hostent)
+_ecore_con_info_ares_host_cb(Ecore_Con_CAres *arg, int status, int timeouts,
+ struct hostent *hostent)
{
struct sockaddr *addr;
int addrlen;
switch (status)
{
case ARES_SUCCESS:
- if (hostent->h_addr_list[0] == NULL)
- {
- fprintf(stderr, "No IP found\n");
- goto on_error;
- }
-
- switch (hostent->h_addrtype)
- {
- case AF_INET:
- {
- struct sockaddr_in *addri;
-
- addrlen = sizeof (struct sockaddr_in);
- addri = malloc(addrlen);
-
- if (!addri)
- {
- fprintf(stderr, "Not enough memory\n");
- goto on_error;
- }
-
- addri->sin_family = AF_INET;
- addri->sin_port = htons(arg->svr->port);
-
- memcpy(&addri->sin_addr.s_addr, arg->byaddr ? &arg->addr.v4 : (struct in_addr*)hostent->h_addr_list[0], sizeof (struct in_addr));
-
- addr = (struct sockaddr*) addri;
- break;
- }
- case AF_INET6:
- {
- struct sockaddr_in6 *addri6;
-
- addrlen = sizeof (struct sockaddr_in6);
- addri6 = malloc(addrlen);
-
- if (!addri6)
- {
- fprintf(stderr, "Not enough memory\n");
- goto on_error;
- }
-
- addri6->sin6_family = AF_INET6;
- addri6->sin6_port = htons(arg->svr->port);
- addri6->sin6_flowinfo = 0;
- addri6->sin6_scope_id = 0;
-
- memcpy(&addri6->sin6_addr.s6_addr, arg->byaddr ? &arg->addr.v6 : (struct in6_addr*)hostent->h_addr_list[0], sizeof (struct in6_addr));
-
- addr = (struct sockaddr*) addri6;
- break;
- }
- default:
- fprintf(stderr, "Unknown addrtype %i\n", hostent->h_addrtype);
- goto on_error;
- }
-
- if (hostent->h_name)
- length = strlen(hostent->h_name) + 1;
-
- arg->result = malloc(sizeof (Ecore_Con_Info) + length);
- if (!arg->result)
- {
- fprintf(stderr, "Not enough memory\n");
- free(addr);
- goto on_error;
- }
-
- /* FIXME: What to do when hint is not set ? */
- arg->result->info.ai_flags = arg->hints.ai_flags;
- arg->result->info.ai_socktype = arg->hints.ai_socktype;
- arg->result->info.ai_protocol = arg->hints.ai_protocol;
-
- arg->result->info.ai_family = hostent->h_addrtype;
- arg->result->info.ai_addrlen = addrlen;
- arg->result->info.ai_addr = addr;
- arg->result->info.ai_canonname = (char*) (arg->result + 1);
-
- strcpy(arg->result->info.ai_canonname, hostent->h_name);
-
- arg->result->info.ai_next = NULL;
-
- ares_getnameinfo(info_channel, addr, addrlen,
- ARES_NI_NUMERICSERV | ARES_NI_NUMERICHOST | ARES_NI_LOOKUPSERVICE | ARES_NI_LOOKUPHOST,
- (ares_nameinfo_callback) _ecore_con_info_ares_nameinfo, arg);
- break;
+ if (hostent->h_addr_list[0] == NULL)
+ {
+ fprintf(stderr, "No IP found\n");
+ goto on_error;
+ }
+
+ switch (hostent->h_addrtype)
+ {
+ case AF_INET:
+ {
+ struct sockaddr_in *addri;
+
+ addrlen = sizeof (struct sockaddr_in);
+ addri = malloc(addrlen);
+
+ if (!addri)
+ goto on_mem_error;
+
+ addri->sin_family = AF_INET;
+ addri->sin_port = htons(arg->svr->port);
+
+ memcpy(&addri->sin_addr.s_addr,
+ hostent->h_addr_list[0], sizeof (struct in_addr));
+
+ addr = (struct sockaddr *)addri;
+ break;
+ }
+
+ case AF_INET6:
+ {
+ struct sockaddr_in6 *addri6;
+
+ addrlen = sizeof (struct sockaddr_in6);
+ addri6 = malloc(addrlen);
+
+ if (!addri6)
+ goto on_mem_error;
+
+ addri6->sin6_family = AF_INET6;
+ addri6->sin6_port = htons(arg->svr->port);
+ addri6->sin6_flowinfo = 0;
+ addri6->sin6_scope_id = 0;
+
+ memcpy(&addri6->sin6_addr.s6_addr,
+ hostent->h_addr_list[0], sizeof (struct in6_addr));
+
+ addr = (struct sockaddr *)addri6;
+ break;
+ }
+
+ default:
+ fprintf(stderr, "Unknown addrtype %i\n", hostent->h_addrtype);
+ goto on_error;
+ }
+
+ if (!_ecore_con_info_ares_getnameinfo(arg, hostent->h_addrtype,
+ hostent->h_name,
+ addr, addrlen))
+ goto on_error;
+
+ break;
+
+ case ARES_ENOTFOUND: /* address notfound */
+ if (arg->byaddr)
+ {
+ /* This happen when host doesn't have a reverse. */
+ if (arg->isv6)
+ {
+ struct sockaddr_in6 *addri6;
+
+ addrlen = sizeof (struct sockaddr_in6);
+ addri6 = malloc(addrlen);
+
+ if (!addri6)
+ goto on_mem_error;
+
+ addri6->sin6_family = AF_INET6;
+ addri6->sin6_port = htons(arg->svr->port);
+ addri6->sin6_flowinfo = 0;
+ addri6->sin6_scope_id = 0;
+
+ memcpy(&addri6->sin6_addr.s6_addr,
+ &arg->addr.v6, sizeof (struct in6_addr));
+
+ addr = (struct sockaddr *)addri6;
+ }
+ else
+ {
+ struct sockaddr_in *addri;
+
+ addrlen = sizeof (struct sockaddr_in);
+ addri = malloc(addrlen);
+
+ if (!addri)
+ goto on_mem_error;
+
+ addri->sin_family = AF_INET;
+ addri->sin_port = htons(arg->svr->port);
+
+ memcpy(&addri->sin_addr.s_addr,
+ &arg->addr.v4, sizeof (struct in_addr));
+
+ addr = (struct sockaddr *)addri;
+ }
+
+ if (!_ecore_con_info_ares_getnameinfo(arg,
+ arg->isv6 ? AF_INET6 :
+ AF_INET,
+ NULL, addr,
+ addrlen))
+ goto on_error;
+
+ break;
+ }
+
case ARES_ENOTIMP: /* unknown family */
case ARES_EBADNAME: /* not a valid internet address */
- case ARES_ENOTFOUND: /* address notfound */
case ARES_ENOMEM: /* not enough memory */
case ARES_EDESTRUCTION: /* request canceled, shuting down */
- goto on_error;
+ goto on_error;
+
default:
- fprintf(stderr, "Unknown status returned by c-ares: %i assuming error\n", status);
- goto on_error;
+ fprintf(stderr,
+ "Unknown status returned by c-ares: %i assuming error\n",
+ status);
+ goto on_error;
}
- return ;
+ return;
- on_error:
+on_mem_error:
+ fprintf(stderr, "Not enough memory\n");
+
+on_error:
arg->done_cb(arg->data, NULL);
free(arg);
}
static void
-_ecore_con_info_ares_nameinfo(Ecore_Con_CAres *arg, int status, int timeouts, char *node, char *service)
+_ecore_con_info_ares_nameinfo(Ecore_Con_CAres *arg, int status, int timeouts,
+ char *node,
+ char *service)
{
switch (status)
{
case ARES_SUCCESS:
- if (node) strcpy(arg->result->ip, node);
- else *arg->result->ip = '\0';
- if (service) strcpy(arg->result->service, service);
- else *arg->result->service = '\0';
+ if (node)
+ strcpy(arg->result->ip, node);
+ else
+ *arg->result->ip = '\0';
+
+ if (service)
+ strcpy(arg->result->service, service);
+ else
+ *arg->result->service = '\0';
+
+ arg->done_cb(arg->data, arg->result);
+ break;
- arg->done_cb(arg->data, arg->result);
- break;
case ARES_ENOTIMP:
case ARES_ENOTFOUND:
case ARES_ENOMEM:
case ARES_EDESTRUCTION:
case ARES_EBADFLAGS:
- arg->done_cb(arg->data, NULL);
- break;
+ arg->done_cb(arg->data, NULL);
+ break;
}
free(arg->result->info.ai_addr);
/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
-/*
* getaddrinfo with callback
*
* man getaddrinfo
};
-static void _ecore_con_info_readdata(CB_Data *cbdata);
-static void _ecore_con_info_slave_free(CB_Data *cbdata);
-static int _ecore_con_info_data_handler(void *data, Ecore_Fd_Handler *fd_handler);
-static int _ecore_con_info_exit_handler(void *data, int type __UNUSED__, void *event);
+static void _ecore_con_info_readdata(CB_Data *cbdata);
+static void _ecore_con_info_slave_free(CB_Data *cbdata);
+static Eina_Bool _ecore_con_info_data_handler(void *data,
+ Ecore_Fd_Handler *fd_handler);
+static Eina_Bool _ecore_con_info_exit_handler(void *data, int type __UNUSED__,
+ void *event);
static int info_init = 0;
static CB_Data *info_slaves = NULL;
{
info_init--;
if (info_init == 0)
- {
- while (info_slaves) _ecore_con_info_slave_free(info_slaves);
- }
+ while (info_slaves) _ecore_con_info_slave_free(info_slaves);
+
return info_init;
}
int
ecore_con_info_tcp_connect(Ecore_Con_Server *svr,
- Ecore_Con_Info_Cb done_cb,
- void *data)
+ Ecore_Con_Info_Cb done_cb,
+ void *data)
{
struct addrinfo hints;
int
ecore_con_info_tcp_listen(Ecore_Con_Server *svr,
- Ecore_Con_Info_Cb done_cb,
- void *data)
+ Ecore_Con_Info_Cb done_cb,
+ void *data)
{
struct addrinfo hints;
int
ecore_con_info_udp_connect(Ecore_Con_Server *svr,
- Ecore_Con_Info_Cb done_cb,
- void *data)
+ Ecore_Con_Info_Cb done_cb,
+ void *data)
{
struct addrinfo hints;
int
ecore_con_info_udp_listen(Ecore_Con_Server *svr,
- Ecore_Con_Info_Cb done_cb,
- void *data)
+ Ecore_Con_Info_Cb done_cb,
+ void *data)
{
struct addrinfo hints;
int
ecore_con_info_mcast_listen(Ecore_Con_Server *svr,
- Ecore_Con_Info_Cb done_cb,
- void *data)
+ Ecore_Con_Info_Cb done_cb,
+ void *data)
{
struct addrinfo hints;
EAPI int
ecore_con_info_get(Ecore_Con_Server *svr,
- Ecore_Con_Info_Cb done_cb,
- void *data,
- struct addrinfo *hints)
+ Ecore_Con_Info_Cb done_cb,
+ void *data,
+ struct addrinfo *hints)
{
CB_Data *cbdata;
int fd[2];
- if (pipe(fd) < 0) return 0;
+ if (pipe(fd) < 0)
+ return 0;
+
cbdata = calloc(1, sizeof(CB_Data));
if (!cbdata)
{
- close(fd[0]);
- close(fd[1]);
- return 0;
+ close(fd[0]);
+ close(fd[1]);
+ return 0;
}
+
cbdata->cb_done = done_cb;
cbdata->data = data;
cbdata->fd2 = fd[1];
if (!(cbdata->fdh = ecore_main_fd_handler_add(fd[0], ECORE_FD_READ,
- _ecore_con_info_data_handler,
- cbdata,
- NULL, NULL)))
+ _ecore_con_info_data_handler,
+ cbdata,
+ NULL, NULL)))
{
- free(cbdata);
- close(fd[0]);
- close(fd[1]);
- return 0;
+ free(cbdata);
+ close(fd[0]);
+ close(fd[1]);
+ return 0;
}
if ((cbdata->pid = fork()) == 0)
{
Ecore_Con_Info *container;
- struct addrinfo *result = NULL;
- char service[NI_MAXSERV];
- char hbuf[NI_MAXHOST];
- char sbuf[NI_MAXSERV];
- void *tosend = NULL;
- int tosend_len;
- int canonname_len = 0;
- int err;
-
- eina_convert_itoa(svr->port, service);
- /* CHILD */
- if (!getaddrinfo(svr->name, service, hints, &result) && result)
- {
- if (result->ai_canonname)
- canonname_len = strlen(result->ai_canonname) + 1;
- tosend_len = sizeof(Ecore_Con_Info) + result->ai_addrlen + canonname_len;
-
- if (!(tosend = alloca(tosend_len)))
- goto on_error;
-
- container = (Ecore_Con_Info *)tosend;
-
- container->size = tosend_len;
-
- memcpy(&container->info, result, sizeof(struct addrinfo));
- memcpy((char *)tosend + sizeof(Ecore_Con_Info), result->ai_addr, result->ai_addrlen);
- memcpy((char *)tosend + sizeof(Ecore_Con_Info) + result->ai_addrlen, result->ai_canonname, canonname_len);
-
- if (!getnameinfo(result->ai_addr, result->ai_addrlen,
- hbuf, sizeof(hbuf), sbuf, sizeof(sbuf),
- NI_NUMERICHOST | NI_NUMERICSERV))
- {
- memcpy(container->ip, hbuf, sizeof(container->ip));
- memcpy(container->service, sbuf, sizeof(container->service));
- }
- err = write(fd[1], tosend, tosend_len);
- }
+ struct addrinfo *result = NULL;
+ char service[NI_MAXSERV] = {0};
+ char hbuf[NI_MAXHOST] = {0};
+ char sbuf[NI_MAXSERV] = {0};
+ unsigned char *tosend = NULL;
+ int tosend_len;
+ int canonname_len = 0;
+ int err;
+
+ eina_convert_itoa(svr->port, service);
+ /* CHILD */
+ if (!getaddrinfo(svr->name, service, hints, &result) && result)
+ {
+ if (result->ai_canonname)
+ canonname_len = strlen(result->ai_canonname) + 1;
+
+ tosend_len = sizeof(Ecore_Con_Info) + result->ai_addrlen +
+ canonname_len;
+
+ if (!(tosend = alloca(tosend_len))) goto on_error;
+ memset(tosend, 0, tosend_len);
+
+ container = (Ecore_Con_Info *)tosend;
+ container->size = tosend_len;
+
+ memcpy(&container->info,
+ result,
+ sizeof(struct addrinfo));
+ memcpy(tosend + sizeof(Ecore_Con_Info),
+ result->ai_addr,
+ result->ai_addrlen);
+ memcpy(tosend + sizeof(Ecore_Con_Info) + result->ai_addrlen,
+ result->ai_canonname,
+ canonname_len);
+
+ if (!getnameinfo(result->ai_addr, result->ai_addrlen,
+ hbuf, sizeof(hbuf), sbuf, sizeof(sbuf),
+ NI_NUMERICHOST | NI_NUMERICSERV))
+ {
+ memcpy(container->ip, hbuf, sizeof(container->ip));
+ memcpy(container->service, sbuf, sizeof(container->service));
+ }
+
+ err = write(fd[1], tosend, tosend_len);
+ }
on_error:
- if (result)
- freeaddrinfo(result);
- err = write(fd[1], "", 1);
- close(fd[1]);
-# ifdef __USE_ISOC99
- _Exit(0);
-# else
- _exit(0);
-# endif
+ if (result)
+ freeaddrinfo(result);
+
+ err = write(fd[1], "", 1);
+ close(fd[1]);
+#ifdef __USE_ISOC99
+ _Exit(0);
+#else
+ _exit(0);
+#endif
}
+
/* PARENT */
- cbdata->handler = ecore_event_handler_add(ECORE_EXE_EVENT_DEL, _ecore_con_info_exit_handler, cbdata);
+ cbdata->handler =
+ ecore_event_handler_add(ECORE_EXE_EVENT_DEL, _ecore_con_info_exit_handler,
+ cbdata);
close(fd[1]);
if (!cbdata->handler)
{
- ecore_main_fd_handler_del(cbdata->fdh);
- free(cbdata);
- close(fd[0]);
- return 0;
+ ecore_main_fd_handler_del(cbdata->fdh);
+ free(cbdata);
+ close(fd[0]);
+ return 0;
}
- info_slaves = (CB_Data *) eina_inlist_append(EINA_INLIST_GET(info_slaves), EINA_INLIST_GET(cbdata));
+
+ info_slaves = (CB_Data *)eina_inlist_append(EINA_INLIST_GET(
+ info_slaves),
+ EINA_INLIST_GET(cbdata));
return 1;
}
{
Ecore_Con_Info container;
Ecore_Con_Info *recv;
- void *torecv;
+ unsigned char *torecv;
int torecv_len;
ssize_t size;
size = read(ecore_main_fd_handler_fd_get(cbdata->fdh), &container,
- sizeof(Ecore_Con_Info));
+ sizeof(Ecore_Con_Info));
if (size == sizeof(Ecore_Con_Info))
{
torecv_len = container.size;
- torecv = malloc(torecv_len);
-
- memcpy(torecv, &container, sizeof(Ecore_Con_Info));
-
- size = read(ecore_main_fd_handler_fd_get(cbdata->fdh), (char *)torecv + sizeof(Ecore_Con_Info),
- torecv_len - sizeof(Ecore_Con_Info));
- if ((size > 0) && ((size_t)size == torecv_len - sizeof(Ecore_Con_Info)))
- {
- recv = (Ecore_Con_Info *)torecv;
-
- recv->info.ai_addr = (struct sockaddr *)((char *)torecv + sizeof(Ecore_Con_Info));
- if ((size_t)torecv_len != (sizeof(Ecore_Con_Info) + recv->info.ai_addrlen))
- recv->info.ai_canonname = (char *)torecv + sizeof(Ecore_Con_Info) + recv->info.ai_addrlen;
- else
- recv->info.ai_canonname = NULL;
- recv->info.ai_next = NULL;
-
- cbdata->cb_done(cbdata->data, recv);
-
- free(torecv);
- }
- else
- cbdata->cb_done(cbdata->data, NULL);
+ torecv = malloc(torecv_len);
+
+ memcpy(torecv, &container, sizeof(Ecore_Con_Info));
+
+ size = read(ecore_main_fd_handler_fd_get(cbdata->fdh),
+ torecv + sizeof(Ecore_Con_Info),
+ torecv_len - sizeof(Ecore_Con_Info));
+ if ((size > 0) &&
+ ((size_t)size == torecv_len - sizeof(Ecore_Con_Info)))
+ {
+ recv = (Ecore_Con_Info *)torecv;
+
+ recv->info.ai_addr =
+ (struct sockaddr *)(torecv + sizeof(Ecore_Con_Info));
+ if ((size_t)torecv_len !=
+ (sizeof(Ecore_Con_Info) + recv->info.ai_addrlen))
+ recv->info.ai_canonname =
+ torecv + sizeof(Ecore_Con_Info) + recv->info.ai_addrlen;
+ else
+ recv->info.ai_canonname = NULL;
+
+ recv->info.ai_next = NULL;
+
+ cbdata->cb_done(cbdata->data, recv);
+
+ free(torecv);
+ }
+ else
+ cbdata->cb_done(cbdata->data, NULL);
}
else
- cbdata->cb_done(cbdata->data, NULL);
+ cbdata->cb_done(cbdata->data, NULL);
+
cbdata->cb_done = NULL;
}
static void
_ecore_con_info_slave_free(CB_Data *cbdata)
{
- info_slaves = (CB_Data *) eina_inlist_remove(EINA_INLIST_GET(info_slaves), EINA_INLIST_GET(cbdata));
- close(ecore_main_fd_handler_fd_get(cbdata->fdh));
+ info_slaves = (CB_Data *)eina_inlist_remove(EINA_INLIST_GET(info_slaves),
+ EINA_INLIST_GET(cbdata));
ecore_main_fd_handler_del(cbdata->fdh);
+ close(ecore_main_fd_handler_fd_get(cbdata->fdh));
ecore_event_handler_del(cbdata->handler);
free(cbdata);
}
-static int
+static Eina_Bool
_ecore_con_info_data_handler(void *data, Ecore_Fd_Handler *fd_handler)
{
CB_Data *cbdata;
cbdata = data;
if (cbdata->cb_done)
{
- if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ))
- _ecore_con_info_readdata(cbdata);
- else
- {
- cbdata->cb_done(cbdata->data, NULL);
- cbdata->cb_done = NULL;
- }
+ if (ecore_main_fd_handler_active_get(fd_handler,
+ ECORE_FD_READ))
+ _ecore_con_info_readdata(cbdata);
+ else
+ {
+ cbdata->cb_done(cbdata->data, NULL);
+ cbdata->cb_done = NULL;
+ }
}
+
_ecore_con_info_slave_free(cbdata);
- return 0;
+ return ECORE_CALLBACK_CANCEL;
}
-static int
+static Eina_Bool
_ecore_con_info_exit_handler(void *data, int type __UNUSED__, void *event)
{
CB_Data *cbdata;
ev = event;
cbdata = data;
- if (cbdata->pid != ev->pid) return 1;
- return 0;
+ if (cbdata->pid != ev->pid)
+ return ECORE_CALLBACK_RENEW;
+
+ return ECORE_CALLBACK_CANCEL; /* FIXME: Woot ??? */
_ecore_con_info_slave_free(cbdata);
- return 0;
+ return ECORE_CALLBACK_CANCEL;
}
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "ecore_con_private.h"
-#define LENGTH_OF_SOCKADDR_UN(s) (strlen((s)->sun_path) + (size_t)(((struct sockaddr_un *)NULL)->sun_path))
-#define LENGTH_OF_ABSTRACT_SOCKADDR_UN(s, path) (strlen(path) + 1 + (size_t)(((struct sockaddr_un *)NULL)->sun_path))
+#define LENGTH_OF_SOCKADDR_UN(s) (strlen((s)->sun_path) + \
+ (size_t)(((struct sockaddr_un *)NULL)-> \
+ sun_path))
+#define LENGTH_OF_ABSTRACT_SOCKADDR_UN(s, path) (strlen(path) + 1 + \
+ (size_t)(((struct sockaddr_un \
+ *)NULL)->sun_path))
static int _ecore_con_local_init_count = 0;
ecore_con_local_init(void)
{
if (++_ecore_con_local_init_count != 1)
- return _ecore_con_local_init_count;
+ return _ecore_con_local_init_count;
return _ecore_con_local_init_count;
}
ecore_con_local_shutdown(void)
{
if (--_ecore_con_local_init_count != 0)
- return _ecore_con_local_init_count;
+ return _ecore_con_local_init_count;
return _ecore_con_local_init_count;
}
int
ecore_con_local_connect(Ecore_Con_Server *svr,
- int (*cb_done)(void *data, Ecore_Fd_Handler *fd_handler),
- void *data __UNUSED__,
- void (*cb_free)(void *data, void *ev))
+ Eina_Bool (*cb_done)(void *data,
+ Ecore_Fd_Handler *fd_handler),
+ void *data __UNUSED__,
+ void (*cb_free)(void *data, void *ev))
{
- char buf[4096];
+ char buf[4096];
struct sockaddr_un socket_unix;
- int curstate = 0;
- const char *homedir;
- int socket_unix_len;
+ int curstate = 0;
+ const char *homedir;
+ int socket_unix_len;
- if (svr->type == ECORE_CON_LOCAL_USER)
+ if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_USER)
{
- homedir = getenv("HOME");
- if (!homedir) homedir = getenv("TMP");
- if (!homedir) homedir = "/tmp";
- snprintf(buf, sizeof(buf), "%s/.ecore/%s/%i", homedir, svr->name, svr->port);
+ homedir = getenv("HOME");
+ if (!homedir)
+ homedir = getenv("TMP");
+
+ if (!homedir)
+ homedir = "/tmp";
+
+ snprintf(buf, sizeof(buf), "%s/.ecore/%s/%i", homedir, svr->name,
+ svr->port);
}
- else if (svr->type == ECORE_CON_LOCAL_SYSTEM)
+ else if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_SYSTEM)
{
- if (svr->port < 0)
- {
- if (svr->name[0] == '/')
- strncpy(buf, svr->name, sizeof(buf));
- else
- snprintf(buf, sizeof(buf), "/tmp/.ecore_service|%s", svr->name);
- }
- else
- {
- if (svr->name[0] == '/')
- snprintf(buf, sizeof(buf), "%s|%i", svr->name, svr->port);
- else
- snprintf(buf, sizeof(buf), "/tmp/.ecore_service|%s|%i", svr->name, svr->port);
- }
+ if (svr->port < 0)
+ {
+ if (svr->name[0] == '/')
+ strncpy(buf, svr->name, sizeof(buf));
+ else
+ snprintf(buf, sizeof(buf), "/tmp/.ecore_service|%s", svr->name);
+ }
+ else
+ {
+ if (svr->name[0] ==
+ '/')
+ snprintf(buf, sizeof(buf), "%s|%i", svr->name,
+ svr->port);
+ else
+ snprintf(buf, sizeof(buf), "/tmp/.ecore_service|%s|%i",
+ svr->name,
+ svr->port);
+ }
}
- else if (svr->type == ECORE_CON_LOCAL_ABSTRACT)
- strncpy(buf, svr->name, sizeof(buf));
+ else if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT)
+ strncpy(buf, svr->name,
+ sizeof(buf));
svr->fd = socket(AF_UNIX, SOCK_STREAM, 0);
- if (svr->fd < 0) return 0;
- if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0) return 0;
- if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0) return 0;
- if (setsockopt(svr->fd, SOL_SOCKET, SO_REUSEADDR, (const void *)&curstate, sizeof(curstate)) < 0) return 0;
+ if (svr->fd < 0)
+ return 0;
+
+ if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0)
+ return 0;
+
+ if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0)
+ return 0;
+
+ if (setsockopt(svr->fd, SOL_SOCKET, SO_REUSEADDR, (const void *)&curstate,
+ sizeof(curstate)) < 0)
+ return 0;
+
socket_unix.sun_family = AF_UNIX;
- if (svr->type == ECORE_CON_LOCAL_ABSTRACT)
+ if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT)
{
#ifdef HAVE_ABSTRACT_SOCKETS
- /* copy name insto sun_path, prefixed by null to indicate abstract namespace */
- snprintf(socket_unix.sun_path, sizeof(socket_unix.sun_path), ".%s", svr->name);
- socket_unix.sun_path[0] = '\0';
- socket_unix_len = LENGTH_OF_ABSTRACT_SOCKADDR_UN(&socket_unix, svr->name);
+ /* copy name insto sun_path, prefixed by null to indicate abstract namespace */
+ snprintf(socket_unix.sun_path, sizeof(socket_unix.sun_path), ".%s",
+ svr->name);
+ socket_unix.sun_path[0] = '\0';
+ socket_unix_len = LENGTH_OF_ABSTRACT_SOCKADDR_UN(&socket_unix,
+ svr->name);
#else
- WRN("Your system does not support abstract sockets!");
- return 0;
+ WRN("Your system does not support abstract sockets!");
+ return 0;
#endif
}
else
{
- strncpy(socket_unix.sun_path, buf, sizeof(socket_unix.sun_path));
- socket_unix_len = LENGTH_OF_SOCKADDR_UN(&socket_unix);
+ strncpy(socket_unix.sun_path, buf, sizeof(socket_unix.sun_path));
+ socket_unix_len = LENGTH_OF_SOCKADDR_UN(&socket_unix);
}
- if (connect(svr->fd, (struct sockaddr *)&socket_unix, socket_unix_len) < 0)
- return 0;
+ if (connect(svr->fd, (struct sockaddr *)&socket_unix,
+ socket_unix_len) < 0)
+ return 0;
+
svr->path = strdup(buf);
- if (!svr->path) return 0;
+ if (!svr->path)
+ return 0;
if (svr->type & ECORE_CON_SSL)
- ecore_con_ssl_server_init(svr);
+ ecore_con_ssl_server_init(svr);
svr->fd_handler =
- ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ,
- cb_done, svr, NULL, NULL);
- if (!svr->fd_handler) return 0;
+ ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ,
+ cb_done, svr, NULL, NULL);
+ if (!svr->fd_handler)
+ return 0;
if (!svr->delete_me)
{
- /* we got our server! */
- Ecore_Con_Event_Server_Add *e;
-
- e = calloc(1, sizeof(Ecore_Con_Event_Server_Add));
- if (e)
- {
- svr->event_count++;
- e->server = svr;
- ecore_event_add(ECORE_CON_EVENT_SERVER_ADD, e,
- cb_free, NULL);
- }
+ /* we got our server! */
+ Ecore_Con_Event_Server_Add *e;
+
+ e = calloc(1, sizeof(Ecore_Con_Event_Server_Add));
+ if (e)
+ {
+ svr->event_count++;
+ e->server = svr;
+ ecore_event_add(ECORE_CON_EVENT_SERVER_ADD, e,
+ cb_free, NULL);
+ }
}
return 1;
}
int
-ecore_con_local_listen(Ecore_Con_Server *svr,
- int (*cb_listen)(void *data, Ecore_Fd_Handler *fd_handler),
- void *data __UNUSED__)
+ecore_con_local_listen(
+ Ecore_Con_Server *svr,
+ Eina_Bool (*
+ cb_listen)(void *data,
+ Ecore_Fd_Handler *
+ fd_handler),
+ void *data
+ __UNUSED__)
{
- char buf[4096];
+ char buf[4096];
struct sockaddr_un socket_unix;
- struct linger lin;
- mode_t pmode;
- const char *homedir;
- struct stat st;
- mode_t mask;
- int socket_unix_len;
+ struct linger lin;
+ mode_t pmode;
+ const char *homedir;
+ struct stat st;
+ mode_t mask;
+ int socket_unix_len;
mask = S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH;
- if (svr->type == ECORE_CON_LOCAL_USER)
+ if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_USER)
{
- homedir = getenv("HOME");
- if (!homedir) homedir = getenv("TMP");
- if (!homedir) homedir = "/tmp";
- mask = S_IRUSR | S_IWUSR | S_IXUSR;
- snprintf(buf, sizeof(buf), "%s/.ecore", homedir);
- if (stat(buf, &st) < 0) mkdir(buf, mask);
- snprintf(buf, sizeof(buf), "%s/.ecore/%s", homedir, svr->name);
- if (stat(buf, &st) < 0) mkdir(buf, mask);
- snprintf(buf, sizeof(buf), "%s/.ecore/%s/%i", homedir, svr->name, svr->port);
- mask = S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH;
+ homedir = getenv("HOME");
+ if (!homedir)
+ homedir = getenv("TMP");
+
+ if (!homedir)
+ homedir = "/tmp";
+
+ mask = S_IRUSR | S_IWUSR | S_IXUSR;
+ snprintf(buf, sizeof(buf), "%s/.ecore", homedir);
+ if (stat(buf, &st) < 0)
+ mkdir(buf, mask);
+
+ snprintf(buf, sizeof(buf), "%s/.ecore/%s", homedir, svr->name);
+ if (stat(buf, &st) < 0)
+ mkdir(buf, mask);
+
+ snprintf(buf,
+ sizeof(buf),
+ "%s/.ecore/%s/%i",
+ homedir,
+ svr->name,
+ svr->port);
+ mask = S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH;
}
- else if (svr->type == ECORE_CON_LOCAL_SYSTEM)
+ else if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_SYSTEM)
{
- mask = 0;
- if (svr->name[0] == '/')
- {
- if (svr->port >= 0)
- snprintf(buf, sizeof(buf), "%s|%i", svr->name, svr->port);
- else
- snprintf(buf, sizeof(buf), "%s", svr->name);
- }
- else
- snprintf(buf, sizeof(buf), "/tmp/.ecore_service|%s|%i", svr->name, svr->port);
+ mask = 0;
+ if (svr->name[0] == '/')
+ {
+ if (svr->port >= 0)
+ snprintf(buf,
+ sizeof(buf),
+ "%s|%i",
+ svr->name,
+ svr->port);
+ else
+ snprintf(buf,
+ sizeof(buf),
+ "%s",
+ svr->name);
+ }
+ else
+ snprintf(buf,
+ sizeof(buf),
+ "/tmp/.ecore_service|%s|%i",
+ svr->name,
+ svr->port);
}
- else if (svr->type == ECORE_CON_LOCAL_ABSTRACT)
- strncpy(buf, svr->name, sizeof(buf));
+ else if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT)
+ strncpy(buf, svr->name,
+ sizeof(buf));
+
pmode = umask(mask);
- start:
+start:
svr->fd = socket(AF_UNIX, SOCK_STREAM, 0);
- if (svr->fd < 0) goto error_umask;
- if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0) goto error_umask;
- if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0) goto error_umask;
+ if (svr->fd < 0)
+ goto error_umask;
+
+ if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0)
+ goto error_umask;
+
+ if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0)
+ goto error_umask;
+
lin.l_onoff = 1;
lin.l_linger = 0;
- if (setsockopt(svr->fd, SOL_SOCKET, SO_LINGER, (const void *)&lin, sizeof(struct linger)) < 0) goto error_umask;
+ if (setsockopt(svr->fd, SOL_SOCKET, SO_LINGER, (const void *)&lin,
+ sizeof(struct linger)) < 0)
+ goto error_umask;
+
socket_unix.sun_family = AF_UNIX;
- if (svr->type == ECORE_CON_LOCAL_ABSTRACT)
+ if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT)
{
#ifdef HAVE_ABSTRACT_SOCKETS
- /* . is a placeholder */
- snprintf(socket_unix.sun_path, sizeof(socket_unix.sun_path), ".%s", svr->name);
- /* first char null indicates abstract namespace */
- socket_unix.sun_path[0] = '\0';
- socket_unix_len = LENGTH_OF_ABSTRACT_SOCKADDR_UN(&socket_unix, svr->name);
+ /* . is a placeholder */
+ snprintf(socket_unix.sun_path, sizeof(socket_unix.sun_path), ".%s",
+ svr->name);
+ /* first char null indicates abstract namespace */
+ socket_unix.sun_path[0] = '\0';
+ socket_unix_len = LENGTH_OF_ABSTRACT_SOCKADDR_UN(&socket_unix,
+ svr->name);
#else
- ERR("Your system does not support abstract sockets!");
- goto error_umask;
+ ERR("Your system does not support abstract sockets!");
+ goto error_umask;
#endif
}
else
{
- strncpy(socket_unix.sun_path, buf, sizeof(socket_unix.sun_path));
- socket_unix_len = LENGTH_OF_SOCKADDR_UN(&socket_unix);
+ strncpy(socket_unix.sun_path, buf, sizeof(socket_unix.sun_path));
+ socket_unix_len = LENGTH_OF_SOCKADDR_UN(&socket_unix);
}
+
if (bind(svr->fd, (struct sockaddr *)&socket_unix, socket_unix_len) < 0)
{
- if (((svr->type == ECORE_CON_LOCAL_USER) || (svr->type == ECORE_CON_LOCAL_SYSTEM)) &&
- (connect(svr->fd, (struct sockaddr *)&socket_unix, socket_unix_len) < 0) &&
- (unlink(buf) >= 0))
- goto start;
- else
- goto error_umask;
+ if ((((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_USER) ||
+ ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_SYSTEM)) &&
+ (connect(svr->fd, (struct sockaddr *)&socket_unix,
+ socket_unix_len) < 0) &&
+ (unlink(buf) >= 0))
+ goto start;
+ else
+ goto error_umask;
}
- if (listen(svr->fd, 4096) < 0) goto error_umask;
+
+ if (listen(svr->fd, 4096) < 0)
+ goto error_umask;
+
svr->path = strdup(buf);
- if (!svr->path) goto error_umask;
+ if (!svr->path)
+ goto error_umask;
+
svr->fd_handler =
- ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ,
- cb_listen, svr, NULL, NULL);
+ ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ,
+ cb_listen, svr, NULL, NULL);
umask(pmode);
- if (!svr->fd_handler) goto error;
+ if (!svr->fd_handler)
+ goto error;
return 1;
- error_umask:
+error_umask:
umask(pmode);
- error:
+error:
return 0;
}
#define READBUFSIZ 65536
-extern int _ecore_con_log_dom ;
+extern int _ecore_con_log_dom;
#ifdef ECORE_CON_DEFAULT_LOG_COLOR
#undef ECORE_LOG_DEFAULT_LOG_COLOR
#endif
#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_con_log_dom, __VA_ARGS__)
+typedef struct _Ecore_Con_Lookup Ecore_Con_Lookup;
+typedef struct _Ecore_Con_Info Ecore_Con_Info;
+
+typedef void (*Ecore_Con_Info_Cb)(void *data, Ecore_Con_Info *infos);
+
typedef enum _Ecore_Con_State
- {
- ECORE_CON_CONNECTED,
- ECORE_CON_DISCONNECTED,
- ECORE_CON_INPROGRESS
- } Ecore_Con_State;
+{
+ ECORE_CON_CONNECTED,
+ ECORE_CON_DISCONNECTED,
+ ECORE_CON_INPROGRESS
+} Ecore_Con_State;
typedef enum _Ecore_Con_Ssl_Error
- {
- ECORE_CON_SSL_ERROR_NONE = 0,
- ECORE_CON_SSL_ERROR_NOT_SUPPORTED,
- ECORE_CON_SSL_ERROR_INIT_FAILED,
- ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED,
- ECORE_CON_SSL_ERROR_SSL2_NOT_SUPPORTED
- } Ecore_Con_Ssl_Error;
+{
+ ECORE_CON_SSL_ERROR_NONE = 0,
+ ECORE_CON_SSL_ERROR_NOT_SUPPORTED,
+ ECORE_CON_SSL_ERROR_INIT_FAILED,
+ ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED,
+ ECORE_CON_SSL_ERROR_SSL2_NOT_SUPPORTED
+} Ecore_Con_Ssl_Error;
struct _Ecore_Con_Client
{
ECORE_MAGIC;
- int fd;
+ int fd;
Ecore_Con_Server *server;
- void *data;
+ void *data;
Ecore_Fd_Handler *fd_handler;
- int buf_size;
- int buf_offset;
- unsigned char *buf;
- char *ip;
- int event_count;
- struct sockaddr *client_addr;
- int client_addr_len;
+ int buf_size;
+ int buf_offset;
+ unsigned char *buf;
+ char *ip;
+ int event_count;
+ struct sockaddr *client_addr;
+ int client_addr_len;
#if USE_GNUTLS
- gnutls_session session;
+ gnutls_session session;
#elif USE_OPENSSL
- SSL_CTX *ssl_ctx;
- SSL *ssl;
- int ssl_err;
+ SSL_CTX *ssl_ctx;
+ SSL *ssl;
+ int ssl_err;
#endif
- char dead : 1;
- char delete_me : 1;
+ char dead : 1;
+ char delete_me : 1;
};
struct _Ecore_Con_Server
{
ECORE_MAGIC;
- int fd;
- Ecore_Con_Type type;
- char *name;
- int port;
- char *path;
- void *data;
+ int fd;
+ Ecore_Con_Type type;
+ char *name;
+ int port;
+ char *path;
+ void *data;
Ecore_Fd_Handler *fd_handler;
- Eina_List *clients;
- int write_buf_size;
- int write_buf_offset;
- unsigned char *write_buf;
- int event_count;
- int client_limit;
- pid_t ppid;
+ Eina_List *clients;
+ int write_buf_size;
+ int write_buf_offset;
+ unsigned char *write_buf;
+ int event_count;
+ int client_limit;
+ pid_t ppid;
#if USE_GNUTLS
- gnutls_session session;
+ gnutls_session session;
gnutls_anon_client_credentials_t anoncred_c;
gnutls_anon_server_credentials_t anoncred_s;
+ gnutls_certificate_credentials_t cert;
#elif USE_OPENSSL
- SSL_CTX *ssl_ctx;
- SSL *ssl;
- int ssl_err;
+ SSL_CTX *ssl_ctx;
+ SSL *ssl;
+ int ssl_err;
#endif
- char *ip;
- char dead : 1;
- char created : 1;
- char connecting : 1;
- char reject_excess_clients : 1;
- char delete_me : 1;
+ char *ip;
+ char dead : 1;
+ char created : 1;
+ char connecting : 1;
+ char reject_excess_clients : 1;
+ char delete_me : 1;
};
#ifdef HAVE_CURL
struct _Ecore_Con_Url
{
ECORE_MAGIC;
- CURL *curl_easy;
+ CURL *curl_easy;
struct curl_slist *headers;
- struct curl_httppost* post;
- Eina_List *additional_headers;
- Eina_List *response_headers;
- char *url;
+ struct curl_httppost *post;
+ Eina_List *additional_headers;
+ Eina_List *response_headers;
+ char *url;
Ecore_Con_Url_Time condition;
- time_t time;
- void *data;
+ time_t time;
+ void *data;
- Ecore_Fd_Handler *fd_handler;
- int fd;
- int flags;
+ Ecore_Fd_Handler *fd_handler;
+ int fd;
+ int flags;
- int received;
- int write_fd;
+ int received;
+ int write_fd;
- unsigned char active : 1;
+ unsigned char active : 1;
};
#endif
struct _Ecore_Con_Info
{
- unsigned int size;
+ unsigned int size;
struct addrinfo info;
- char ip[NI_MAXHOST];
- char service[NI_MAXSERV];
+ char ip[NI_MAXHOST];
+ char service[NI_MAXSERV];
+};
+
+struct _Ecore_Con_Lookup
+{
+ Ecore_Con_Dns_Cb done_cb;
+ const void *data;
};
/* from ecore_local.c */
int ecore_con_local_init(void);
int ecore_con_local_shutdown(void);
-int ecore_con_local_connect(Ecore_Con_Server *svr, int (*cb_done)(void *data, Ecore_Fd_Handler *fd_handler), void *data, void (*cb_free)(void *data, void *ev));
-int ecore_con_local_listen(Ecore_Con_Server *svr, int (*cb_listen)(void *data, Ecore_Fd_Handler *fd_handler), void *data);
+int ecore_con_local_connect(Ecore_Con_Server *svr,
+ Eina_Bool (*cb_done)(
+ void *data,
+ Ecore_Fd_Handler *fd_handler),
+ void *data,
+ void (*cb_free)(
+ void *data, void *ev));
+int ecore_con_local_listen(Ecore_Con_Server *svr,
+ Eina_Bool (*cb_listen)(
+ void *data,
+ Ecore_Fd_Handler *fd_handler),
+ void *data);
/* from ecore_con_info.c */
-int ecore_con_info_init(void);
-int ecore_con_info_shutdown(void);
-int ecore_con_info_tcp_connect(Ecore_Con_Server *svr, Ecore_Con_Info_Cb done_cb, void *data);
-int ecore_con_info_tcp_listen(Ecore_Con_Server *svr, Ecore_Con_Info_Cb done_cb, void *data);
-int ecore_con_info_udp_connect(Ecore_Con_Server *svr, Ecore_Con_Info_Cb done_cb, void *data);
-int ecore_con_info_udp_listen(Ecore_Con_Server *svr, Ecore_Con_Info_Cb done_cb, void *data);
-int ecore_con_info_mcast_listen(Ecore_Con_Server *svr, Ecore_Con_Info_Cb done_cb, void *data);
+int ecore_con_info_init(void);
+int ecore_con_info_shutdown(void);
+int ecore_con_info_tcp_connect(Ecore_Con_Server *svr,
+ Ecore_Con_Info_Cb done_cb,
+ void *data);
+int ecore_con_info_tcp_listen(Ecore_Con_Server *svr,
+ Ecore_Con_Info_Cb done_cb,
+ void *data);
+int ecore_con_info_udp_connect(Ecore_Con_Server *svr,
+ Ecore_Con_Info_Cb done_cb,
+ void *data);
+int ecore_con_info_udp_listen(Ecore_Con_Server *svr,
+ Ecore_Con_Info_Cb done_cb,
+ void *data);
+int ecore_con_info_mcast_listen(Ecore_Con_Server *svr,
+ Ecore_Con_Info_Cb done_cb,
+ void *data);
/* from ecore_con_ssl.c */
Ecore_Con_Ssl_Error ecore_con_ssl_init(void);
Ecore_Con_Ssl_Error ecore_con_ssl_shutdown(void);
+Eina_Bool ecore_con_ssl_server_cert_add(const char *cert);
+Eina_Bool ecore_con_ssl_client_cert_add(const char *cert_file,
+ const char *crl_file,
+ const char *key_file);
void ecore_con_ssl_server_prepare(Ecore_Con_Server *svr);
Ecore_Con_Ssl_Error ecore_con_ssl_server_init(Ecore_Con_Server *svr);
Ecore_Con_Ssl_Error ecore_con_ssl_server_shutdown(Ecore_Con_Server *svr);
Ecore_Con_State ecore_con_ssl_server_try(Ecore_Con_Server *svr);
-int ecore_con_ssl_server_read(Ecore_Con_Server *svr, unsigned char *buf, int size);
-int ecore_con_ssl_server_write(Ecore_Con_Server *svr, unsigned char *buf, int size);
+int ecore_con_ssl_server_read(Ecore_Con_Server *svr,
+ unsigned char *buf,
+ int size);
+int ecore_con_ssl_server_write(Ecore_Con_Server *svr,
+ unsigned char *buf,
+ int size);
Ecore_Con_Ssl_Error ecore_con_ssl_client_init(Ecore_Con_Client *svr);
Ecore_Con_Ssl_Error ecore_con_ssl_client_shutdown(Ecore_Con_Client *svr);
Ecore_Con_State ecore_con_ssl_client_try(Ecore_Con_Client *svr);
-int ecore_con_ssl_client_read(Ecore_Con_Client *svr, unsigned char *buf, int size);
-int ecore_con_ssl_client_write(Ecore_Con_Client *svr, unsigned char *buf, int size);
+int ecore_con_ssl_client_read(Ecore_Con_Client *svr,
+ unsigned char *buf,
+ int size);
+int ecore_con_ssl_client_write(Ecore_Con_Client *svr,
+ unsigned char *buf,
+ int size);
+
+int ecore_con_info_get(Ecore_Con_Server *svr,
+ Ecore_Con_Info_Cb done_cb,
+ void *data,
+ struct addrinfo *hints);
+
#endif
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#if USE_GNUTLS
# include <gnutls/gnutls.h>
+# include <gnutls/x509.h>
+# include <gcrypt.h>
#elif USE_OPENSSL
# include <openssl/ssl.h>
+# include <openssl/err.h>
#endif
#ifdef HAVE_WS2TCPIP_H
#include "Ecore.h"
#include "ecore_con_private.h"
+#include <sys/mman.h>
+#include <errno.h>
static int _init_con_ssl_init_count = 0;
#if USE_GNUTLS
-static int _client_connected = 0;
+# ifdef EFL_HAVE_PTHREAD
+GCRY_THREAD_OPTION_PTHREAD_IMPL;
+# endif
-# define SSL_SUFFIX(ssl_func) ssl_func##_gnutls
+static int _client_connected = 0;
+# define SSL_SUFFIX(ssl_func) ssl_func ## _gnutls
# define _ECORE_CON_SSL_AVAILABLE 1
#elif USE_OPENSSL
-# define SSL_SUFFIX(ssl_func) ssl_func##_openssl
+
+# define SSL_SUFFIX(ssl_func) ssl_func ## _openssl
# define _ECORE_CON_SSL_AVAILABLE 2
#else
-# define SSL_SUFFIX(ssl_func) ssl_func##_none
+# define SSL_SUFFIX(ssl_func) ssl_func ## _none
# define _ECORE_CON_SSL_AVAILABLE 0
#endif
+#if USE_GNUTLS
+typedef struct _cert_thingy
+{
+ gnutls_certificate_credentials_t cert;
+ int count;
+} gnutls;
+static gnutls *client_cert = NULL;
+static gnutls *server_cert = NULL;
+#elif USE_OPENSSL
+typedef struct _cert_thingy
+{
+ X509 *cert;
+ int count;
+} openssl;
+typedef struct _key_thingy
+{
+ EVP_PKEY *key;
+ int count;
+} openssl_pkey;
+static openssl_pkey *private_key = NULL;
+static openssl *client_cert = NULL;
+static openssl *server_cert = NULL;
+#endif
+
static Ecore_Con_Ssl_Error
-SSL_SUFFIX(_ecore_con_ssl_init)(void);
+ SSL_SUFFIX(_ecore_con_ssl_init) (void);
static Ecore_Con_Ssl_Error
-SSL_SUFFIX(_ecore_con_ssl_shutdown)(void);
-
-static void
-SSL_SUFFIX(_ecore_con_ssl_server_prepare)(Ecore_Con_Server *svr);
+ SSL_SUFFIX(_ecore_con_ssl_shutdown) (void);
+
+static Eina_Bool SSL_SUFFIX(_ecore_con_ssl_client_cert_add) (const char *
+ cert_file,
+ const char *
+ crl_file,
+ const char *
+ key_file);
+static Eina_Bool SSL_SUFFIX(_ecore_con_ssl_server_cert_add) (const char *cert);
+
+static void SSL_SUFFIX(_ecore_con_ssl_server_prepare) (Ecore_Con_Server *
+ svr);
static Ecore_Con_Ssl_Error
-SSL_SUFFIX(_ecore_con_ssl_server_init)(Ecore_Con_Server *svr);
+ SSL_SUFFIX(_ecore_con_ssl_server_init) (Ecore_Con_Server * svr);
static Ecore_Con_Ssl_Error
-SSL_SUFFIX(_ecore_con_ssl_server_shutdown)(Ecore_Con_Server *svr);
+ SSL_SUFFIX(_ecore_con_ssl_server_shutdown) (Ecore_Con_Server *
+ svr);
static Ecore_Con_State
-SSL_SUFFIX(_ecore_con_ssl_server_try)(Ecore_Con_Server *svr);
+ SSL_SUFFIX(_ecore_con_ssl_server_try) (Ecore_Con_Server * svr);
static int
-SSL_SUFFIX(_ecore_con_ssl_server_read)(Ecore_Con_Server *svr, unsigned char *buf, int size);
+ SSL_SUFFIX(_ecore_con_ssl_server_read) (Ecore_Con_Server * svr,
+ unsigned char *buf, int size);
static int
-SSL_SUFFIX(_ecore_con_ssl_server_write)(Ecore_Con_Server *svr, unsigned char *buf, int size);
+ SSL_SUFFIX(_ecore_con_ssl_server_write) (Ecore_Con_Server *
+ svr,
+ unsigned char *buf, int size);
static void
-SSL_SUFFIX(_ecore_con_ssl_client_prepare)(Ecore_Con_Client *cl);
+ SSL_SUFFIX(_ecore_con_ssl_client_prepare) (Ecore_Con_Client *
+ cl);
static Ecore_Con_Ssl_Error
-SSL_SUFFIX(_ecore_con_ssl_client_init)(Ecore_Con_Client *cl);
+ SSL_SUFFIX(_ecore_con_ssl_client_init) (Ecore_Con_Client * cl);
static Ecore_Con_Ssl_Error
-SSL_SUFFIX(_ecore_con_ssl_client_shutdown)(Ecore_Con_Client *cl);
+ SSL_SUFFIX(_ecore_con_ssl_client_shutdown) (Ecore_Con_Client *
+ cl);
static int
-SSL_SUFFIX(_ecore_con_ssl_client_read)(Ecore_Con_Client *cl, unsigned char *buf, int size);
+ SSL_SUFFIX(_ecore_con_ssl_client_read) (Ecore_Con_Client * cl,
+ unsigned char *buf, int size);
static int
-SSL_SUFFIX(_ecore_con_ssl_client_write)(Ecore_Con_Client *cl, unsigned char *buf, int size);
+ SSL_SUFFIX(_ecore_con_ssl_client_write) (Ecore_Con_Client * cl,
+ unsigned char *buf, int size);
/*
* General SSL API
Ecore_Con_Ssl_Error
ecore_con_ssl_init(void)
{
- if (!_init_con_ssl_init_count++)
- SSL_SUFFIX(_ecore_con_ssl_init)();
+ if (!_init_con_ssl_init_count++)
+ SSL_SUFFIX(_ecore_con_ssl_init) ();
- return _init_con_ssl_init_count;
+ return _init_con_ssl_init_count;
}
Ecore_Con_Ssl_Error
ecore_con_ssl_shutdown(void)
{
- if (!--_init_con_ssl_init_count)
- SSL_SUFFIX(_ecore_con_ssl_shutdown)();
+ if (!--_init_con_ssl_init_count)
+ {
+#if USE_OPENSSL || USE_GNUTLS
+ if (client_cert)
+ client_cert->count = 0;
+
+ if (server_cert)
+ server_cert->count = 0;
+#endif
+#if USE_OPENSSL && !USE_GNUTLS
+ if (private_key)
+ private_key->count = 0;
- return _init_con_ssl_init_count;
+#endif
+ SSL_SUFFIX(_ecore_con_ssl_shutdown) ();
+ }
+
+ return _init_con_ssl_init_count;
}
/**
int
ecore_con_ssl_available_get(void)
{
- return _ECORE_CON_SSL_AVAILABLE;
+ return _ECORE_CON_SSL_AVAILABLE;
}
void
ecore_con_ssl_server_prepare(Ecore_Con_Server *svr)
{
- SSL_SUFFIX(_ecore_con_ssl_server_prepare)(svr);
+ SSL_SUFFIX(_ecore_con_ssl_server_prepare) (svr);
}
Ecore_Con_Ssl_Error
ecore_con_ssl_server_init(Ecore_Con_Server *svr)
{
- return SSL_SUFFIX(_ecore_con_ssl_server_init)(svr);
+ return SSL_SUFFIX(_ecore_con_ssl_server_init) (svr);
+}
+
+Eina_Bool
+ecore_con_ssl_server_cert_add(const char *cert)
+{
+ return SSL_SUFFIX(_ecore_con_ssl_server_cert_add) (cert);
}
Ecore_Con_Ssl_Error
ecore_con_ssl_server_shutdown(Ecore_Con_Server *svr)
{
- return SSL_SUFFIX(_ecore_con_ssl_server_shutdown)(svr);
+ return SSL_SUFFIX(_ecore_con_ssl_server_shutdown) (svr);
}
Ecore_Con_State
ecore_con_ssl_server_try(Ecore_Con_Server *svr)
{
- return SSL_SUFFIX(_ecore_con_ssl_server_try)(svr);
+ return SSL_SUFFIX(_ecore_con_ssl_server_try) (svr);
}
int
ecore_con_ssl_server_read(Ecore_Con_Server *svr, unsigned char *buf, int size)
{
- return SSL_SUFFIX(_ecore_con_ssl_server_read)(svr, buf, size);
+ return SSL_SUFFIX(_ecore_con_ssl_server_read) (svr, buf, size);
}
int
ecore_con_ssl_server_write(Ecore_Con_Server *svr, unsigned char *buf, int size)
{
- return SSL_SUFFIX(_ecore_con_ssl_server_write)(svr, buf, size);
+ return SSL_SUFFIX(_ecore_con_ssl_server_write) (svr, buf, size);
}
Ecore_Con_Ssl_Error
ecore_con_ssl_client_init(Ecore_Con_Client *cl)
{
- return SSL_SUFFIX(_ecore_con_ssl_client_init)(cl);
+ return SSL_SUFFIX(_ecore_con_ssl_client_init) (cl);
+}
+
+Eina_Bool
+ecore_con_ssl_client_cert_add(const char *cert_file,
+ const char *crl_file,
+ const char *key_file)
+{
+ return SSL_SUFFIX(_ecore_con_ssl_client_cert_add) (cert_file, crl_file,
+ key_file);
}
Ecore_Con_Ssl_Error
ecore_con_ssl_client_shutdown(Ecore_Con_Client *cl)
{
- return SSL_SUFFIX(_ecore_con_ssl_client_shutdown)(cl);
+ return SSL_SUFFIX(_ecore_con_ssl_client_shutdown) (cl);
}
int
ecore_con_ssl_client_read(Ecore_Con_Client *cl, unsigned char *buf, int size)
{
- return SSL_SUFFIX(_ecore_con_ssl_client_read)(cl, buf, size);
+ return SSL_SUFFIX(_ecore_con_ssl_client_read) (cl, buf, size);
}
int
ecore_con_ssl_client_write(Ecore_Con_Client *cl, unsigned char *buf, int size)
{
- return SSL_SUFFIX(_ecore_con_ssl_client_write)(cl, buf, size);
+ return SSL_SUFFIX(_ecore_con_ssl_client_write) (cl, buf, size);
}
#if USE_GNUTLS
static Ecore_Con_Ssl_Error
_ecore_con_ssl_init_gnutls(void)
{
- if (gnutls_global_init())
- return ECORE_CON_SSL_ERROR_INIT_FAILED;
+#ifdef EFL_HAVE_PTHREAD
+ if (gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread))
+ WRN(
+ "YOU ARE USING PTHREADS, BUT I CANNOT INITIALIZE THREADSAFE GCRYPT OPERATIONS!");
+
+#endif
+ if (gnutls_global_init())
+ return ECORE_CON_SSL_ERROR_INIT_FAILED;
- return ECORE_CON_SSL_ERROR_NONE;
+ return ECORE_CON_SSL_ERROR_NONE;
}
static Ecore_Con_Ssl_Error
_ecore_con_ssl_shutdown_gnutls(void)
{
- gnutls_global_deinit();
+ gnutls_global_deinit();
- return ECORE_CON_SSL_ERROR_NONE;
+ return ECORE_CON_SSL_ERROR_NONE;
}
static void
_ecore_con_ssl_server_prepare_gnutls(Ecore_Con_Server *svr)
{
- svr->session = NULL;
- svr->anoncred_c = NULL;
- return;
+ svr->session = NULL;
+ svr->anoncred_c = NULL;
+ return;
}
+/* Tries to connect an Ecore_Con_Server to an SSL host.
+ * Returns 1 on success, -1 on fatal errors and 0 if the caller
+ * should try again later.
+ */
static Ecore_Con_Ssl_Error
_ecore_con_ssl_server_init_gnutls(Ecore_Con_Server *svr)
{
- const int *proto = NULL;
- int ret;
- const int kx[] = { GNUTLS_KX_ANON_DH, 0 };
- const int ssl3_proto[] = { GNUTLS_SSL3, 0 };
- const int tls_proto[] = {
- GNUTLS_TLS1_0,
- GNUTLS_TLS1_1,
+ const int *proto = NULL;
+ int ret = 0;
+ const int kx[] = { GNUTLS_KX_ANON_DH, 0 };
+ const int ssl3_proto[] = { GNUTLS_SSL3, 0 };
+ const int tls_proto[] = {
+ GNUTLS_TLS1_0,
+ GNUTLS_TLS1_1,
#ifdef USE_GNUTLS2
- GNUTLS_TLS1_2,
+ GNUTLS_TLS1_2,
#endif
- 0
- };
-
- switch (svr->type & ECORE_CON_SSL)
- {
- case ECORE_CON_USE_SSL2: /* not supported because of security issues */
- return ECORE_CON_SSL_ERROR_SSL2_NOT_SUPPORTED;
- case ECORE_CON_USE_SSL3:
- proto = ssl3_proto;
- break;
- case ECORE_CON_USE_TLS:
- proto = tls_proto;
- break;
- default:
- return ECORE_CON_SSL_ERROR_NONE;
- }
-
- gnutls_anon_allocate_client_credentials(&(svr->anoncred_c));
- gnutls_init(&(svr->session), GNUTLS_CLIENT);
- gnutls_set_default_priority(svr->session);
- gnutls_kx_set_priority(svr->session, kx);
- gnutls_credentials_set(svr->session, GNUTLS_CRD_ANON, svr->anoncred_c);
- gnutls_kx_set_priority(svr->session, kx);
- gnutls_protocol_set_priority(svr->session, proto);
- gnutls_dh_set_prime_bits(svr->session, 512);
-
- gnutls_transport_set_ptr(svr->session, (gnutls_transport_ptr_t)svr->fd);
-
- while ((ret = gnutls_handshake(svr->session)) < 0)
- {
- if ((ret == GNUTLS_E_AGAIN) ||
- (ret == GNUTLS_E_INTERRUPTED))
- continue;
-
- _ecore_con_ssl_server_shutdown_gnutls(svr);
- return ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED;
- }
-
- return ECORE_CON_SSL_ERROR_NONE;
+ 0
+ };
+
+ switch (svr->type & ECORE_CON_SSL)
+ {
+ case ECORE_CON_USE_SSL2: /* not supported because of security issues */
+ return ECORE_CON_SSL_ERROR_SSL2_NOT_SUPPORTED;
+
+ case ECORE_CON_USE_SSL3:
+ proto = ssl3_proto;
+ break;
+
+ case ECORE_CON_USE_TLS:
+ proto = tls_proto;
+ break;
+
+ default:
+ return ECORE_CON_SSL_ERROR_NONE;
+ }
+
+ if ((server_cert) && (server_cert->cert) &&
+ ((svr->type & ECORE_CON_TYPE) & ECORE_CON_LOAD_CERT))
+ {
+ svr->cert = server_cert->cert;
+ server_cert->count++;
+ }
+
+ gnutls_init(&(svr->session), GNUTLS_CLIENT);
+ gnutls_set_default_priority(svr->session);
+ gnutls_kx_set_priority(svr->session, kx);
+ if (svr->cert)
+ gnutls_credentials_set(svr->session, GNUTLS_CRD_CERTIFICATE,
+ svr->cert);
+ else
+ {
+ gnutls_anon_allocate_client_credentials(&svr->anoncred_c);
+ gnutls_credentials_set(svr->session, GNUTLS_CRD_ANON, svr->anoncred_c);
+ }
+
+ gnutls_kx_set_priority(svr->session, kx);
+ gnutls_protocol_set_priority(svr->session, proto);
+ gnutls_dh_set_prime_bits(svr->session, 2048);
+
+ gnutls_transport_set_ptr(svr->session, (gnutls_transport_ptr_t)svr->fd);
+
+ while ((ret = gnutls_handshake(svr->session)) < 0)
+ {
+ if ((ret == GNUTLS_E_AGAIN) ||
+ (ret == GNUTLS_E_INTERRUPTED))
+ continue;
+
+ _ecore_con_ssl_server_shutdown_gnutls(svr);
+ return ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED;
+ }
+
+ return ECORE_CON_SSL_ERROR_NONE;
+}
+
+static Eina_Bool
+_ecore_con_ssl_server_cert_add_gnutls(const char *cert_file)
+{
+ gnutls_certificate_credentials_t cert = NULL;
+
+ /* cert load */
+ if (gnutls_certificate_set_x509_trust_file(cert, cert_file,
+ GNUTLS_X509_FMT_PEM) < 0)
+ goto on_error;
+
+ if (!server_cert)
+ {
+ server_cert = malloc(sizeof(gnutls));
+ if (!server_cert)
+ return EINA_FALSE;
+ }
+ else if ((server_cert->cert) && ((--server_cert->count) < 1))
+ gnutls_certificate_free_credentials(server_cert->cert);
+
+ server_cert->cert = cert;
+ server_cert->count = 1;
+
+ return EINA_TRUE;
+
+on_error:
+ if (cert)
+ gnutls_certificate_free_credentials(cert);
+
+ return EINA_FALSE;
}
static Ecore_Con_Ssl_Error
_ecore_con_ssl_server_shutdown_gnutls(Ecore_Con_Server *svr)
{
- if (svr->session)
- {
- gnutls_bye(svr->session, GNUTLS_SHUT_RDWR);
- gnutls_deinit(svr->session);
- }
- if (svr->anoncred_c)
- gnutls_anon_free_client_credentials(svr->anoncred_c);
- _ecore_con_ssl_server_prepare_gnutls(svr);
+ if (svr->session)
+ {
+ gnutls_bye(svr->session, GNUTLS_SHUT_RDWR);
+ gnutls_deinit(svr->session);
+ }
- return ECORE_CON_SSL_ERROR_NONE;
+ if (((svr->type & ECORE_CON_TYPE) & ECORE_CON_LOAD_CERT) &&
+ (server_cert) &&
+ (server_cert->cert) && (--server_cert->count < 1))
+ {
+ gnutls_certificate_free_credentials(server_cert->cert);
+ free(server_cert);
+ server_cert = NULL;
+ }
+ else if (svr->anoncred_c)
+ gnutls_anon_free_client_credentials(svr->anoncred_c);
+
+ _ecore_con_ssl_server_prepare_gnutls(svr);
+
+ return ECORE_CON_SSL_ERROR_NONE;
}
-/* Tries to connect an Ecore_Con_Server to an SSL host.
- * Returns 1 on success, -1 on fatal errors and 0 if the caller
- * should try again later.
- */
+/* this is a stub function, the handshake is done in _init_gnutls */
static Ecore_Con_State
_ecore_con_ssl_server_try_gnutls(Ecore_Con_Server *svr __UNUSED__)
{
}
static int
-_ecore_con_ssl_server_read_gnutls(Ecore_Con_Server *svr, unsigned char *buf, int size)
+_ecore_con_ssl_server_read_gnutls(Ecore_Con_Server *svr, unsigned char *buf,
+ int size)
{
- int num;
+ int num;
- num = gnutls_record_recv(svr->session, buf, size);
- if (num > 0)
- return num;
- if ((num == GNUTLS_E_AGAIN) ||
- (num == GNUTLS_E_REHANDSHAKE) ||
- (num == GNUTLS_E_INTERRUPTED))
- return 0;
- return -1;
+ num = gnutls_record_recv(svr->session, buf, size);
+ if (num > 0)
+ return num;
+
+ if ((num == GNUTLS_E_AGAIN) ||
+ (num == GNUTLS_E_REHANDSHAKE) ||
+ (num == GNUTLS_E_INTERRUPTED))
+ return 0;
+
+ return -1;
}
static int
-_ecore_con_ssl_server_write_gnutls(Ecore_Con_Server *svr, unsigned char *buf, int size)
+_ecore_con_ssl_server_write_gnutls(Ecore_Con_Server *svr, unsigned char *buf,
+ int size)
{
- int num;
+ int num;
+
+ num = gnutls_record_send(svr->session, buf, size);
+ if (num > 0)
+ return num;
+
+ if ((num == GNUTLS_E_AGAIN) ||
+ (num == GNUTLS_E_REHANDSHAKE) ||
+ (num == GNUTLS_E_INTERRUPTED))
+ return 0;
- num = gnutls_record_send(svr->session, buf, size);
- if (num > 0)
- return num;
- if ((num == GNUTLS_E_AGAIN) ||
- (num == GNUTLS_E_REHANDSHAKE) ||
- (num == GNUTLS_E_INTERRUPTED))
- return 0;
- return -1;
+ return -1;
}
static void
_ecore_con_ssl_client_prepare_gnutls(Ecore_Con_Client *cl)
{
- cl->session = NULL;
- if (!_client_connected)
- cl->server->anoncred_s = NULL;
+ cl->session = NULL;
+ if (!_client_connected)
+ {
+ cl->server->anoncred_s = NULL;
+ cl->server->cert = NULL;
+ }
}
static Ecore_Con_Ssl_Error
_ecore_con_ssl_client_init_gnutls(Ecore_Con_Client *cl)
{
- const int *proto = NULL;
- gnutls_dh_params_t dh_params;
- int ret;
- const int kx[] = { GNUTLS_KX_ANON_DH, 0 };
- const int ssl3_proto[] = { GNUTLS_SSL3, 0 };
- const int tls_proto[] = {
- GNUTLS_TLS1_0,
- GNUTLS_TLS1_1,
+ const int *proto = NULL;
+ gnutls_dh_params_t dh_params;
+ int ret;
+ const int kx[] = { GNUTLS_KX_ANON_DH, 0 };
+ const int ssl3_proto[] = { GNUTLS_SSL3, 0 };
+ const int tls_proto[] = {
+ GNUTLS_TLS1_0,
+ GNUTLS_TLS1_1,
#ifdef USE_GNUTLS2
- GNUTLS_TLS1_2,
+ GNUTLS_TLS1_2,
#endif
- 0
- };
+ 0
+ };
- switch (cl->server->type & ECORE_CON_SSL)
- {
- case ECORE_CON_USE_SSL2: /* not supported because of security issues */
- return ECORE_CON_SSL_ERROR_SSL2_NOT_SUPPORTED;
- case ECORE_CON_USE_SSL3:
- proto = ssl3_proto;
- break;
- case ECORE_CON_USE_TLS:
- proto = tls_proto;
- break;
- default:
- return ECORE_CON_SSL_ERROR_NONE;
- }
+ switch (cl->server->type & ECORE_CON_SSL)
+ {
+ case ECORE_CON_USE_SSL2: /* not supported because of security issues */
+ return ECORE_CON_SSL_ERROR_SSL2_NOT_SUPPORTED;
- _client_connected++;
- if (!cl->server->anoncred_s)
- {
- gnutls_anon_allocate_server_credentials(&(cl->server->anoncred_s));
- gnutls_dh_params_init(&dh_params);
- gnutls_dh_params_generate2(dh_params, 512);
- gnutls_anon_set_server_dh_params(cl->server->anoncred_s, dh_params);
- }
+ case ECORE_CON_USE_SSL3:
+ proto = ssl3_proto;
+ break;
- gnutls_init(&(cl->session), GNUTLS_SERVER);
- gnutls_set_default_priority(cl->session);
- gnutls_credentials_set(cl->session, GNUTLS_CRD_ANON, cl->server->anoncred_s);
+ case ECORE_CON_USE_TLS:
+ proto = tls_proto;
+ break;
- gnutls_kx_set_priority(cl->session, kx);
+ default:
+ return ECORE_CON_SSL_ERROR_NONE;
+ }
- gnutls_protocol_set_priority(cl->session, proto);
+ _client_connected++;
- gnutls_dh_set_prime_bits(cl->session, 512);
+ gnutls_dh_params_init(&dh_params);
+ gnutls_dh_params_generate2(dh_params, 1024);
- gnutls_transport_set_ptr(cl->session, (gnutls_transport_ptr_t)cl->fd);
+ if ((client_cert) && (client_cert->cert) &&
+ ((cl->server->type & ECORE_CON_TYPE) & ECORE_CON_LOAD_CERT))
+ {
+ cl->server->cert = client_cert->cert;
+ client_cert->count++;
+ gnutls_certificate_set_dh_params(cl->server->cert, dh_params);
+ }
- while ((ret = gnutls_handshake(cl->session)) < 0)
- {
- if ((ret == GNUTLS_E_AGAIN) ||
- (ret == GNUTLS_E_INTERRUPTED))
- continue;
+ if ((!cl->server->anoncred_s) && (!cl->server->cert))
+ {
+ gnutls_anon_allocate_server_credentials(&(cl->server->anoncred_s));
+ gnutls_anon_set_server_dh_params(cl->server->anoncred_s, dh_params);
+ }
- _ecore_con_ssl_client_shutdown_gnutls(cl);
- return ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED;
- }
+ gnutls_init(&(cl->session), GNUTLS_SERVER);
+ gnutls_set_default_priority(cl->session);
+ if (cl->server->cert)
+ {
+ gnutls_credentials_set(cl->session,
+ GNUTLS_CRD_CERTIFICATE,
+ cl->server->cert);
+ gnutls_certificate_server_set_request(cl->session, GNUTLS_CERT_REQUEST);
+ }
+ else
+ gnutls_credentials_set(cl->session, GNUTLS_CRD_ANON,
+ cl->server->anoncred_s);
- return ECORE_CON_SSL_ERROR_NONE;
+ gnutls_kx_set_priority(cl->session, kx);
+
+ gnutls_protocol_set_priority(cl->session, proto);
+
+ gnutls_transport_set_ptr(cl->session, (gnutls_transport_ptr_t)cl->fd);
+
+ while ((ret = gnutls_handshake(cl->session)) < 0)
+ {
+ if ((ret == GNUTLS_E_AGAIN) ||
+ (ret == GNUTLS_E_INTERRUPTED))
+ continue;
+
+ _ecore_con_ssl_client_shutdown_gnutls(cl);
+ return ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED;
+ }
+
+ /* TODO: add cert verification support */
+ return ECORE_CON_SSL_ERROR_NONE;
}
static Ecore_Con_Ssl_Error
_ecore_con_ssl_client_shutdown_gnutls(Ecore_Con_Client *cl)
{
- if (cl->session)
- {
- gnutls_bye(cl->session, GNUTLS_SHUT_RDWR);
- gnutls_deinit(cl->session);
- }
- if (cl->server->anoncred_s && !--_client_connected)
- gnutls_anon_free_server_credentials(cl->server->anoncred_s);
- _ecore_con_ssl_client_prepare_gnutls(cl);
+ if (cl->session)
+ {
+ gnutls_bye(cl->session, GNUTLS_SHUT_RDWR);
+ gnutls_deinit(cl->session);
+ }
+
+ if (cl->server->anoncred_s && !--_client_connected)
+ gnutls_anon_free_server_credentials(cl->server->anoncred_s);
+
+ if (((cl->server->type & ECORE_CON_TYPE) & ECORE_CON_LOAD_CERT) &&
+ (client_cert) &&
+ (client_cert->cert) && (--client_cert->count < 1))
+ {
+ gnutls_certificate_free_credentials(client_cert->cert);
+ free(client_cert);
+ client_cert = NULL;
+ }
+
+ _ecore_con_ssl_client_prepare_gnutls(cl);
+
+ return ECORE_CON_SSL_ERROR_NONE;
+}
+
+static Eina_Bool
+_ecore_con_ssl_client_cert_add_gnutls(const char *cert_file,
+ const char *crl_file,
+ const char *key_file)
+{
+ gnutls_certificate_credentials_t cert = NULL;
+
+ if (gnutls_certificate_allocate_credentials(&cert) < 0)
+ return EINA_FALSE;
+
+ /* cert load */
+ if (gnutls_certificate_set_x509_trust_file(cert, cert_file,
+ GNUTLS_X509_FMT_PEM) < 0)
+ goto on_error;
+
+ /* private key load */
+ if (gnutls_certificate_set_x509_key_file(cert, cert_file, key_file,
+ GNUTLS_X509_FMT_PEM) < 0)
+ goto on_error;
+
+#if 0
+ //TODO: uncomment once we implement cert checking
+ if (crl_file)
+ /* CRL file load */
+ if (gnutls_certificate_set_x509_crl_mem(cert, crl_file,
+ GNUTLS_X509_FMT_PEM) < 0)
+ goto on_error;
- return ECORE_CON_SSL_ERROR_NONE;
+}
+#endif
+ if (!client_cert)
+ {
+ client_cert = malloc(sizeof(gnutls));
+ if (!client_cert)
+ return EINA_FALSE;
+ }
+ else if ((client_cert->cert) && ((--client_cert->count) < 1))
+ gnutls_certificate_free_credentials(client_cert->cert);
+
+ client_cert->cert = cert;
+ client_cert->count = 1;
+
+ return EINA_TRUE;
+
+on_error:
+ if (cert)
+ gnutls_certificate_free_credentials(cert);
+
+ return EINA_FALSE;
}
static int
-_ecore_con_ssl_client_read_gnutls(Ecore_Con_Client *cl, unsigned char *buf, int size)
+_ecore_con_ssl_client_read_gnutls(Ecore_Con_Client *cl, unsigned char *buf,
+ int size)
{
- int num;
+ int num;
+
+ num = gnutls_record_recv(cl->session, buf, size);
+ if (num > 0)
+ return num;
+
+ if ((num == GNUTLS_E_AGAIN) ||
+ (num == GNUTLS_E_REHANDSHAKE) ||
+ (num == GNUTLS_E_INTERRUPTED))
+ return 0;
- num = gnutls_record_recv(cl->session, buf, size);
- if (num > 0)
- return num;
- if ((num == GNUTLS_E_AGAIN) ||
- (num == GNUTLS_E_REHANDSHAKE) ||
- (num == GNUTLS_E_INTERRUPTED))
- return 0;
- return -1;
+ return -1;
}
static int
-_ecore_con_ssl_client_write_gnutls(Ecore_Con_Client *cl, unsigned char *buf, int size)
+_ecore_con_ssl_client_write_gnutls(Ecore_Con_Client *cl, unsigned char *buf,
+ int size)
{
- int num;
+ int num;
- num = gnutls_record_send(cl->session, buf, size);
- if (num > 0)
- return num;
- if ((num == GNUTLS_E_AGAIN) ||
- (num == GNUTLS_E_REHANDSHAKE) ||
- (num == GNUTLS_E_INTERRUPTED))
- return 0;
- return -1;
+ num = gnutls_record_send(cl->session, buf, size);
+ if (num > 0)
+ return num;
+
+ if ((num == GNUTLS_E_AGAIN) ||
+ (num == GNUTLS_E_REHANDSHAKE) ||
+ (num == GNUTLS_E_INTERRUPTED))
+ return 0;
+
+ return -1;
}
-#elif USE_OPENSSL
+#elif USE_OPENSSL && !USE_GNUTLS
/*
* OpenSSL
static Ecore_Con_Ssl_Error
_ecore_con_ssl_init_openssl(void)
{
- SSL_library_init();
- SSL_load_error_strings();
+ SSL_library_init();
+ SSL_load_error_strings();
- return ECORE_CON_SSL_ERROR_NONE;
+ return ECORE_CON_SSL_ERROR_NONE;
}
static Ecore_Con_Ssl_Error
_ecore_con_ssl_shutdown_openssl(void)
{
- // FIXME nothing to do ?
- return ECORE_CON_SSL_ERROR_NONE;
+ ERR_free_strings();
+ return ECORE_CON_SSL_ERROR_NONE;
}
static void
_ecore_con_ssl_server_prepare_openssl(Ecore_Con_Server *svr)
{
- svr->ssl = NULL;
- svr->ssl_ctx = NULL;
- svr->ssl_err = SSL_ERROR_NONE;
+ svr->ssl = NULL;
+ svr->ssl_ctx = NULL;
+ svr->ssl_err = SSL_ERROR_NONE;
}
static Ecore_Con_Ssl_Error
_ecore_con_ssl_server_init_openssl(Ecore_Con_Server *svr)
{
- switch (svr->type & ECORE_CON_SSL)
- {
- case ECORE_CON_USE_SSL2:
- /* Unsafe version of SSL */
- if (!(svr->ssl_ctx = SSL_CTX_new(SSLv2_client_method())))
- return ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED;
- break;
- case ECORE_CON_USE_SSL3:
- if (!(svr->ssl_ctx = SSL_CTX_new(SSLv3_client_method())))
- return ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED;
- break;
- case ECORE_CON_USE_TLS:
- if (!(svr->ssl_ctx = SSL_CTX_new(TLSv1_client_method())))
- return ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED;
- break;
- default:
- return ECORE_CON_SSL_ERROR_NONE;
- }
- if (!(svr->ssl = SSL_new(svr->ssl_ctx)))
- {
- SSL_CTX_free(svr->ssl_ctx);
- return ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED;
- }
+ switch (svr->type & ECORE_CON_SSL)
+ {
+ case ECORE_CON_USE_SSL2:
+ /* Unsafe version of SSL */
+ if (!(svr->ssl_ctx =
+ SSL_CTX_new(SSLv2_client_method())))
+ return
+ ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED;
+
+ break;
+
+ case ECORE_CON_USE_SSL3:
+ if (!(svr->ssl_ctx =
+ SSL_CTX_new(SSLv3_client_method())))
+ return
+ ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED;
+
+ break;
- SSL_set_fd(svr->ssl, svr->fd);
+ case ECORE_CON_USE_TLS:
+ if (!(svr->ssl_ctx =
+ SSL_CTX_new(TLSv1_client_method())))
+ return
+ ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED;
- return ECORE_CON_SSL_ERROR_NONE;
+ break;
+
+ default:
+ return ECORE_CON_SSL_ERROR_NONE;
+ }
+ if (!(svr->ssl = SSL_new(svr->ssl_ctx)))
+ {
+ SSL_CTX_free(svr->ssl_ctx);
+ return ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED;
+ }
+
+ if ((server_cert) && (server_cert->cert) &&
+ ((svr->type & ECORE_CON_TYPE) & ECORE_CON_LOAD_CERT))
+ {
+ //FIXME: just log and go on without cert if loading fails?
+ if (!SSL_CTX_use_certificate(svr->ssl_ctx, server_cert->cert))
+ ERR(
+ "ssl cert load failed: %s", ERR_reason_error_string(ERR_get_error()));
+
+ server_cert->count++;
+ }
+
+ SSL_set_fd(svr->ssl, svr->fd);
+
+ return ECORE_CON_SSL_ERROR_NONE;
+}
+
+static Eina_Bool
+_ecore_con_ssl_server_cert_add_openssl(const char *cert_file)
+{
+ FILE *fp = NULL;
+ X509 *cert = NULL;
+
+ if (!(fp = fopen(cert_file, "r")))
+ goto on_error;
+
+ if (!(cert = PEM_read_X509(fp, NULL, NULL, NULL)))
+ goto on_error;
+
+ fclose(fp);
+
+ if (!server_cert)
+ {
+ server_cert = malloc(sizeof(openssl));
+ if (!server_cert)
+ return EINA_FALSE;
+ }
+ else if ((server_cert->cert) && ((--server_cert->count) < 1))
+ X509_free(server_cert->cert);
+
+ server_cert->cert = cert;
+
+ server_cert->count = 1;
+
+ return EINA_TRUE;
+
+on_error:
+ if (fp)
+ fclose(fp);
+
+ return EINA_FALSE;
}
static Ecore_Con_Ssl_Error
_ecore_con_ssl_server_shutdown_openssl(Ecore_Con_Server *svr)
{
- if (svr->ssl)
- {
- if (!SSL_shutdown(svr->ssl))
- SSL_shutdown(svr->ssl);
- SSL_free(svr->ssl);
- }
- if (svr->ssl_ctx) SSL_CTX_free(svr->ssl_ctx);
+ if (svr->ssl)
+ {
+ if (!SSL_shutdown(svr->ssl))
+ SSL_shutdown(svr->ssl);
+
+ SSL_free(svr->ssl);
+ }
+
+ if (((svr->type & ECORE_CON_TYPE) & ECORE_CON_LOAD_CERT) &&
+ (server_cert) && (server_cert->cert) &&
+ (--server_cert->count < 1))
+ {
+ X509_free(server_cert->cert);
+ free(server_cert);
+ server_cert = NULL;
+ }
+
+ if (svr->ssl_ctx)
+ SSL_CTX_free(svr->ssl_ctx);
- _ecore_con_ssl_server_prepare_openssl(svr);
+ _ecore_con_ssl_server_prepare_openssl(svr);
- return ECORE_CON_SSL_ERROR_NONE;
+ return ECORE_CON_SSL_ERROR_NONE;
}
/* Tries to connect an Ecore_Con_Server to an SSL host.
int res, flag = 0;
if ((res = SSL_connect(svr->ssl)) == 1)
- return ECORE_CON_CONNECTED;
+ return ECORE_CON_CONNECTED;
svr->ssl_err = SSL_get_error(svr->ssl, res);
switch (svr->ssl_err)
{
- case SSL_ERROR_NONE:
- return ECORE_CON_CONNECTED;
- case SSL_ERROR_WANT_READ:
- flag = ECORE_FD_READ;
- break;
- case SSL_ERROR_WANT_WRITE:
- flag = ECORE_FD_WRITE;
- break;
- default:
- return ECORE_CON_DISCONNECTED;
+ case SSL_ERROR_NONE:
+ return ECORE_CON_CONNECTED;
+
+ case SSL_ERROR_WANT_READ:
+ flag = ECORE_FD_READ;
+ break;
+
+ case SSL_ERROR_WANT_WRITE:
+ flag = ECORE_FD_WRITE;
+ break;
+
+ default:
+ return ECORE_CON_DISCONNECTED;
}
if (svr->fd_handler && flag)
- ecore_main_fd_handler_active_set(svr->fd_handler, flag);
+ ecore_main_fd_handler_active_set(svr->fd_handler,
+ flag);
return ECORE_CON_INPROGRESS;
}
static int
-_ecore_con_ssl_server_read_openssl(Ecore_Con_Server *svr, unsigned char *buf, int size)
+_ecore_con_ssl_server_read_openssl(Ecore_Con_Server *svr, unsigned char *buf,
+ int size)
{
- int num;
+ int num;
+
+ num = SSL_read(svr->ssl, buf, size);
+ svr->ssl_err = SSL_get_error(svr->ssl, num);
+
+ if (svr->fd_handler)
+ {
+ if (svr->ssl && svr->ssl_err ==
+ SSL_ERROR_WANT_READ)
+ ecore_main_fd_handler_active_set(svr->fd_handler,
+ ECORE_FD_READ);
+ else if (svr->ssl && svr->ssl_err ==
+ SSL_ERROR_WANT_WRITE)
+ ecore_main_fd_handler_active_set(
+ svr->fd_handler,
+ ECORE_FD_WRITE);
+ }
- num = SSL_read(svr->ssl, buf, size);
- svr->ssl_err = SSL_get_error(svr->ssl, num);
+ if ((svr->ssl_err == SSL_ERROR_ZERO_RETURN) ||
+ (svr->ssl_err == SSL_ERROR_SYSCALL) ||
+ (svr->ssl_err == SSL_ERROR_SSL))
+ return -1;
- if (svr->fd_handler)
- {
- if (svr->ssl && svr->ssl_err == SSL_ERROR_WANT_READ)
- ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ);
- else if (svr->ssl && svr->ssl_err == SSL_ERROR_WANT_WRITE)
- ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_WRITE);
- }
+ if (num < 0)
+ return 0;
- if ((svr->ssl_err == SSL_ERROR_ZERO_RETURN) ||
- (svr->ssl_err == SSL_ERROR_SYSCALL) ||
- (svr->ssl_err == SSL_ERROR_SSL))
- return -1;
- if (num < 0)
- return 0;
- return num;
+ return num;
}
static int
-_ecore_con_ssl_server_write_openssl(Ecore_Con_Server *svr, unsigned char *buf, int size)
+_ecore_con_ssl_server_write_openssl(Ecore_Con_Server *svr, unsigned char *buf,
+ int size)
{
- int num;
+ int num;
+
+ num = SSL_write(svr->ssl, buf, size);
+ svr->ssl_err = SSL_get_error(svr->ssl, num);
- num = SSL_write(svr->ssl, buf, size);
- svr->ssl_err = SSL_get_error(svr->ssl, num);
+ if (svr->fd_handler)
+ {
+ if (svr->ssl && svr->ssl_err ==
+ SSL_ERROR_WANT_READ)
+ ecore_main_fd_handler_active_set(svr->fd_handler,
+ ECORE_FD_READ);
+ else if (svr->ssl && svr->ssl_err ==
+ SSL_ERROR_WANT_WRITE)
+ ecore_main_fd_handler_active_set(
+ svr->fd_handler,
+ ECORE_FD_WRITE);
+ }
- if (svr->fd_handler)
- {
- if (svr->ssl && svr->ssl_err == SSL_ERROR_WANT_READ)
- ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ);
- else if (svr->ssl && svr->ssl_err == SSL_ERROR_WANT_WRITE)
- ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_WRITE);
- }
+ if ((svr->ssl_err == SSL_ERROR_ZERO_RETURN) ||
+ (svr->ssl_err == SSL_ERROR_SYSCALL) ||
+ (svr->ssl_err == SSL_ERROR_SSL))
+ return -1;
- if ((svr->ssl_err == SSL_ERROR_ZERO_RETURN) ||
- (svr->ssl_err == SSL_ERROR_SYSCALL) ||
- (svr->ssl_err == SSL_ERROR_SSL))
- return -1;
- if (num < 0)
- return 0;
- return num;
+ if (num < 0)
+ return 0;
+
+ return num;
}
static void
_ecore_con_ssl_client_prepare_openssl(Ecore_Con_Client *cl)
{
- cl->ssl = NULL;
- cl->ssl_ctx = NULL;
- cl->ssl_err = SSL_ERROR_NONE;
+ cl->ssl = NULL;
+ cl->ssl_ctx = NULL;
+ cl->ssl_err = SSL_ERROR_NONE;
}
static Ecore_Con_Ssl_Error
_ecore_con_ssl_client_init_openssl(Ecore_Con_Client *cl)
{
- switch (cl->server->type & ECORE_CON_SSL)
- {
- case ECORE_CON_USE_SSL2:
- /* Unsafe version of SSL */
- if (!(cl->ssl_ctx = SSL_CTX_new(SSLv2_client_method())))
- return ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED;
- break;
- case ECORE_CON_USE_SSL3:
- if (!(cl->ssl_ctx = SSL_CTX_new(SSLv3_client_method())))
- return ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED;
- break;
- case ECORE_CON_USE_TLS:
- if (!(cl->ssl_ctx = SSL_CTX_new(TLSv1_client_method())))
- return ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED;
- break;
- default:
- return ECORE_CON_SSL_ERROR_NONE;
- }
- if (!(cl->ssl = SSL_new(cl->ssl_ctx)))
- {
- SSL_CTX_free(cl->ssl_ctx);
- return ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED;
- }
-
- SSL_set_fd(cl->ssl, cl->fd);
-
- return ECORE_CON_SSL_ERROR_NONE;
+ switch (cl->server->type & ECORE_CON_SSL)
+ {
+ case ECORE_CON_USE_SSL2:
+ /* Unsafe version of SSL */
+ if (!(cl->ssl_ctx =
+ SSL_CTX_new(SSLv2_client_method())))
+ return
+ ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED;
+
+ break;
+
+ case ECORE_CON_USE_SSL3:
+ if (!(cl->ssl_ctx =
+ SSL_CTX_new(SSLv3_client_method())))
+ return
+ ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED;
+
+ break;
+
+ case ECORE_CON_USE_TLS:
+ if (!(cl->ssl_ctx =
+ SSL_CTX_new(TLSv1_client_method())))
+ return
+ ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED;
+
+ break;
+
+ default:
+ return ECORE_CON_SSL_ERROR_NONE;
+ }
+ if (!(cl->ssl = SSL_new(cl->ssl_ctx)))
+ {
+ SSL_CTX_free(cl->ssl_ctx);
+ return ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED;
+ }
+
+ if ((client_cert) && (client_cert->cert) && (private_key->key) &&
+ ((cl->server->type & ECORE_CON_TYPE) & ECORE_CON_LOAD_CERT))
+ {
+ //FIXME: just log and go on without cert if loading fails?
+ if (!SSL_CTX_use_certificate(cl->server->ssl_ctx, client_cert->cert) ||
+ !SSL_CTX_use_PrivateKey(cl->server->ssl_ctx, private_key->key) ||
+ !SSL_CTX_check_private_key(cl->server->ssl_ctx))
+ ERR(
+ "ssl cert load failed: %s", ERR_reason_error_string(ERR_get_error()));
+
+ client_cert->count++;
+ private_key->count++;
+ }
+
+ SSL_set_fd(cl->ssl, cl->fd);
+
+ return ECORE_CON_SSL_ERROR_NONE;
+}
+
+
+static Eina_Bool
+_ecore_con_ssl_client_cert_add_openssl(const char *cert_file,
+ const char *crl_file,
+ const char *key_file)
+{
+ FILE *fp = NULL;
+ EVP_PKEY *privkey = NULL;
+ X509 *cert = NULL;
+
+ if (!(fp = fopen(cert_file, "r")))
+ goto on_error;
+
+ if (!(cert = PEM_read_X509(fp, NULL, NULL, NULL)))
+ goto on_error;
+
+ if (key_file)
+ {
+ fclose(fp);
+ if (!(fp = fopen(key_file, "r")))
+ goto on_error;
+ }
+
+ if (!(privkey = PEM_read_PrivateKey(fp, NULL, NULL, NULL)))
+ goto on_error;
+
+ fclose(fp);
+
+ if (!client_cert)
+ {
+ client_cert = malloc(sizeof(openssl));
+ if (!client_cert)
+ return EINA_FALSE;
+ }
+ else if ((client_cert->cert) && (--client_cert->count < 1))
+ X509_free(client_cert->cert);
+
+ if (!private_key)
+ {
+ private_key = malloc(sizeof(openssl_pkey));
+ if (!private_key) return EINA_FALSE;
+ }
+ else if ((private_key->key) && ((--private_key->count) < 1))
+ EVP_PKEY_free(private_key->key);
+
+ private_key->key = privkey;
+ client_cert->cert = cert;
+
+ private_key->count = client_cert->count = 1;
+
+ return EINA_TRUE;
+
+on_error:
+ if (fp)
+ fclose(fp);
+
+ if (cert)
+ X509_free(cert);
+
+ if (privkey)
+ EVP_PKEY_free(privkey);
+
+ return EINA_FALSE;
}
static Ecore_Con_Ssl_Error
_ecore_con_ssl_client_shutdown_openssl(Ecore_Con_Client *cl)
{
- if (cl->ssl)
- {
- if (!SSL_shutdown(cl->ssl))
- SSL_shutdown(cl->ssl);
- SSL_free(cl->ssl);
- }
- if (cl->ssl_ctx) SSL_CTX_free(cl->ssl_ctx);
+ if (cl->ssl)
+ {
+ if (!SSL_shutdown(cl->ssl))
+ SSL_shutdown(cl->ssl);
+
+ SSL_free(cl->ssl);
+ }
+
+ if (cl->ssl_ctx)
+ {
+ SSL_CTX_free(cl->ssl_ctx);
+ if (((cl->server->type & ECORE_CON_TYPE) & ECORE_CON_LOAD_CERT) &&
+ (client_cert) && (client_cert->cert) && (--client_cert->count < 1))
+ {
+ X509_free(client_cert->cert);
+ free(client_cert);
+ client_cert = NULL;
+ }
+
+ if (((cl->server->type & ECORE_CON_TYPE) & ECORE_CON_LOAD_CERT) &&
+ (private_key) && (private_key->key) && (--private_key->count < 1))
+ {
+ EVP_PKEY_free(private_key->key);
+ free(private_key);
+ private_key = NULL;
+ }
+ }
- _ecore_con_ssl_client_prepare_openssl(cl);
+ _ecore_con_ssl_client_prepare_openssl(cl);
- return ECORE_CON_SSL_ERROR_NONE;
+ return ECORE_CON_SSL_ERROR_NONE;
}
static int
-_ecore_con_ssl_client_read_openssl(Ecore_Con_Client *cl, unsigned char *buf, int size)
+_ecore_con_ssl_client_read_openssl(Ecore_Con_Client *cl, unsigned char *buf,
+ int size)
{
- int num;
+ int num;
- num = SSL_read(cl->ssl, buf, size);
- cl->ssl_err = SSL_get_error(cl->ssl, num);
+ num = SSL_read(cl->ssl, buf, size);
+ cl->ssl_err = SSL_get_error(cl->ssl, num);
- if (cl->fd_handler)
- {
- if (cl->ssl && cl->ssl_err == SSL_ERROR_WANT_READ)
- ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_READ);
- else if (cl->ssl && cl->ssl_err == SSL_ERROR_WANT_WRITE)
- ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_WRITE);
- }
+ if (cl->fd_handler)
+ {
+ if (cl->ssl && cl->ssl_err ==
+ SSL_ERROR_WANT_READ)
+ ecore_main_fd_handler_active_set(cl->fd_handler,
+ ECORE_FD_READ);
+ else if (cl->ssl && cl->ssl_err ==
+ SSL_ERROR_WANT_WRITE)
+ ecore_main_fd_handler_active_set(
+ cl->fd_handler,
+ ECORE_FD_WRITE);
+ }
+
+ if ((cl->ssl_err == SSL_ERROR_ZERO_RETURN) ||
+ (cl->ssl_err == SSL_ERROR_SYSCALL) ||
+ (cl->ssl_err == SSL_ERROR_SSL))
+ return -1;
+
+ if (num < 0)
+ return 0;
- if ((cl->ssl_err == SSL_ERROR_ZERO_RETURN) ||
- (cl->ssl_err == SSL_ERROR_SYSCALL) ||
- (cl->ssl_err == SSL_ERROR_SSL))
- return -1;
- if (num < 0)
- return 0;
- return num;
+ return num;
}
static int
-_ecore_con_ssl_client_write_openssl(Ecore_Con_Client *cl, unsigned char *buf, int size)
+_ecore_con_ssl_client_write_openssl(Ecore_Con_Client *cl, unsigned char *buf,
+ int size)
{
- int num;
+ int num;
+
+ num = SSL_write(cl->ssl, buf, size);
+ cl->ssl_err = SSL_get_error(cl->ssl, num);
+
+ if (cl->fd_handler)
+ {
+ if (cl->ssl && cl->ssl_err ==
+ SSL_ERROR_WANT_READ)
+ ecore_main_fd_handler_active_set(cl->fd_handler,
+ ECORE_FD_READ);
+ else if (cl->ssl && cl->ssl_err ==
+ SSL_ERROR_WANT_WRITE)
+ ecore_main_fd_handler_active_set(
+ cl->fd_handler,
+ ECORE_FD_WRITE);
+ }
- num = SSL_write(cl->ssl, buf, size);
- cl->ssl_err = SSL_get_error(cl->ssl, num);
+ if ((cl->ssl_err == SSL_ERROR_ZERO_RETURN) ||
+ (cl->ssl_err == SSL_ERROR_SYSCALL) ||
+ (cl->ssl_err == SSL_ERROR_SSL))
+ return -1;
- if (cl->fd_handler)
- {
- if (cl->ssl && cl->ssl_err == SSL_ERROR_WANT_READ)
- ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_READ);
- else if (cl->ssl && cl->ssl_err == SSL_ERROR_WANT_WRITE)
- ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_WRITE);
- }
+ if (num < 0)
+ return 0;
- if ((cl->ssl_err == SSL_ERROR_ZERO_RETURN) ||
- (cl->ssl_err == SSL_ERROR_SYSCALL) ||
- (cl->ssl_err == SSL_ERROR_SSL))
- return -1;
- if (num < 0)
- return 0;
- return num;
+ return num;
}
#else
static Ecore_Con_Ssl_Error
_ecore_con_ssl_init_none(void)
{
- return ECORE_CON_SSL_ERROR_NONE;
+ return ECORE_CON_SSL_ERROR_NONE;
}
static Ecore_Con_Ssl_Error
_ecore_con_ssl_shutdown_none(void)
{
- return ECORE_CON_SSL_ERROR_NONE;
+ return ECORE_CON_SSL_ERROR_NONE;
}
static void
static Ecore_Con_Ssl_Error
_ecore_con_ssl_server_init_none(Ecore_Con_Server *svr)
{
- return ECORE_CON_SSL_ERROR_NOT_SUPPORTED;
+ return ECORE_CON_SSL_ERROR_NOT_SUPPORTED;
+}
+
+static Eina_Bool
+_ecore_con_ssl_server_cert_add_none(const char *cert_file)
+{
+ return EINA_TRUE;
}
static Ecore_Con_Ssl_Error
_ecore_con_ssl_server_shutdown_none(Ecore_Con_Server *svr)
{
- return ECORE_CON_SSL_ERROR_NOT_SUPPORTED;
+ return ECORE_CON_SSL_ERROR_NOT_SUPPORTED;
}
/* Tries to connect an Ecore_Con_Server to an SSL host.
static Ecore_Con_State
_ecore_con_ssl_server_try_none(Ecore_Con_Server *svr)
{
- return ECORE_CON_DISCONNECTED;
+ return ECORE_CON_DISCONNECTED;
}
static int
-_ecore_con_ssl_server_read_none(Ecore_Con_Server *svr, unsigned char *buf, int size)
+_ecore_con_ssl_server_read_none(Ecore_Con_Server *svr, unsigned char *buf,
+ int size)
{
- return -1;
+ return -1;
}
static int
-_ecore_con_ssl_server_write_none(Ecore_Con_Server *svr, unsigned char *buf, int size)
+_ecore_con_ssl_server_write_none(Ecore_Con_Server *svr, unsigned char *buf,
+ int size)
{
- return -1;
+ return -1;
}
static void
_ecore_con_ssl_client_prepare_none(Ecore_Con_Client *cl)
{
- return;
+ return;
}
static Ecore_Con_Ssl_Error
_ecore_con_ssl_client_init_none(Ecore_Con_Client *cl)
{
- return ECORE_CON_SSL_ERROR_NOT_SUPPORTED;
+ return ECORE_CON_SSL_ERROR_NOT_SUPPORTED;
+}
+
+static Eina_Bool
+_ecore_con_ssl_client_cert_add_none(const char *cert_file,
+ const char *crl_file,
+ const char *key_file)
+{
+ return EINA_TRUE;
}
static Ecore_Con_Ssl_Error
_ecore_con_ssl_client_shutdown_none(Ecore_Con_Client *cl)
{
- return ECORE_CON_SSL_ERROR_NOT_SUPPORTED;
+ return ECORE_CON_SSL_ERROR_NOT_SUPPORTED;
}
static int
-_ecore_con_ssl_client_read_none(Ecore_Con_Client *cl, unsigned char *buf, int size)
+_ecore_con_ssl_client_read_none(Ecore_Con_Client *cl, unsigned char *buf,
+ int size)
{
- return -1;
+ return -1;
}
static int
-_ecore_con_ssl_client_write_none(Ecore_Con_Client *cl, unsigned char *buf, int size)
+_ecore_con_ssl_client_write_none(Ecore_Con_Client *cl, unsigned char *buf,
+ int size)
{
- return -1;
+ return -1;
}
#endif
/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
-/*
* For info on how to use libcurl, see:
* http://curl.haxx.se/libcurl/c/libcurl-tutorial.html
*/
int ECORE_CON_EVENT_URL_PROGRESS = 0;
#ifdef HAVE_CURL
-static int _ecore_con_url_fd_handler(void *data, Ecore_Fd_Handler *fd_handler);
-static int _ecore_con_url_perform(Ecore_Con_Url *url_con);
-static size_t _ecore_con_url_header_cb(void *ptr, size_t size, size_t nitems, void *stream);
-static size_t _ecore_con_url_data_cb(void *buffer, size_t size, size_t nitems, void *userp);
-static int _ecore_con_url_progress_cb(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow);
-static size_t _ecore_con_url_read_cb(void *ptr, size_t size, size_t nitems, void *stream);
-static void _ecore_con_event_url_free(void *data __UNUSED__, void *ev);
-static int _ecore_con_url_process_completed_jobs(Ecore_Con_Url *url_con_to_match);
-static int _ecore_con_url_idler_handler(void *data __UNUSED__);
+static Eina_Bool _ecore_con_url_fd_handler(void *data,
+ Ecore_Fd_Handler *fd_handler);
+static int _ecore_con_url_perform(Ecore_Con_Url *url_con);
+static size_t _ecore_con_url_header_cb(void *ptr, size_t size, size_t nitems,
+ void *stream);
+static size_t _ecore_con_url_data_cb(void *buffer,
+ size_t size,
+ size_t nitems,
+ void *userp);
+static int _ecore_con_url_progress_cb(void *clientp, double dltotal,
+ double dlnow, double ultotal,
+ double ulnow);
+static size_t _ecore_con_url_read_cb(void *ptr, size_t size, size_t nitems,
+ void *stream);
+static void _ecore_con_event_url_free(void *data __UNUSED__, void *ev);
+static int _ecore_con_url_process_completed_jobs(
+ Ecore_Con_Url *url_con_to_match);
+static Eina_Bool _ecore_con_url_idler_handler(void *data __UNUSED__);
static Ecore_Idler *_fd_idler_handler = NULL;
static Eina_List *_url_con_list = NULL;
struct _Ecore_Con_Url_Event
{
int type;
- void *ev;
+ void *ev;
};
-static int
+static Eina_Bool
_url_complete_idler_cb(void *data)
{
Ecore_Con_Url_Event *lev;
ecore_event_add(lev->type, lev->ev, _ecore_con_event_url_free, NULL);
free(lev);
- return 0;
+ return ECORE_CALLBACK_CANCEL;
}
static void
#ifdef HAVE_CURL
init_count++;
- if (init_count > 1) return init_count;
+ if (init_count > 1)
+ return init_count;
if (!ECORE_CON_EVENT_URL_DATA)
{
- ECORE_CON_EVENT_URL_DATA = ecore_event_type_new();
- ECORE_CON_EVENT_URL_COMPLETE = ecore_event_type_new();
- ECORE_CON_EVENT_URL_PROGRESS = ecore_event_type_new();
+ ECORE_CON_EVENT_URL_DATA = ecore_event_type_new();
+ ECORE_CON_EVENT_URL_COMPLETE = ecore_event_type_new();
+ ECORE_CON_EVENT_URL_PROGRESS = ecore_event_type_new();
}
if (!curlm)
{
- long ms;
-
- FD_ZERO(&_current_fd_set);
- if (curl_global_init(CURL_GLOBAL_NOTHING))
- {
- while (_url_con_list)
- ecore_con_url_destroy(eina_list_data_get(_url_con_list));
- return 0;
- }
-
- curlm = curl_multi_init();
- if (!curlm)
- {
- while (_url_con_list)
- ecore_con_url_destroy(eina_list_data_get(_url_con_list));
-
- init_count--;
- return 0;
- }
-
- curl_multi_timeout(curlm, &ms);
- if (ms <= 0) ms = 1000;
-
- _curl_timeout = ecore_timer_add((double) ms / 1000, _ecore_con_url_idler_handler, (void *) 0xACE);
- ecore_timer_freeze(_curl_timeout);
+ long ms;
+
+ FD_ZERO(&_current_fd_set);
+ if (curl_global_init(CURL_GLOBAL_NOTHING))
+ {
+ while (_url_con_list)
+ ecore_con_url_destroy(eina_list_data_get(_url_con_list));
+ return 0;
+ }
+
+ curlm = curl_multi_init();
+ if (!curlm)
+ {
+ while (_url_con_list)
+ ecore_con_url_destroy(eina_list_data_get(_url_con_list));
+
+ init_count--;
+ return 0;
+ }
+
+ curl_multi_timeout(curlm, &ms);
+ if (ms <= 0)
+ ms = 1000;
+
+ _curl_timeout =
+ ecore_timer_add((double)ms / 1000, _ecore_con_url_idler_handler,
+ (void *)0xACE);
+ ecore_timer_freeze(_curl_timeout);
}
+
return 1;
#else
return 0;
ecore_con_url_shutdown(void)
{
#ifdef HAVE_CURL
- if (!init_count) return 0;
+ if (!init_count)
+ return 0;
init_count--;
- if (init_count != 0) return init_count;
+ if (init_count != 0)
+ return init_count;
if (_fd_idler_handler)
- ecore_idler_del(_fd_idler_handler);
+ ecore_idler_del(_fd_idler_handler);
+
_fd_idler_handler = NULL;
if (_curl_timeout)
- ecore_timer_del(_curl_timeout);
+ ecore_timer_del(_curl_timeout);
+
_curl_timeout = NULL;
while (_url_con_list)
- ecore_con_url_destroy(eina_list_data_get(_url_con_list));
+ ecore_con_url_destroy(eina_list_data_get(_url_con_list));
if (curlm)
{
- curl_multi_cleanup(curlm);
- curlm = NULL;
+ curl_multi_cleanup(curlm);
+ curlm = NULL;
}
curl_global_cleanup();
#ifdef HAVE_CURL
Ecore_Con_Url *url_con;
- if (!init_count) return NULL;
+ if (!init_count)
+ return NULL;
url_con = calloc(1, sizeof(Ecore_Con_Url));
- if (!url_con) return NULL;
+ if (!url_con)
+ return NULL;
url_con->curl_easy = curl_easy_init();
if (!url_con->curl_easy)
{
- free(url_con);
- return NULL;
+ free(url_con);
+ return NULL;
}
ECORE_MAGIC_SET(url_con, ECORE_MAGIC_CON_URL);
ecore_con_url_url_set(url_con, url);
- curl_easy_setopt(url_con->curl_easy, CURLOPT_WRITEFUNCTION,
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_WRITEFUNCTION,
_ecore_con_url_data_cb);
curl_easy_setopt(url_con->curl_easy, CURLOPT_WRITEDATA, url_con);
- curl_easy_setopt(url_con->curl_easy, CURLOPT_PROGRESSFUNCTION,
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_PROGRESSFUNCTION,
_ecore_con_url_progress_cb);
curl_easy_setopt(url_con->curl_easy, CURLOPT_PROGRESSDATA, url_con);
- curl_easy_setopt(url_con->curl_easy, CURLOPT_NOPROGRESS, EINA_FALSE);
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_NOPROGRESS, EINA_FALSE);
- curl_easy_setopt(url_con->curl_easy, CURLOPT_HEADERFUNCTION, _ecore_con_url_header_cb);
- curl_easy_setopt(url_con->curl_easy, CURLOPT_HEADERDATA, url_con);
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_HEADERFUNCTION,
+ _ecore_con_url_header_cb);
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_HEADERDATA, url_con);
/*
* FIXME: Check that these timeouts are sensible defaults
* FIXME: Provide a means to change these timeouts
*/
curl_easy_setopt(url_con->curl_easy, CURLOPT_CONNECTTIMEOUT, 30);
- curl_easy_setopt(url_con->curl_easy, CURLOPT_TIMEOUT, 300);
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_TIMEOUT, 300);
curl_easy_setopt(url_con->curl_easy, CURLOPT_FOLLOWLOCATION, 1);
- curl_easy_setopt(url_con->curl_easy, CURLOPT_ENCODING, "gzip,deflate");
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_ENCODING, "gzip,deflate");
url_con->fd = -1;
url_con->write_fd = -1;
#ifdef HAVE_CURL
Ecore_Con_Url *url_con;
- if (!url) return NULL;
- if (!custom_request) return NULL;
+ if (!url)
+ return NULL;
+
+ if (!custom_request)
+ return NULL;
url_con = ecore_con_url_new(url);
- if (!url_con) return NULL;
+ if (!url_con)
+ return NULL;
curl_easy_setopt(url_con->curl_easy, CURLOPT_CUSTOMREQUEST, custom_request);
#ifdef HAVE_CURL
char *s;
- if (!url_con) return;
+ if (!url_con)
+ return;
+
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
{
- ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_destroy");
- return;
+ ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_destroy");
+ return;
}
ECORE_MAGIC_SET(url_con, ECORE_MAGIC_NONE);
if(url_con->fd != -1)
{
- FD_CLR(url_con->fd, &_current_fd_set);
- if (url_con->fd_handler)
- ecore_main_fd_handler_del(url_con->fd_handler);
- url_con->fd = -1;
- url_con->fd_handler = NULL;
+ FD_CLR(url_con->fd, &_current_fd_set);
+ if (url_con->fd_handler)
+ ecore_main_fd_handler_del(url_con->fd_handler);
+
+ url_con->fd = -1;
+ url_con->fd_handler = NULL;
}
if (url_con->post)
- curl_formfree(url_con->post);
+ curl_formfree(url_con->post);
+
url_con->post = NULL;
-
+
if (url_con->curl_easy)
{
- // FIXME: For an unknown reason, progress continue to arrive after destruction
- // this prevent any further call to the callback.
- curl_easy_setopt(url_con->curl_easy, CURLOPT_PROGRESSFUNCTION, NULL);
+ // FIXME: For an unknown reason, progress continue to arrive after destruction
+ // this prevent any further call to the callback.
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_PROGRESSFUNCTION, NULL);
- if (url_con->active)
- {
- url_con->active = 0;
+ if (url_con->active)
+ {
+ url_con->active = 0;
- curl_multi_remove_handle(curlm, url_con->curl_easy);
- }
- curl_easy_cleanup(url_con->curl_easy);
+ curl_multi_remove_handle(curlm, url_con->curl_easy);
+ }
+
+ curl_easy_cleanup(url_con->curl_easy);
}
+
_url_con_list = eina_list_remove(_url_con_list, url_con);
curl_slist_free_all(url_con->headers);
EINA_LIST_FREE(url_con->additional_headers, s)
- free(s);
+ free(s);
EINA_LIST_FREE(url_con->response_headers, s)
- free(s);
+ free(s);
free(url_con->url);
free(url_con);
#else
#ifdef HAVE_CURL
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
{
- ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_url_set");
- return 0;
+ ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_url_set");
+ return 0;
}
- if (url_con->active) return 0;
+ if (url_con->active)
+ return 0;
+
+ if (url_con->url)
+ free(url_con->url);
- if (url_con->url) free(url_con->url);
url_con->url = NULL;
- if (url) url_con->url = strdup(url);
+ if (url)
+ url_con->url = strdup(url);
+
if (url_con->url)
- curl_easy_setopt(url_con->curl_easy, CURLOPT_URL, url_con->url);
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_URL,
+ url_con->url);
else
- curl_easy_setopt(url_con->curl_easy, CURLOPT_URL, "");
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_URL, "");
+
return 1;
#else
return 0;
#ifdef HAVE_CURL
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
{
- ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_data_set");
- return;
+ ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_data_set");
+ return;
}
url_con->data = data;
* @see ecore_con_url_additional_headers_clear()
*/
EAPI void
-ecore_con_url_additional_header_add(Ecore_Con_Url *url_con, const char *key, const char *value)
+ecore_con_url_additional_header_add(Ecore_Con_Url *url_con, const char *key,
+ const char *value)
{
#ifdef HAVE_CURL
char *tmp;
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
{
- ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_additional_header_add");
- return;
+ ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL,
+ "ecore_con_url_additional_header_add");
+ return;
}
tmp = malloc(strlen(key) + strlen(value) + 3);
- if (!tmp) return ;
+ if (!tmp)
+ return;
+
sprintf(tmp, "%s: %s", key, value);
- url_con->additional_headers = eina_list_append(url_con->additional_headers, tmp);
+ url_con->additional_headers = eina_list_append(url_con->additional_headers,
+ tmp);
#else
return;
url_con = NULL;
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
{
- ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_additional_headers_clear");
- return;
+ ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL,
+ "ecore_con_url_additional_headers_clear");
+ return;
}
EINA_LIST_FREE(url_con->additional_headers, s)
- free(s);
+ free(s);
#else
return;
url_con = NULL;
#ifdef HAVE_CURL
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
{
- ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_data_get");
- return NULL;
+ ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_data_get");
+ return NULL;
}
return url_con->data;
}
/**
- * FIXME: To be documented.
- * @return FIXME: To be documented.
+ * FIXME
+ * Sets the @ref Ecore_Con_Url object's condition/time members.
* @ingroup Ecore_Con_Url_Group
*/
EAPI void
-ecore_con_url_time(Ecore_Con_Url *url_con, Ecore_Con_Url_Time condition, time_t tm)
+ecore_con_url_time(Ecore_Con_Url *url_con, Ecore_Con_Url_Time condition,
+ time_t tm)
{
#ifdef HAVE_CURL
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
{
- ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_time");
- return;
+ ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_time");
+ return;
}
url_con->condition = condition;
#ifdef HAVE_CURL
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
{
- ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_set");
- return ;
+ ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_set");
+ return;
}
+
url_con->write_fd = fd;
#endif
}
#ifdef HAVE_CURL
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
{
- ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_received_bytes_get");
- return -1;
+ ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL,
+ "ecore_con_url_received_bytes_get");
+ return -1;
}
return url_con->received;
* Sets url_con to use http auth, with given username and password, "safely" or not.
*
* @param url_con Connection object to perform a request on, previously created
- * with ecore_con_url_new() or ecore_con_url_custom_new().
+ * with ecore_con_url_new() or ecore_con_url_custom_new().
* @param username Username to use in authentication
* @param password Password to use in authentication
* @param safe Whether to use "safer" methods (eg, NOT http basic auth)
* @ingroup Ecore_Con_Url_Group
*/
EAPI int
-ecore_con_url_httpauth_set(Ecore_Con_Url *url_con, const char *username, const char *password, Eina_Bool safe)
+ecore_con_url_httpauth_set(Ecore_Con_Url *url_con, const char *username,
+ const char *password,
+ Eina_Bool safe)
{
#ifdef HAVE_CURL
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
{
- ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_httpauth_set");
- return 0;
+ ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL,
+ "ecore_con_url_httpauth_set");
+ return 0;
}
-# ifdef CURLOPT_USERNAME
-# ifdef CURLOPT_PASSWORD
+
+# if LIBCURL_VERSION_NUM >= 0x071301
if ((username != NULL) && (password != NULL))
{
- if (safe)
- curl_easy_setopt(url_con->curl_easy, CURLOPT_HTTPAUTH, CURLAUTH_ANYSAFE);
- else
- curl_easy_setopt(url_con->curl_easy, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
- curl_easy_setopt(url_con->curl_easy, CURLOPT_USERNAME, username);
- curl_easy_setopt(url_con->curl_easy, CURLOPT_PASSWORD, password);
+ if (safe)
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_HTTPAUTH,
+ CURLAUTH_ANYSAFE);
+ else
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
+
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_USERNAME, username);
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_PASSWORD, password);
return 1;
}
-# endif
+
# endif
#endif
return 0;
* @see ecore_con_url_response_headers_get()
*/
EAPI int
-ecore_con_url_send(Ecore_Con_Url *url_con, const void *data, size_t length, const char *content_type)
+ecore_con_url_send(Ecore_Con_Url *url_con, const void *data, size_t length,
+ const char *content_type)
{
#ifdef HAVE_CURL
Eina_List *l;
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
{
- ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_send");
- return 0;
+ ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_send");
+ return 0;
}
- if (url_con->active) return 0;
- if (!url_con->url) return 0;
+ if (url_con->active)
+ return 0;
+
+ if (!url_con->url)
+ return 0;
/* Free response headers from previous send() calls */
EINA_LIST_FREE(url_con->response_headers, s) free((char *)s);
if (data)
{
- curl_easy_setopt(url_con->curl_easy, CURLOPT_POSTFIELDS, data);
- curl_easy_setopt(url_con->curl_easy, CURLOPT_POSTFIELDSIZE, length);
-
- if (content_type && (strlen(content_type) < 200))
- {
- sprintf(tmp, "Content-type: %s", content_type);
- url_con->headers = curl_slist_append(url_con->headers, tmp);
- }
- sprintf(tmp, "Content-length: %zu", length);
- url_con->headers = curl_slist_append(url_con->headers, tmp);
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_POSTFIELDS, data);
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_POSTFIELDSIZE, length);
+
+ if (content_type && (strlen(content_type) < 200))
+ {
+ sprintf(tmp, "Content-type: %s", content_type);
+ url_con->headers = curl_slist_append(url_con->headers, tmp);
+ }
+
+ sprintf(tmp, "Content-length: %zu", length);
+ url_con->headers = curl_slist_append(url_con->headers, tmp);
}
switch (url_con->condition)
{
case ECORE_CON_URL_TIME_NONE:
- curl_easy_setopt(url_con->curl_easy, CURLOPT_TIMECONDITION,
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_TIMECONDITION,
CURL_TIMECOND_NONE);
- break;
+ break;
+
case ECORE_CON_URL_TIME_IFMODSINCE:
- curl_easy_setopt(url_con->curl_easy, CURLOPT_TIMECONDITION,
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_TIMECONDITION,
CURL_TIMECOND_IFMODSINCE);
- curl_easy_setopt(url_con->curl_easy, CURLOPT_TIMEVALUE, url_con->time);
- break;
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_TIMEVALUE, url_con->time);
+ break;
+
case ECORE_CON_URL_TIME_IFUNMODSINCE:
- curl_easy_setopt(url_con->curl_easy, CURLOPT_TIMECONDITION,
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_TIMECONDITION,
CURL_TIMECOND_IFUNMODSINCE);
- curl_easy_setopt(url_con->curl_easy, CURLOPT_TIMEVALUE, url_con->time);
- break;
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_TIMEVALUE, url_con->time);
+ break;
+
case ECORE_CON_URL_TIME_LASTMOD:
- curl_easy_setopt(url_con->curl_easy, CURLOPT_TIMECONDITION,
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_TIMECONDITION,
CURL_TIMECOND_LASTMOD);
- curl_easy_setopt(url_con->curl_easy, CURLOPT_TIMEVALUE, url_con->time);
- break;
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_TIMEVALUE, url_con->time);
+ break;
}
/* Additional headers */
EINA_LIST_FOREACH(url_con->additional_headers, l, s)
- url_con->headers = curl_slist_append(url_con->headers, s);
+ url_con->headers = curl_slist_append(url_con->headers, s);
curl_easy_setopt(url_con->curl_easy, CURLOPT_HTTPHEADER, url_con->headers);
* @ingroup Ecore_Con_Url_Group
*/
EAPI int
-ecore_con_url_ftp_upload(Ecore_Con_Url *url_con, const char *filename, const char *user, const char *pass, const char *upload_dir)
+ecore_con_url_ftp_upload(Ecore_Con_Url *url_con, const char *filename,
+ const char *user, const char *pass,
+ const char *upload_dir)
{
#ifdef HAVE_CURL
char url[4096];
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
{
- ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_ftp_upload");
- return 0;
+ ECORE_MAGIC_FAIL(url_con,
+ ECORE_MAGIC_CON_URL,
+ "ecore_con_url_ftp_upload");
+ return 0;
}
- if (url_con->active) return 0;
- if (!url_con->url) return 0;
+ if (url_con->active)
+ return 0;
+
+ if (!url_con->url)
+ return 0;
+
if (filename)
{
- char tmp[PATH_MAX];
+ char tmp[PATH_MAX];
- snprintf(tmp, PATH_MAX, "%s", filename);
+ snprintf(tmp, PATH_MAX, "%s", filename);
- if (stat(filename, &file_info)) return 0;
- fd = fopen(filename, "rb");
- if (upload_dir)
- snprintf(url, sizeof(url), "ftp://%s/%s/%s", url_con->url,
+ if (stat(filename, &file_info))
+ return 0;
+
+ fd = fopen(filename, "rb");
+ if (upload_dir)
+ snprintf(url, sizeof(url), "ftp://%s/%s/%s", url_con->url,
upload_dir, basename(tmp));
- else
- snprintf(url, sizeof(url), "ftp://%s/%s", url_con->url,
+ else
+ snprintf(url, sizeof(url), "ftp://%s/%s", url_con->url,
basename(tmp));
- snprintf(userpwd, sizeof(userpwd), "%s:%s", user, pass);
- curl_easy_setopt(url_con->curl_easy, CURLOPT_INFILESIZE_LARGE,
+
+ snprintf(userpwd, sizeof(userpwd), "%s:%s", user, pass);
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_INFILESIZE_LARGE,
(curl_off_t)file_info.st_size);
- curl_easy_setopt(url_con->curl_easy, CURLOPT_USERPWD, userpwd);
- curl_easy_setopt(url_con->curl_easy, CURLOPT_UPLOAD, 1);
- curl_easy_setopt(url_con->curl_easy, CURLOPT_READFUNCTION,
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_USERPWD, userpwd);
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_UPLOAD, 1);
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_READFUNCTION,
_ecore_con_url_read_cb);
- curl_easy_setopt(url_con->curl_easy, CURLOPT_READDATA, fd);
- ecore_con_url_url_set(url_con, url);
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_READDATA, fd);
+ ecore_con_url_url_set(url_con, url);
- return _ecore_con_url_perform(url_con);
+ return _ecore_con_url_perform(url_con);
}
else
- return 0;
+ return 0;
+
#else
return 0;
url_con = NULL;
}
/**
- * Send a Curl httppost
+ * Send a Curl httppost
* @return 1 on success, 0 on error.
* @ingroup Ecore_Con_Url_Group
*/
ecore_con_url_http_post_send(Ecore_Con_Url *url_con, void *httppost)
{
#ifdef HAVE_CURL
- if (url_con->post)
- curl_formfree(url_con->post);
- url_con->post = NULL;
+ if (url_con->post)
+ curl_formfree(url_con->post);
- if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
- {
- ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_http_post_send");
+ url_con->post = NULL;
+
+ if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
+ {
+ ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL,
+ "ecore_con_url_http_post_send");
+ return 0;
+ }
+
+ url_con->post = httppost;
+
+ if (url_con->active)
return 0;
- }
-
- url_con->post = httppost;
-
- if (url_con->active) return 0;
- if (!url_con->url) return 0;
-
- curl_easy_setopt(url_con->curl_easy, CURLOPT_HTTPPOST, httppost);
-
- return ecore_con_url_send(url_con, NULL, 0, NULL);
+
+ if (!url_con->url)
+ return 0;
+
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_HTTPPOST, httppost);
+
+ return ecore_con_url_send(url_con, NULL, 0, NULL);
#else
- return 0;
- url_con = NULL;
+ return 0;
+ url_con = NULL;
#endif
}
#ifdef HAVE_CURL
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
{
- ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_verbose_set");
- return;
+ ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL,
+ "ecore_con_url_verbose_set");
+ return;
}
- if (url_con->active) return;
- if (!url_con->url) return;
- if (verbose == EINA_TRUE)
- curl_easy_setopt(url_con->curl_easy, CURLOPT_VERBOSE, 1);
+ if (url_con->active)
+ return;
+
+ if (!url_con->url)
+ return;
+
+ if (verbose ==
+ EINA_TRUE)
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_VERBOSE,
+ 1);
else
- curl_easy_setopt(url_con->curl_easy, CURLOPT_VERBOSE, 0);
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_VERBOSE, 0);
+
#endif
}
#ifdef HAVE_CURL
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
{
- ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_ftp_use_epsv_set");
- return;
+ ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL,
+ "ecore_con_url_ftp_use_epsv_set");
+ return;
}
- if (url_con->active) return;
- if (!url_con->url) return;
- if (use_epsv == EINA_TRUE)
- curl_easy_setopt(url_con->curl_easy, CURLOPT_FTP_USE_EPSV, 1);
+ if (url_con->active)
+ return;
+
+ if (!url_con->url)
+ return;
+
+ if (use_epsv ==
+ EINA_TRUE)
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_FTP_USE_EPSV,
+ 1);
else
- curl_easy_setopt(url_con->curl_easy, CURLOPT_FTP_USE_EPSV, 0);
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_FTP_USE_EPSV, 0);
+
#endif
}
Ecore_Con_Url *url_con;
int deleted = 0;
- if (!_url_con_list) return 0;
+ if (!_url_con_list)
+ return 0;
EINA_LIST_FOREACH(_url_con_list, l, url_con)
- {
- if (url_con->active && url_con->fd_handler)
- {
- ecore_main_fd_handler_del(url_con->fd_handler);
- url_con->fd_handler = NULL;
- deleted++;
- }
- }
+ {
+ if (url_con->active && url_con->fd_handler)
+ {
+ ecore_main_fd_handler_del(url_con->fd_handler);
+ url_con->fd_handler = NULL;
+ deleted++;
+ }
+ }
return deleted;
}
Ecore_Con_Url *url_con;
int activated = 0;
- if (!_url_con_list) return 0;
+ if (!_url_con_list)
+ return 0;
EINA_LIST_FOREACH(_url_con_list, l, url_con)
- {
- if (url_con->fd_handler == NULL && url_con->fd != -1)
- {
- url_con->fd_handler =
- ecore_main_fd_handler_add(url_con->fd, url_con->flags,
- _ecore_con_url_fd_handler,
- NULL, NULL, NULL);
- activated++;
- }
- }
+ {
+ if (url_con->fd_handler == NULL && url_con->fd != -1)
+ {
+ url_con->fd_handler =
+ ecore_main_fd_handler_add(url_con->fd, url_con->flags,
+ _ecore_con_url_fd_handler,
+ NULL, NULL, NULL);
+ activated++;
+ }
+ }
return activated;
}
url_con = (Ecore_Con_Url *)userp;
- if (!url_con) return -1;
+ if (!url_con)
+ return -1;
+
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
{
- ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_data_cb");
- return -1;
+ ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_data_cb");
+ return -1;
}
url_con->received += real_size;
if (url_con->write_fd < 0)
{
- e = malloc(sizeof(Ecore_Con_Event_Url_Data) + sizeof(unsigned char) * (real_size - 1));
- if (e)
- {
- e->url_con = url_con;
- e->size = real_size;
- memcpy(e->data, buffer, real_size);
- ecore_event_add(ECORE_CON_EVENT_URL_DATA, e,
- _ecore_con_event_url_free, NULL);
- }
+ e =
+ malloc(sizeof(Ecore_Con_Event_Url_Data) + sizeof(unsigned char) *
+ (real_size - 1));
+ if (e)
+ {
+ e->url_con = url_con;
+ e->size = real_size;
+ memcpy(e->data, buffer, real_size);
+ ecore_event_add(ECORE_CON_EVENT_URL_DATA, e,
+ _ecore_con_event_url_free, NULL);
+ }
}
else
{
- ssize_t count = 0;
- size_t total_size = real_size;
- size_t offset = 0;
-
- while (total_size > 0)
- {
- count = write(url_con->write_fd, (char*) buffer + offset, total_size);
- if (count < 0)
- {
- if (errno != EAGAIN && errno != EINTR) return -1;
- }
- else
- {
- total_size -= count;
- offset += count;
- }
- }
+ ssize_t count = 0;
+ size_t total_size = real_size;
+ size_t offset = 0;
+
+ while (total_size > 0)
+ {
+ count = write(url_con->write_fd,
+ (char *)buffer + offset,
+ total_size);
+ if (count < 0)
+ {
+ if (errno != EAGAIN && errno != EINTR)
+ return -1;
+ }
+ else
+ {
+ total_size -= count;
+ offset += count;
+ }
+ }
}
return real_size;
}
#define ECORE_CON_URL_TRANSMISSION(Transmit, Event, Url_con, Total, Now) \
-{ \
- Ecore_Con_Event_Url_Progress *e; \
- if ((Total != 0) || (Now != 0)) \
- { \
- e = calloc(1, sizeof(Ecore_Con_Event_Url_Progress)); \
- if (e) \
- { \
- e->url_con = url_con; \
- e->total = Total; \
- e->now = Now; \
- ecore_event_add(Event, e, _ecore_con_event_url_free, NULL); \
- } \
- } \
-}
+ { \
+ Ecore_Con_Event_Url_Progress *e; \
+ if ((Total != 0) || (Now != 0)) \
+ { \
+ e = calloc(1, sizeof(Ecore_Con_Event_Url_Progress)); \
+ if (e) \
+ { \
+ e->url_con = url_con; \
+ e->total = Total; \
+ e->now = Now; \
+ ecore_event_add(Event, e, _ecore_con_event_url_free, NULL); \
+ } \
+ } \
+ }
static size_t
_ecore_con_url_header_cb(void *ptr, size_t size, size_t nitems, void *stream)
size_t real_size = size * nitems;
Ecore_Con_Url *url_con = stream;
- char *header = malloc(sizeof(char)*(real_size + 1));
- if (!header) return real_size;
+ char *header = malloc(sizeof(char) * (real_size + 1));
+ if (!header)
+ return real_size;
+
memcpy(header, ptr, real_size);
header[real_size] = '\0';
url_con->response_headers = eina_list_append(url_con->response_headers,
- header);
+ header);
return real_size;
}
static int
-_ecore_con_url_progress_cb(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
+_ecore_con_url_progress_cb(void *clientp, double dltotal, double dlnow,
+ double ultotal,
+ double ulnow)
{
- Ecore_Con_Event_Url_Progress *e;
+ Ecore_Con_Event_Url_Progress *e;
Ecore_Con_Url *url_con;
url_con = clientp;
e = malloc(sizeof(Ecore_Con_Event_Url_Progress));
if (e)
{
- e->url_con = url_con;
- e->down.total = dltotal;
- e->down.now = dlnow;
- e->up.total = ultotal;
- e->up.now = ulnow;
- ecore_event_add(ECORE_CON_EVENT_URL_PROGRESS, e,
+ e->url_con = url_con;
+ e->down.total = dltotal;
+ e->down.now = dlnow;
+ e->up.total = ultotal;
+ e->up.now = ulnow;
+ ecore_event_add(ECORE_CON_EVENT_URL_PROGRESS, e,
_ecore_con_event_url_free, NULL);
}
{
size_t retcode = fread(ptr, size, nitems, stream);
- if (ferror((FILE*)stream))
+ if (ferror((FILE *)stream))
{
fclose(stream);
return CURL_READFUNC_ABORT;
- }
- else if ((retcode == 0) || (retcode < nitems))
+ }
+ else if ((retcode == 0) || (retcode < nitems))
{
- fclose((FILE*)stream);
+ fclose((FILE *)stream);
return 0;
}
+
INF("*** We read %zu bytes from file", retcode);
return retcode;
}
url_con->active = 1;
curl_multi_add_handle(curlm, url_con->curl_easy);
/* This one can't be stopped, or the download never start. */
- while (curl_multi_perform(curlm, &still_running) == CURLM_CALL_MULTI_PERFORM);
+ while (curl_multi_perform(curlm, &still_running) == CURLM_CALL_MULTI_PERFORM) ;
completed_immediately = _ecore_con_url_process_completed_jobs(url_con);
if (!completed_immediately)
{
- if (url_con->fd_handler)
- ecore_main_fd_handler_del(url_con->fd_handler);
- url_con->fd_handler = NULL;
-
- /* url_con still active -- set up an fd_handler */
- FD_ZERO(&read_set);
- FD_ZERO(&write_set);
- FD_ZERO(&exc_set);
-
- /* Stupid curl, why can't I get the fd to the current added job? */
- curl_multi_fdset(curlm, &read_set, &write_set, &exc_set, &fd_max);
- for (fd = 0; fd <= fd_max; fd++)
- {
- if (!FD_ISSET(fd, &_current_fd_set))
- {
- flags = 0;
- if (FD_ISSET(fd, &read_set)) flags |= ECORE_FD_READ;
- if (FD_ISSET(fd, &write_set)) flags |= ECORE_FD_WRITE;
- if (FD_ISSET(fd, &exc_set)) flags |= ECORE_FD_ERROR;
- if (flags)
- {
- long ms = 0;
-
- curl_multi_timeout(curlm, &ms);
- if (ms == 0) ms = 1000;
-
- FD_SET(fd, &_current_fd_set);
- url_con->fd = fd;
- url_con->flags = flags;
- url_con->fd_handler =
- ecore_main_fd_handler_add(fd, flags,
- _ecore_con_url_fd_handler,
- NULL, NULL, NULL);
- break;
- }
- }
- }
- if (!url_con->fd_handler)
- {
- /* Failed to set up an fd_handler */
- ecore_timer_freeze(_curl_timeout);
- curl_multi_remove_handle(curlm, url_con->curl_easy);
- url_con->active = 0;
- url_con->fd = -1;
- return 0;
- }
- ecore_timer_thaw(_curl_timeout);
+ if (url_con->fd_handler)
+ ecore_main_fd_handler_del(url_con->fd_handler);
+
+ url_con->fd_handler = NULL;
+
+ /* url_con still active -- set up an fd_handler */
+ FD_ZERO(&read_set);
+ FD_ZERO(&write_set);
+ FD_ZERO(&exc_set);
+
+ /* Stupid curl, why can't I get the fd to the current added job? */
+ curl_multi_fdset(curlm, &read_set, &write_set, &exc_set, &fd_max);
+ for (fd = 0; fd <= fd_max; fd++)
+ {
+ if (!FD_ISSET(fd, &_current_fd_set))
+ {
+ flags = 0;
+ if (FD_ISSET(fd, &read_set))
+ flags |= ECORE_FD_READ;
+
+ if (FD_ISSET(fd, &write_set))
+ flags |= ECORE_FD_WRITE;
+
+ if (FD_ISSET(fd, &exc_set))
+ flags |= ECORE_FD_ERROR;
+
+ if (flags)
+ {
+ long ms = 0;
+
+ curl_multi_timeout(curlm, &ms);
+ if (ms == 0)
+ ms = 1000;
+
+ FD_SET(fd, &_current_fd_set);
+ url_con->fd = fd;
+ url_con->flags = flags;
+ url_con->fd_handler =
+ ecore_main_fd_handler_add(fd, flags,
+ _ecore_con_url_fd_handler,
+ NULL, NULL, NULL);
+ break;
+ }
+ }
+ }
+ if (!url_con->fd_handler)
+ {
+ /* Failed to set up an fd_handler */
+ ecore_timer_freeze(_curl_timeout);
+ curl_multi_remove_handle(curlm, url_con->curl_easy);
+ url_con->active = 0;
+ url_con->fd = -1;
+ return 0;
+ }
+
+ ecore_timer_thaw(_curl_timeout);
}
return 1;
}
-static int
+static Eina_Bool
_ecore_con_url_idler_handler(void *data)
{
double start;
start = ecore_time_get();
while (curl_multi_perform(curlm, &still_running) == CURLM_CALL_MULTI_PERFORM)
- /* make this not more than a frametime to keep interactivity high */
- if ((ecore_time_get() - start) > ecore_animator_frametime_get())
- {
- done = 0;
- break;
- }
+ /* make this not more than a frametime to keep interactivity high */
+ if ((ecore_time_get() - start) > ecore_animator_frametime_get())
+ {
+ done = 0;
+ break;
+ }
_ecore_con_url_process_completed_jobs(NULL);
if (done)
{
- _ecore_con_url_restart_fd_handler();
- _fd_idler_handler = NULL;
+ _ecore_con_url_restart_fd_handler();
+ _fd_idler_handler = NULL;
+
+ if (!_url_con_list)
+ ecore_timer_freeze(_curl_timeout);
- if (!_url_con_list)
- ecore_timer_freeze(_curl_timeout);
- return data == (void*) 0xACE ? 1 : 0;
+ return data ==
+ (void *)0xACE ? ECORE_CALLBACK_RENEW : ECORE_CALLBACK_CANCEL;
}
- return 1;
+ return ECORE_CALLBACK_RENEW;
}
-static int
-_ecore_con_url_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UNUSED__)
+static Eina_Bool
+_ecore_con_url_fd_handler(void *data __UNUSED__,
+ Ecore_Fd_Handler *fd_handler __UNUSED__)
{
_ecore_con_url_suspend_fd_handler();
if (_fd_idler_handler == NULL)
- _fd_idler_handler = ecore_idler_add(_ecore_con_url_idler_handler, NULL);
+ _fd_idler_handler = ecore_idler_add(
+ _ecore_con_url_idler_handler, NULL);
- return 1;
+ return ECORE_CALLBACK_RENEW;
}
static int
/* Loop jobs and check if any are done */
while ((curlmsg = curl_multi_info_read(curlm, &n_remaining)) != NULL)
{
- if (curlmsg->msg != CURLMSG_DONE) continue;
-
- /* find the job which is done */
- EINA_LIST_FOREACH(_url_con_list, l, url_con)
- {
- if (curlmsg->easy_handle == url_con->curl_easy)
- {
- if (url_con_to_match && (url_con == url_con_to_match))
- job_matched = 1;
- if(url_con->fd != -1)
- {
- FD_CLR(url_con->fd, &_current_fd_set);
- if (url_con->fd_handler)
- ecore_main_fd_handler_del(url_con->fd_handler);
- url_con->fd = -1;
- url_con->fd_handler = NULL;
- }
- _url_con_list = eina_list_remove(_url_con_list, url_con);
- url_con->active = 0;
- e = calloc(1, sizeof(Ecore_Con_Event_Url_Complete));
- if (e)
- {
- e->url_con = url_con;
- e->status = 0;
- if (curlmsg->data.result == CURLE_OK)
- {
- long status; /* curl API uses long, not int */
-
- status = 0;
- curl_easy_getinfo(curlmsg->easy_handle, CURLINFO_RESPONSE_CODE, &status);
- e->status = status;
- }
-
- _url_complete_push_event(ECORE_CON_EVENT_URL_COMPLETE, e);
- }
- curl_multi_remove_handle(curlm, url_con->curl_easy);
- break;
- }
- }
+ if (curlmsg->msg != CURLMSG_DONE)
+ continue;
+
+ /* find the job which is done */
+ EINA_LIST_FOREACH(_url_con_list, l, url_con)
+ {
+ if (curlmsg->easy_handle == url_con->curl_easy)
+ {
+ if (url_con_to_match &&
+ (url_con == url_con_to_match))
+ job_matched = 1;
+
+ if(url_con->fd != -1)
+ {
+ FD_CLR(url_con->fd, &_current_fd_set);
+ if (url_con->fd_handler)
+ ecore_main_fd_handler_del(
+ url_con->fd_handler);
+
+ url_con->fd = -1;
+ url_con->fd_handler = NULL;
+ }
+
+ _url_con_list = eina_list_remove(_url_con_list, url_con);
+ url_con->active = 0;
+ e = calloc(1, sizeof(Ecore_Con_Event_Url_Complete));
+ if (e)
+ {
+ e->url_con = url_con;
+ e->status = 0;
+ if (curlmsg->data.result == CURLE_OK)
+ {
+ long status; /* curl API uses long, not int */
+
+ status = 0;
+ curl_easy_getinfo(curlmsg->easy_handle,
+ CURLINFO_RESPONSE_CODE,
+ &status);
+ e->status = status;
+ }
+
+ _url_complete_push_event(ECORE_CON_EVENT_URL_COMPLETE, e);
+ }
+
+ curl_multi_remove_handle(curlm, url_con->curl_easy);
+ break;
+ }
+ }
}
return job_matched;
lib_LTLIBRARIES = libecore_config.la
-include_HEADERS = Ecore_Config.h
+includes_HEADERS = Ecore_Config.h
+includesdir = $(includedir)/ecore-@VMAJ@
libecore_config_la_LDFLAGS = -no-undefined -version-info @version_info@ @release_info@
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
/*****************************************************************************/
-static int
+static Eina_Bool
_ecore_config_ipc_client_add(void *data, int type __UNUSED__, void *event)
{
Ecore_Ipc_Server **server;
e = (Ecore_Ipc_Event_Client_Data *) event;
if (*server != ecore_ipc_client_server_get(e->client))
- return 1;
+ return EINA_TRUE;
INF("IPC/eCore: Client connected. @ %p", server);
- return 1;
+ return EINA_TRUE;
}
-static int
+static Eina_Bool
_ecore_config_ipc_client_del(void *data, int type __UNUSED__, void *event)
{
Ecore_Ipc_Server **server;
e = (Ecore_Ipc_Event_Client_Data *) event;
if (*server != ecore_ipc_client_server_get(e->client))
- return 1;
+ return EINA_TRUE;
INF("IPC/eCore: Client disconnected. @ %p", server);
- return 1;
+ return EINA_TRUE;
}
-static int
+static Eina_Bool
_ecore_config_ipc_client_sent(void *data, int type __UNUSED__, void *event)
{
Ecore_Ipc_Server **server;
e = (Ecore_Ipc_Event_Client_Data *) event;
if (*server != ecore_ipc_client_server_get(e->client))
- return 1;
+ return EINA_TRUE;
_ecore_config_ipc_ecore_handle_request(*server, e);
- return 1;
+ return EINA_TRUE;
}
/*****************************************************************************/
ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DATA,
_ecore_config_ipc_client_sent, server);
- if (server)
+ if (*server)
{
INF("IPC/eCore: Server is listening on %s.", pipe_name);
}
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
return ns ? ecore_config_bundle_serial_get(ns) : -1;
}
-static int
+static Eina_Bool
_ecore_config_ipc_poll(void *data __UNUSED__)
{
Ecore_Config_Server *s;
s = s->next;
}
- return 1;
+ return EINA_TRUE;
}
int
ret_srv = NULL;
list = NULL;
- list = malloc(sizeof(Ecore_Config_Server));
- memset(list, 0, sizeof(Ecore_Config_Server));
+ list = calloc(1, sizeof(Ecore_Config_Server));
if ((ret = _ecore_config_ipc_ecore_init(pipe_name, &list->server)) != ECORE_CONFIG_ERR_SUCC)
{
ERR("_ecore_config_ipc_init: failed to register %s, code %d",
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef EAPI
#undef EAPI
-#endif
+#endif /* ifdef EAPI */
#ifdef _MSC_VER
# ifdef BUILDING_DLL
# define EAPI __declspec(dllexport)
-# else
+# else /* ifdef BUILDING_DLL */
# define EAPI __declspec(dllimport)
-# endif
-#else
+# endif /* ifdef BUILDING_DLL */
+#else /* ifdef _MSC_VER */
# ifdef __GNUC__
# if __GNUC__ >= 4
# define EAPI __attribute__ ((visibility("default")))
-# else
+# else /* if __GNUC__ >= 4 */
# define EAPI
-# endif
-# else
+# endif /* if __GNUC__ >= 4 */
+# else /* ifdef __GNUC__ */
# define EAPI
-# endif
-#endif
-
+# endif /* ifdef __GNUC__ */
+#endif /* ifdef _MSC_VER */
#ifdef __cplusplus
extern "C" {
-#endif
+#endif /* ifdef __cplusplus */
EAPI extern int ECORE_DIRECTFB_EVENT_POSITION;
EAPI extern int ECORE_DIRECTFB_EVENT_SIZE;
EAPI extern int ECORE_DIRECTFB_EVENT_LEAVE;
EAPI extern int ECORE_DIRECTFB_EVENT_WHEEL;
-
-
#ifndef _ECORE_DIRECTFB_WINDOW_PREDEF
-typedef struct _Ecore_DirectFB_Window Ecore_DirectFB_Window;
-#endif
-typedef struct _Ecore_DirectFB_Cursor Ecore_DirectFB_Cursor;
-
-typedef struct _Ecore_DirectFB_Event_Key_Down Ecore_DirectFB_Event_Key_Down;
-typedef struct _Ecore_DirectFB_Event_Key_Up Ecore_DirectFB_Event_Key_Up;
-typedef struct _Ecore_DirectFB_Event_Button_Down Ecore_DirectFB_Event_Button_Down;
-typedef struct _Ecore_DirectFB_Event_Button_Up Ecore_DirectFB_Event_Button_Up;
-typedef struct _Ecore_DirectFB_Event_Motion Ecore_DirectFB_Event_Motion;
-typedef struct _Ecore_DirectFB_Event_Enter Ecore_DirectFB_Event_Enter;
-typedef struct _Ecore_DirectFB_Event_Leave Ecore_DirectFB_Event_Leave;
-typedef struct _Ecore_DirectFB_Event_Wheel Ecore_DirectFB_Event_Wheel;
-typedef struct _Ecore_DirectFB_Event_Got_Focus Ecore_DirectFB_Event_Got_Focus;
-typedef struct _Ecore_DirectFB_Event_Lost_Focus Ecore_DirectFB_Event_Lost_Focus;
-
+typedef struct _Ecore_DirectFB_Window Ecore_DirectFB_Window;
+#endif /* ifndef _ECORE_DIRECTFB_WINDOW_PREDEF */
+typedef struct _Ecore_DirectFB_Cursor Ecore_DirectFB_Cursor;
+
+typedef struct _Ecore_DirectFB_Event_Key_Down Ecore_DirectFB_Event_Key_Down;
+typedef struct _Ecore_DirectFB_Event_Key_Up Ecore_DirectFB_Event_Key_Up;
+typedef struct _Ecore_DirectFB_Event_Button_Down Ecore_DirectFB_Event_Button_Down;
+typedef struct _Ecore_DirectFB_Event_Button_Up Ecore_DirectFB_Event_Button_Up;
+typedef struct _Ecore_DirectFB_Event_Motion Ecore_DirectFB_Event_Motion;
+typedef struct _Ecore_DirectFB_Event_Enter Ecore_DirectFB_Event_Enter;
+typedef struct _Ecore_DirectFB_Event_Leave Ecore_DirectFB_Event_Leave;
+typedef struct _Ecore_DirectFB_Event_Wheel Ecore_DirectFB_Event_Wheel;
+typedef struct _Ecore_DirectFB_Event_Got_Focus Ecore_DirectFB_Event_Got_Focus;
+typedef struct _Ecore_DirectFB_Event_Lost_Focus Ecore_DirectFB_Event_Lost_Focus;
/* this struct is to keep windows data (id, window itself and surface) in memory as every call
* to DirectFB for this values (e.g window->GetSurface(window,&surface)) will increment the
- * reference count, then we will have to release N times the data, so better we just ask for
- them once */
+ * reference count, then we will have to release N times the data, so better we just ask for
+ them once */
struct _Ecore_DirectFB_Window
{
- DFBWindowID id;
- IDirectFBWindow *window;
- IDirectFBSurface *surface;
- Ecore_DirectFB_Cursor *cursor;
-
+ DFBWindowID id;
+ IDirectFBWindow *window;
+ IDirectFBSurface *surface;
+ Ecore_DirectFB_Cursor *cursor;
};
struct _Ecore_DirectFB_Cursor
{
- IDirectFBSurface *surface;
- int hot_x;
- int hot_y;
-
+ IDirectFBSurface *surface;
+ int hot_x;
+ int hot_y;
};
struct _Ecore_DirectFB_Event_Key_Down /** DirectFB Key Down event */
{
- char *name; /**< The name of the key that was released */
- char *string; /**< The logical symbol of the key that was pressed */
- char *key_compose; /**< The UTF-8 string conversion if any */
- unsigned int time;
- DFBWindowID win;
+ char *name; /**< The name of the key that was released */
+ char *string; /**< The logical symbol of the key that was pressed */
+ char *key_compose; /**< The UTF-8 string conversion if any */
+ unsigned int time;
+ DFBWindowID win;
};
-
+
struct _Ecore_DirectFB_Event_Key_Up /** DirectFB Key Up event */
{
- char *name; /**< The name of the key that was released */
- char *string; /**< The logical symbol of the key that was pressed */
- char *key_compose; /**< The UTF-8 string conversion if any */
- unsigned int time;
- DFBWindowID win;
+ char *name; /**< The name of the key that was released */
+ char *string; /**< The logical symbol of the key that was pressed */
+ char *key_compose; /**< The UTF-8 string conversion if any */
+ unsigned int time;
+ DFBWindowID win;
};
struct _Ecore_DirectFB_Event_Button_Down
{
- int button;
- int modifiers;
- int x, y;
- unsigned int time;
- int double_click : 1;
- int triple_click : 1;
- DFBWindowID win;
+ int button;
+ int modifiers;
+ int x, y;
+ unsigned int time;
+ int double_click : 1;
+ int triple_click : 1;
+ DFBWindowID win;
};
struct _Ecore_DirectFB_Event_Button_Up
{
- int button;
- int modifiers;
- int x, y;
- unsigned int time;
- DFBWindowID win;
+ int button;
+ int modifiers;
+ int x, y;
+ unsigned int time;
+ DFBWindowID win;
};
struct _Ecore_DirectFB_Event_Motion
{
- int modifiers;
- int x, y;
- unsigned int time;
- DFBWindowID win;
+ int modifiers;
+ int x, y;
+ unsigned int time;
+ DFBWindowID win;
};
struct _Ecore_DirectFB_Event_Enter
{
- int modifiers;
- int x, y;
- unsigned int time;
- DFBWindowID win;
+ int modifiers;
+ int x, y;
+ unsigned int time;
+ DFBWindowID win;
};
struct _Ecore_DirectFB_Event_Leave
{
- int modifiers;
- int x, y;
- unsigned int time;
- DFBWindowID win;
+ int modifiers;
+ int x, y;
+ unsigned int time;
+ DFBWindowID win;
};
struct _Ecore_DirectFB_Event_Wheel
{
- int direction;
- int z;
- int modifiers;
- unsigned int time;
- DFBWindowID win;
+ int direction;
+ int z;
+ int modifiers;
+ unsigned int time;
+ DFBWindowID win;
};
struct _Ecore_DirectFB_Event_Got_Focus
{
- unsigned int time;
- DFBWindowID win;
+ unsigned int time;
+ DFBWindowID win;
};
struct _Ecore_DirectFB_Event_Lost_Focus
{
- unsigned int time;
- DFBWindowID win;
+ unsigned int time;
+ DFBWindowID win;
};
/* main functions */
-EAPI int ecore_directfb_init(const char *name);
-EAPI int ecore_directfb_shutdown(void);
-EAPI IDirectFB * ecore_directfb_interface_get(void);
+EAPI int ecore_directfb_init(const char *name);
+EAPI int ecore_directfb_shutdown(void);
+EAPI IDirectFB * ecore_directfb_interface_get(void);
/* window operations */
-EAPI Ecore_DirectFB_Window * ecore_directfb_window_new(int x, int y, int w, int h);
-EAPI void ecore_directfb_window_free(Ecore_DirectFB_Window *window);
-EAPI void ecore_directfb_window_move(Ecore_DirectFB_Window *window, int x, int y);
-EAPI void ecore_directfb_window_resize(Ecore_DirectFB_Window *window, int w, int h);
-EAPI void ecore_directfb_window_focus(Ecore_DirectFB_Window *window);
-EAPI void ecore_directfb_window_show(Ecore_DirectFB_Window *window);
-EAPI void ecore_directfb_window_hide(Ecore_DirectFB_Window *window);
-EAPI void ecore_directfb_window_shaped_set(Ecore_DirectFB_Window *window, int set);
-EAPI void ecore_directfb_window_fullscreen_set(Ecore_DirectFB_Window *window, int set);
-EAPI void ecore_directfb_window_size_get(Ecore_DirectFB_Window *window, int *w, int *h);
-EAPI void ecore_directfb_window_cursor_show(Ecore_DirectFB_Window *window, int show);
-
-
+EAPI Ecore_DirectFB_Window * ecore_directfb_window_new(int x, int y, int w, int h);
+EAPI void ecore_directfb_window_free(Ecore_DirectFB_Window *window);
+EAPI void ecore_directfb_window_move(Ecore_DirectFB_Window *window, int x, int y);
+EAPI void ecore_directfb_window_resize(Ecore_DirectFB_Window *window, int w, int h);
+EAPI void ecore_directfb_window_focus(Ecore_DirectFB_Window *window);
+EAPI void ecore_directfb_window_show(Ecore_DirectFB_Window *window);
+EAPI void ecore_directfb_window_hide(Ecore_DirectFB_Window *window);
+EAPI void ecore_directfb_window_shaped_set(Ecore_DirectFB_Window *window, int set);
+EAPI void ecore_directfb_window_fullscreen_set(Ecore_DirectFB_Window *window, int set);
+EAPI void ecore_directfb_window_size_get(Ecore_DirectFB_Window *window, int *w, int *h);
+EAPI void ecore_directfb_window_cursor_show(Ecore_DirectFB_Window *window, int show);
#ifdef __cplusplus
}
-#endif
+#endif /* ifdef __cplusplus */
-#endif
+#endif /* ifndef _ECORE_DIRECTFB_H */
if BUILD_ECORE_DIRECTFB
lib_LTLIBRARIES = libecore_directfb.la
-include_HEADERS = \
-Ecore_DirectFB.h
+includes_HEADERS = Ecore_DirectFB.h
+includesdir = $(includedir)/ecore-@VMAJ@
libecore_directfb_la_SOURCES = \
ecore_directfb.c \
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#include <stdio.h>
#include <string.h>
/* with this you can create windows of directfb and handle events through ecore
* TODO:
* - handle all event types
- * -
+ * -
* */
int _ecore_directfb_log_dom = -1;
-
static int _ecore_directfb_init_count = 0;
static int _window_event_fd = 0;
EAPI int ECORE_DIRECTFB_EVENT_LEAVE = 0;
EAPI int ECORE_DIRECTFB_EVENT_WHEEL = 0;
-
static Ecore_Fd_Handler *_window_event_fd_handler_handle = NULL;
static Ecore_Fd_Handler *_input_event_fd_handler_handle = NULL;
/* this hash is to store all the possible key names for fast lookup */
static Eina_Hash *_ecore_directfb_key_symbols_hash = NULL;
-
-static IDirectFB *_dfb = NULL; // the main interface
-static IDirectFBEventBuffer *_window_event; // the main event buffer (all windows are attached to this)
-static IDirectFBEventBuffer *_input_event; // the main event buffer (all windows are attached to this)
-static IDirectFBDisplayLayer *_layer; // the main layer
-static DFBResult _err; // usefull for DFBCHECK
-
+static IDirectFB *_dfb = NULL; // the main interface
+static IDirectFBEventBuffer *_window_event; // the main event buffer (all windows are attached to this)
+static IDirectFBEventBuffer *_input_event; // the main event buffer (all windows are attached to this)
+static IDirectFBDisplayLayer *_layer; // the main layer
+static DFBResult _err; // usefull for DFBCHECK
/*******************/
/* local functions */
/* free ecore directfb events functions */
/****************************************/
-static void
+static void
_ecore_directfb_event_free_key_down(void *data __UNUSED__, void *ev)
{
Ecore_DirectFB_Event_Key_Up *e;
-
+
e = ev;
- if(e->name) free(e->name);
- if (e->string) free(e->string);
- if (e->key_compose) free(e->key_compose);
+ if(e->name)
+ free(e->name);
+
+ if (e->string)
+ free(e->string);
+
+ if (e->key_compose)
+ free(e->key_compose);
+
free(e);
-}
+} /* _ecore_directfb_event_free_key_down */
static void
_ecore_directfb_event_free_key_up(void *data __UNUSED__, void *ev)
{
Ecore_DirectFB_Event_Key_Up *e;
-
+
e = ev;
- if(e->name) free(e->name);
- if (e->string) free(e->string);
- if (e->key_compose) free(e->key_compose);
- free(e);
-}
+ if(e->name)
+ free(e->name);
+
+ if (e->string)
+ free(e->string);
+
+ if (e->key_compose)
+ free(e->key_compose);
+ free(e);
+} /* _ecore_directfb_event_free_key_up */
/* directfb window input events handler */
/****************************************/
static void
_ecore_directfb_event_handle_motion(DFBEvent *evt)
{
+ Ecore_DirectFB_Event_Motion *e;
+ e = calloc(1, sizeof(Ecore_DirectFB_Event_Motion));
+
+ switch(evt->clazz)
+ {
+ case DFEC_INPUT:
+ e->modifiers = 0;
+ switch(evt->input.axis)
+ {
+ case DIAI_X:
+ e->x = _cursor_x = evt->input.axisabs;
+ e->y = _cursor_y;
+ break;
+
+ case DIAI_Y:
+ e->y = _cursor_y = evt->input.axisabs;
+ e->x = _cursor_x;
+ break;
+
+ case DIAI_Z:
+ //_ecore_directfb_event_handle_wheel(evt);
+ return;
+
+ default:
+ return;
+ } /* switch */
+ e->win = _ecore_directfb_fullscreen_window_id;
+ e->time = 0;
+ break;
+
+ case DFEC_WINDOW:
+ e->modifiers = 0;
+ e->x = evt->window.x;
+ e->y = evt->window.y;
+ e->win = evt->window.window_id;
+ e->time = 0;
+ break;
+
+ default:
+ break;
+ } /* switch */
+ ecore_event_add(ECORE_DIRECTFB_EVENT_MOTION, e, NULL, NULL);
+} /* _ecore_directfb_event_handle_motion */
- Ecore_DirectFB_Event_Motion *e;
- e = calloc(1, sizeof(Ecore_DirectFB_Event_Motion));
-
- switch(evt->clazz)
- {
- case DFEC_INPUT:
- e->modifiers = 0;
- switch(evt->input.axis)
- {
- case DIAI_X:
- e->x = _cursor_x = evt->input.axisabs;
- e->y = _cursor_y;
- break;
- case DIAI_Y:
- e->y = _cursor_y = evt->input.axisabs;
- e->x = _cursor_x;
- break;
- case DIAI_Z:
- //_ecore_directfb_event_handle_wheel(evt);
- return;
- default:
- return;
- }
- e->win = _ecore_directfb_fullscreen_window_id;
- e->time = 0;
- break;
-
- case DFEC_WINDOW:
- e->modifiers = 0;
- e->x = evt->window.x;
- e->y = evt->window.y;
- e->win = evt->window.window_id;
- e->time = 0;
- break;
- default:
- break;
- }
- ecore_event_add(ECORE_DIRECTFB_EVENT_MOTION, e, NULL, NULL);
-}
static void
_ecore_directfb_event_handle_key_down(DFBEvent *evt)
{
+ Ecore_DirectFB_Event_Key_Down *e;
+ unsigned int key_symbol;
+ struct keymap *k;
+
+ e = calloc(1, sizeof(Ecore_DirectFB_Event_Key_Down));
+
+ switch(evt->clazz)
+ {
+ case DFEC_INPUT:
+ key_symbol = evt->input.key_symbol;
+ k = eina_hash_find(_ecore_directfb_key_symbols_hash, &key_symbol);
+
+ if(!k)
+ {
+ ERR("Symbol %0X of class DFEC_INPUT not found.", evt->input.key_symbol);
+ return;
+ }
+
+ e->name = strdup(k->name);
+ e->string = strdup(k->string);
+ e->key_compose = NULL;
+ e->win = _ecore_directfb_fullscreen_window_id;
+ e->time = 0;
+ break;
+
+ case DFEC_WINDOW:
+ key_symbol = evt->window.key_symbol;
+ k = eina_hash_find(_ecore_directfb_key_symbols_hash, &key_symbol);
+
+ if(!k)
+ {
+ ERR("Symbol %0X of class DFEC_WINDOW not found.", evt->window.key_symbol);
+ return;
+ }
+
+ e->name = strdup(k->name);
+ e->string = strdup(k->string);
+ e->key_compose = NULL;
+ e->win = evt->window.window_id;
+ e->time = 0;
+ break;
+
+ default:
+ break;
+ } /* switch */
+
+ ecore_event_add(ECORE_DIRECTFB_EVENT_KEY_DOWN, e, _ecore_directfb_event_free_key_down, NULL);
+} /* _ecore_directfb_event_handle_key_down */
- Ecore_DirectFB_Event_Key_Down *e;
- unsigned int key_symbol;
- struct keymap *k;
-
- e = calloc(1, sizeof(Ecore_DirectFB_Event_Key_Down));
-
- switch(evt->clazz)
- {
- case DFEC_INPUT:
- key_symbol = evt->input.key_symbol;
- k = eina_hash_find(_ecore_directfb_key_symbols_hash, &key_symbol);
-
- if(!k)
- {
- ERR("error en el numero, %0X", evt->input.key_symbol);
- return;
- }
- e->name = strdup(k->name);
- e->string = strdup(k->string);
- e->key_compose = NULL;
- e->win = _ecore_directfb_fullscreen_window_id;
- e->time = 0;
- break;
-
- case DFEC_WINDOW:
- key_symbol = evt->window.key_symbol;
- k = eina_hash_find(_ecore_directfb_key_symbols_hash, &key_symbol);
-
- if(!k)
- {
- ERR("error en el numero, %0X", evt->window.key_symbol);
- return;
- }
- e->name = strdup(k->name);
- e->string = strdup(k->string);
- e->key_compose = NULL;
- e->win = evt->window.window_id;
- e->time = 0;
- break;
- default:
- break;
- }
-
- ecore_event_add(ECORE_DIRECTFB_EVENT_KEY_DOWN, e, _ecore_directfb_event_free_key_down, NULL);
-}
static void
_ecore_directfb_event_handle_key_up(DFBEvent *evt)
{
- Ecore_DirectFB_Event_Key_Up *e;
- unsigned int key_symbol;
- struct keymap *k;
-
- e = calloc(1, sizeof(Ecore_DirectFB_Event_Key_Up));
-
- switch(evt->clazz)
- {
- case DFEC_INPUT:
- key_symbol = evt->input.key_symbol;
- k = eina_hash_find(_ecore_directfb_key_symbols_hash, &key_symbol);
-
-
- if(!k)
- {
- ERR("error en el numero, %0X", evt->input.key_symbol);
- return;
- }
- e->name = strdup(k->name);
- e->string = strdup(k->string);
- e->key_compose = NULL;
- e->win = _ecore_directfb_fullscreen_window_id;
- e->time = 0;
- break;
-
- case DFEC_WINDOW:
- key_symbol = evt->window.key_symbol;
- k = eina_hash_find(_ecore_directfb_key_symbols_hash, &key_symbol);
-
- if(!k)
- {
- ERR("error en el numero, %0X", evt->window.key_symbol);
- return;
- }
- e->name = strdup(k->name);
- e->string = strdup(k->string);
- e->key_compose = NULL;
- e->win = evt->window.window_id;
- e->time = 0;
- break;
- default:
- break;
- }
- ecore_event_add(ECORE_DIRECTFB_EVENT_KEY_UP, e, _ecore_directfb_event_free_key_up, NULL);
-
-}
+ Ecore_DirectFB_Event_Key_Up *e;
+ unsigned int key_symbol;
+ struct keymap *k;
+
+ e = calloc(1, sizeof(Ecore_DirectFB_Event_Key_Up));
+
+ switch(evt->clazz)
+ {
+ case DFEC_INPUT:
+ key_symbol = evt->input.key_symbol;
+ k = eina_hash_find(_ecore_directfb_key_symbols_hash, &key_symbol);
+
+ if(!k)
+ {
+ ERR("Symbol %0X of class DFEC_INPUT not found.", evt->input.key_symbol);
+ return;
+ }
+
+ e->name = strdup(k->name);
+ e->string = strdup(k->string);
+ e->key_compose = NULL;
+ e->win = _ecore_directfb_fullscreen_window_id;
+ e->time = 0;
+ break;
+
+ case DFEC_WINDOW:
+ key_symbol = evt->window.key_symbol;
+ k = eina_hash_find(_ecore_directfb_key_symbols_hash, &key_symbol);
+
+ if(!k)
+ {
+ ERR("Symbol %0X of class DFEC_WINDOW not found.", evt->window.key_symbol);
+ return;
+ }
+
+ e->name = strdup(k->name);
+ e->string = strdup(k->string);
+ e->key_compose = NULL;
+ e->win = evt->window.window_id;
+ e->time = 0;
+ break;
+
+ default:
+ break;
+ } /* switch */
+ ecore_event_add(ECORE_DIRECTFB_EVENT_KEY_UP, e, _ecore_directfb_event_free_key_up, NULL);
+} /* _ecore_directfb_event_handle_key_up */
static void
_ecore_directfb_event_handle_button_down(DFBEvent *evt)
{
- Ecore_DirectFB_Event_Button_Down *e;
- e = calloc(1, sizeof(Ecore_DirectFB_Event_Button_Down));
-
- switch(evt->clazz)
- {
- case DFEC_INPUT:
- e->button = evt->input.button + 1;
- e->modifiers = 0;
- DFBCHECK(_layer->GetCursorPosition(_layer,&e->x,&e->y));
- e->x = _cursor_x;
- e->y = _cursor_y;
- e->win = _ecore_directfb_fullscreen_window_id;
- e->time = 0;
-
- break;
-
- case DFEC_WINDOW:
- e->button = evt->window.button + 1;
- e->modifiers = 0;
- e->x = evt->window.x;
- e->y = evt->window.y;
- e->win = evt->window.window_id;
- e->time = 0;
- break;
- default:
- break;
- }
-
- ecore_event_add(ECORE_DIRECTFB_EVENT_BUTTON_DOWN, e, NULL, NULL);
-
-}
+ Ecore_DirectFB_Event_Button_Down *e;
+ e = calloc(1, sizeof(Ecore_DirectFB_Event_Button_Down));
+
+ switch(evt->clazz)
+ {
+ case DFEC_INPUT:
+ e->button = evt->input.button + 1;
+ e->modifiers = 0;
+ DFBCHECK(_layer->GetCursorPosition(_layer,&e->x,&e->y));
+ e->x = _cursor_x;
+ e->y = _cursor_y;
+ e->win = _ecore_directfb_fullscreen_window_id;
+ e->time = 0;
+
+ break;
+
+ case DFEC_WINDOW:
+ e->button = evt->window.button + 1;
+ e->modifiers = 0;
+ e->x = evt->window.x;
+ e->y = evt->window.y;
+ e->win = evt->window.window_id;
+ e->time = 0;
+ break;
+
+ default:
+ break;
+ } /* switch */
+
+ ecore_event_add(ECORE_DIRECTFB_EVENT_BUTTON_DOWN, e, NULL, NULL);
+} /* _ecore_directfb_event_handle_button_down */
static void
_ecore_directfb_event_handle_button_up(DFBEvent *evt)
{
- Ecore_DirectFB_Event_Button_Up *e;
- e = calloc(1, sizeof(Ecore_DirectFB_Event_Button_Up));
-
- switch(evt->clazz)
- {
- case DFEC_INPUT:
- e->button = evt->input.button + 1;
- e->modifiers = 0;
- e->x = _cursor_x;
- e->y = _cursor_y;
- e->win = _ecore_directfb_fullscreen_window_id;
- e->time = 0;
-
- break;
-
- case DFEC_WINDOW:
- e->button = evt->window.button + 1;
- e->modifiers = 0;
- e->x = evt->window.x;
- e->y = evt->window.y;
- e->win = evt->window.window_id;
- e->time = 0;
- break;
- default:
- break;
- }
- ecore_event_add(ECORE_DIRECTFB_EVENT_BUTTON_UP, e, NULL, NULL);
-
-}
+ Ecore_DirectFB_Event_Button_Up *e;
+ e = calloc(1, sizeof(Ecore_DirectFB_Event_Button_Up));
+
+ switch(evt->clazz)
+ {
+ case DFEC_INPUT:
+ e->button = evt->input.button + 1;
+ e->modifiers = 0;
+ e->x = _cursor_x;
+ e->y = _cursor_y;
+ e->win = _ecore_directfb_fullscreen_window_id;
+ e->time = 0;
+
+ break;
+
+ case DFEC_WINDOW:
+ e->button = evt->window.button + 1;
+ e->modifiers = 0;
+ e->x = evt->window.x;
+ e->y = evt->window.y;
+ e->win = evt->window.window_id;
+ e->time = 0;
+ break;
+
+ default:
+ break;
+ } /* switch */
+ ecore_event_add(ECORE_DIRECTFB_EVENT_BUTTON_UP, e, NULL, NULL);
+} /* _ecore_directfb_event_handle_button_up */
static void
_ecore_directfb_event_handle_enter(DFBWindowEvent *evt)
{
- Ecore_DirectFB_Event_Enter *e;
- e = calloc(1, sizeof(Ecore_DirectFB_Event_Enter));
+ Ecore_DirectFB_Event_Enter *e;
+ e = calloc(1, sizeof(Ecore_DirectFB_Event_Enter));
- e->modifiers = 0;
- e->x = evt->x;
- e->y = evt->y;
- e->win = evt->window_id;
- e->time = 0;
-
- ecore_event_add(ECORE_DIRECTFB_EVENT_ENTER, e, NULL, NULL);
+ e->modifiers = 0;
+ e->x = evt->x;
+ e->y = evt->y;
+ e->win = evt->window_id;
+ e->time = 0;
-}
+ ecore_event_add(ECORE_DIRECTFB_EVENT_ENTER, e, NULL, NULL);
+} /* _ecore_directfb_event_handle_enter */
static void
_ecore_directfb_event_handle_leave(DFBWindowEvent *evt)
{
- Ecore_DirectFB_Event_Leave *e;
- e = calloc(1, sizeof(Ecore_DirectFB_Event_Leave));
+ Ecore_DirectFB_Event_Leave *e;
+ e = calloc(1, sizeof(Ecore_DirectFB_Event_Leave));
- e->modifiers = 0;
- e->x = evt->x;
- e->y = evt->y;
- e->win = evt->window_id;
- e->time = 0;
-
- ecore_event_add(ECORE_DIRECTFB_EVENT_LEAVE, e, NULL, NULL);
+ e->modifiers = 0;
+ e->x = evt->x;
+ e->y = evt->y;
+ e->win = evt->window_id;
+ e->time = 0;
-}
+ ecore_event_add(ECORE_DIRECTFB_EVENT_LEAVE, e, NULL, NULL);
+} /* _ecore_directfb_event_handle_leave */
static void
_ecore_directfb_event_handle_wheel(DFBWindowEvent *evt)
{
- Ecore_DirectFB_Event_Wheel *e;
- e = calloc(1, sizeof(Ecore_DirectFB_Event_Wheel));
+ Ecore_DirectFB_Event_Wheel *e;
+ e = calloc(1, sizeof(Ecore_DirectFB_Event_Wheel));
- // currently there's no direction (only up/down);
- e->direction = 0;
- e->z = evt->step;
- e->modifiers = 0;
- e->win = evt->window_id;
- e->time = 0;
-
- ecore_event_add(ECORE_DIRECTFB_EVENT_WHEEL, e, NULL, NULL);
+ // currently there's no direction (only up/down);
+ e->direction = 0;
+ e->z = evt->step;
+ e->modifiers = 0;
+ e->win = evt->window_id;
+ e->time = 0;
-}
+ ecore_event_add(ECORE_DIRECTFB_EVENT_WHEEL, e, NULL, NULL);
+} /* _ecore_directfb_event_handle_wheel */
static void
_ecore_directfb_event_handle_got_focus(DFBWindowEvent *evt)
{
- Ecore_DirectFB_Event_Got_Focus *e;
- e = calloc(1, sizeof(Ecore_DirectFB_Event_Got_Focus));
+ Ecore_DirectFB_Event_Got_Focus *e;
+ e = calloc(1, sizeof(Ecore_DirectFB_Event_Got_Focus));
- e->win = evt->window_id;
- e->time = 0;
-
- ecore_event_add(ECORE_DIRECTFB_EVENT_GOT_FOCUS, e, NULL, NULL);
+ e->win = evt->window_id;
+ e->time = 0;
-}
+ ecore_event_add(ECORE_DIRECTFB_EVENT_GOT_FOCUS, e, NULL, NULL);
+} /* _ecore_directfb_event_handle_got_focus */
static void
_ecore_directfb_event_handle_lost_focus(DFBWindowEvent *evt)
{
- Ecore_DirectFB_Event_Lost_Focus *e;
- e = calloc(1, sizeof(Ecore_DirectFB_Event_Lost_Focus));
+ Ecore_DirectFB_Event_Lost_Focus *e;
+ e = calloc(1, sizeof(Ecore_DirectFB_Event_Lost_Focus));
- e->win = evt->window_id;
- e->time = 0;
-
- ecore_event_add(ECORE_DIRECTFB_EVENT_LOST_FOCUS, e, NULL, NULL);
-
-}
+ e->win = evt->window_id;
+ e->time = 0;
+ ecore_event_add(ECORE_DIRECTFB_EVENT_LOST_FOCUS, e, NULL, NULL);
+} /* _ecore_directfb_event_handle_lost_focus */
/* inputs and windows fds handlers */
/***********************************/
* in fullscreen theres no window_id so get the id from a global var (only one fullscreen
* window at a time */
-
-static int
+static Eina_Bool
_ecore_directfb_input_event_fd_handler(void *data __UNUSED__,Ecore_Fd_Handler *fd_handler __UNUSED__)
{
- DFBEvent evt;
- int v = 0;
-
- v = read(_input_event_fd, &evt, sizeof(DFBEvent));
- if (v < 0) return 1;
- if (v < 1) return 1;
-
- /* we are getting duplicate events, only parse if we are in fullscreen */
- //if(_ecore_directfb_fullscreen_window_id == 0) break;
- if(evt.input.type == DIET_KEYPRESS)
- _ecore_directfb_event_handle_key_down(&evt);
- if(evt.input.type == DIET_KEYRELEASE)
- _ecore_directfb_event_handle_key_up(&evt);
- if(evt.input.type == DIET_BUTTONPRESS)
- _ecore_directfb_event_handle_button_down(&evt);
- if(evt.input.type == DIET_BUTTONRELEASE)
- _ecore_directfb_event_handle_button_up(&evt);
- if(evt.input.type == DIET_AXISMOTION)
- _ecore_directfb_event_handle_motion(&evt);
-
- return 1;
-}
-
-static int
+ DFBEvent evt;
+ int v = 0;
+
+ v = read(_input_event_fd, &evt, sizeof(DFBEvent));
+ if (v < 0)
+ return EINA_TRUE;
+
+ if (v < 1)
+ return EINA_TRUE;
+
+ /* we are getting duplicate events, only parse if we are in fullscreen */
+ //if(_ecore_directfb_fullscreen_window_id == 0) break;
+ if(evt.input.type == DIET_KEYPRESS)
+ _ecore_directfb_event_handle_key_down(&evt);
+
+ if(evt.input.type == DIET_KEYRELEASE)
+ _ecore_directfb_event_handle_key_up(&evt);
+
+ if(evt.input.type == DIET_BUTTONPRESS)
+ _ecore_directfb_event_handle_button_down(&evt);
+
+ if(evt.input.type == DIET_BUTTONRELEASE)
+ _ecore_directfb_event_handle_button_up(&evt);
+
+ if(evt.input.type == DIET_AXISMOTION)
+ _ecore_directfb_event_handle_motion(&evt);
+
+ return EINA_TRUE;
+} /* _ecore_directfb_input_event_fd_handler */
+
+static Eina_Bool
_ecore_directfb_window_event_fd_handler(void *data __UNUSED__,Ecore_Fd_Handler *fd_handler __UNUSED__)
{
- DFBEvent evt;
- int v = 0;
-
- v = read(_window_event_fd, &evt, sizeof(DFBEvent));
- if (v < 0) return 1;
- if (v < 1) return 1;
-
- if(evt.window.type & DWET_POSITION)
- INF("position");
- if(evt.window.type & DWET_SIZE)
- INF("size");
- if(evt.window.type & DWET_CLOSE)
- INF("close");
- if(evt.window.type & DWET_DESTROYED)
- INF("destroyed");
- if(evt.window.type & DWET_GOTFOCUS)
- _ecore_directfb_event_handle_got_focus(&evt.window);
- if(evt.window.type & DWET_LOSTFOCUS)
- _ecore_directfb_event_handle_lost_focus(&evt.window);
- if(evt.window.type & DWET_KEYDOWN)
- _ecore_directfb_event_handle_key_down(&evt);
- if(evt.window.type & DWET_KEYUP)
- _ecore_directfb_event_handle_key_up(&evt);
- if(evt.window.type & DWET_BUTTONDOWN)
- _ecore_directfb_event_handle_button_down(&evt);
- if(evt.window.type & DWET_BUTTONUP)
- _ecore_directfb_event_handle_button_up(&evt);
- if(evt.window.type & DWET_MOTION)
- _ecore_directfb_event_handle_motion(&evt);
- if(evt.window.type & DWET_ENTER)
- _ecore_directfb_event_handle_enter(&evt.window);
- if(evt.window.type & DWET_LEAVE)
- _ecore_directfb_event_handle_leave(&evt.window);
- if(evt.window.type & DWET_WHEEL)
- _ecore_directfb_event_handle_wheel(&evt.window);
- return 1;
-}
-
+ DFBEvent evt;
+ int v = 0;
+
+ v = read(_window_event_fd, &evt, sizeof(DFBEvent));
+ if (v < 0)
+ return EINA_TRUE;
+
+ if (v < 1)
+ return EINA_TRUE;
+
+ if(evt.window.type & DWET_POSITION)
+ INF("position");
+
+ if(evt.window.type & DWET_SIZE)
+ INF("size");
+
+ if(evt.window.type & DWET_CLOSE)
+ INF("close");
+
+ if(evt.window.type & DWET_DESTROYED)
+ INF("destroyed");
+
+ if(evt.window.type & DWET_GOTFOCUS)
+ _ecore_directfb_event_handle_got_focus(&evt.window);
+
+ if(evt.window.type & DWET_LOSTFOCUS)
+ _ecore_directfb_event_handle_lost_focus(&evt.window);
+
+ if(evt.window.type & DWET_KEYDOWN)
+ _ecore_directfb_event_handle_key_down(&evt);
+
+ if(evt.window.type & DWET_KEYUP)
+ _ecore_directfb_event_handle_key_up(&evt);
+
+ if(evt.window.type & DWET_BUTTONDOWN)
+ _ecore_directfb_event_handle_button_down(&evt);
+
+ if(evt.window.type & DWET_BUTTONUP)
+ _ecore_directfb_event_handle_button_up(&evt);
+
+ if(evt.window.type & DWET_MOTION)
+ _ecore_directfb_event_handle_motion(&evt);
+
+ if(evt.window.type & DWET_ENTER)
+ _ecore_directfb_event_handle_enter(&evt.window);
+
+ if(evt.window.type & DWET_LEAVE)
+ _ecore_directfb_event_handle_leave(&evt.window);
+
+ if(evt.window.type & DWET_WHEEL)
+ _ecore_directfb_event_handle_wheel(&evt.window);
+
+ return EINA_TRUE;
+} /* _ecore_directfb_window_event_fd_handler */
+
/* api functions */
/*****************/
-
EAPI IDirectFB *
ecore_directfb_interface_get(void)
{
- return _dfb;
-}
-
-
+ return _dfb;
+} /* ecore_directfb_interface_get */
EAPI Ecore_DirectFB_Window *
ecore_directfb_window_new(int x, int y, int w, int h)
{
- Ecore_DirectFB_Window *window;
- IDirectFBWindow *dfb_window;
- IDirectFBSurface *dfb_surface = NULL;
- DFBWindowDescription desc;
- DFBWindowID id;
-
- memset(&desc, 0, sizeof(DFBWindowDescription));
- desc.flags = (DWDESC_POSX | DWDESC_POSY | DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_CAPS);
- desc.posx = x;
- desc.posy = y;
- desc.width = w;
- desc.height = h;
- desc.caps = DWCAPS_ALPHACHANNEL;
-
- DFBCHECK(_layer->CreateWindow(_layer, &desc, &dfb_window));
-
- dfb_window->AttachEventBuffer(dfb_window, _window_event);
- dfb_window->SetOptions(dfb_window,DWOP_NONE);
- dfb_window->SetOpacity(dfb_window, 0xFF);
-
- DFBCHECK(dfb_window->GetID(dfb_window, &id));
- DFBCHECK(dfb_window->GetSurface(dfb_window,&dfb_surface));
-
- window = malloc(sizeof(Ecore_DirectFB_Window));
- window->id = id;
- window->window = dfb_window;
- window->surface = dfb_surface;
- window->cursor = NULL;
-
- return window;
-}
+ Ecore_DirectFB_Window *window;
+ IDirectFBWindow *dfb_window;
+ IDirectFBSurface *dfb_surface = NULL;
+ DFBWindowDescription desc;
+ DFBWindowID id;
+
+ memset(&desc, 0, sizeof(DFBWindowDescription));
+ desc.flags = (DWDESC_POSX | DWDESC_POSY | DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_CAPS);
+ desc.posx = x;
+ desc.posy = y;
+ desc.width = w;
+ desc.height = h;
+ desc.caps = DWCAPS_ALPHACHANNEL;
+
+ DFBCHECK(_layer->CreateWindow(_layer, &desc, &dfb_window));
+
+ dfb_window->AttachEventBuffer(dfb_window, _window_event);
+ dfb_window->SetOptions(dfb_window,DWOP_NONE);
+ dfb_window->SetOpacity(dfb_window, 0xFF);
+
+ DFBCHECK(dfb_window->GetID(dfb_window, &id));
+ DFBCHECK(dfb_window->GetSurface(dfb_window,&dfb_surface));
+
+ window = malloc(sizeof(Ecore_DirectFB_Window));
+ window->id = id;
+ window->window = dfb_window;
+ window->surface = dfb_surface;
+ window->cursor = NULL;
+
+ return window;
+} /* ecore_directfb_window_new */
EAPI void
ecore_directfb_window_free(Ecore_DirectFB_Window *ecore_window)
{
- DFBCHECK(ecore_window->surface->Release(ecore_window->surface));
- DFBCHECK(ecore_window->window->Release(ecore_window->window));
- free(ecore_window);
-}
-
+ DFBCHECK(ecore_window->surface->Release(ecore_window->surface));
+ DFBCHECK(ecore_window->window->Release(ecore_window->window));
+ free(ecore_window);
+} /* ecore_directfb_window_free */
EAPI void
ecore_directfb_window_move(Ecore_DirectFB_Window *ecore_window, int x, int y)
{
- DFBCHECK(ecore_window->window->MoveTo(ecore_window->window, x, y));
-}
+ DFBCHECK(ecore_window->window->MoveTo(ecore_window->window, x, y));
+} /* ecore_directfb_window_move */
EAPI void
ecore_directfb_window_resize(Ecore_DirectFB_Window *ecore_window, int w, int h)
{
- DFBCHECK(ecore_window->window->Resize(ecore_window->window, w, h));
-}
+ DFBCHECK(ecore_window->window->Resize(ecore_window->window, w, h));
+} /* ecore_directfb_window_resize */
-EAPI void
+EAPI void
ecore_directfb_window_focus(Ecore_DirectFB_Window *ecore_window)
-{
- DFBCHECK(ecore_window->window->RequestFocus(ecore_window->window));
-}
+{
+ DFBCHECK(ecore_window->window->RequestFocus(ecore_window->window));
+} /* ecore_directfb_window_focus */
-EAPI void
+EAPI void
ecore_directfb_window_hide(Ecore_DirectFB_Window *ecore_window)
{
- DFBCHECK(ecore_window->window->SetOpacity(ecore_window->window,0));
-
-}
+ DFBCHECK(ecore_window->window->SetOpacity(ecore_window->window,0));
+} /* ecore_directfb_window_hide */
EAPI void
ecore_directfb_window_show(Ecore_DirectFB_Window *ecore_window)
{
- DFBCHECK(ecore_window->window->SetOpacity(ecore_window->window, 0xFF));
-}
+ DFBCHECK(ecore_window->window->SetOpacity(ecore_window->window, 0xFF));
+} /* ecore_directfb_window_show */
EAPI void
ecore_directfb_window_shaped_set(Ecore_DirectFB_Window *ecore_window, int set)
{
- DFBWindowOptions opts;
-
- DFBCHECK(ecore_window->window->GetOptions(ecore_window->window, &opts));
- if(set)
- {
- opts |= DWOP_SHAPED;
- opts |= DWOP_ALPHACHANNEL;
- DFBCHECK(ecore_window->window->SetOptions(ecore_window->window, opts));
- }
- else
- {
- opts &= ~DWOP_SHAPED;
- opts &= ~DWOP_ALPHACHANNEL;
- DFBCHECK(ecore_window->window->SetOptions(ecore_window->window, opts));
- }
-}
+ DFBWindowOptions opts;
+
+ DFBCHECK(ecore_window->window->GetOptions(ecore_window->window, &opts));
+ if(set)
+ {
+ opts |= DWOP_SHAPED;
+ opts |= DWOP_ALPHACHANNEL;
+ DFBCHECK(ecore_window->window->SetOptions(ecore_window->window, opts));
+ }
+ else
+ {
+ opts &= ~DWOP_SHAPED;
+ opts &= ~DWOP_ALPHACHANNEL;
+ DFBCHECK(ecore_window->window->SetOptions(ecore_window->window, opts));
+ }
+} /* ecore_directfb_window_shaped_set */
EAPI void
ecore_directfb_window_cursor_show(Ecore_DirectFB_Window *ecore_window, int show)
{
- if(!show)
- {
- /* create an empty cursor and set it */
- IDirectFBSurface *cursor;
- DFBSurfaceDescription desc;
-
- memset(&desc, 0, sizeof(DFBSurfaceDescription));
- desc.flags = (DSDESC_HEIGHT | DSDESC_WIDTH | DSDESC_PIXELFORMAT);
- desc.width = 1;
- desc.height = 1;
- desc.pixelformat = DSPF_A1;
-
- DFBCHECK(_dfb->CreateSurface(_dfb,&desc,&cursor));
- DFBCHECK(cursor->Clear(cursor,0,0,0,0));
- DFBCHECK(ecore_window->window->SetCursorShape(ecore_window->window, cursor, 0, 0));
- }
- else
- {
- /* we already have a cursor surface so set it*/
- if(ecore_window->cursor)
- {
- DFBCHECK(ecore_window->window->SetCursorShape(ecore_window->window, ecore_window->cursor->surface, ecore_window->cursor->hot_x, ecore_window->cursor->hot_y));
- }
- /* or just set the default directfb cursor */
- else
- {
- DFBCHECK(ecore_window->window->SetCursorShape(ecore_window->window, NULL, 0, 0));
- }
-
- }
-}
+ if(!show)
+ {
+ /* create an empty cursor and set it */
+ IDirectFBSurface *cursor;
+ DFBSurfaceDescription desc;
+
+ memset(&desc, 0, sizeof(DFBSurfaceDescription));
+ desc.flags = (DSDESC_HEIGHT | DSDESC_WIDTH | DSDESC_PIXELFORMAT);
+ desc.width = 1;
+ desc.height = 1;
+ desc.pixelformat = DSPF_A1;
+
+ DFBCHECK(_dfb->CreateSurface(_dfb,&desc,&cursor));
+ DFBCHECK(cursor->Clear(cursor,0,0,0,0));
+ DFBCHECK(ecore_window->window->SetCursorShape(ecore_window->window, cursor, 0, 0));
+ }
+ else
+ {
+ /* we already have a cursor surface so set it*/
+ if(ecore_window->cursor)
+ {
+ DFBCHECK(ecore_window->window->SetCursorShape(ecore_window->window, ecore_window->cursor->surface, ecore_window->cursor->hot_x, ecore_window->cursor->hot_y));
+ }
+ /* or just set the default directfb cursor */
+ else
+ {
+ DFBCHECK(ecore_window->window->SetCursorShape(ecore_window->window, NULL, 0, 0));
+ }
+ }
+} /* ecore_directfb_window_cursor_show */
EAPI void
ecore_directfb_window_cursor_set(Ecore_DirectFB_Window *ecore_window, Ecore_DirectFB_Cursor *cursor)
{
- if( (!cursor) && (ecore_window->cursor))
- {
- ecore_window->cursor = NULL;
- DFBCHECK(ecore_window->window->SetCursorShape(ecore_window->window, NULL, 0, 0));
- return;
- }
- if(cursor)
- {
- ecore_window->cursor = cursor;
- DFBCHECK(ecore_window->window->SetCursorShape(ecore_window->window, cursor->surface, cursor->hot_x, cursor->hot_y));
-
- }
-
-}
-
-EAPI void
+ if((!cursor) && (ecore_window->cursor))
+ {
+ ecore_window->cursor = NULL;
+ DFBCHECK(ecore_window->window->SetCursorShape(ecore_window->window, NULL, 0, 0));
+ return;
+ }
+
+ if(cursor)
+ {
+ ecore_window->cursor = cursor;
+ DFBCHECK(ecore_window->window->SetCursorShape(ecore_window->window, cursor->surface, cursor->hot_x, cursor->hot_y));
+ }
+} /* ecore_directfb_window_cursor_set */
+
+EAPI void
ecore_directfb_window_fullscreen_set(Ecore_DirectFB_Window *ecore_window, int on)
{
- // always release the surface (we are going to get a new one in both cases)
- DFBCHECK(ecore_window->surface->Release(ecore_window->surface));
- if(on)
- {
- DFBCHECK(_layer->SetCooperativeLevel(_layer,DLSCL_EXCLUSIVE));
- DFBCHECK(_layer->GetSurface(_layer,&ecore_window->surface));
- DFBCHECK(_dfb->CreateInputEventBuffer(_dfb, DICAPS_ALL, DFB_FALSE, &_input_event));
- DFBCHECK(_input_event->CreateFileDescriptor(_input_event,&_input_event_fd));
- /* the event of axismove sends one axis at a time, so we must store both */
- DFBCHECK(_layer->GetCursorPosition(_layer,&_cursor_x,&_cursor_y));
-
- _input_event_fd_handler_handle = ecore_main_fd_handler_add(_input_event_fd,ECORE_FD_READ,_ecore_directfb_input_event_fd_handler, NULL,NULL,NULL);
- _ecore_directfb_fullscreen_window_id = ecore_window->id;
- }
- else
- {
- DFBCHECK(_input_event->Release(_input_event));
- DFBCHECK(_layer->SetCooperativeLevel(_layer,DLSCL_SHARED));
- DFBCHECK(ecore_window->window->GetSurface(ecore_window->window, &ecore_window->surface));
- ecore_main_fd_handler_del(_input_event_fd_handler_handle);
- _ecore_directfb_fullscreen_window_id = 0;
- }
-
-}
+ // always release the surface (we are going to get a new one in both cases)
+ DFBCHECK(ecore_window->surface->Release(ecore_window->surface));
+ if(on)
+ {
+ DFBCHECK(_layer->SetCooperativeLevel(_layer,DLSCL_EXCLUSIVE));
+ DFBCHECK(_layer->GetSurface(_layer,&ecore_window->surface));
+ DFBCHECK(_dfb->CreateInputEventBuffer(_dfb, DICAPS_ALL, DFB_FALSE, &_input_event));
+ DFBCHECK(_input_event->CreateFileDescriptor(_input_event,&_input_event_fd));
+ /* the event of axismove sends one axis at a time, so we must store both */
+ DFBCHECK(_layer->GetCursorPosition(_layer,&_cursor_x,&_cursor_y));
+
+ _input_event_fd_handler_handle = ecore_main_fd_handler_add(_input_event_fd,ECORE_FD_READ,_ecore_directfb_input_event_fd_handler, NULL,NULL,NULL);
+ _ecore_directfb_fullscreen_window_id = ecore_window->id;
+ }
+ else
+ {
+ ecore_main_fd_handler_del(_input_event_fd_handler_handle);
+ DFBCHECK(_input_event->Release(_input_event));
+ DFBCHECK(_layer->SetCooperativeLevel(_layer,DLSCL_SHARED));
+ DFBCHECK(ecore_window->window->GetSurface(ecore_window->window, &ecore_window->surface));
+ _ecore_directfb_fullscreen_window_id = 0;
+ }
+} /* ecore_directfb_window_fullscreen_set */
EAPI void
ecore_directfb_window_size_get(Ecore_DirectFB_Window *ecore_window, int *w, int *h)
{
- DFBCHECK(ecore_window->surface->GetSize(ecore_window->surface,w,h));
- return;
-}
+ DFBCHECK(ecore_window->surface->GetSize(ecore_window->surface,w,h));
+ return;
+} /* ecore_directfb_window_size_get */
EAPI int
ecore_directfb_init(const char *name __UNUSED__)
{
- int i = 0;
-
- if (++_ecore_directfb_init_count != 1) return _ecore_directfb_init_count;
- _ecore_directfb_log_dom = eina_log_domain_register("EcoreDirectFB", ECORE_DIRECTFB_DEFAULT_LOG_COLOR);
- if(_ecore_directfb_log_dom < 0)
- {
- EINA_LOG_ERR("Impossible to create a log domain for the Ecore directFB module.");
- return _ecore_directfb_init_count--;
- }
- DFBCHECK(DirectFBInit(NULL,NULL));
- DFBCHECK(DirectFBCreate(&_dfb));
-
- DFBCHECK(_dfb->GetDisplayLayer(_dfb, DLID_PRIMARY, &_layer));
- DFBCHECK(_layer->SetCooperativeLevel(_layer, DLSCL_SHARED));
-
-
- /* window events and fd */
- DFBCHECK(_dfb->CreateEventBuffer(_dfb, &_window_event));
- DFBCHECK(_window_event->CreateFileDescriptor(_window_event,&_window_event_fd));
- _window_event_fd_handler_handle = ecore_main_fd_handler_add(_window_event_fd,ECORE_FD_READ,_ecore_directfb_window_event_fd_handler, NULL,NULL,NULL);
-
- /* register ecore directfb events */
- ECORE_DIRECTFB_EVENT_POSITION = ecore_event_type_new();
- ECORE_DIRECTFB_EVENT_SIZE = ecore_event_type_new();;
- ECORE_DIRECTFB_EVENT_CLOSE = ecore_event_type_new();;
- ECORE_DIRECTFB_EVENT_DESTROYED = ecore_event_type_new();;
- ECORE_DIRECTFB_EVENT_GOT_FOCUS = ecore_event_type_new();;
- ECORE_DIRECTFB_EVENT_LOST_FOCUS = ecore_event_type_new();;
- ECORE_DIRECTFB_EVENT_KEY_DOWN = ecore_event_type_new();;
- ECORE_DIRECTFB_EVENT_KEY_UP = ecore_event_type_new();;
- ECORE_DIRECTFB_EVENT_BUTTON_DOWN = ecore_event_type_new();;
- ECORE_DIRECTFB_EVENT_BUTTON_UP = ecore_event_type_new();;
- ECORE_DIRECTFB_EVENT_MOTION = ecore_event_type_new();;
- ECORE_DIRECTFB_EVENT_ENTER = ecore_event_type_new();;
- ECORE_DIRECTFB_EVENT_LEAVE = ecore_event_type_new();;
- ECORE_DIRECTFB_EVENT_WHEEL = ecore_event_type_new();;
-
- /* create the hash table for the keynames */
- _ecore_directfb_key_symbols_hash = eina_hash_int32_new(free);
- for(i=0; i<_ecore_directfb_key_symbols_count; i++)
- {
- struct keymap *k;
- k = malloc(sizeof(struct keymap));
- k->name = _ecore_directfb_key_symbols[i].name;
- k->string = _ecore_directfb_key_symbols[i].string;
- eina_hash_add(_ecore_directfb_key_symbols_hash, &_ecore_directfb_key_symbols[i].id, k);
- }
- /* create the hash for the windows(key = windowid, val = Ecore_DirectFB_Window struct) */
- return _ecore_directfb_init_count;
-}
+ int i = 0;
+
+ if (++_ecore_directfb_init_count != 1)
+ return _ecore_directfb_init_count;
+
+ _ecore_directfb_log_dom = eina_log_domain_register("EcoreDirectFB", ECORE_DIRECTFB_DEFAULT_LOG_COLOR);
+ if(_ecore_directfb_log_dom < 0)
+ {
+ EINA_LOG_ERR("Impossible to create a log domain for the Ecore directFB module.");
+ return _ecore_directfb_init_count--;
+ }
+
+ DFBCHECK(DirectFBInit(NULL,NULL));
+ DFBCHECK(DirectFBCreate(&_dfb));
+
+ DFBCHECK(_dfb->GetDisplayLayer(_dfb, DLID_PRIMARY, &_layer));
+ DFBCHECK(_layer->SetCooperativeLevel(_layer, DLSCL_SHARED));
+
+ /* window events and fd */
+ DFBCHECK(_dfb->CreateEventBuffer(_dfb, &_window_event));
+ DFBCHECK(_window_event->CreateFileDescriptor(_window_event,&_window_event_fd));
+ _window_event_fd_handler_handle = ecore_main_fd_handler_add(_window_event_fd,ECORE_FD_READ,_ecore_directfb_window_event_fd_handler, NULL,NULL,NULL);
+
+ /* register ecore directfb events */
+ ECORE_DIRECTFB_EVENT_POSITION = ecore_event_type_new();
+ ECORE_DIRECTFB_EVENT_SIZE = ecore_event_type_new();
+ ECORE_DIRECTFB_EVENT_CLOSE = ecore_event_type_new();
+ ECORE_DIRECTFB_EVENT_DESTROYED = ecore_event_type_new();
+ ECORE_DIRECTFB_EVENT_GOT_FOCUS = ecore_event_type_new();
+ ECORE_DIRECTFB_EVENT_LOST_FOCUS = ecore_event_type_new();
+ ECORE_DIRECTFB_EVENT_KEY_DOWN = ecore_event_type_new();
+ ECORE_DIRECTFB_EVENT_KEY_UP = ecore_event_type_new();
+ ECORE_DIRECTFB_EVENT_BUTTON_DOWN = ecore_event_type_new();
+ ECORE_DIRECTFB_EVENT_BUTTON_UP = ecore_event_type_new();
+ ECORE_DIRECTFB_EVENT_MOTION = ecore_event_type_new();
+ ECORE_DIRECTFB_EVENT_ENTER = ecore_event_type_new();
+ ECORE_DIRECTFB_EVENT_LEAVE = ecore_event_type_new();
+ ECORE_DIRECTFB_EVENT_WHEEL = ecore_event_type_new();
+
+ /* create the hash table for the keynames */
+ _ecore_directfb_key_symbols_hash = eina_hash_int32_new(free);
+ for(i = 0; i < _ecore_directfb_key_symbols_count; i++)
+ {
+ struct keymap *k;
+ k = malloc(sizeof(struct keymap));
+ k->name = _ecore_directfb_key_symbols[i].name;
+ k->string = _ecore_directfb_key_symbols[i].string;
+ eina_hash_add(_ecore_directfb_key_symbols_hash, &_ecore_directfb_key_symbols[i].id, k);
+ }
+ /* create the hash for the windows(key = windowid, val = Ecore_DirectFB_Window struct) */
+ return _ecore_directfb_init_count;
+} /* ecore_directfb_init */
EAPI int
ecore_directfb_shutdown(void)
{
- if (--_ecore_directfb_init_count != 0) return _ecore_directfb_init_count;
-
- ecore_main_fd_handler_del(_window_event_fd_handler_handle);
- eina_hash_free(_ecore_directfb_key_symbols_hash);
-
- if(_ecore_directfb_fullscreen_window_id)
- {
- DFBCHECK(_input_event->Release(_input_event));
- ecore_main_fd_handler_del(_input_event_fd_handler_handle);
- }
- DFBCHECK(_window_event->Release(_window_event));
- DFBCHECK(_layer->Release(_layer));
- DFBCHECK(_dfb->Release(_dfb));
- eina_log_domain_unregister(_ecore_directfb_log_dom);
- _ecore_directfb_log_dom = -1;
- return _ecore_directfb_init_count;
-}
+ if (--_ecore_directfb_init_count != 0)
+ return _ecore_directfb_init_count;
+
+ ecore_main_fd_handler_del(_window_event_fd_handler_handle);
+ eina_hash_free(_ecore_directfb_key_symbols_hash);
+
+ if(_ecore_directfb_fullscreen_window_id)
+ {
+ DFBCHECK(_input_event->Release(_input_event));
+ ecore_main_fd_handler_del(_input_event_fd_handler_handle);
+ }
+
+ DFBCHECK(_window_event->Release(_window_event));
+ DFBCHECK(_layer->Release(_layer));
+ DFBCHECK(_dfb->Release(_dfb));
+ eina_log_domain_unregister(_ecore_directfb_log_dom);
+ _ecore_directfb_log_dom = -1;
+ return _ecore_directfb_init_count;
+} /* ecore_directfb_shutdown */
+
-typedef struct _Ecore_DirectFB_Key_Symbols Ecore_DirectFB_Key_Symbols;
+typedef struct _Ecore_DirectFB_Key_Symbols Ecore_DirectFB_Key_Symbols;
struct _Ecore_DirectFB_Key_Symbols
{
- char *string;
- char *name;
- unsigned int id;
+ char *string;
+ char *name;
+ unsigned int id;
};
static const Ecore_DirectFB_Key_Symbols _ecore_directfb_key_symbols[] = {
- {"\010", "BackSpace",DIKS_BACKSPACE},
- {"\011", "Tab", DIKS_TAB},
- {"\015", "Return", DIKS_RETURN},
- {"", "Cancel", DIKS_CANCEL},
- {"", "Escape", DIKS_ESCAPE},
- {" ", "space", DIKS_SPACE},
- {"!", "exclam", DIKS_EXCLAMATION_MARK},
- {"\"", "quotedbl", DIKS_QUOTATION},
- {"#", "numbersign", DIKS_NUMBER_SIGN},
- {"$", "dollar", DIKS_DOLLAR_SIGN},
- {"%", "percent", DIKS_PERCENT_SIGN},
- {"&", "ampersand", DIKS_AMPERSAND},
- {"'", "apostrophe", DIKS_APOSTROPHE},
- {"(", "parenleft", DIKS_PARENTHESIS_LEFT},
- {")", "parenright", DIKS_PARENTHESIS_RIGHT},
- {"*", "asterisk", DIKS_ASTERISK},
- {"+", "plus", DIKS_PLUS_SIGN},
- {",", "comma", DIKS_COMMA},
- {"-", "minus", DIKS_MINUS_SIGN},
- {".", "period", DIKS_PERIOD},
- {"/", "slash", DIKS_SLASH},
- {"0", "0", DIKS_0},
- {"1", "1", DIKS_1},
- {"2", "2", DIKS_2},
- {"3", "3", DIKS_3},
- {"4", "4", DIKS_4},
- {"5", "5", DIKS_5},
- {"6", "6", DIKS_6},
- {"7", "7", DIKS_7},
- {"8", "8", DIKS_8},
- {"9", "9", DIKS_9},
- {":", "colon", DIKS_COLON},
- {";", "semicolon", DIKS_SEMICOLON},
- {"<", "less", DIKS_LESS_THAN_SIGN},
- {"=", "equal", DIKS_EQUALS_SIGN},
- {">", "greater", DIKS_GREATER_THAN_SIGN},
- {"?", "question", DIKS_QUESTION_MARK},
- {"@", "at", DIKS_AT},
- {"A", "A", DIKS_CAPITAL_A },
- {"B", "B", DIKS_CAPITAL_B },
- {"C", "C", DIKS_CAPITAL_C },
- {"D", "D", DIKS_CAPITAL_D },
- {"E", "E", DIKS_CAPITAL_E },
- {"F", "F", DIKS_CAPITAL_F },
- {"G", "G", DIKS_CAPITAL_G },
- {"H", "H", DIKS_CAPITAL_H },
- {"I", "I", DIKS_CAPITAL_I },
- {"J", "J", DIKS_CAPITAL_J },
- {"K", "K", DIKS_CAPITAL_K },
- {"L", "L", DIKS_CAPITAL_L },
- {"M", "M", DIKS_CAPITAL_M },
- {"N", "N", DIKS_CAPITAL_N },
- {"O", "O", DIKS_CAPITAL_O },
- {"P", "P", DIKS_CAPITAL_P },
- {"Q", "Q", DIKS_CAPITAL_Q },
- {"R", "R", DIKS_CAPITAL_R },
- {"S", "S", DIKS_CAPITAL_S },
- {"T", "T", DIKS_CAPITAL_T },
- {"U", "U", DIKS_CAPITAL_U },
- {"V", "V", DIKS_CAPITAL_V },
- {"W", "W", DIKS_CAPITAL_W },
- {"X", "X", DIKS_CAPITAL_X },
- {"Y", "Y", DIKS_CAPITAL_Y },
- {"Z", "Z", DIKS_CAPITAL_Z },
- {"[", "bracketleft", DIKS_SQUARE_BRACKET_LEFT },
- {"\\", "backslash", DIKS_BACKSLASH },
- {"]", "bracketright", DIKS_SQUARE_BRACKET_RIGHT },
- {"^", "asciicircum", DIKS_CIRCUMFLEX_ACCENT },
- {"_", "underscore", DIKS_UNDERSCORE },
- {"`", "grave", DIKS_GRAVE_ACCENT},
- {"a", "a", DIKS_SMALL_A },
- {"b","b", DIKS_SMALL_B },
- {"c","c", DIKS_SMALL_C },
- {"d","d", DIKS_SMALL_D },
- {"e","e", DIKS_SMALL_E },
- {"f","f", DIKS_SMALL_F },
- {"g","g", DIKS_SMALL_G },
- {"h","h", DIKS_SMALL_H },
- {"i","i", DIKS_SMALL_I },
- {"j","j", DIKS_SMALL_J },
- {"k","k", DIKS_SMALL_K },
- {"l","l", DIKS_SMALL_L },
- {"m","m", DIKS_SMALL_M },
- {"n","n", DIKS_SMALL_N },
- {"o", "o", DIKS_SMALL_O },
- {"p", "p", DIKS_SMALL_P },
- {"q", "q", DIKS_SMALL_Q },
- {"r", "r", DIKS_SMALL_R },
- {"s", "s", DIKS_SMALL_S },
- {"t", "t", DIKS_SMALL_T },
- {"u", "u", DIKS_SMALL_U },
- {"v", "v", DIKS_SMALL_V },
- {"w", "w", DIKS_SMALL_W },
- {"x", "x", DIKS_SMALL_X },
- {"y", "y", DIKS_SMALL_Y },
- {"z", "z", DIKS_SMALL_Z },
- {"{", "braceleft",DIKS_CURLY_BRACKET_LEFT },
- {"|", "bar", DIKS_VERTICAL_BAR },
- {"}", "braceright", DIKS_CURLY_BRACKET_RIGHT },
- {"~", "asciitilde", DIKS_TILDE },
- {"\177", "Delete", DIKS_DELETE },
- {"", "Left", DIKS_CURSOR_LEFT },
- {"", "Right", DIKS_CURSOR_RIGHT},
- {"", "Up", DIKS_CURSOR_UP},
- {"", "Down", DIKS_CURSOR_DOWN},
- {"", "Insert", DIKS_INSERT},
- {"", "Home", DIKS_HOME},
- {"", "End", DIKS_END},
- {"", "Page_Up", DIKS_PAGE_UP},
- {"", "Page_Down", DIKS_PAGE_DOWN},
- {"", "Print", DIKS_PRINT},
- {"", "Pause", DIKS_PAUSE},
- /* ok */
- {"", "Select",DIKS_SELECT},
- /* goto */
- {"", "Clear", DIKS_CLEAR},
- /* power */
- /* power 2 */
- /* option */
- {"", "Menu",DIKS_MENU},
- {"", "Help",DIKS_HELP},
- /* info */
- /* time */
- /* vendor */
- /* archive */
- /* program */
- /* channel */
- /* favorites */
- /* hasta next */
- {"", "Next",DIKS_NEXT},
- {"", "Begin",DIKS_BEGIN},
- /* digits */
- /* teen */
- /* twen */
- {"", "Break", DIKS_BREAK},
- /* exit */
- /* setup */
- {"", "upleftcorner", DIKS_CURSOR_LEFT_UP },
- {"", "lowleftcorner", DIKS_CURSOR_LEFT_DOWN },
- {"", "uprightcorner", DIKS_CURSOR_UP_RIGHT },
- {"", "lowrightcorner",DIKS_CURSOR_DOWN_RIGHT },
- {"", "F1",DIKS_F1},
- {"", "F2",DIKS_F2},
- {"", "F3",DIKS_F3},
- {"", "F4",DIKS_F4},
- {"", "F5",DIKS_F5},
- {"", "F6",DIKS_F6},
- {"", "F7",DIKS_F7},
- {"", "F8",DIKS_F8},
- {"", "F9",DIKS_F9},
- {"", "F10",DIKS_F10},
- {"", "F11",DIKS_F11},
- {"", "F12",DIKS_F12},
- /* this are only mapped to one, not left right */
- {"", "Shift_L", DIKS_SHIFT},
- /*{"Shift_R",0xFFE2},*/
- {"", "Control_L", DIKS_CONTROL},
- /*{"Control_R",0xFFE4},*/
- {"", "Meta_L", DIKS_META},
- /* {"Meta_R",0xFFE8},*/
- {"", "Alt_L", DIKS_ALT},
- {"", "Alt_R", DIKS_ALTGR},
- {"", "Super_L", DIKS_SUPER},
- /*{"Super_R",0xFFEC},*/
- {"", "Hyper_L", DIKS_HYPER},
- /*{"Hyper_R",0xFFEE},*/
-
- {"", "Caps_Lock", DIKS_CAPS_LOCK},
- {"", "Num_Lock", DIKS_NUM_LOCK},
- {"", "Scroll_Lock", DIKS_SCROLL_LOCK},
- /* not included the dead keys */
- /* not included the custom keys */
- {"", "VoidSymbol", DIKS_NULL}
+ {"\010", "BackSpace",DIKS_BACKSPACE},
+ {"\011", "Tab", DIKS_TAB},
+ {"\015", "Return", DIKS_RETURN},
+ {"", "Cancel", DIKS_CANCEL},
+ {"", "Escape", DIKS_ESCAPE},
+ {" ", "space", DIKS_SPACE},
+ {"!", "exclam", DIKS_EXCLAMATION_MARK},
+ {"\"", "quotedbl", DIKS_QUOTATION},
+ {"#", "numbersign", DIKS_NUMBER_SIGN},
+ {"$", "dollar", DIKS_DOLLAR_SIGN},
+ {"%", "percent", DIKS_PERCENT_SIGN},
+ {"&", "ampersand", DIKS_AMPERSAND},
+ {"'", "apostrophe", DIKS_APOSTROPHE},
+ {"(", "parenleft", DIKS_PARENTHESIS_LEFT},
+ {")", "parenright", DIKS_PARENTHESIS_RIGHT},
+ {"*", "asterisk", DIKS_ASTERISK},
+ {"+", "plus", DIKS_PLUS_SIGN},
+ {",", "comma", DIKS_COMMA},
+ {"-", "minus", DIKS_MINUS_SIGN},
+ {".", "period", DIKS_PERIOD},
+ {"/", "slash", DIKS_SLASH},
+ {"0", "0", DIKS_0},
+ {"1", "1", DIKS_1},
+ {"2", "2", DIKS_2},
+ {"3", "3", DIKS_3},
+ {"4", "4", DIKS_4},
+ {"5", "5", DIKS_5},
+ {"6", "6", DIKS_6},
+ {"7", "7", DIKS_7},
+ {"8", "8", DIKS_8},
+ {"9", "9", DIKS_9},
+ {":", "colon", DIKS_COLON},
+ {";", "semicolon", DIKS_SEMICOLON},
+ {"<", "less", DIKS_LESS_THAN_SIGN},
+ {"=", "equal", DIKS_EQUALS_SIGN},
+ {">", "greater", DIKS_GREATER_THAN_SIGN},
+ {"?", "question", DIKS_QUESTION_MARK},
+ {"@", "at", DIKS_AT},
+ {"A", "A", DIKS_CAPITAL_A },
+ {"B", "B", DIKS_CAPITAL_B },
+ {"C", "C", DIKS_CAPITAL_C },
+ {"D", "D", DIKS_CAPITAL_D },
+ {"E", "E", DIKS_CAPITAL_E },
+ {"F", "F", DIKS_CAPITAL_F },
+ {"G", "G", DIKS_CAPITAL_G },
+ {"H", "H", DIKS_CAPITAL_H },
+ {"I", "I", DIKS_CAPITAL_I },
+ {"J", "J", DIKS_CAPITAL_J },
+ {"K", "K", DIKS_CAPITAL_K },
+ {"L", "L", DIKS_CAPITAL_L },
+ {"M", "M", DIKS_CAPITAL_M },
+ {"N", "N", DIKS_CAPITAL_N },
+ {"O", "O", DIKS_CAPITAL_O },
+ {"P", "P", DIKS_CAPITAL_P },
+ {"Q", "Q", DIKS_CAPITAL_Q },
+ {"R", "R", DIKS_CAPITAL_R },
+ {"S", "S", DIKS_CAPITAL_S },
+ {"T", "T", DIKS_CAPITAL_T },
+ {"U", "U", DIKS_CAPITAL_U },
+ {"V", "V", DIKS_CAPITAL_V },
+ {"W", "W", DIKS_CAPITAL_W },
+ {"X", "X", DIKS_CAPITAL_X },
+ {"Y", "Y", DIKS_CAPITAL_Y },
+ {"Z", "Z", DIKS_CAPITAL_Z },
+ {"[", "bracketleft", DIKS_SQUARE_BRACKET_LEFT },
+ {"\\", "backslash", DIKS_BACKSLASH },
+ {"]", "bracketright", DIKS_SQUARE_BRACKET_RIGHT },
+ {"^", "asciicircum", DIKS_CIRCUMFLEX_ACCENT },
+ {"_", "underscore", DIKS_UNDERSCORE },
+ {"`", "grave", DIKS_GRAVE_ACCENT},
+ {"a", "a", DIKS_SMALL_A },
+ {"b","b", DIKS_SMALL_B },
+ {"c","c", DIKS_SMALL_C },
+ {"d","d", DIKS_SMALL_D },
+ {"e","e", DIKS_SMALL_E },
+ {"f","f", DIKS_SMALL_F },
+ {"g","g", DIKS_SMALL_G },
+ {"h","h", DIKS_SMALL_H },
+ {"i","i", DIKS_SMALL_I },
+ {"j","j", DIKS_SMALL_J },
+ {"k","k", DIKS_SMALL_K },
+ {"l","l", DIKS_SMALL_L },
+ {"m","m", DIKS_SMALL_M },
+ {"n","n", DIKS_SMALL_N },
+ {"o", "o", DIKS_SMALL_O },
+ {"p", "p", DIKS_SMALL_P },
+ {"q", "q", DIKS_SMALL_Q },
+ {"r", "r", DIKS_SMALL_R },
+ {"s", "s", DIKS_SMALL_S },
+ {"t", "t", DIKS_SMALL_T },
+ {"u", "u", DIKS_SMALL_U },
+ {"v", "v", DIKS_SMALL_V },
+ {"w", "w", DIKS_SMALL_W },
+ {"x", "x", DIKS_SMALL_X },
+ {"y", "y", DIKS_SMALL_Y },
+ {"z", "z", DIKS_SMALL_Z },
+ {"{", "braceleft",DIKS_CURLY_BRACKET_LEFT },
+ {"|", "bar", DIKS_VERTICAL_BAR },
+ {"}", "braceright", DIKS_CURLY_BRACKET_RIGHT },
+ {"~", "asciitilde", DIKS_TILDE },
+ {"\177", "Delete", DIKS_DELETE },
+ {"", "Left", DIKS_CURSOR_LEFT },
+ {"", "Right", DIKS_CURSOR_RIGHT},
+ {"", "Up", DIKS_CURSOR_UP},
+ {"", "Down", DIKS_CURSOR_DOWN},
+ {"", "Insert", DIKS_INSERT},
+ {"", "Home", DIKS_HOME},
+ {"", "End", DIKS_END},
+ {"", "Page_Up", DIKS_PAGE_UP},
+ {"", "Page_Down", DIKS_PAGE_DOWN},
+ {"", "Print", DIKS_PRINT},
+ {"", "Pause", DIKS_PAUSE},
+ /* ok */
+ {"", "Select",DIKS_SELECT},
+ /* goto */
+ {"", "Clear", DIKS_CLEAR},
+ /* power */
+ /* power 2 */
+ /* option */
+ {"", "Menu",DIKS_MENU},
+ {"", "Help",DIKS_HELP},
+ /* info */
+ /* time */
+ /* vendor */
+ /* archive */
+ /* program */
+ /* channel */
+ /* favorites */
+ /* hasta next */
+ {"", "Next",DIKS_NEXT},
+ {"", "Begin",DIKS_BEGIN},
+ /* digits */
+ /* teen */
+ /* twen */
+ {"", "Break", DIKS_BREAK},
+ /* exit */
+ /* setup */
+ {"", "upleftcorner", DIKS_CURSOR_LEFT_UP },
+ {"", "lowleftcorner", DIKS_CURSOR_LEFT_DOWN },
+ {"", "uprightcorner", DIKS_CURSOR_UP_RIGHT },
+ {"", "lowrightcorner",DIKS_CURSOR_DOWN_RIGHT },
+ {"", "F1",DIKS_F1},
+ {"", "F2",DIKS_F2},
+ {"", "F3",DIKS_F3},
+ {"", "F4",DIKS_F4},
+ {"", "F5",DIKS_F5},
+ {"", "F6",DIKS_F6},
+ {"", "F7",DIKS_F7},
+ {"", "F8",DIKS_F8},
+ {"", "F9",DIKS_F9},
+ {"", "F10",DIKS_F10},
+ {"", "F11",DIKS_F11},
+ {"", "F12",DIKS_F12},
+ /* this are only mapped to one, not left right */
+ {"", "Shift_L", DIKS_SHIFT},
+ /*{"Shift_R",0xFFE2},*/
+ {"", "Control_L", DIKS_CONTROL},
+ /*{"Control_R",0xFFE4},*/
+ {"", "Meta_L", DIKS_META},
+ /* {"Meta_R",0xFFE8},*/
+ {"", "Alt_L", DIKS_ALT},
+ {"", "Alt_R", DIKS_ALTGR},
+ {"", "Super_L", DIKS_SUPER},
+ /*{"Super_R",0xFFEC},*/
+ {"", "Hyper_L", DIKS_HYPER},
+ /*{"Hyper_R",0xFFEE},*/
+
+ {"", "Caps_Lock", DIKS_CAPS_LOCK},
+ {"", "Num_Lock", DIKS_NUM_LOCK},
+ {"", "Scroll_Lock", DIKS_SCROLL_LOCK},
+ /* not included the dead keys */
+ /* not included the custom keys */
+ {"", "VoidSymbol", DIKS_NULL}
};
-static int _ecore_directfb_key_symbols_count = sizeof(_ecore_directfb_key_symbols)/sizeof(Ecore_DirectFB_Key_Symbols);
+static int _ecore_directfb_key_symbols_count = sizeof(_ecore_directfb_key_symbols) / sizeof(Ecore_DirectFB_Key_Symbols);
#ifdef ECORE_DIRECTFB_DEFAULT_LOG_COLOR
#undef ECORE_DIRECTFB_DEFAULT_LOG_COLOR
-#endif
+#endif /* ifdef ECORE_DIRECTFB_DEFAULT_LOG_COLOR */
#define ECORE_DIRECTFB_DEFAULT_LOG_COLOR EINA_COLOR_BLUE
#ifdef ERR
# undef ERR
-#endif
+#endif /* ifdef ERR */
#define ERR(...) EINA_LOG_DOM_ERR(_ecore_directfb_log_dom, __VA_ARGS__)
#ifdef DBG
# undef DBG
-#endif
+#endif /* ifdef DBG */
#define DBG(...) EINA_LOG_DOM_DBG(_ecore_directfb_log_dom, __VA_ARGS__)
#ifdef INF
# undef INF
-#endif
+#endif /* ifdef INF */
#define INF(...) EINA_LOG_DOM_INFO(_ecore_directfb_log_dom, __VA_ARGS__)
#ifdef WRN
# undef WRN
-#endif
+#endif /* ifdef WRN */
#define WRN(...) EINA_LOG_DOM_WARN(_ecore_directfb_log_dom, __VA_ARGS__)
#ifdef CRIT
# undef CRIT
-#endif
+#endif /* ifdef CRIT */
#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_directfb_log_dom, __VA_ARGS__)
/* macro for a safe call to DirectFB functions */
-#define DFBCHECK(x...) \
- { \
- _err = x; \
- if (_err != DFB_OK) { \
- CRIT("%s <%d>:\n\t", __FILE__, __LINE__ ); \
- DirectFBErrorFatal( #x, _err ); \
- } \
- }
+#define DFBCHECK(x ...)\
+ {\
+ _err = x;\
+ if (_err != DFB_OK) {\
+ CRIT("%s <%d>:\n\t", __FILE__, __LINE__ );\
+ DirectFBErrorFatal( # x, _err );\
+ }\
+ }
struct keymap
{
- char *name;
- char *string;
+ char *name;
+ char *string;
};
-#endif
+#endif /* ifndef _ECORE_DIRECTFB_PRIVATE_H */
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifndef _ECORE_EVAS_H
#define _ECORE_EVAS_H
ECORE_EVAS_ENGINE_SOFTWARE_SDL,
ECORE_EVAS_ENGINE_DIRECTFB,
ECORE_EVAS_ENGINE_SOFTWARE_FB,
+ ECORE_EVAS_ENGINE_SOFTWARE_8_X11,
ECORE_EVAS_ENGINE_SOFTWARE_16_X11,
ECORE_EVAS_ENGINE_SOFTWARE_16_DDRAW,
ECORE_EVAS_ENGINE_SOFTWARE_16_WINCE,
EAPI void ecore_evas_app_comp_sync_set(int do_sync);
EAPI int ecore_evas_app_comp_sync_get(void);
-
+
EAPI Eina_List *ecore_evas_engines_get(void);
EAPI void ecore_evas_engines_free(Eina_List *engines);
EAPI Ecore_Evas *ecore_evas_new(const char *engine_name, int x, int y, int w, int h, const char *extra_options);
EAPI int ecore_evas_gl_x11_direct_resize_get(const Ecore_Evas *ee);
EAPI void ecore_evas_gl_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win);
EAPI void ecore_evas_gl_x11_pre_post_swap_callback_set(const Ecore_Evas *ee, void *data, void (*pre_cb) (void *data, Evas *e), void (*post_cb) (void *data, Evas *e));
-
+
EAPI Ecore_Evas *ecore_evas_xrender_x11_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h);
EAPI Ecore_X_Window ecore_evas_xrender_x11_window_get(const Ecore_Evas *ee);
EAPI void ecore_evas_xrender_x11_direct_resize_set(Ecore_Evas *ee, int on);
EAPI int ecore_evas_xrender_x11_direct_resize_get(const Ecore_Evas *ee);
EAPI void ecore_evas_xrender_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win);
+EAPI Ecore_Evas *ecore_evas_software_x11_8_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h);
+EAPI Ecore_X_Window ecore_evas_software_x11_8_window_get(const Ecore_Evas *ee);
+EAPI Ecore_X_Window ecore_evas_software_x11_8_subwindow_get(const Ecore_Evas *ee);
+EAPI void ecore_evas_software_x11_8_direct_resize_set(Ecore_Evas *ee, int on);
+EAPI int ecore_evas_software_x11_8_direct_resize_get(const Ecore_Evas *ee);
+EAPI void ecore_evas_software_x11_8_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win);
+
EAPI Ecore_Evas *ecore_evas_software_x11_16_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h);
EAPI Ecore_X_Window ecore_evas_software_x11_16_window_get(const Ecore_Evas *ee);
EAPI void ecore_evas_software_x11_16_direct_resize_set(Ecore_Evas *ee, int on);
/* helper function to be used with ECORE_GETOPT_CALLBACK_*() */
EAPI unsigned char ecore_getopt_callback_ecore_evas_list_engines(const Ecore_Getopt *parser, const Ecore_Getopt_Desc *desc, const char *str, void *data, Ecore_Getopt_Value *storage);
+EAPI Eina_List *ecore_evas_ecore_evas_list_get(void);
+
+
#ifdef __cplusplus
}
#endif
if BUILD_ECORE_EVAS
lib_LTLIBRARIES = libecore_evas.la
-include_HEADERS = \
-Ecore_Evas.h
+includes_HEADERS = Ecore_Evas.h
+includesdir = $(includedir)/ecore-@VMAJ@
libecore_evas_la_SOURCES = \
ecore_evas.c \
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
int _ecore_evas_log_dom = -1;
static int _ecore_evas_init_count = 0;
static Ecore_Fd_Handler *_ecore_evas_async_events_fd = NULL;
-static int _ecore_evas_async_events_fd_handler(void *data, Ecore_Fd_Handler *fd_handler);
+static Eina_Bool _ecore_evas_async_events_fd_handler(void *data, Ecore_Fd_Handler *fd_handler);
static Ecore_Idle_Enterer *ecore_evas_idle_enterer = NULL;
static Ecore_Evas *ecore_evases = NULL;
static int _ecore_evas_fps_debug = 0;
-static int
+static Eina_Bool
_ecore_evas_idle_enter(void *data __UNUSED__)
{
Ecore_Evas *ee;
double t2 = 0.0;
int rend = 0;
- if (!ecore_evases) return 1;
+ if (!ecore_evases) return ECORE_CALLBACK_RENEW;
if (_ecore_evas_fps_debug)
{
t1 = ecore_time_get();
if (rend)
_ecore_evas_fps_debug_rendertime_add(t2 - t1);
}
- return 1;
+ return ECORE_CALLBACK_RENEW;
}
/**
return 0;
#endif
+ case ECORE_EVAS_ENGINE_SOFTWARE_8_X11:
+#ifdef BUILD_ECORE_EVAS_SOFTWARE_8_X11
+ return 1;
+#else
+ return 0;
+#endif
+
case ECORE_EVAS_ENGINE_SOFTWARE_16_X11:
#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_X11
return 1;
}
#endif
+#ifdef BUILD_ECORE_EVAS_SOFTWARE_8_X11
+static Ecore_Evas *
+_ecore_evas_constructor_software_8_x11(int x, int y, int w, int h, const char *extra_options)
+{
+ Ecore_X_Window parent = 0;
+ char *disp_name = NULL;
+ Ecore_Evas *ee;
+
+ _ecore_evas_parse_extra_options_x(extra_options, &disp_name, &parent);
+ ee = ecore_evas_software_x11_8_new(disp_name, parent, x, y, w, h);
+ free(disp_name);
+
+ return ee;
+}
+#endif
+
#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_X11
static Ecore_Evas *
_ecore_evas_constructor_software_16_x11(int x, int y, int w, int h, const char *extra_options)
#ifdef BUILD_ECORE_EVAS_XRENDER_XCB
{"xrender_xcb", _ecore_evas_constructor_xrender_x11},
#endif
+#ifdef BUILD_ECORE_EVAS_SOFTWARE_8_X11
+ {"software_8_x11", _ecore_evas_constructor_software_8_x11},
+#endif
#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_X11
{"software_16_x11", _ecore_evas_constructor_software_16_x11},
#endif
free(ee);
}
-static int
+static Eina_Bool
_ecore_evas_cb_idle_flush(void *data)
{
Ecore_Evas *ee;
ee = (Ecore_Evas *)data;
evas_render_idle_flush(ee->evas);
ee->engine.idle_flush_timer = NULL;
- return 0;
+ return ECORE_CALLBACK_CANCEL;
}
-static int
+static Eina_Bool
_ecore_evas_async_events_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UNUSED__)
{
evas_async_events_process();
- return 1;
+ return ECORE_CALLBACK_RENEW;
}
void
evas_event_feed_mouse_move(ee->evas, y, ee->w - x - 1, timestamp, NULL);
}
+/**
+ * Get a list of all the ecore_evases.
+ *
+ * The returned list of ecore evases is only valid until the canvases are
+ * destroyed (and should not be cached for instance).
+ * The list can be free by just deleting the list.
+ *
+ * @return A list of ecore_evases.
+ */
+EAPI Eina_List *
+ecore_evas_ecore_evas_list_get(void){
+ Ecore_Evas *ee;
+ Eina_List *l = NULL;
+
+ EINA_INLIST_FOREACH(ecore_evases, ee)
+ {
+ l = eina_list_append(l, ee);
+ }
+
+ return l;
+}
+
+
_ecore_evas_buffer_init(void)
{
_ecore_evas_init_count++;
- if (_ecore_evas_init_count > 1) return _ecore_evas_init_count;
return _ecore_evas_init_count;
}
Eina_Rectangle *r;
EINA_LIST_FOREACH(updates, l, r)
- if (ee->engine.buffer.image)
- evas_object_image_data_update_add(ee->engine.buffer.image,
- r->x, r->y, r->w, r->h);
+ evas_object_image_data_update_add(ee->engine.buffer.image,
+ r->x, r->y, r->w, r->h);
}
if (updates)
{
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
return ecore_evases;
}
-static int
+static Eina_Bool
_ecore_evas_cocoa_event_got_focus(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
ee = _ecore_evas_cocoa_match();
- if (!ee) return 1;
+ if (!ee) return EINA_TRUE;
ee->prop.focused = 1;
- return 0;
+ return EINA_FALSE;
}
-static int
+static Eina_Bool
_ecore_evas_cocoa_event_lost_focus(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
ee = _ecore_evas_cocoa_match();
- if (!ee) return 1;
+ if (!ee) return EINA_TRUE;
ee->prop.focused = 0;
- return 0;
+ return EINA_FALSE;
}
-static int
+static Eina_Bool
_ecore_evas_cocoa_event_video_resize(void *data __UNUSED__, int type __UNUSED__, void *event)
{
/*Ecore_Cocoa_Event_Video_Resize *e;
return 0;*/
}
-static int
+static Eina_Bool
_ecore_evas_cocoa_event_video_expose(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
{
Ecore_Evas *ee;
ee = _ecore_evas_cocoa_match();
- if (!ee) return 1;
+ if (!ee) return EINA_TRUE;
evas_output_size_get(ee->evas, &w, &h);
evas_damage_rectangle_add(ee->evas, 0, 0, w, h);
- return 0;
+ return EINA_FALSE;
}
static int
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
return ee;
}
-static int
+static Eina_Bool
_ecore_evas_directfb_event_key_down(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
e = event;
ee = _ecore_evas_directfb_match(e->win);
- if (!ee) return 1; /* pass on event */
+ if (!ee) return EINA_TRUE; /* pass on event */
evas_event_feed_key_down(ee->evas, e->name, e->name, e->string,
e->key_compose, e->time, NULL);
- return 1;
+ return EINA_TRUE;
}
-static int
+static Eina_Bool
_ecore_evas_directfb_event_key_up(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
e = event;
ee = _ecore_evas_directfb_match(e->win);
- if (!ee) return 1; /* pass on event */
+ if (!ee) return EINA_TRUE; /* pass on event */
evas_event_feed_key_up(ee->evas, e->name, e->name, e->string,
e->key_compose, e->time, NULL);
- return 1;
+ return EINA_TRUE;
}
-static int
+static Eina_Bool
_ecore_evas_directfb_event_motion(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
e = event;
ee = _ecore_evas_directfb_match(e->win);
- if (!ee) return 1; /* pass on event */
+ if (!ee) return EINA_TRUE; /* pass on event */
_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
- return 1;
+ return EINA_TRUE;
}
-static int
+static Eina_Bool
_ecore_evas_directfb_event_button_down(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
e = event;
ee = _ecore_evas_directfb_match(e->win);
- if (!ee) return 1; /* pass on event */
+ if (!ee) return EINA_TRUE; /* pass on event */
// _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
evas_event_feed_mouse_down(ee->evas, e->button, EVAS_BUTTON_NONE, e->time, NULL);
- return 1;
+ return EINA_TRUE;
}
-static int
+static Eina_Bool
_ecore_evas_directfb_event_button_up(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
e = event;
ee = _ecore_evas_directfb_match(e->win);
- if (!ee) return 1; /* pass on event */
+ if (!ee) return EINA_TRUE; /* pass on event */
//_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
evas_event_feed_mouse_up(ee->evas, e->button, flags, e->time, NULL);
- return 1;
+ return EINA_TRUE;
}
-static int
+static Eina_Bool
_ecore_evas_directfb_event_enter(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
e = event;
ee = _ecore_evas_directfb_match(e->win);
- if (!ee) return 1; /* pass on event */
+ if (!ee) return EINA_TRUE; /* pass on event */
evas_event_feed_mouse_in(ee->evas, e->time, NULL);
//_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
- return 1;
+ return EINA_TRUE;
}
-static int
+static Eina_Bool
_ecore_evas_directfb_event_leave(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
e = event;
ee = _ecore_evas_directfb_match(e->win);
- if (!ee) return 1; /* pass on event */
+ if (!ee) return EINA_TRUE; /* pass on event */
evas_event_feed_mouse_out(ee->evas, e->time, NULL);
//_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
- return 1;
+ return EINA_TRUE;
}
-static int
+static Eina_Bool
_ecore_evas_directfb_event_wheel(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
e = event;
ee = _ecore_evas_directfb_match(e->win);
- if (!ee) return 1; /* pass on event */
+ if (!ee) return EINA_TRUE; /* pass on event */
evas_event_feed_mouse_wheel(ee->evas, e->direction, e->z, e->time, NULL);
- return 1;
+ return EINA_TRUE;
}
-static int
+static Eina_Bool
_ecore_evas_directfb_event_got_focus(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
e = event;
ee = _ecore_evas_directfb_match(e->win);
- if (!ee) return 1; /* pass on event */
+ if (!ee) return EINA_TRUE; /* pass on event */
ee->prop.focused = 1;
- return 1;
+ return EINA_TRUE;
}
-static int
+static Eina_Bool
_ecore_evas_directfb_event_lost_focus(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
e = event;
ee = _ecore_evas_directfb_match(e->win);
- if (!ee) return 1; /* pass on event */
+ if (!ee) return EINA_TRUE; /* pass on event */
ee->prop.focused = 0;
- return 1;
+ return EINA_TRUE;
}
int
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
ecore_fb_input_device_listen(dev, 1);
}
-static int
+static Eina_Bool
_ecore_evas_event_key_down(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
e = event;
ee = _ecore_evas_fb_match();
- if (!ee) return 1; /* pass on event */
+ if (!ee) return EINA_TRUE; /* pass on event */
evas_event_feed_key_down(ee->evas, e->keyname, e->keysymbol, e->key_compose, NULL, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
- return 0; /* dont pass it on */
+ return EINA_FALSE; /* dont pass it on */
}
-static int
+static Eina_Bool
_ecore_evas_event_key_up(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
e = event;
ee = _ecore_evas_fb_match();
- if (!ee) return 1; /* pass on event */
+ if (!ee) return EINA_TRUE; /* pass on event */
evas_event_feed_key_up(ee->evas, e->keyname, e->keysymbol, e->key_compose, NULL, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
- return 0; /* dont pass it on */
+ return EINA_FALSE; /* dont pass it on */
}
-static int
+static Eina_Bool
_ecore_evas_event_mouse_button_down(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
e = event;
ee = _ecore_evas_fb_match();
- if (!ee) return 1; /* pass on event */
+ if (!ee) return EINA_TRUE; /* pass on event */
_ecore_evas_mouse_move_process_fb(ee, e->x, e->y, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff));
if (e->double_click) flags |= EVAS_BUTTON_DOUBLE_CLICK;
if (e->triple_click) flags |= EVAS_BUTTON_TRIPLE_CLICK;
evas_event_feed_mouse_down(ee->evas, e->button, flags, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
- return 0; /* dont pass it on */
+ return EINA_FALSE; /* dont pass it on */
}
-static int
+static Eina_Bool
_ecore_evas_event_mouse_button_up(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
e = event;
ee = _ecore_evas_fb_match();
- if (!ee) return 1; /* pass on event */
+ if (!ee) return EINA_TRUE; /* pass on event */
_ecore_evas_mouse_move_process_fb(ee, e->x, e->y, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff));
evas_event_feed_mouse_up(ee->evas, e->button, EVAS_BUTTON_NONE, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
- return 0; /* dont pass it on */
+ return EINA_FALSE; /* dont pass it on */
}
-static int
+static Eina_Bool
_ecore_evas_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
e = event;
ee = _ecore_evas_fb_match();
- if (!ee) return 1; /* pass on event */
+ if (!ee) return EINA_TRUE; /* pass on event */
_ecore_evas_mouse_move_process_fb(ee, e->x, e->y, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff));
- return 0; /* dont pass it on */
+ return EINA_FALSE; /* dont pass it on */
}
-static int
+static Eina_Bool
_ecore_evas_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
e = event;
ee = _ecore_evas_fb_match();
- if (!ee) return 1; /* pass on event */
+ if (!ee) return EINA_TRUE; /* pass on event */
_ecore_evas_mouse_move_process_fb(ee, e->x, e->y, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff));
- return 0; /* dont pass it on */
+ return EINA_FALSE; /* dont pass it on */
}
static int
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
#ifndef _ECORE_EVAS_PRIVATE_H
#define _ECORE_EVAS_PRIVATE_H
# include <xcb/render.h>
# include <Evas_Engine_XRender_X11.h>
# endif
+# ifdef BUILD_ECORE_EVAS_SOFTWARE_8_X11
+# include <Evas_Engine_Software_8_X11.h>
+# endif
# endif
# ifdef HAVE_ECORE_X_XLIB
# include <X11/Xlib.h>
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
return sdl_ee;
}
-static int
+static Eina_Bool
_ecore_evas_sdl_event_got_focus(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
{
Ecore_Evas *ee;
ee = _ecore_evas_sdl_match();
- if (!ee) return 1;
+ if (!ee) return ECORE_CALLBACK_PASS_ON;
/* pass on event */
ee->prop.focused = 1;
- return 0;
+ return ECORE_CALLBACK_DONE;
}
-static int
+static Eina_Bool
_ecore_evas_sdl_event_lost_focus(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
{
Ecore_Evas *ee;
ee = _ecore_evas_sdl_match();
- if (!ee) return 1;
+ if (!ee) return ECORE_CALLBACK_PASS_ON;
/* pass on event */
ee->prop.focused = 0;
- return 0;
+ return ECORE_CALLBACK_DONE;
}
-static int
+static Eina_Bool
_ecore_evas_sdl_event_video_resize(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Sdl_Event_Video_Resize *e;
e = event;
ee = _ecore_evas_sdl_match();
- if (!ee) return 1; /* pass on event */
+ if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
evas_output_size_set(ee->evas, e->w, e->h);
- return 0;
+ return ECORE_CALLBACK_DONE;
}
-static int
+static Eina_Bool
_ecore_evas_sdl_event_video_expose(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
{
Ecore_Evas *ee;
ee = _ecore_evas_sdl_match();
- if (!ee) return 1;
+ if (!ee) return ECORE_CALLBACK_PASS_ON;
evas_output_size_get(ee->evas, &w, &h);
evas_damage_rectangle_add(ee->evas, 0, 0, w, h);
- return 0;
+ return ECORE_CALLBACK_DONE;
}
static int
return rend;
}
-static int
+static Eina_Bool
_ecore_evas_sdl_event(void *data __UNUSED__)
{
ecore_sdl_feed_events();
- return 1;
+ return ECORE_CALLBACK_RENEW;
}
static int
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
static Ecore_Event_Handler *ecore_evas_event_handlers[ECORE_EVAS_EVENT_COUNT];
-static int _ecore_evas_win32_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event);
+static Eina_Bool _ecore_evas_win32_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event);
-static int _ecore_evas_win32_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event);
+static Eina_Bool _ecore_evas_win32_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event);
-static int _ecore_evas_win32_event_window_damage(void *data __UNUSED__, int type __UNUSED__, void *event);
+static Eina_Bool _ecore_evas_win32_event_window_damage(void *data __UNUSED__, int type __UNUSED__, void *event);
-static int _ecore_evas_win32_event_window_destroy(void *data __UNUSED__, int type __UNUSED__, void *event);
+static Eina_Bool _ecore_evas_win32_event_window_destroy(void *data __UNUSED__, int type __UNUSED__, void *event);
-static int _ecore_evas_win32_event_window_show(void *data __UNUSED__, int type __UNUSED__, void *event);
+static Eina_Bool _ecore_evas_win32_event_window_show(void *data __UNUSED__, int type __UNUSED__, void *event);
-static int _ecore_evas_win32_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void *event);
+static Eina_Bool _ecore_evas_win32_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void *event);
-static int _ecore_evas_win32_event_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event);
+static Eina_Bool _ecore_evas_win32_event_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event);
-static int _ecore_evas_win32_event_window_delete_request(void *data __UNUSED__, int type __UNUSED__, void *event);
+static Eina_Bool _ecore_evas_win32_event_window_delete_request(void *data __UNUSED__, int type __UNUSED__, void *event);
/* Private functions */
return _ecore_evas_init_count;
}
-static int
+static Eina_Bool
_ecore_evas_win32_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
return 1;
}
-static int
+static Eina_Bool
_ecore_evas_win32_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
return 1;
}
-static int
+static Eina_Bool
_ecore_evas_win32_event_window_damage(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
return 1;
}
-static int
+static Eina_Bool
_ecore_evas_win32_event_window_destroy(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
return 1;
}
-static int
+static Eina_Bool
_ecore_evas_win32_event_window_show(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
return 1;
}
-static int
+static Eina_Bool
_ecore_evas_win32_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
return 1;
}
-static int
+static Eina_Bool
_ecore_evas_win32_event_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
return 1;
}
-static int
+static Eina_Bool
_ecore_evas_win32_event_window_delete_request(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
static Ecore_Event_Handler *ecore_evas_event_handlers[ECORE_EVAS_EVENT_COUNT];
-static int _ecore_evas_wince_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event);
+static Eina_Bool _ecore_evas_wince_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event);
-static int _ecore_evas_wince_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event);
+static Eina_Bool _ecore_evas_wince_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event);
-static int _ecore_evas_wince_event_window_damage(void *data __UNUSED__, int type __UNUSED__, void *event);
+static Eina_Bool _ecore_evas_wince_event_window_damage(void *data __UNUSED__, int type __UNUSED__, void *event);
-static int _ecore_evas_wince_event_window_destroy(void *data __UNUSED__, int type __UNUSED__, void *event);
+static Eina_Bool _ecore_evas_wince_event_window_destroy(void *data __UNUSED__, int type __UNUSED__, void *event);
-static int _ecore_evas_wince_event_window_show(void *data __UNUSED__, int type __UNUSED__, void *event);
+static Eina_Bool _ecore_evas_wince_event_window_show(void *data __UNUSED__, int type __UNUSED__, void *event);
-static int _ecore_evas_wince_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void *event);
+static Eina_Bool _ecore_evas_wince_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void *event);
-static int _ecore_evas_wince_event_window_delete_request(void *data __UNUSED__, int type __UNUSED__, void *event);
+static Eina_Bool _ecore_evas_wince_event_window_delete_request(void *data __UNUSED__, int type __UNUSED__, void *event);
/* Private functions */
return _ecore_evas_init_count;
}
-static int
+static Eina_Bool
_ecore_evas_wince_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
return 1;
}
-static int
+static Eina_Bool
_ecore_evas_wince_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
return 1;
}
-static int
+static Eina_Bool
_ecore_evas_wince_event_window_damage(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
return 1;
}
-static int
+static Eina_Bool
_ecore_evas_wince_event_window_destroy(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
return 1;
}
-static int
+static Eina_Bool
_ecore_evas_wince_event_window_show(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
return 1;
}
-static int
+static Eina_Bool
_ecore_evas_wince_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
return 1;
}
-static int
+static Eina_Bool
_ecore_evas_wince_event_window_delete_request(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
# endif /* XXX no shaped window support for software_16_x11 */
#endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
}
+ if (!strcmp(ee->driver, "software_8_x11"))
+ {
+#if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11)
+ Evas_Engine_Info_Software_8_X11 *einfo;
+
+ einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas);
+ if (einfo)
+ {
+ unsigned int foreground;
+ Ecore_X_GC gc;
+
+ if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
+ ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1);
+ foreground = 0;
+ gc = ecore_x_gc_new(ee->engine.x.mask,
+ ECORE_X_GC_VALUE_MASK_FOREGROUND,
+ &foreground);
+ ecore_x_drawable_rectangle_fill(ee->engine.x.mask, gc,
+ 0, 0, ee->w, ee->h);
+ ecore_x_gc_free(gc);
+ einfo->info.mask = ee->engine.x.mask;
+ if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
+ {
+ ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
+ }
+ evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
+ }
+#endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */
+ }
}
/* TODO: we need to make this work for all the states, not just sticky */
-static int
+static Eina_Bool
_ecore_evas_x_event_property_change(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
e = event;
ee = ecore_event_window_match(e->win);
- if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */
- if (e->win != ee->prop.window) return 1;
+ if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */
+ if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
if (e->atom == ECORE_X_ATOM_NET_WM_STATE)
{
unsigned int i, num;
}
}
- return 1;
+ return ECORE_CALLBACK_PASS_ON;
}
-static int
+static Eina_Bool
_ecore_evas_x_event_visibility_change(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
e = event;
ee = ecore_event_window_match(e->win);
- if (!ee) return 1; /* pass on event */
- if (e->win != ee->prop.window) return 1;
+ if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
+ if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
// printf("VIS CHANGE OBSCURED: %p %i\n", ee, e->fully_obscured);
if (e->fully_obscured)
{
ee->draw_ok = 0;
}
else ee->draw_ok = 1;
- return 1;
+ return ECORE_CALLBACK_PASS_ON;
}
-static int
+static Eina_Bool
_ecore_evas_x_event_client_message(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
Ecore_X_Event_Client_Message *e;
e = event;
- if (e->format != 32) return 1;
+ if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
if (e->message_type == ECORE_X_ATOM_E_COMP_SYNC_BEGIN)
{
ee = ecore_event_window_match(e->data.l[0]);
- if (!ee) return 1; /* pass on event */
- if (e->data.l[0] != (long)ee->prop.window) return 1;
+ if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
+ if (e->data.l[0] != (long)ee->prop.window) return ECORE_CALLBACK_PASS_ON;
ee->engine.x.sync_began = 1;
ee->engine.x.sync_cancel = 0;
}
else if (e->message_type == ECORE_X_ATOM_E_COMP_SYNC_END)
{
ee = ecore_event_window_match(e->data.l[0]);
- if (!ee) return 1; /* pass on event */
- if (e->data.l[0] != (long)ee->prop.window) return 1;
+ if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
+ if (e->data.l[0] != (long)ee->prop.window) return ECORE_CALLBACK_PASS_ON;
ee->engine.x.sync_began = 0;
ee->engine.x.sync_cancel = 0;
}
else if (e->message_type == ECORE_X_ATOM_E_COMP_SYNC_CANCEL)
{
ee = ecore_event_window_match(e->data.l[0]);
- if (!ee) return 1; /* pass on event */
- if (e->data.l[0] != (long)ee->prop.window) return 1;
+ if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
+ if (e->data.l[0] != (long)ee->prop.window) return ECORE_CALLBACK_PASS_ON;
ee->engine.x.sync_began = 0;
ee->engine.x.sync_cancel = 1;
}
- return 1;
+ return ECORE_CALLBACK_PASS_ON;
}
-static int
+static Eina_Bool
_ecore_evas_x_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
e = event;
ee = ecore_event_window_match(e->win);
- if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */
- if (e->win != ee->prop.window) return 1;
+ if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */
+ if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
/* { */
/* time_t t; */
/* char *ct; */
ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers);
evas_event_feed_mouse_in(ee->evas, e->time, NULL);
_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
- return 1;
+ return ECORE_CALLBACK_PASS_ON;
}
-static int
+static Eina_Bool
_ecore_evas_x_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
e = event;
ee = ecore_event_window_match(e->win);
- if ((!ee) || (ee->ignore_events)) return 1;
+ if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
/* pass on event */
- if (e->win != ee->prop.window) return 1;
+ if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
/* { */
/* time_t t; */
/* char *ct; */
evas_event_feed_mouse_out(ee->evas, e->time, NULL);
if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
- return 1;
+ return ECORE_CALLBACK_PASS_ON;
}
-static int
+static Eina_Bool
_ecore_evas_x_event_window_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
e = event;
ee = ecore_event_window_match(e->win);
- if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */
- if (e->win != ee->prop.window) return 1;
- if (e->mode == ECORE_X_EVENT_MODE_UNGRAB) return 1;
+ if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */
+ if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
+ if (e->mode == ECORE_X_EVENT_MODE_UNGRAB) return ECORE_CALLBACK_PASS_ON;
ee->prop.focused = 1;
evas_focus_in(ee->evas);
if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
- return 1;
+ return ECORE_CALLBACK_PASS_ON;
}
-static int
+static Eina_Bool
_ecore_evas_x_event_window_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
e = event;
ee = ecore_event_window_match(e->win);
- if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */
- if (e->win != ee->prop.window) return 1;
- if (e->mode == ECORE_X_EVENT_MODE_GRAB) return 1;
+ if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */
+ if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
+ if (e->mode == ECORE_X_EVENT_MODE_GRAB) return ECORE_CALLBACK_PASS_ON;
// if (ee->prop.fullscreen)
// ecore_x_window_focus(ee->prop.window);
evas_focus_out(ee->evas);
ee->prop.focused = 0;
if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
- return 1;
+ return ECORE_CALLBACK_PASS_ON;
}
-static int
+static Eina_Bool
_ecore_evas_x_event_window_damage(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
e = event;
ee = ecore_event_window_match(e->win);
- if (!ee) return 1; /* pass on event */
- if (e->win != ee->prop.window) return 1;
- if (ee->engine.x.using_bg_pixmap) return 1;
+ if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
+ if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
+ if (ee->engine.x.using_bg_pixmap) return ECORE_CALLBACK_PASS_ON;
// printf("EXPOSE %p [%i] %i %i %ix%i\n", ee, ee->prop.avoid_damage, e->x, e->y, e->w, e->h);
if (ee->prop.avoid_damage)
{
ee->w - e->x - e->w,
e->h, e->w);
}
- return 1;
+ return ECORE_CALLBACK_PASS_ON;
}
-static int
+static Eina_Bool
_ecore_evas_x_event_window_destroy(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
e = event;
ee = ecore_event_window_match(e->win);
- if (!ee) return 1; /* pass on event */
- if (e->win != ee->prop.window) return 1;
+ if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
+ if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
if (ee->func.fn_destroy) ee->func.fn_destroy(ee);
_ecore_evas_x_sync_clear(ee);
ecore_evas_free(ee);
- return 1;
+ return ECORE_CALLBACK_PASS_ON;
}
-static int
+static Eina_Bool
_ecore_evas_x_event_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
e = event;
ee = ecore_event_window_match(e->win);
- if (!ee) return 1; /* pass on event */
- if (e->win != ee->prop.window) return 1;
- if (ee->engine.x.direct_resize) return 1;
+ if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
+ if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
+ if (ee->engine.x.direct_resize) return ECORE_CALLBACK_PASS_ON;
if ((e->from_wm) || (ee->prop.override))
{
}
if (ee->func.fn_resize) ee->func.fn_resize(ee);
}
- return 1;
+ return ECORE_CALLBACK_PASS_ON;
}
-static int
+static Eina_Bool
_ecore_evas_x_event_window_delete_request(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
e = event;
ee = ecore_event_window_match(e->win);
- if (!ee) return 1; /* pass on event */
- if (e->win != ee->prop.window) return 1;
+ if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
+ if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
if (ee->func.fn_delete_request) ee->func.fn_delete_request(ee);
- return 1;
+ return ECORE_CALLBACK_PASS_ON;
}
-static int
+static Eina_Bool
_ecore_evas_x_event_window_show(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
Ecore_X_Event_Window_Show *e;
-
+ static int first_map_bug = -1;
+
e = event;
ee = ecore_event_window_match(e->win);
- if (!ee) return 1; /* pass on event */
- if (e->win != ee->prop.window) return 1;
- if (ee->visible) return 0; /* dont pass it on */
+ if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
+ if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
+ if (first_map_bug < 0)
+ {
+ if (getenv("ECORE_EVAS_GL_FIRST_MAP_BUG"))
+ first_map_bug = atoi(getenv("ECORE_EVAS_GL_FIRST_MAP_BUG"));
+ else
+ first_map_bug = 0;
+ if ((first_map_bug) &&
+ (!strcmp(ee->driver, "opengl_x11")))
+ evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
+ }
+ if (ee->visible) return ECORE_CALLBACK_DONE;
// printf("SHOW EVENT %p\n", ee);
ee->visible = 1;
if (ee->func.fn_show) ee->func.fn_show(ee);
- return 1;
+ return ECORE_CALLBACK_PASS_ON;
}
-static int
+static Eina_Bool
_ecore_evas_x_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Evas *ee;
e = event;
ee = ecore_event_window_match(e->win);
- if (!ee) return 1; /* pass on event */
- if (e->win != ee->prop.window) return 1;
- if (!ee->visible) return 0; /* dont pass it on */
+ if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
+ if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
+ if (!ee->visible) return ECORE_CALLBACK_DONE;
// printf("HIDE EVENT %p\n", ee);
ee->visible = 0;
if (ee->func.fn_hide) ee->func.fn_hide(ee);
- return 1;
+ return ECORE_CALLBACK_PASS_ON;
}
/* FIXME, should be in idler */
(ee, rotation, resize, (Evas_Engine_Info *)einfo);
#endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
}
+ else if (!strcmp(ee->driver, "software_8_x11"))
+ {
+#if BUILD_ECORE_EVAS_SOFTWARE_8_X11
+ Evas_Engine_Info_Software_8_X11 *einfo;
+
+ einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas);
+ if (!einfo) return;
+ einfo->info.rotation = rotation;
+ _ecore_evas_x_rotation_set_internal
+ (ee, rotation, resize, (Evas_Engine_Info *)einfo);
+#endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */
+ }
}
static void
# endif /* XXX no shaped window support for software_16_x11 */
#endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
}
+ if (!strcmp(ee->driver, "software_8_x11"))
+ {
+#if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11)
+ Evas_Engine_Info_Software_8_X11 *einfo;
+ einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas);
+ ee->shaped = shaped;
+ if (einfo)
+ {
+ if (ee->shaped)
+ {
+ unsigned int foreground;
+ Ecore_X_GC gc;
+
+ if (!ee->engine.x.mask)
+ ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1);
+ foreground = 0;
+ gc = ecore_x_gc_new(ee->engine.x.mask,
+ ECORE_X_GC_VALUE_MASK_FOREGROUND,
+ &foreground);
+ ecore_x_drawable_rectangle_fill(ee->engine.x.mask, gc,
+ 0, 0, ee->w, ee->h);
+ ecore_x_gc_free(gc);
+ einfo->info.mask = ee->engine.x.mask;
+ if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
+ {
+ ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
+ }
+ evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
+ ecore_x_window_shape_input_mask_set(ee->prop.window, 0);
+ }
+ else
+ {
+ if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
+ ee->engine.x.mask = 0;
+ einfo->info.mask = 0;
+ evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
+ ecore_x_window_shape_mask_set(ee->prop.window, 0);
+ ecore_x_window_shape_input_mask_set(ee->prop.window, 0);
+ }
+ }
+#endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */
+ }
}
/* FIXME, round trip */
// putenv((char*)"DESKTOP_STARTUP_ID=");
}
}
+ else if (!strcmp(ee->driver, "software_8_x11"))
+ {
+#if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11)
+ Evas_Engine_Info_Software_8_X11 *einfo;
+
+ einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas);
+ if (!einfo) return;
+
+ ee->shaped = 0;
+ ee->alpha = alpha;
+ ecore_x_window_free(ee->prop.window);
+ ecore_event_window_unregister(ee->prop.window);
+ if (ee->alpha)
+ {
+ if (ee->prop.override)
+ ee->prop.window = ecore_x_window_override_argb_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h);
+ else
+ ee->prop.window = ecore_x_window_argb_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h);
+ if (!ee->engine.x.mask)
+ ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->req.w, ee->req.h, 1);
+ }
+ else
+ {
+ if (ee->prop.override)
+ ee->prop.window = ecore_x_window_override_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h);
+ else
+ ee->prop.window = ecore_x_window_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h);
+ if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
+ ee->engine.x.mask = 0;
+ ecore_x_window_shape_input_mask_set(ee->prop.window, 0);
+ }
+
+ einfo->info.destination_alpha = alpha;
+
+ cookie_geom = xcb_get_geometry_unchecked(ecore_x_connection_get(), ee->prop.window);
+ cookie_attr = xcb_get_window_attributes_unchecked(ecore_x_connection_get(), ee->prop.window);
+
+ reply_geom = xcb_get_geometry_reply(ecore_x_connection_get(), cookie_geom, NULL);
+ reply_attr = xcb_get_window_attributes_reply(ecore_x_connection_get(), cookie_attr, NULL);
+ einfo->info.visual = xcb_visualtype_get(ecore_x_default_screen_get(), reply_attr->visual);
+ einfo->info.colormap = reply_attr->colormap;
+ einfo->info.depth = reply_geom->depth;
+ free(reply_geom);
+ free(reply_attr);
+
+// if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask);
+// ee->engine.x.mask = 0;
+ einfo->info.mask = ee->engine.x.mask;
+ einfo->info.drawable = ee->prop.window;
+ if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
+ {
+ ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
+ }
+ evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h);
+ ecore_x_window_shape_mask_set(ee->prop.window, 0);
+ ecore_x_input_multi_select(ee->prop.window);
+ ecore_event_window_register(ee->prop.window, ee, ee->evas, (Ecore_Event_Mouse_Move_Cb) _ecore_evas_mouse_move_process);
+ if (ee->prop.borderless)
+ ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless);
+ if (ee->visible) ecore_x_window_show(ee->prop.window);
+ if (ee->prop.focused) ecore_x_window_focus(ee->prop.window);
+ if (ee->prop.title)
+ {
+ ecore_x_icccm_title_set(ee->prop.window, ee->prop.title);
+ ecore_x_netwm_name_set(ee->prop.window, ee->prop.title);
+ }
+ ecore_x_icccm_hints_set(ee->prop.window,
+ 1 /* accepts_focus */,
+ ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */,
+ 0 /* icon_pixmap */,
+ 0 /* icon_mask */,
+ 0 /* icon_window */,
+ 0 /* window_group */,
+ 0 /* is_urgent */);
+ _ecore_evas_x_protocols_set(ee);
+ _ecore_evas_x_sync_set(ee);
+
+ if (getenv("DESKTOP_STARTUP_ID"))
+ {
+ ecore_x_netwm_startup_id_set(ee->prop.window,
+ getenv("DESKTOP_STARTUP_ID"));
+ /* NB: on linux this may simply empty the env as opposed to completely
+ * unset it to being empty - unsure as solartis libc crashes looking
+ * for the '=' char */
+ // putenv((char*)"DESKTOP_STARTUP_ID=");
+ }
+#endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */
+ }
}
static void
}
#endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
}
+ else if (!strcmp(ee->driver, "software_8_x11"))
+ {
+#if BUILD_ECORE_EVAS_SOFTWARE_8_X11
+ Evas_Engine_Info_Software_8_X11 *einfo;
+
+ ee->prop.avoid_damage = on;
+ einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas);
+ if (einfo)
+ {
+ if (ee->prop.avoid_damage)
+ {
+ ee->engine.x.pmap = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, einfo->info.depth);
+ ee->engine.x.gc = ecore_x_gc_new(ee->engine.x.pmap, 0, NULL);
+ einfo->info.drawable = ee->engine.x.pmap;
+ if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
+ {
+ ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
+ }
+ if ((ee->rotation == 90) || (ee->rotation == 270))
+ evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
+ else
+ evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
+ if (ee->prop.avoid_damage == ECORE_EVAS_AVOID_DAMAGE_BUILT_IN)
+ {
+ ee->engine.x.using_bg_pixmap = 1;
+ ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap);
+ ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h);
+ }
+ if (ee->engine.x.direct_resize)
+ {
+ /* Turn this off for now
+ ee->engine.x.using_bg_pixmap = 1;
+ ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap);
+ */
+ }
+ }
+ else
+ {
+ if (ee->engine.x.pmap) ecore_x_pixmap_free(ee->engine.x.pmap);
+ if (ee->engine.x.gc) ecore_x_gc_free(ee->engine.x.gc);
+ if (ee->engine.x.using_bg_pixmap)
+ {
+ ecore_x_window_pixmap_set(ee->prop.window, 0);
+ ee->engine.x.using_bg_pixmap = 0;
+ ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h);
+ }
+ ee->engine.x.pmap = 0;
+ ee->engine.x.gc = 0;
+ einfo->info.drawable = ee->prop.window;
+ if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
+ {
+ ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
+ }
+ }
+ }
+#endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */
+ }
}
int
* ecore_x_init in 2 functions and supress some round trips.
*/
-#if defined (BUILD_ECORE_EVAS_SOFTWARE_X11) || defined (BUILD_ECORE_EVAS_OPENGL_X11) || defined (BUILD_ECORE_EVAS_XRENDER_X11) || defined (BUILD_ECORE_EVAS_XRENDER_XCB) || defined (BUILD_ECORE_EVAS_SOFTWARE_16_X11)
+#if defined (BUILD_ECORE_EVAS_SOFTWARE_X11) || defined (BUILD_ECORE_EVAS_OPENGL_X11) || defined (BUILD_ECORE_EVAS_XRENDER_X11) || defined (BUILD_ECORE_EVAS_XRENDER_XCB) || defined (BUILD_ECORE_EVAS_SOFTWARE_16_X11) || defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11)
static void
_ecore_evas_x_flush_pre(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
{
{
}
#endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
+
+
+/**
+ * To be documented.
+ *
+ * FIXME: To be fixed.
+ */
+EAPI Ecore_Evas *
+ecore_evas_software_x11_8_new(const char *disp_name, Ecore_X_Window parent,
+ int x, int y, int w, int h)
+{
+#if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11)
+ Evas_Engine_Info_Software_8_X11 *einfo;
+ Ecore_Evas *ee;
+ int argb = 0;
+ int rmethod;
+ static int redraw_debug = -1;
+
+ rmethod = evas_render_method_lookup("software_8_x11");
+ if (!rmethod) return NULL;
+ if (!ecore_x_init(disp_name)) return NULL;
+ ee = calloc(1, sizeof(Ecore_Evas));
+ if (!ee) return NULL;
+
+ ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
+
+ _ecore_evas_x_init();
+
+ ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_x_engine_func;
+
+ ee->driver = "software_8_x11";
+ if (disp_name) ee->name = strdup(disp_name);
+
+ if (w < 1) w = 1;
+ if (h < 1) h = 1;
+ ee->x = x;
+ ee->y = y;
+ ee->w = w;
+ ee->h = h;
+ ee->req.x = ee->x;
+ ee->req.y = ee->y;
+ ee->req.w = ee->w;
+ ee->req.h = ee->h;
+
+ ee->prop.max.w = 32767;
+ ee->prop.max.h = 32767;
+ ee->prop.layer = 4;
+ ee->prop.request_pos = 0;
+ ee->prop.sticky = 0;
+ ee->engine.x.state.sticky = 0;
+
+ /* init evas here */
+ ee->evas = evas_new();
+ evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_PRE, _ecore_evas_x_flush_pre, ee);
+ evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_POST, _ecore_evas_x_flush_post, ee);
+ evas_data_attach_set(ee->evas, ee);
+ evas_output_method_set(ee->evas, rmethod);
+ evas_output_size_set(ee->evas, w, h);
+ evas_output_viewport_set(ee->evas, 0, 0, w, h);
+
+ ee->engine.x.win_root = parent;
+ // if (parent != 0)
+ // {
+ // /* FIXME: round trip in ecore_x_window_argb_get */
+ // if (ecore_x_window_argb_get(parent))
+ // {
+ // ee->engine.x.win = ecore_x_window_argb_new(parent, x, y, w, h);
+ // argb = 1;
+ // }
+ // else
+ // ee->engine.x.win = ecore_x_window_new(parent, x, y, w, h);
+ // }
+ // else
+ ee->prop.window = ecore_x_window_new(parent, x, y, w, h);
+ if (getenv("DESKTOP_STARTUP_ID"))
+ {
+ ecore_x_netwm_startup_id_set(ee->prop.window,
+ getenv("DESKTOP_STARTUP_ID"));
+ /* NB: on linux this may simply empty the env as opposed to completely
+ * unset it to being empty - unsure as solartis libc crashes looking
+ * for the '=' char */
+ // putenv((char*)"DESKTOP_STARTUP_ID=");
+ }
+ einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas);
+ if (einfo)
+ {
+ xcb_screen_iterator_t iter;
+ xcb_screen_t *screen;
+
+ /* FIXME: this is inefficient as its a round trip */
+ //einfo->info.backend = 1;
+ screen = ecore_x_default_screen_get();
+ iter = xcb_setup_roots_iterator (xcb_get_setup (ecore_x_connection_get()));
+ if (iter.rem > 1)
+ {
+ xcb_get_geometry_cookie_t cookie;
+ xcb_get_geometry_reply_t *reply;
+ Ecore_X_Window *roots;
+ int num;
+ uint8_t i;
+
+ num = 0;
+ cookie = xcb_get_geometry_unchecked(ecore_x_connection_get(), parent);
+ roots = ecore_x_window_root_list(&num);
+ if (roots)
+ {
+ reply = xcb_get_geometry_reply(ecore_x_connection_get(), cookie, NULL);
+
+ if (reply)
+ {
+ for (i = 0; i < num; xcb_screen_next (&iter), i++)
+ {
+ if (reply->root == roots[i])
+ {
+ screen = iter.data;
+ break;
+ }
+ }
+ free(reply);
+ }
+ free(roots);
+ }
+ else
+ {
+ reply = xcb_get_geometry_reply(ecore_x_connection_get(), cookie, NULL);
+ if (reply) free(reply);
+ }
+ }
+
+ if (redraw_debug < 0)
+ {
+ if (getenv("REDRAW_DEBUG"))
+ redraw_debug = atoi(getenv("REDRAW_DEBUG"));
+ else
+ redraw_debug = 0;
+ }
+ einfo->info.connection = ecore_x_connection_get();
+ einfo->info.screen = screen;
+ einfo->info.drawable = ee->prop.window;
+ if (argb)
+ {
+ /* FIXME: round trip */
+ xcb_get_geometry_cookie_t cookie_geom;
+ xcb_get_window_attributes_cookie_t cookie_attr;
+ xcb_get_geometry_reply_t *reply_geom;
+ xcb_get_window_attributes_reply_t *reply_attr;
+
+ cookie_geom = xcb_get_geometry_unchecked(ecore_x_connection_get(), ee->prop.window);
+ cookie_attr = xcb_get_window_attributes_unchecked(ecore_x_connection_get(), ee->prop.window);
+
+ reply_geom = xcb_get_geometry_reply(ecore_x_connection_get(), cookie_geom, NULL);
+ reply_attr = xcb_get_window_attributes_reply(ecore_x_connection_get(), cookie_attr, NULL);
+ if (reply_attr && reply_geom)
+ {
+ einfo->info.visual = xcb_visualtype_get(ecore_x_default_screen_get(), reply_attr->visual);
+ einfo->info.colormap = reply_attr->colormap;
+ einfo->info.depth = reply_geom->depth;
+ einfo->info.destination_alpha = 1;
+ free(reply_geom);
+ free(reply_attr);
+ }
+ }
+ else
+ {
+ xcb_screen_t *screen;
+
+ screen = ecore_x_default_screen_get();
+ einfo->info.visual = xcb_visualtype_get(screen, screen->root_visual);
+ einfo->info.colormap = screen->default_colormap;
+ einfo->info.depth = screen->root_depth;
+ einfo->info.destination_alpha = 0;
+ }
+ einfo->info.rotation = 0;
+ einfo->info.debug = redraw_debug;
+ if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
+ {
+ WRN("evas_engine_info_set() init engine '%s' failed.", ee->driver);
+ ecore_evas_free(ee);
+ return NULL;
+ }
+ }
+
+ ecore_x_icccm_hints_set(ee->prop.window,
+ 1 /* accepts_focus */,
+ ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */,
+ 0 /* icon_pixmap */,
+ 0 /* icon_mask */,
+ 0 /* icon_window */,
+ 0 /* window_group */,
+ 0 /* is_urgent */);
+
+ ee->engine.func->fn_render = _ecore_evas_x_render;
+ _ecore_evas_register(ee);
+ ecore_x_input_multi_select(ee->prop.window);
+ ecore_event_window_register(ee->prop.window, ee, ee->evas, (Ecore_Event_Mouse_Move_Cb) _ecore_evas_mouse_move_process);
+
+ return ee;
+#else
+ return NULL;
+#endif /* ! BUILD_ECORE_EVAS_SOFTWARE_8_X11 */
+}
+
+/**
+ * To be documented.
+ *
+ * FIXME: To be fixed.
+ */
+EAPI Ecore_X_Window
+ecore_evas_software_x11_8_window_get(const Ecore_Evas *ee)
+{
+#if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11)
+ return (Ecore_X_Window) ecore_evas_window_get(ee);
+#else
+ return 0;
+#endif
+}
+
+/**
+ * To be documented.
+ *
+ * FIXME: To be fixed.
+ */
+EAPI Ecore_X_Window
+ecore_evas_software_x11_8_subwindow_get(const Ecore_Evas *ee)
+{
+#if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11)
+ return (Ecore_X_Window) ecore_evas_window_get(ee);
+#else
+ return 0;
+#endif
+}
+
+/**
+ * To be documented.
+ *
+ * FIXME: To be fixed.
+ */
+EAPI void
+ecore_evas_software_x11_8_direct_resize_set(Ecore_Evas *ee, int on)
+{
+#if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11)
+ ee->engine.x.direct_resize = on;
+ if (ee->prop.avoid_damage)
+ {
+ if (ee->engine.x.direct_resize)
+ {
+ /* turn this off for now
+ ee->engine.x.using_bg_pixmap = 1;
+ ecore_x_window_pixmap_set(ee->engine.x.win, ee->engine.x.pmap);
+ */
+ }
+ else
+ {
+ /* turn this off too- bg pixmap is controlled by avoid damage directly
+ ee->engine.x.using_bg_pixmap = 0;
+ ecore_x_window_pixmap_set(ee->engine.x.win, 0);
+ ecore_x_window_area_expose(ee->engine.x.win, 0, 0, ee->w, ee->h);
+ */
+ }
+ }
+#else
+ return;
+#endif
+}
+
+/**
+ * To be documented.
+ *
+ * FIXME: To be fixed.
+ */
+EAPI int
+ecore_evas_software_x11_8_direct_resize_get(const Ecore_Evas *ee)
+{
+#if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11)
+ return ee->engine.x.direct_resize;
+#else
+ return 0;
+#endif
+}
+
+/**
+ * To be documented.
+ *
+ * FIXME: To be fixed.
+ */
+EAPI void
+ecore_evas_software_x11_8_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win)
+{
+#if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11)
+ Ecore_X_Window *winp;
+
+ winp = malloc(sizeof(Ecore_X_Window));
+ if (winp)
+ {
+ *winp = win;
+ ee->engine.x.win_extra = eina_list_append(ee->engine.x.win_extra, winp);
+ ecore_x_input_multi_select(win);
+ ecore_event_window_register(win, ee, ee->evas, (Ecore_Event_Mouse_Move_Cb) _ecore_evas_mouse_move_process);
+ }
+#else
+#endif
+}
if BUILD_ECORE_FB
lib_LTLIBRARIES = libecore_fb.la
-include_HEADERS = \
-Ecore_Fb.h
+includes_HEADERS = Ecore_Fb.h
+includesdir = $(includedir)/ecore-@VMAJ@
libecore_fb_la_SOURCES = \
ecore_fb.c \
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
static int _ecore_fb_lock = 0;
static Ecore_Fd_Handler *_ecore_fb_kbd_fd_handler_handle = NULL;
-static int _ecore_fb_kbd_fd_handler(void *data, Ecore_Fd_Handler *fd_handler);
+static Eina_Bool _ecore_fb_kbd_fd_handler(void *data, Ecore_Fd_Handler *fd_handler);
static void
_ecore_fb_event_free_key_down(void *data __UNUSED__, void *ev)
free(e);
}
-static int
+static Eina_Bool
_ecore_fb_kbd_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UNUSED__)
{
int v = 0;
unsigned char buf;
v = read(_ecore_fb_kbd_fd, &buf, 1);
- if (v < 0) return 1;
- if (v < 1) return 1;
+ if (v < 0) return EINA_TRUE;
+ if (v < 1) return EINA_TRUE;
if (!(buf & 0x80))
{
/* DOWN */
;
}
while (v > 0);
- return 1;
+ return EINA_TRUE;
}
int
void
ecore_fb_kbd_shutdown(void)
{
- if (_ecore_fb_kbd_fd >= 0) close(_ecore_fb_kbd_fd);
if (_ecore_fb_kbd_fd_handler_handle)
ecore_main_fd_handler_del(_ecore_fb_kbd_fd_handler_handle);
+ if (_ecore_fb_kbd_fd >= 0) close(_ecore_fb_kbd_fd);
_ecore_fb_kbd_fd = 0;
_ecore_fb_kbd_fd_handler_handle = NULL;
_ecore_fb_ctrl = 0;
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
}
}
-static int
+static Eina_Bool
_ecore_fb_li_device_fd_callback(void *data, Ecore_Fd_Handler *fdh)
{
Ecore_Fb_Input_Device *dev;
break;
}
}
- return 1;
+ return EINA_TRUE;
}
-/*
- * Starts getting events from the input device
- *
+/**
+ * @brief Sets the listen mode for an input device
+ * @param dev The device to set the mode of
+ * @param listen The mode of listening (0 for off, 1 for on)
+ * This enables or disables listening on an input device.
*/
EAPI void
ecore_fb_input_device_listen(Ecore_Fb_Input_Device *dev, int listen)
#endif
/*
- * Opens an input device
+ * @brief Opens an input device
+ * @param dev The device to open
+ * @return The @ref Ecore_Fb_Input_Device object that has been opened
+ * This opens an input device and returns the object for it, or returns NULL on failure.
*/
EAPI Ecore_Fb_Input_Device *
ecore_fb_input_device_open(const char *dev)
static int _ecore_fb_ps2_event_byte_count = 0;
static Ecore_Fb_Ps2_Event _ecore_fb_ps2_event;
static int _ecore_fb_ps2_fd = 0;
-static int _ecore_fb_ps2_fd_handler(void *data, Ecore_Fd_Handler *fd_handler);
+static Eina_Bool _ecore_fb_ps2_fd_handler(void *data, Ecore_Fd_Handler *fd_handler);
int
ecore_fb_ps2_init(void)
_ecore_fb_ps2_fd = 0;
}
-static int
+static Eina_Bool
_ecore_fb_ps2_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UNUSED__)
{
static int prev_x = 0, prev_y = 0, prev_button = 0;
ptr += _ecore_fb_ps2_event_byte_count;
num = sizeof(Ecore_Fb_Ps2_Event) - _ecore_fb_ps2_event_byte_count;
v = read(_ecore_fb_ps2_fd, ptr, num);
- if (v < 0) return 1;
+ if (v < 0) return EINA_TRUE;
_ecore_fb_ps2_event_byte_count += v;
- if (v < num) return 1;
+ if (v < num) return EINA_TRUE;
t = ecore_time_get();
_ecore_fb_ps2_event_byte_count = 0;
if (_ecore_fb_ps2_event.button & 0x10)
prev_button = button;
}
while (v > 0);
- return 1;
+ return EINA_TRUE;
}
/**
* @defgroup Ecore_FB_Click_Group Framebuffer Double Click Functions
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
unsigned char brightness;
};
-static int _ecore_fb_ts_fd_handler(void *data, Ecore_Fd_Handler *fd_handler);
+static Eina_Bool _ecore_fb_ts_fd_handler(void *data, Ecore_Fd_Handler *fd_handler);
static int _ecore_fb_ts_fd = -1;
static int _ecore_fb_ts_event_byte_count = 0;
static int _ecore_fb_ts_apply_cal = 0;
EAPI void
ecore_fb_ts_shutdown(void)
{
- if (_ecore_fb_ts_fd >= 0) close(_ecore_fb_ts_fd);
if (_ecore_fb_ts_fd_handler_handle)
ecore_main_fd_handler_del(_ecore_fb_ts_fd_handler_handle);
+ if (_ecore_fb_ts_fd >= 0) close(_ecore_fb_ts_fd);
_ecore_fb_ts_fd = -1;
_ecore_fb_ts_fd_handler_handle = NULL;
}
if (xyswap) *xyswap = cal.xyswap;
}
-static int
+static Eina_Bool
_ecore_fb_ts_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UNUSED__)
{
static int prev_x = 0, prev_y = 0, prev_pressure = 0;
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
static struct termios _ecore_fb_tty_prev_tio_mode;
static struct vt_mode _ecore_fb_vt_prev_mode;
-static int _ecore_fb_signal_usr_handler(void *data, int type, void *ev);
+static Eina_Bool _ecore_fb_signal_usr_handler(void *data, int type, void *ev);
static Ecore_Event_Handler *_ecore_fb_user_handler = NULL;
static int _ecore_fb_tty_prev_mode = 0;
static int _ecore_fb_tty_prev_kd_mode = 0;
static Ecore_Event_Filter *_ecore_fb_filter_handler = NULL;
static void *_ecore_fb_event_filter_start(void *data);
-static int _ecore_fb_event_filter_filter(void *data, void *loop_data, int type, void *event);
+static Eina_Bool _ecore_fb_event_filter_filter(void *data, void *loop_data, int type, void *event);
static void _ecore_fb_event_filter_end(void *data, void *loop_data);
/* prototypes */
static void _ecore_fb_vt_switch(int vt);
-static int
+static Eina_Bool
_ecore_fb_signal_usr_handler(void *data __UNUSED__, int type __UNUSED__, void *ev)
{
return filter_data;
}
-static int
+static Eina_Bool
_ecore_fb_event_filter_filter(void *data __UNUSED__, void *loop_data,int type, void *event __UNUSED__)
{
Ecore_Fb_Filter_Data *filter_data;
filter_data = loop_data;
- if (!filter_data) return 1;
+ if (!filter_data) return EINA_TRUE;
if (type == ECORE_FB_EVENT_MOUSE_MOVE)
{
if ((filter_data->last_event_type) == ECORE_FB_EVENT_MOUSE_MOVE)
{
filter_data->last_event_type = type;
- return 0;
+ return EINA_FALSE;
}
}
filter_data->last_event_type = type;
- return 1;
+ return EINA_TRUE;
}
static void
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifndef ECORE_FILE_H
#define ECORE_FILE_H
EAPI int ecore_file_shutdown (void);
EAPI long long ecore_file_mod_time (const char *file);
EAPI long long ecore_file_size (const char *file);
- EAPI int ecore_file_exists (const char *file);
- EAPI int ecore_file_is_dir (const char *file);
- EAPI int ecore_file_mkdir (const char *dir);
+ EAPI Eina_Bool ecore_file_exists (const char *file);
+ EAPI Eina_Bool ecore_file_is_dir (const char *file);
+ EAPI Eina_Bool ecore_file_mkdir (const char *dir);
EAPI int ecore_file_mkdirs (const char **dirs);
EAPI int ecore_file_mksubdirs (const char *base, const char **subdirs);
- EAPI int ecore_file_rmdir (const char *dir);
- EAPI int ecore_file_recursive_rm (const char *dir);
- EAPI int ecore_file_mkpath (const char *path);
+ EAPI Eina_Bool ecore_file_rmdir (const char *dir);
+ EAPI Eina_Bool ecore_file_recursive_rm (const char *dir);
+ EAPI Eina_Bool ecore_file_mkpath (const char *path);
EAPI int ecore_file_mkpaths (const char **paths);
- EAPI int ecore_file_cp (const char *src, const char *dst);
- EAPI int ecore_file_mv (const char *src, const char *dst);
- EAPI int ecore_file_symlink (const char *src, const char *dest);
+ EAPI Eina_Bool ecore_file_cp (const char *src, const char *dst);
+ EAPI Eina_Bool ecore_file_mv (const char *src, const char *dst);
+ EAPI Eina_Bool ecore_file_symlink (const char *src, const char *dest);
EAPI char *ecore_file_realpath (const char *file);
- EAPI int ecore_file_unlink (const char *file);
- EAPI int ecore_file_remove (const char *file);
+ EAPI Eina_Bool ecore_file_unlink (const char *file);
+ EAPI Eina_Bool ecore_file_remove (const char *file);
EAPI const char *ecore_file_file_get (const char *path);
EAPI char *ecore_file_dir_get (const char *path);
- EAPI int ecore_file_can_read (const char *file);
- EAPI int ecore_file_can_write (const char *file);
- EAPI int ecore_file_can_exec (const char *file);
+ EAPI Eina_Bool ecore_file_can_read (const char *file);
+ EAPI Eina_Bool ecore_file_can_write (const char *file);
+ EAPI Eina_Bool ecore_file_can_exec (const char *file);
EAPI char *ecore_file_readlink (const char *link);
EAPI Eina_List *ecore_file_ls (const char *dir);
+ EAPI Eina_Iterator *ecore_file_ls_iterator(const char *dir);
EAPI char *ecore_file_app_exe_get (const char *app);
EAPI char *ecore_file_escape_name (const char *filename);
EAPI char *ecore_file_strip_ext (const char *file);
if BUILD_ECORE_FILE
lib_LTLIBRARIES = libecore_file.la
-include_HEADERS = Ecore_File.h
+includes_HEADERS = Ecore_File.h
+includesdir = $(includedir)/ecore-@VMAJ@
libecore_file_la_SOURCES = \
ecore_file.c \
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <dirent.h>
#ifndef _MSC_VER
# include <unistd.h>
/**
* Check if file exists
* @param file The name of the file
- * @return 1 if file exists on local filesystem, 0 otherwise
+ * @return EINA_TRUE if file exists on local filesystem, EINA_FALSE otherwise
*/
-EAPI int
+EAPI Eina_Bool
ecore_file_exists(const char *file)
{
struct stat st;
/*Workaround so that "/" returns a true, otherwise we can't monitor "/" in ecore_file_monitor*/
- if (stat(file, &st) < 0 && strcmp(file, "/")) return 0;
- return 1;
+ if (stat(file, &st) < 0 && strcmp(file, "/")) return EINA_FALSE;
+ return EINA_TRUE;
}
/**
* Check if file is a directory
* @param file The name of the file
- * @return 1 if file exist and is a directory, 0 otherwise
+ * @return EINA_TRUE if file exist and is a directory, EINA_FALSE otherwise
*/
-EAPI int
+EAPI Eina_Bool
ecore_file_is_dir(const char *file)
{
struct stat st;
- if (stat(file, &st) < 0) return 0;
- if (S_ISDIR(st.st_mode)) return 1;
- return 0;
+ if (stat(file, &st) < 0) return EINA_FALSE;
+ if (S_ISDIR(st.st_mode)) return EINA_TRUE;
+ return EINA_FALSE;
}
static mode_t default_mode = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
/**
* Create a new directory
* @param dir The name of the directory to create
- * @return 1 on successfull creation, 0 on failure
+ * @return EINA_TRUE on successfull creation, EINA_FALSE on failure
*
* The directory is created with the mode: S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH
*/
-EAPI int
+EAPI Eina_Bool
ecore_file_mkdir(const char *dir)
{
- if (mkdir(dir, default_mode) < 0) return 0;
- return 1;
+ if (mkdir(dir, default_mode) < 0) return EINA_FALSE;
+ return EINA_TRUE;
}
/**
/**
* Delete the given dir
* @param dir The name of the directory to delete
- * @return 1 on success, 0 on failure
+ * @return EINA_TRUE on success, EINA_FALSE on failure
*/
-EAPI int
+EAPI Eina_Bool
ecore_file_rmdir(const char *dir)
{
- if (rmdir(dir) < 0) return 0;
- return 1;
+ if (rmdir(dir) < 0) return EINA_FALSE;
+ return EINA_TRUE;
}
/**
* Delete the given file
* @param file The name of the file to delete
- * @return 1 on success, 0 on failure
+ * @return EINA_TRUE on success, EINA_FALSE on failure
*/
-EAPI int
+EAPI Eina_Bool
ecore_file_unlink(const char *file)
{
- if (unlink(file) < 0) return 0;
- return 1;
+ if (unlink(file) < 0) return EINA_FALSE;
+ return EINA_TRUE;
}
/**
* Remove the given file or directory
* @param file The name of the file or directory to delete
- * @return 1 on success, 0 on failure
+ * @return EINA_TRUE on success, EINA_FALSE on failure
*/
-EAPI int
+EAPI Eina_Bool
ecore_file_remove(const char *file)
{
- if (remove(file) < 0) return 0;
- return 1;
+ if (remove(file) < 0) return EINA_FALSE;
+ return EINA_TRUE;
}
/**
* Delete a directory and all its contents
* @param dir The name of the directory to delete
- * @return 1 on success, 0 on failure
+ * @return EINA_TRUE on success, EINA_FALSE on failure
*
* If dir is a link only the link is removed
*/
-EAPI int
+EAPI Eina_Bool
ecore_file_recursive_rm(const char *dir)
{
DIR *dirp;
if ((ret == 0) && (S_ISDIR(st.st_mode)))
{
ret = 1;
- if (stat(dir, &st) == -1) return 0;
+ if (stat(dir, &st) == -1) return EINA_FALSE;
dirp = opendir(dir);
if (dirp)
{
closedir(dirp);
}
if (!ecore_file_rmdir(dir)) ret = 0;
- return ret;
+ if (ret)
+ return EINA_TRUE;
+ else
+ return EINA_FALSE;
}
else
{
- if (ret == -1) return 0;
+ if (ret == -1) return EINA_FALSE;
return ecore_file_unlink(dir);
}
}
-static inline int
+static inline Eina_Bool
_ecore_file_mkpath_if_not_exists(const char *path)
{
struct stat st;
if (stat(path, &st) < 0)
return ecore_file_mkdir(path);
else if (!S_ISDIR(st.st_mode))
- return 0;
+ return EINA_FALSE;
else
- return 1;
+ return EINA_TRUE;
}
/**
* Create a complete path
* @param path The path to create
- * @return 1 on success, 0 on failure
+ * @return EINA_TRUE on success, EINA_FALSE on failure
*
* @see ecore_file_mkpaths() and ecore_file_mkdir()
*/
-EAPI int
+EAPI Eina_Bool
ecore_file_mkpath(const char *path)
{
char ss[PATH_MAX];
unsigned int i;
if (ecore_file_is_dir(path))
- return 1;
+ return EINA_TRUE;
for (i = 0; path[i] != '\0'; ss[i] = path[i], i++)
{
- if (i == sizeof(ss) - 1) return 0;
+ if (i == sizeof(ss) - 1) return EINA_FALSE;
if ((path[i] == '/') && (i > 0))
{
ss[i] = '\0';
if (!_ecore_file_mkpath_if_not_exists(ss))
- return 0;
+ return EINA_FALSE;
}
}
ss[i] = '\0';
* Copy a file
* @param src The name of the source file
* @param dst The name of the destination file
- * @return 1 on success, 0 on failure
+ * @return EINA_TRUE on success, EINA_FALSE on failure
*/
-EAPI int
+EAPI Eina_Bool
ecore_file_cp(const char *src, const char *dst)
{
FILE *f1, *f2;
char buf[16384];
char realpath1[PATH_MAX], realpath2[PATH_MAX];
size_t num;
- int ret = 1;
+ Eina_Bool ret = EINA_TRUE;
- if (!realpath(src, realpath1)) return 0;
- if (realpath(dst, realpath2) && !strcmp(realpath1, realpath2)) return 0;
+ if (!realpath(src, realpath1)) return EINA_FALSE;
+ if (realpath(dst, realpath2) && !strcmp(realpath1, realpath2)) return EINA_FALSE;
f1 = fopen(src, "rb");
- if (!f1) return 0;
+ if (!f1) return EINA_FALSE;
f2 = fopen(dst, "wb");
if (!f2)
{
fclose(f1);
- return 0;
+ return EINA_FALSE;
}
while ((num = fread(buf, 1, sizeof(buf), f1)) > 0)
{
- if (fwrite(buf, 1, num, f2) != num) ret = 0;
+ if (fwrite(buf, 1, num, f2) != num) ret = EINA_FALSE;
}
fclose(f1);
fclose(f2);
* Move a file
* @param src The name of the source file
* @param dst The name of the destination file
- * @return 1 on success, 0 on failure
+ * @return EINA_TRUE on success, EINA_FALSE on failure
*/
-EAPI int
+EAPI Eina_Bool
ecore_file_mv(const char *src, const char *dst)
{
char buf[PATH_MAX];
}
PASS:
- return 1;
+ return EINA_TRUE;
FAIL:
- return 0;
+ return EINA_FALSE;
}
/**
* Create a symbolic link
* @param src The name of the file to link
* @param dest The name of link
- * @return 1 on success, 0 on failure
+ * @return EINA_TRUE on success, EINA_FALSE on failure
*/
-EAPI int
+EAPI Eina_Bool
ecore_file_symlink(const char *src, const char *dest)
{
- if (!symlink(src, dest)) return 1;
+ if (!symlink(src, dest)) return EINA_TRUE;
- return 0;
+ return EINA_FALSE;
}
/**
/**
* Check if file can be read
* @param file The name of the file
- * @return 1 if the file is readable, 0 otherwise
+ * @return EINA_TRUE if the file is readable, EINA_FALSE otherwise
*/
-EAPI int
+EAPI Eina_Bool
ecore_file_can_read(const char *file)
{
- if (!file) return 0;
- if (!access(file, R_OK)) return 1;
- return 0;
+ if (!file) return EINA_FALSE;
+ if (!access(file, R_OK)) return EINA_TRUE;
+ return EINA_FALSE;
}
/**
* Check if file can be written
* @param file The name of the file
- * @return 1 if the file is writable, 0 otherwise
+ * @return EINA_TRUE if the file is writable, EINA_FALSE otherwise
*/
-EAPI int
+EAPI Eina_Bool
ecore_file_can_write(const char *file)
{
- if (!file) return 0;
- if (!access(file, W_OK)) return 1;
- return 0;
+ if (!file) return EINA_FALSE;
+ if (!access(file, W_OK)) return EINA_TRUE;
+ return EINA_FALSE;
}
/**
* Check if file can be executed
* @param file The name of the file
- * @return 1 if the file can be executed, 0 otherwise
+ * @return EINA_TRUE if the file can be executed, EINA_FALSE otherwise
*/
-EAPI int
+EAPI Eina_Bool
ecore_file_can_exec(const char *file)
{
- if (!file) return 0;
- if (!access(file, X_OK)) return 1;
- return 0;
+ if (!file) return EINA_FALSE;
+ if (!access(file, X_OK)) return EINA_TRUE;
+ return EINA_FALSE;
}
/**
char buf[PATH_MAX];
int count;
- if ((count = readlink(link, buf, sizeof(buf))) < 0) return NULL;
+ if ((count = readlink(link, buf, sizeof(buf) - 1)) < 0) return NULL;
buf[count] = 0;
return strdup(buf);
}
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
int (*progress_cb)(void *data, const char *file, long int dltotal, long int dlnow, long int ultotal, long int ulnow),
void *data);
-static int _ecore_file_download_url_complete_cb(void *data, int type, void *event);
-static int _ecore_file_download_url_progress_cb(void *data, int type, void *event);
+static Eina_Bool _ecore_file_download_url_complete_cb(void *data, int type, void *event);
+static Eina_Bool _ecore_file_download_url_progress_cb(void *data, int type, void *event);
#endif
static Ecore_Event_Handler *_url_complete_handler = NULL;
return -1;
}
-static int
+static Eina_Bool
_ecore_file_download_url_complete_cb(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Con_Event_Url_Complete *ev = event;
Ecore_File_Download_Job *job;
job = eina_list_search_unsorted(_job_list, _ecore_file_download_url_compare_job, ev->url_con);
- if (!ECORE_MAGIC_CHECK(job, ECORE_MAGIC_FILE_DOWNLOAD_JOB)) return 1;
-
+ if (!ECORE_MAGIC_CHECK(job, ECORE_MAGIC_FILE_DOWNLOAD_JOB)) return ECORE_CALLBACK_PASS_ON;
if (job->completion_cb)
job->completion_cb(ecore_con_url_data_get(job->url_con), job->dst, !ev->status);
free(job->dst);
free(job);
- return 0;
+ return ECORE_CALLBACK_DONE;
}
-static int
+static Eina_Bool
_ecore_file_download_url_progress_cb(void *data __UNUSED__, int type __UNUSED__, void *event)
{
/* this reports the downloads progress. if we return 0, then download
Ecore_File_Download_Job *job;
job = eina_list_search_unsorted(_job_list, _ecore_file_download_url_compare_job, ev->url_con);
- if (!ECORE_MAGIC_CHECK(job, ECORE_MAGIC_FILE_DOWNLOAD_JOB)) return 1;
+ if (!ECORE_MAGIC_CHECK(job, ECORE_MAGIC_FILE_DOWNLOAD_JOB)) return ECORE_CALLBACK_PASS_ON;
if (job->progress_cb)
if (job->progress_cb(ecore_con_url_data_get(job->url_con), job->dst,
free(job->dst);
free(job);
- return 1;
+ return ECORE_CALLBACK_PASS_ON;
}
- return 0;
+ return ECORE_CALLBACK_DONE;
}
Ecore_File_Download_Job *
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
static Ecore_Fd_Handler *_fdh = NULL;
static Ecore_File_Monitor *_monitors = NULL;
-static int _ecore_file_monitor_inotify_handler(void *data, Ecore_Fd_Handler *fdh);
+static Eina_Bool _ecore_file_monitor_inotify_handler(void *data, Ecore_Fd_Handler *fdh);
static Ecore_File_Monitor *_ecore_file_monitor_inotify_monitor_find(int wd);
static void _ecore_file_monitor_inotify_events(Ecore_File_Monitor *em, char *file, int mask);
static int _ecore_file_monitor_inotify_monitor(Ecore_File_Monitor *em, const char *path);
free(em);
}
-static int
+static Eina_Bool
_ecore_file_monitor_inotify_handler(void *data __UNUSED__, Ecore_Fd_Handler *fdh)
{
Ecore_File_Monitor *em;
_ecore_file_monitor_inotify_events(em, (event->len ? event->name : NULL), event->mask);
}
- return 1;
+ return ECORE_CALLBACK_RENEW;
}
static Ecore_File_Monitor *
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
static Ecore_File_Monitor *_monitors = NULL;
static int _lock = 0;
-static int _ecore_file_monitor_poll_handler(void *data);
+static Eina_Bool _ecore_file_monitor_poll_handler(void *data);
static void _ecore_file_monitor_poll_check(Ecore_File_Monitor *em);
static int _ecore_file_monitor_poll_checking(Ecore_File_Monitor *em, char *name);
em->data = data;
ECORE_FILE_MONITOR_POLL(em)->mtime = ecore_file_mod_time(em->path);
+ _monitors = ECORE_FILE_MONITOR(eina_inlist_append(EINA_INLIST_GET(_monitors), EINA_INLIST_GET(em)));
+
if (ecore_file_exists(em->path))
{
if (ecore_file_is_dir(em->path))
return NULL;
}
- _monitors = ECORE_FILE_MONITOR(eina_inlist_append(EINA_INLIST_GET(_monitors), EINA_INLIST_GET(em)));
-
return em;
}
}
}
-static int
+static Eina_Bool
_ecore_file_monitor_poll_handler(void *data __UNUSED__)
{
Ecore_File_Monitor *l;
if (ECORE_FILE_MONITOR_POLL(em)->deleted)
ecore_file_monitor_del(em);
}
- return 1;
+ return ECORE_CALLBACK_RENEW;
}
static void
\r
static Ecore_File_Monitor *_monitors = NULL;\r
\r
-static int _ecore_file_monitor_win32_cb(void *data, Ecore_Win32_Handler *wh);\r
+static Eina_Bool _ecore_file_monitor_win32_cb(void *data, Ecore_Win32_Handler *wh);\r
\r
\r
static Ecore_File_Monitor_Win32_Data *\r
free (md);\r
}\r
\r
-static int\r
+static Eina_Bool\r
_ecore_file_monitor_win32_cb(void *data, Ecore_Win32_Handler *wh)\r
{\r
char filename[PATH_MAX];\r
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
# include <Evil.h>
#endif
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <dirent.h>
+
#include "Ecore.h"
#include "ecore_private.h"
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifndef _ECORE_IMF_H
#define _ECORE_IMF_H
AM_CFLAGS = @WIN32_CFLAGS@
lib_LTLIBRARIES = libecore_imf.la
-include_HEADERS = \
-Ecore_IMF.h
+includes_HEADERS = Ecore_IMF.h
+includesdir = $(includedir)/ecore-@VMAJ@
libecore_imf_la_SOURCES = \
ecore_imf.c \
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
if (!it)
return NULL;
- eina_iterator_foreach(it, EINA_EACH(_hash_module_available_get), &values);
+ eina_iterator_foreach(it, EINA_EACH_CB(_hash_module_available_get), &values);
eina_iterator_free(it);
return values;
if (!it)
return NULL;
- eina_iterator_foreach(it, EINA_EACH(_hash_ids_get), &l);
+ eina_iterator_foreach(it, EINA_EACH_CB(_hash_ids_get), &l);
eina_iterator_free(it);
return l;
selector.toselect = canvas_type;
selector.selected = values;
- eina_iterator_foreach(it, EINA_EACH(_hash_ids_by_canvas_type_get), &selector);
+ eina_iterator_foreach(it, EINA_EACH_CB(_hash_ids_by_canvas_type_get), &selector);
eina_iterator_free(it);
return values;
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
#ifndef _ECORE_IMF_EVAS_H
#define _ECORE_IMF_EVAS_H
@EINA_CFLAGS@
lib_LTLIBRARIES = libecore_imf_evas.la
-include_HEADERS = \
-Ecore_IMF_Evas.h
+includes_HEADERS = Ecore_IMF_Evas.h
+includesdir = $(includedir)/ecore-@VMAJ@
libecore_imf_evas_la_SOURCES = \
ecore_imf_evas.c
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifndef _ECORE_INPUT_H
#define _ECORE_INPUT_H
if BUILD_ECORE_INPUT
lib_LTLIBRARIES = libecore_input.la
-include_HEADERS = Ecore_Input.h
+includes_HEADERS = Ecore_Input.h
+includesdir = $(includedir)/ecore-@VMAJ@
libecore_input_la_SOURCES = \
ecore_input.c
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifndef _ECORE_INPUT_EVAS_H
#define _ECORE_INPUT_EVAS_H
EAPI int ecore_event_evas_init(void);
EAPI int ecore_event_evas_shutdown(void);
-EAPI int ecore_event_evas_key_down(void *data, int type, void *event);
-EAPI int ecore_event_evas_key_up(void *data, int type, void *event);
-EAPI int ecore_event_evas_mouse_button_up(void *data, int type, void *event);
-EAPI int ecore_event_evas_mouse_button_down(void *data, int type, void *event);
-EAPI int ecore_event_evas_mouse_wheel(void *data, int type, void *event);
-EAPI int ecore_event_evas_mouse_move(void *data, int type, void *event);
-EAPI int ecore_event_evas_mouse_in(void *data, int type, void *event);
-EAPI int ecore_event_evas_mouse_out(void *data, int type, void *event);
+EAPI Eina_Bool ecore_event_evas_key_down(void *data, int type, void *event);
+EAPI Eina_Bool ecore_event_evas_key_up(void *data, int type, void *event);
+EAPI Eina_Bool ecore_event_evas_mouse_button_up(void *data, int type, void *event);
+EAPI Eina_Bool ecore_event_evas_mouse_button_down(void *data, int type, void *event);
+EAPI Eina_Bool ecore_event_evas_mouse_wheel(void *data, int type, void *event);
+EAPI Eina_Bool ecore_event_evas_mouse_move(void *data, int type, void *event);
+EAPI Eina_Bool ecore_event_evas_mouse_in(void *data, int type, void *event);
+EAPI Eina_Bool ecore_event_evas_mouse_out(void *data, int type, void *event);
EAPI void ecore_event_window_register(Ecore_Window id, void *window, Evas *evas, Ecore_Event_Mouse_Move_Cb move_mouse);
EAPI void ecore_event_window_unregister(Ecore_Window id);
if BUILD_ECORE_INPUT_EVAS
lib_LTLIBRARIES = libecore_input_evas.la
-include_HEADERS = Ecore_Input_Evas.h
+includes_HEADERS = Ecore_Input_Evas.h
+includesdir = $(includedir)/ecore-@VMAJ@
libecore_input_evas_la_SOURCES = \
ecore_input_evas.c
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
return lookup;
}
-static int
+static Eina_Bool
_ecore_event_evas_key(Ecore_Event_Key *e, Ecore_Event_Press press)
{
Ecore_Input_Window *lookup;
lookup = _ecore_event_window_match(e->window);
- if (!lookup) return 1;
+ if (!lookup) return ECORE_CALLBACK_RENEW;
ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers);
if (press == ECORE_DOWN)
evas_event_feed_key_down(lookup->evas, e->keyname, e->key, e->string, e->compose, e->timestamp, NULL);
else
evas_event_feed_key_up(lookup->evas, e->keyname, e->key, e->string, e->compose, e->timestamp, NULL);
- return 1;
+ return ECORE_CALLBACK_RENEW;
}
-static int
+static Eina_Bool
_ecore_event_evas_mouse_button(Ecore_Event_Mouse_Button *e, Ecore_Event_Press press)
{
Ecore_Input_Window *lookup;
Evas_Button_Flags flags = EVAS_BUTTON_NONE;
lookup = _ecore_event_window_match(e->window);
- if (!lookup) return 1;
+ if (!lookup) return ECORE_CALLBACK_RENEW;
if (e->double_click) flags |= EVAS_BUTTON_DOUBLE_CLICK;
if (e->triple_click) flags |= EVAS_BUTTON_TRIPLE_CLICK;
if (e->multi.device == 0)
else
evas_event_feed_multi_up(lookup->evas, e->multi.device, e->x, e->y, e->multi.radius, e->multi.radius_x, e->multi.radius_y, e->multi.pressure, e->multi.angle, e->multi.x, e->multi.y, flags, e->timestamp, NULL);
}
- return 1;
+ return ECORE_CALLBACK_RENEW;
}
-EAPI int
+EAPI Eina_Bool
ecore_event_evas_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Event_Mouse_Move *e;
e = event;
lookup = _ecore_event_window_match(e->window);
- if (!lookup) return 1;
+ if (!lookup) return ECORE_CALLBACK_RENEW;
if (e->multi.device == 0)
{
ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers);
{
evas_event_feed_multi_move(lookup->evas, e->multi.device, e->x, e->y, e->multi.radius, e->multi.radius_x, e->multi.radius_y, e->multi.pressure, e->multi.angle, e->multi.x, e->multi.y, e->timestamp, NULL);
}
- return 1;
+ return ECORE_CALLBACK_RENEW;
}
-EAPI int
+EAPI Eina_Bool
ecore_event_evas_mouse_button_down(void *data __UNUSED__, int type __UNUSED__, void *event)
{
return _ecore_event_evas_mouse_button((Ecore_Event_Mouse_Button *)event, ECORE_DOWN);
}
-EAPI int
+EAPI Eina_Bool
ecore_event_evas_mouse_button_up(void *data __UNUSED__, int type __UNUSED__, void *event)
{
return _ecore_event_evas_mouse_button((Ecore_Event_Mouse_Button *)event, ECORE_UP);
}
-static int
+static Eina_Bool
_ecore_event_evas_mouse_io(Ecore_Event_Mouse_IO *e, Ecore_Event_IO io)
{
Ecore_Input_Window *lookup;
lookup = _ecore_event_window_match(e->window);
- if (!lookup) return 1;
+ if (!lookup) return ECORE_CALLBACK_RENEW;
ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers);
switch (io)
{
}
lookup->move_mouse(lookup->window, e->x, e->y, e->timestamp);
- return 1;
+ return ECORE_CALLBACK_RENEW;
}
-EAPI int
+EAPI Eina_Bool
ecore_event_evas_key_down(void *data __UNUSED__, int type __UNUSED__, void *event)
{
return _ecore_event_evas_key((Ecore_Event_Key *)event, ECORE_DOWN);
}
-EAPI int
+EAPI Eina_Bool
ecore_event_evas_key_up(void *data __UNUSED__, int type __UNUSED__, void *event)
{
return _ecore_event_evas_key((Ecore_Event_Key *)event, ECORE_UP);
}
-EAPI int
+EAPI Eina_Bool
ecore_event_evas_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Event_Mouse_Wheel *e;
e = event;
lookup = _ecore_event_window_match(e->window);
- if (!lookup) return 1;
+ if (!lookup) return ECORE_CALLBACK_RENEW;
ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers);
evas_event_feed_mouse_wheel(lookup->evas, e->direction, e->z, e->timestamp, NULL);
- return 1;
+ return ECORE_CALLBACK_RENEW;
}
-EAPI int
+EAPI Eina_Bool
ecore_event_evas_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event)
{
return _ecore_event_evas_mouse_io((Ecore_Event_Mouse_IO *)event, ECORE_IN);
}
-EAPI int
+EAPI Eina_Bool
ecore_event_evas_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event)
{
return _ecore_event_evas_mouse_io((Ecore_Event_Mouse_IO *)event, ECORE_OUT);
EAPI void ecore_ipc_server_client_limit_set(Ecore_Ipc_Server *svr, int client_limit, char reject_excess_clients);
EAPI void ecore_ipc_server_data_size_max_set(Ecore_Ipc_Server *srv, int size);
EAPI int ecore_ipc_server_data_size_max_get(Ecore_Ipc_Server *srv);
- EAPI char *ecore_ipc_server_ip_get(Ecore_Ipc_Server *svr);
+ EAPI const char *ecore_ipc_server_ip_get(Ecore_Ipc_Server *svr);
EAPI void ecore_ipc_server_flush(Ecore_Ipc_Server *svr);
/* FIXME: this needs to become an ipc message */
EAPI void *ecore_ipc_client_data_get(Ecore_Ipc_Client *cl);
EAPI void ecore_ipc_client_data_size_max_set(Ecore_Ipc_Client *cl, int size);
EAPI int ecore_ipc_client_data_size_max_get(Ecore_Ipc_Client *cl);
- EAPI char *ecore_ipc_client_ip_get(Ecore_Ipc_Client *cl);
+ EAPI const char *ecore_ipc_client_ip_get(Ecore_Ipc_Client *cl);
EAPI void ecore_ipc_client_flush(Ecore_Ipc_Client *cl);
EAPI int ecore_ipc_ssl_available_get(void);
if BUILD_ECORE_IPC
lib_LTLIBRARIES = libecore_ipc.la
-include_HEADERS = \
-Ecore_Ipc.h
+includes_HEADERS = Ecore_Ipc.h
+includesdir = $(includedir)/ecore-@VMAJ@
libecore_ipc_la_SOURCES = \
ecore_ipc.c
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
return 0;
}
-static int _ecore_ipc_event_client_add(void *data, int ev_type, void *ev);
-static int _ecore_ipc_event_client_del(void *data, int ev_type, void *ev);
-static int _ecore_ipc_event_server_add(void *data, int ev_type, void *ev);
-static int _ecore_ipc_event_server_del(void *data, int ev_type, void *ev);
-static int _ecore_ipc_event_client_data(void *data, int ev_type, void *ev);
-static int _ecore_ipc_event_server_data(void *data, int ev_type, void *ev);
+static Eina_Bool _ecore_ipc_event_client_add(void *data, int ev_type, void *ev);
+static Eina_Bool _ecore_ipc_event_client_del(void *data, int ev_type, void *ev);
+static Eina_Bool _ecore_ipc_event_server_add(void *data, int ev_type, void *ev);
+static Eina_Bool _ecore_ipc_event_server_del(void *data, int ev_type, void *ev);
+static Eina_Bool _ecore_ipc_event_client_data(void *data, int ev_type, void *ev);
+static Eina_Bool _ecore_ipc_event_server_data(void *data, int ev_type, void *ev);
static void _ecore_ipc_event_client_add_free(void *data, void *ev);
static void _ecore_ipc_event_client_del_free(void *data, void *ev);
static void _ecore_ipc_event_client_data_free(void *data, void *ev);
* deletion for the @p svr object. If no IP is known NULL is returned.
* @ingroup Ecore_Ipc_Server_Group
*/
-EAPI char *
+EAPI const char *
ecore_ipc_server_ip_get(Ecore_Ipc_Server *svr)
{
if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_IPC_SERVER))
* deletion for the @p cl object. If no IP is known NULL is returned.
* @ingroup Ecore_Ipc_Client_Group
*/
-EAPI char *
+EAPI const char *
ecore_ipc_client_ip_get(Ecore_Ipc_Client *cl)
{
if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_IPC_CLIENT))
}
-static int
+static Eina_Bool
_ecore_ipc_event_client_add(void *data __UNUSED__, int ev_type __UNUSED__, void *ev)
{
Ecore_Con_Event_Client_Add *e;
e = ev;
- if (!eina_list_data_find(servers, ecore_con_server_data_get(ecore_con_client_server_get(e->client)))) return 1;
+ if (!eina_list_data_find(servers, ecore_con_server_data_get(ecore_con_client_server_get(e->client)))) return ECORE_CALLBACK_RENEW;
/* handling code here */
{
Ecore_Ipc_Client *cl;
Ecore_Ipc_Server *svr;
cl = calloc(1, sizeof(Ecore_Ipc_Client));
- if (!cl) return 0;
+ if (!cl) return ECORE_CALLBACK_CANCEL;
svr = ecore_con_server_data_get(ecore_con_client_server_get(e->client));
ECORE_MAGIC_SET(cl, ECORE_MAGIC_IPC_CLIENT);
cl->client = e->client;
}
}
}
- return 0;
+ return ECORE_CALLBACK_CANCEL;
}
-static int
+static Eina_Bool
_ecore_ipc_event_client_del(void *data __UNUSED__, int ev_type __UNUSED__, void *ev)
{
Ecore_Con_Event_Client_Del *e;
e = ev;
- if (!eina_list_data_find(servers, ecore_con_server_data_get(ecore_con_client_server_get(e->client)))) return 1;
+ if (!eina_list_data_find(servers, ecore_con_server_data_get(ecore_con_client_server_get(e->client)))) return ECORE_CALLBACK_RENEW;
/* handling code here */
{
Ecore_Ipc_Client *cl;
}
}
}
- return 0;
+ return ECORE_CALLBACK_CANCEL;
}
-static int
+static Eina_Bool
_ecore_ipc_event_server_add(void *data __UNUSED__, int ev_type __UNUSED__, void *ev)
{
Ecore_Con_Event_Server_Add *e;
e = ev;
- if (!eina_list_data_find(servers, ecore_con_server_data_get(e->server))) return 1;
+ if (!eina_list_data_find(servers, ecore_con_server_data_get(e->server))) return ECORE_CALLBACK_RENEW;
/* handling code here */
{
Ecore_Ipc_Server *svr;
}
}
}
- return 0;
+ return ECORE_CALLBACK_CANCEL;
}
-static int
+static Eina_Bool
_ecore_ipc_event_server_del(void *data __UNUSED__, int ev_type __UNUSED__, void *ev)
{
Ecore_Con_Event_Server_Del *e;
e = ev;
- if (!eina_list_data_find(servers, ecore_con_server_data_get(e->server))) return 1;
+ if (!eina_list_data_find(servers, ecore_con_server_data_get(e->server))) return ECORE_CALLBACK_RENEW;
/* handling code here */
{
Ecore_Ipc_Server *svr;
}
}
}
- return 0;
+ return ECORE_CALLBACK_CANCEL;
}
#define CLSZ(_n) \
} \
msg._member = _ecore_ipc_ddlt_int(d, cl->prev.i._member, md);
-static int
+static Eina_Bool
_ecore_ipc_event_client_data(void *data __UNUSED__, int ev_type __UNUSED__, void *ev)
{
Ecore_Con_Event_Client_Data *e;
e = ev;
- if (!eina_list_data_find(servers, ecore_con_server_data_get(ecore_con_client_server_get(e->client)))) return 1;
+ if (!eina_list_data_find(servers, ecore_con_server_data_get(ecore_con_client_server_get(e->client)))) return ECORE_CALLBACK_RENEW;
/* handling code here */
{
Ecore_Ipc_Client *cl;
free(cl->buf);
cl->buf = 0;
cl->buf_size = 0;
- return 0;
+ return ECORE_CALLBACK_CANCEL;
}
cl->buf = buf;
memcpy(cl->buf + cl->buf_size, e->data, e->size);
if ((cl->buf_size - offset) < s)
{
if (offset > 0) goto scroll;
- return 0;
+ return ECORE_CALLBACK_CANCEL;
}
s = 4;
if (msg.size > 0)
{
buf = malloc(msg.size);
- if (!buf) return 0;
+ if (!buf) return ECORE_CALLBACK_CANCEL;
memcpy(buf, cl->buf + offset + s, msg.size);
}
if (!cl->delete_me)
free(cl->buf);
cl->buf = NULL;
cl->buf_size = 0;
- return 0;
+ return ECORE_CALLBACK_CANCEL;
}
goto redo;
}
free(cl->buf);
cl->buf = NULL;
cl->buf_size = 0;
- return 0;
+ return ECORE_CALLBACK_CANCEL;
}
memcpy(buf, cl->buf + offset, cl->buf_size - offset);
free(cl->buf);
cl->buf_size -= offset;
}
}
- return 0;
+ return ECORE_CALLBACK_CANCEL;
}
#define SVSZ(_n) \
} \
msg._member = _ecore_ipc_ddlt_int(d, svr->prev.i._member, md);
-static int
+static Eina_Bool
_ecore_ipc_event_server_data(void *data __UNUSED__, int ev_type __UNUSED__, void *ev)
{
Ecore_Con_Event_Server_Data *e;
e = ev;
- if (!eina_list_data_find(servers, ecore_con_server_data_get(e->server))) return 1;
+ if (!eina_list_data_find(servers, ecore_con_server_data_get(e->server))) return ECORE_CALLBACK_RENEW;
/* handling code here */
{
Ecore_Ipc_Server *svr;
free(svr->buf);
svr->buf = 0;
svr->buf_size = 0;
- return 0;
+ return ECORE_CALLBACK_CANCEL;
}
svr->buf = buf;
memcpy(svr->buf + svr->buf_size, e->data, e->size);
if ((svr->buf_size - offset) < s)
{
if (offset > 0) goto scroll;
- return 0;
+ return ECORE_CALLBACK_CANCEL;
}
s = 4;
if (msg.size > 0)
{
buf = malloc(msg.size);
- if (!buf) return 0;
+ if (!buf) return ECORE_CALLBACK_CANCEL;
memcpy(buf, svr->buf + offset + s, msg.size);
}
if (!svr->delete_me)
free(svr->buf);
svr->buf = NULL;
svr->buf_size = 0;
- return 0;
+ return ECORE_CALLBACK_CANCEL;
}
goto redo;
}
free(svr->buf);
svr->buf = NULL;
svr->buf_size = 0;
- return 0;
+ return ECORE_CALLBACK_CANCEL;
}
memcpy(buf, svr->buf + offset, svr->buf_size - offset);
free(svr->buf);
svr->buf_size -= offset;
}
}
- return 0;
+ return ECORE_CALLBACK_CANCEL;
}
static void
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifndef _ECORE_SDL_H
#define _ECORE_SDL_H
if BUILD_ECORE_SDL
lib_LTLIBRARIES = libecore_sdl.la
-include_HEADERS = \
-Ecore_Sdl.h
+includes_HEADERS = Ecore_Sdl.h
+includesdir = $(includedir)/ecore-@VMAJ@
libecore_sdl_la_SOURCES = \
ecore_sdl.c
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifndef __ECORE_WIN32_H__
#define __ECORE_WIN32_H__
lib_LTLIBRARIES = libecore_win32.la
-include_HEADERS = \
-Ecore_Win32.h
+includes_HEADERS = Ecore_Win32.h
+includesdir = $(includedir)/ecore-@VMAJ@
libecore_win32_la_SOURCES = \
ecore_win32.c \
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifndef __ECORE_WIN32_PRIVATE_H__
#define __ECORE_WIN32_PRIVATE_H__
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifndef __ECORE_WINCE_H__
#define __ECORE_WINCE_H__
lib_LTLIBRARIES = libecore_wince.la
-include_HEADERS = \
-Ecore_WinCE.h
+includes_HEADERS = Ecore_WinCE.h
+includesdir = $(includedir)/ecore-@VMAJ@
libecore_wince_la_SOURCES = \
ecore_wince.c \
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifndef __ECORE_WINCE_PRIVATE_H__
#define __ECORE_WINCE_PRIVATE_H__
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifndef _ECORE_X_H
#define _ECORE_X_H
#ifdef EAPI
# undef EAPI
-#endif
+#endif // ifdef EAPI
#ifdef _MSC_VER
# ifdef BUILDING_DLL
# define EAPI __declspec(dllexport)
-# else
+# else // ifdef BUILDING_DLL
# define EAPI __declspec(dllimport)
-# endif
-#else
+# endif // ifdef BUILDING_DLL
+#else // ifdef _MSC_VER
# ifdef __GNUC__
# if __GNUC__ >= 4
# define EAPI __attribute__ ((visibility("default")))
-# else
+# else // if __GNUC__ >= 4
# define EAPI
-# endif
-# else
+# endif // if __GNUC__ >= 4
+# else // ifdef __GNUC__
# define EAPI
-# endif
-#endif
+# endif // ifdef __GNUC__
+#endif // ifdef _MSC_VER
#include <sys/types.h>
* @li @ref Ecore_X_Flush_Group
*/
-
-typedef unsigned int Ecore_X_ID;
+typedef unsigned int Ecore_X_ID;
#ifndef _ECORE_X_WINDOW_PREDEF
-typedef Ecore_X_ID Ecore_X_Window;
-#endif
+typedef Ecore_X_ID Ecore_X_Window;
+#endif // ifndef _ECORE_X_WINDOW_PREDEF
#ifdef HAVE_ECORE_X_XCB
-typedef Ecore_X_ID Ecore_X_Visual;
-#else
-typedef void * Ecore_X_Visual;
+typedef Ecore_X_ID Ecore_X_Visual;
+#else // ifdef HAVE_ECORE_X_XCB
+typedef void * Ecore_X_Visual;
#endif /* HAVE_ECORE_X_XCB */
-typedef Ecore_X_ID Ecore_X_Pixmap;
-typedef Ecore_X_ID Ecore_X_Drawable;
+typedef Ecore_X_ID Ecore_X_Pixmap;
+typedef Ecore_X_ID Ecore_X_Drawable;
#ifdef HAVE_ECORE_X_XCB
-typedef Ecore_X_ID Ecore_X_GC;
-#else
-typedef void * Ecore_X_GC;
+typedef Ecore_X_ID Ecore_X_GC;
+#else // ifdef HAVE_ECORE_X_XCB
+typedef void * Ecore_X_GC;
#endif /* HAVE_ECORE_X_XCB */
-typedef Ecore_X_ID Ecore_X_Atom;
-typedef Ecore_X_ID Ecore_X_Colormap;
-typedef Ecore_X_ID Ecore_X_Time;
-typedef Ecore_X_ID Ecore_X_Cursor;
-typedef void Ecore_X_Display;
-typedef void Ecore_X_Connection;
-typedef void Ecore_X_Screen;
-typedef Ecore_X_ID Ecore_X_Sync_Counter;
-typedef Ecore_X_ID Ecore_X_Sync_Alarm;
-typedef void Ecore_X_XRegion;
-
-typedef Ecore_X_ID Ecore_X_Randr_Output;
-typedef Ecore_X_ID Ecore_X_Randr_Crtc;
-typedef Ecore_X_ID Ecore_X_Randr_Mode;
-typedef unsigned short Ecore_X_Randr_Size_ID;
-
-typedef Ecore_X_ID Ecore_X_Device;
+typedef Ecore_X_ID Ecore_X_Atom;
+typedef Ecore_X_ID Ecore_X_Colormap;
+typedef Ecore_X_ID Ecore_X_Time;
+typedef Ecore_X_ID Ecore_X_Cursor;
+typedef void Ecore_X_Display;
+typedef void Ecore_X_Connection;
+typedef void Ecore_X_Screen;
+typedef Ecore_X_ID Ecore_X_Sync_Counter;
+typedef Ecore_X_ID Ecore_X_Sync_Alarm;
+typedef void Ecore_X_XRegion;
+
+typedef Ecore_X_ID Ecore_X_Randr_Output;
+typedef Ecore_X_ID Ecore_X_Randr_Crtc;
+typedef Ecore_X_ID Ecore_X_Randr_Mode;
+typedef unsigned short Ecore_X_Randr_Size_ID;
+typedef int Ecore_X_Randr_Screen;
+
+typedef Ecore_X_ID Ecore_X_Device;
#ifdef __cplusplus
extern "C" {
-#endif
+#endif // ifdef __cplusplus
-typedef struct _Ecore_X_Rectangle {
- int x, y;
+typedef struct _Ecore_X_Rectangle
+{
+ int x, y;
unsigned int width, height;
} Ecore_X_Rectangle;
-typedef struct _Ecore_X_Icon {
+typedef struct _Ecore_X_Icon
+{
unsigned int width, height;
unsigned int *data;
} Ecore_X_Icon;
} Ecore_X_Composite_Update_Type;
typedef enum _Ecore_X_Window_State {
- /* Unknown state */
- ECORE_X_WINDOW_STATE_UNKNOWN = 0,
- /** The window is iconified. */
- ECORE_X_WINDOW_STATE_ICONIFIED,
- /** The window is a modal dialog box. */
- ECORE_X_WINDOW_STATE_MODAL,
- /** The window manager should keep the window's position fixed
- * even if the virtual desktop scrolls. */
- ECORE_X_WINDOW_STATE_STICKY,
- /** The window has the maximum vertical size. */
- ECORE_X_WINDOW_STATE_MAXIMIZED_VERT,
- /** The window has the maximum horizontal size. */
- ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ,
- /** The window is shaded. */
- ECORE_X_WINDOW_STATE_SHADED,
- /** The window should not be included in the taskbar. */
- ECORE_X_WINDOW_STATE_SKIP_TASKBAR,
- /** The window should not be included in the pager. */
- ECORE_X_WINDOW_STATE_SKIP_PAGER,
- /** The window is invisible (i.e. minimized/iconified) */
- ECORE_X_WINDOW_STATE_HIDDEN,
- /** The window should fill the entire screen and have no
- * window border/decorations */
- ECORE_X_WINDOW_STATE_FULLSCREEN,
- /* The following are not documented because they are not
- * intended for use in applications. */
- ECORE_X_WINDOW_STATE_ABOVE,
- ECORE_X_WINDOW_STATE_BELOW,
- /* FIXME: Documentation */
- ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION
+ /* Unknown state */
+ ECORE_X_WINDOW_STATE_UNKNOWN = 0,
+ /** The window is iconified. */
+ ECORE_X_WINDOW_STATE_ICONIFIED,
+ /** The window is a modal dialog box. */
+ ECORE_X_WINDOW_STATE_MODAL,
+ /** The window manager should keep the window's position fixed
+ * even if the virtual desktop scrolls. */
+ ECORE_X_WINDOW_STATE_STICKY,
+ /** The window has the maximum vertical size. */
+ ECORE_X_WINDOW_STATE_MAXIMIZED_VERT,
+ /** The window has the maximum horizontal size. */
+ ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ,
+ /** The window is shaded. */
+ ECORE_X_WINDOW_STATE_SHADED,
+ /** The window should not be included in the taskbar. */
+ ECORE_X_WINDOW_STATE_SKIP_TASKBAR,
+ /** The window should not be included in the pager. */
+ ECORE_X_WINDOW_STATE_SKIP_PAGER,
+ /** The window is invisible (i.e. minimized/iconified) */
+ ECORE_X_WINDOW_STATE_HIDDEN,
+ /** The window should fill the entire screen and have no
+ * window border/decorations */
+ ECORE_X_WINDOW_STATE_FULLSCREEN,
+ /* The following are not documented because they are not
+ * intended for use in applications. */
+ ECORE_X_WINDOW_STATE_ABOVE,
+ ECORE_X_WINDOW_STATE_BELOW,
+ /* FIXME: Documentation */
+ ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION
} Ecore_X_Window_State;
typedef enum _Ecore_X_Window_State_Action {
- ECORE_X_WINDOW_STATE_ACTION_REMOVE,
- ECORE_X_WINDOW_STATE_ACTION_ADD,
- ECORE_X_WINDOW_STATE_ACTION_TOGGLE
+ ECORE_X_WINDOW_STATE_ACTION_REMOVE,
+ ECORE_X_WINDOW_STATE_ACTION_ADD,
+ ECORE_X_WINDOW_STATE_ACTION_TOGGLE
} Ecore_X_Window_State_Action;
typedef enum _Ecore_X_Window_Stack_Mode {
ECORE_X_WINDOW_STACK_OPPOSITE = 4
} Ecore_X_Window_Stack_Mode;
-typedef enum _Ecore_X_Randr_Rotation {
- ECORE_X_RANDR_ROT_0 = (1 << 0),
- ECORE_X_RANDR_ROT_90 = (1 << 1),
- ECORE_X_RANDR_ROT_180 = (1 << 2),
- ECORE_X_RANDR_ROT_270 = (1 << 3),
- ECORE_X_RANDR_FLIP_X = (1 << 4),
- ECORE_X_RANDR_FLIP_Y = (1 << 5)
-} Ecore_X_Randr_Rotation;
-
-typedef enum _Ecore_X_Randr_Connection {
- ECORE_X_RANDR_CONNECTED = 0,
- ECORE_X_RANDR_DISCONNECTED = 1,
- ECORE_X_RANDR_UNKNOWN_CONNECTION = 2
-} Ecore_X_Randr_Connection;
+typedef enum _Ecore_X_Randr_Orientation {
+ ECORE_X_RANDR_ORIENTATION_ROT_0 = (1 << 0),
+ ECORE_X_RANDR_ORIENTATION_ROT_90 = (1 << 1),
+ ECORE_X_RANDR_ORIENTATION_ROT_180 = (1 << 2),
+ ECORE_X_RANDR_ORIENTATION_ROT_270 = (1 << 3),
+ ECORE_X_RANDR_ORIENTATION_FLIP_X = (1 << 4),
+ ECORE_X_RANDR_ORIENTATION_FLIP_Y = (1 << 5)
+} Ecore_X_Randr_Orientation;
+
+typedef enum _Ecore_X_Randr_Connection_Status {
+ ECORE_X_RANDR_CONNECTION_STATUS_CONNECTED = 0,
+ ECORE_X_RANDR_CONNECTION_STATUS_DISCONNECTED = 1,
+ ECORE_X_RANDR_CONNECTION_STATUS_UNKNOWN = 2
+} Ecore_X_Randr_Connection_Status;
+
+typedef enum _Ecore_X_Randr_Output_Policy {
+ ECORE_X_RANDR_OUTPUT_POLICY_ABOVE = 1,
+ ECORE_X_RANDR_OUTPUT_POLICY_RIGHT = 2,
+ ECORE_X_RANDR_OUTPUT_POLICY_BELOW = 3,
+ ECORE_X_RANDR_OUTPUT_POLICY_LEFT = 4,
+ ECORE_X_RANDR_OUTPUT_POLICY_CLONE = 5,
+ ECORE_X_RANDR_OUTPUT_POLICY_NONE = 6
+} Ecore_X_Randr_Output_Policy;
+
+typedef enum _Ecore_X_Randr_Relative_Alignment {
+ ECORE_X_RANDR_RELATIVE_ALIGNMENT_NONE = 0,
+ ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_REL = 1,
+ ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_SCR = 2
+} Ecore_X_Randr_Relative_Alignment;
typedef enum _Ecore_X_Render_Subpixel_Order {
ECORE_X_RENDER_SUBPIXEL_ORDER_UNKNOWN = 0,
ECORE_X_RENDER_SUBPIXEL_ORDER_NONE = 5
} Ecore_X_Render_Subpixel_Order;
-#define ECORE_X_SELECTION_TARGET_TARGETS "TARGETS"
-#define ECORE_X_SELECTION_TARGET_TEXT "TEXT"
+#define ECORE_X_SELECTION_TARGET_TARGETS "TARGETS"
+#define ECORE_X_SELECTION_TARGET_TEXT "TEXT"
#define ECORE_X_SELECTION_TARGET_COMPOUND_TEXT "COMPOUND_TEXT"
-#define ECORE_X_SELECTION_TARGET_STRING "STRING"
-#define ECORE_X_SELECTION_TARGET_UTF8_STRING "UTF8_STRING"
-#define ECORE_X_SELECTION_TARGET_FILENAME "FILENAME"
+#define ECORE_X_SELECTION_TARGET_STRING "STRING"
+#define ECORE_X_SELECTION_TARGET_UTF8_STRING "UTF8_STRING"
+#define ECORE_X_SELECTION_TARGET_FILENAME "FILENAME"
-#define ECORE_X_DND_VERSION 5
+#define ECORE_X_DND_VERSION 5
EAPI extern Ecore_X_Atom ECORE_X_DND_ACTION_COPY;
EAPI extern Ecore_X_Atom ECORE_X_DND_ACTION_MOVE;
typedef enum _Ecore_X_Event_Mask
{
- ECORE_X_EVENT_MASK_NONE = 0L,
- ECORE_X_EVENT_MASK_KEY_DOWN = (1L << 0),
- ECORE_X_EVENT_MASK_KEY_UP = (1L << 1),
- ECORE_X_EVENT_MASK_MOUSE_DOWN = (1L << 2),
- ECORE_X_EVENT_MASK_MOUSE_UP = (1L << 3),
- ECORE_X_EVENT_MASK_MOUSE_IN = (1L << 4),
- ECORE_X_EVENT_MASK_MOUSE_OUT = (1L << 5),
- ECORE_X_EVENT_MASK_MOUSE_MOVE = (1L << 6),
- ECORE_X_EVENT_MASK_WINDOW_DAMAGE = (1L << 15),
- ECORE_X_EVENT_MASK_WINDOW_VISIBILITY = (1L << 16),
- ECORE_X_EVENT_MASK_WINDOW_CONFIGURE = (1L << 17),
- ECORE_X_EVENT_MASK_WINDOW_RESIZE_MANAGE = (1L << 18),
- ECORE_X_EVENT_MASK_WINDOW_MANAGE = (1L << 19),
+ ECORE_X_EVENT_MASK_NONE = 0L,
+ ECORE_X_EVENT_MASK_KEY_DOWN = (1L << 0),
+ ECORE_X_EVENT_MASK_KEY_UP = (1L << 1),
+ ECORE_X_EVENT_MASK_MOUSE_DOWN = (1L << 2),
+ ECORE_X_EVENT_MASK_MOUSE_UP = (1L << 3),
+ ECORE_X_EVENT_MASK_MOUSE_IN = (1L << 4),
+ ECORE_X_EVENT_MASK_MOUSE_OUT = (1L << 5),
+ ECORE_X_EVENT_MASK_MOUSE_MOVE = (1L << 6),
+ ECORE_X_EVENT_MASK_WINDOW_DAMAGE = (1L << 15),
+ ECORE_X_EVENT_MASK_WINDOW_VISIBILITY = (1L << 16),
+ ECORE_X_EVENT_MASK_WINDOW_CONFIGURE = (1L << 17),
+ ECORE_X_EVENT_MASK_WINDOW_RESIZE_MANAGE = (1L << 18),
+ ECORE_X_EVENT_MASK_WINDOW_MANAGE = (1L << 19),
ECORE_X_EVENT_MASK_WINDOW_CHILD_CONFIGURE = (1L << 20),
- ECORE_X_EVENT_MASK_WINDOW_FOCUS_CHANGE = (1L << 21),
- ECORE_X_EVENT_MASK_WINDOW_PROPERTY = (1L << 22),
- ECORE_X_EVENT_MASK_WINDOW_COLORMAP = (1L << 23),
- ECORE_X_EVENT_MASK_WINDOW_GRAB = (1L << 24),
- ECORE_X_EVENT_MASK_MOUSE_WHEEL = (1L << 29),
- ECORE_X_EVENT_MASK_WINDOW_FOCUS_IN = (1L << 30),
- ECORE_X_EVENT_MASK_WINDOW_FOCUS_OUT = (1L << 31)
+ ECORE_X_EVENT_MASK_WINDOW_FOCUS_CHANGE = (1L << 21),
+ ECORE_X_EVENT_MASK_WINDOW_PROPERTY = (1L << 22),
+ ECORE_X_EVENT_MASK_WINDOW_COLORMAP = (1L << 23),
+ ECORE_X_EVENT_MASK_WINDOW_GRAB = (1L << 24),
+ ECORE_X_EVENT_MASK_MOUSE_WHEEL = (1L << 29),
+ ECORE_X_EVENT_MASK_WINDOW_FOCUS_IN = (1L << 30),
+ ECORE_X_EVENT_MASK_WINDOW_FOCUS_OUT = (1L << 31)
} Ecore_X_Event_Mask;
typedef enum _Ecore_X_Gravity
typedef enum _Ecore_X_Shape_Type
{
ECORE_X_SHAPE_BOUNDING,
- ECORE_X_SHAPE_CLIP
+ ECORE_X_SHAPE_CLIP,
+ ECORE_X_SHAPE_INPUT
} Ecore_X_Shape_Type;
-typedef struct _Ecore_X_Event_Mouse_In Ecore_X_Event_Mouse_In;
-typedef struct _Ecore_X_Event_Mouse_Out Ecore_X_Event_Mouse_Out;
-typedef struct _Ecore_X_Event_Window_Focus_In Ecore_X_Event_Window_Focus_In;
-typedef struct _Ecore_X_Event_Window_Focus_Out Ecore_X_Event_Window_Focus_Out;
-typedef struct _Ecore_X_Event_Window_Keymap Ecore_X_Event_Window_Keymap;
-typedef struct _Ecore_X_Event_Window_Damage Ecore_X_Event_Window_Damage;
+typedef struct _Ecore_X_Event_Mouse_In Ecore_X_Event_Mouse_In;
+typedef struct _Ecore_X_Event_Mouse_Out Ecore_X_Event_Mouse_Out;
+typedef struct _Ecore_X_Event_Window_Focus_In Ecore_X_Event_Window_Focus_In;
+typedef struct _Ecore_X_Event_Window_Focus_Out Ecore_X_Event_Window_Focus_Out;
+typedef struct _Ecore_X_Event_Window_Keymap Ecore_X_Event_Window_Keymap;
+typedef struct _Ecore_X_Event_Window_Damage Ecore_X_Event_Window_Damage;
typedef struct _Ecore_X_Event_Window_Visibility_Change Ecore_X_Event_Window_Visibility_Change;
-typedef struct _Ecore_X_Event_Window_Create Ecore_X_Event_Window_Create;
-typedef struct _Ecore_X_Event_Window_Destroy Ecore_X_Event_Window_Destroy;
-typedef struct _Ecore_X_Event_Window_Hide Ecore_X_Event_Window_Hide;
-typedef struct _Ecore_X_Event_Window_Show Ecore_X_Event_Window_Show;
-typedef struct _Ecore_X_Event_Window_Show_Request Ecore_X_Event_Window_Show_Request;
-typedef struct _Ecore_X_Event_Window_Reparent Ecore_X_Event_Window_Reparent;
-typedef struct _Ecore_X_Event_Window_Configure Ecore_X_Event_Window_Configure;
+typedef struct _Ecore_X_Event_Window_Create Ecore_X_Event_Window_Create;
+typedef struct _Ecore_X_Event_Window_Destroy Ecore_X_Event_Window_Destroy;
+typedef struct _Ecore_X_Event_Window_Hide Ecore_X_Event_Window_Hide;
+typedef struct _Ecore_X_Event_Window_Show Ecore_X_Event_Window_Show;
+typedef struct _Ecore_X_Event_Window_Show_Request Ecore_X_Event_Window_Show_Request;
+typedef struct _Ecore_X_Event_Window_Reparent Ecore_X_Event_Window_Reparent;
+typedef struct _Ecore_X_Event_Window_Configure Ecore_X_Event_Window_Configure;
typedef struct _Ecore_X_Event_Window_Configure_Request Ecore_X_Event_Window_Configure_Request;
-typedef struct _Ecore_X_Event_Window_Gravity Ecore_X_Event_Window_Gravity;
-typedef struct _Ecore_X_Event_Window_Resize_Request Ecore_X_Event_Window_Resize_Request;
-typedef struct _Ecore_X_Event_Window_Stack Ecore_X_Event_Window_Stack;
-typedef struct _Ecore_X_Event_Window_Stack_Request Ecore_X_Event_Window_Stack_Request;
-typedef struct _Ecore_X_Event_Window_Property Ecore_X_Event_Window_Property;
-typedef struct _Ecore_X_Event_Window_Colormap Ecore_X_Event_Window_Colormap;
-typedef struct _Ecore_X_Event_Window_Mapping Ecore_X_Event_Window_Mapping;
-typedef struct _Ecore_X_Event_Selection_Clear Ecore_X_Event_Selection_Clear;
-typedef struct _Ecore_X_Event_Selection_Request Ecore_X_Event_Selection_Request;
-typedef struct _Ecore_X_Event_Selection_Notify Ecore_X_Event_Selection_Notify;
-typedef struct _Ecore_X_Selection_Data Ecore_X_Selection_Data;
-typedef struct _Ecore_X_Selection_Data_Files Ecore_X_Selection_Data_Files;
-typedef struct _Ecore_X_Selection_Data_Text Ecore_X_Selection_Data_Text;
-typedef struct _Ecore_X_Selection_Data_Targets Ecore_X_Selection_Data_Targets;
-typedef struct _Ecore_X_Event_Xdnd_Enter Ecore_X_Event_Xdnd_Enter;
-typedef struct _Ecore_X_Event_Xdnd_Position Ecore_X_Event_Xdnd_Position;
-typedef struct _Ecore_X_Event_Xdnd_Status Ecore_X_Event_Xdnd_Status;
-typedef struct _Ecore_X_Event_Xdnd_Leave Ecore_X_Event_Xdnd_Leave;
-typedef struct _Ecore_X_Event_Xdnd_Drop Ecore_X_Event_Xdnd_Drop;
-typedef struct _Ecore_X_Event_Xdnd_Finished Ecore_X_Event_Xdnd_Finished;
-typedef struct _Ecore_X_Event_Client_Message Ecore_X_Event_Client_Message;
-typedef struct _Ecore_X_Event_Window_Shape Ecore_X_Event_Window_Shape;
-typedef struct _Ecore_X_Event_Screensaver_Notify Ecore_X_Event_Screensaver_Notify;
-typedef struct _Ecore_X_Event_Sync_Counter Ecore_X_Event_Sync_Counter;
-typedef struct _Ecore_X_Event_Sync_Alarm Ecore_X_Event_Sync_Alarm;
-typedef struct _Ecore_X_Event_Screen_Change Ecore_X_Event_Screen_Change;
-typedef struct _Ecore_X_Event_Randr_Crtc_Change Ecore_X_Event_Randr_Crtc_Change;
-typedef struct _Ecore_X_Event_Randr_Output_Change Ecore_X_Event_Randr_Output_Change;
+typedef struct _Ecore_X_Event_Window_Gravity Ecore_X_Event_Window_Gravity;
+typedef struct _Ecore_X_Event_Window_Resize_Request Ecore_X_Event_Window_Resize_Request;
+typedef struct _Ecore_X_Event_Window_Stack Ecore_X_Event_Window_Stack;
+typedef struct _Ecore_X_Event_Window_Stack_Request Ecore_X_Event_Window_Stack_Request;
+typedef struct _Ecore_X_Event_Window_Property Ecore_X_Event_Window_Property;
+typedef struct _Ecore_X_Event_Window_Colormap Ecore_X_Event_Window_Colormap;
+typedef struct _Ecore_X_Event_Window_Mapping Ecore_X_Event_Window_Mapping;
+typedef struct _Ecore_X_Event_Selection_Clear Ecore_X_Event_Selection_Clear;
+typedef struct _Ecore_X_Event_Selection_Request Ecore_X_Event_Selection_Request;
+typedef struct _Ecore_X_Event_Selection_Notify Ecore_X_Event_Selection_Notify;
+typedef struct _Ecore_X_Selection_Data Ecore_X_Selection_Data;
+typedef struct _Ecore_X_Selection_Data_Files Ecore_X_Selection_Data_Files;
+typedef struct _Ecore_X_Selection_Data_Text Ecore_X_Selection_Data_Text;
+typedef struct _Ecore_X_Selection_Data_Targets Ecore_X_Selection_Data_Targets;
+typedef struct _Ecore_X_Event_Xdnd_Enter Ecore_X_Event_Xdnd_Enter;
+typedef struct _Ecore_X_Event_Xdnd_Position Ecore_X_Event_Xdnd_Position;
+typedef struct _Ecore_X_Event_Xdnd_Status Ecore_X_Event_Xdnd_Status;
+typedef struct _Ecore_X_Event_Xdnd_Leave Ecore_X_Event_Xdnd_Leave;
+typedef struct _Ecore_X_Event_Xdnd_Drop Ecore_X_Event_Xdnd_Drop;
+typedef struct _Ecore_X_Event_Xdnd_Finished Ecore_X_Event_Xdnd_Finished;
+typedef struct _Ecore_X_Event_Client_Message Ecore_X_Event_Client_Message;
+typedef struct _Ecore_X_Event_Window_Shape Ecore_X_Event_Window_Shape;
+typedef struct _Ecore_X_Event_Screensaver_Notify Ecore_X_Event_Screensaver_Notify;
+typedef struct _Ecore_X_Event_Sync_Counter Ecore_X_Event_Sync_Counter;
+typedef struct _Ecore_X_Event_Sync_Alarm Ecore_X_Event_Sync_Alarm;
+typedef struct _Ecore_X_Event_Screen_Change Ecore_X_Event_Screen_Change;
+typedef struct _Ecore_X_Event_Randr_Crtc_Change Ecore_X_Event_Randr_Crtc_Change;
+typedef struct _Ecore_X_Event_Randr_Output_Change Ecore_X_Event_Randr_Output_Change;
typedef struct _Ecore_X_Event_Randr_Output_Property_Notify Ecore_X_Event_Randr_Output_Property_Notify;
-typedef struct _Ecore_X_Event_Window_Delete_Request Ecore_X_Event_Window_Delete_Request;
-typedef struct _Ecore_X_Event_Window_Prop_Title_Change Ecore_X_Event_Window_Prop_Title_Change;
-typedef struct _Ecore_X_Event_Window_Prop_Visible_Title_Change Ecore_X_Event_Window_Prop_Visible_Title_Change;
-typedef struct _Ecore_X_Event_Window_Prop_Icon_Name_Change Ecore_X_Event_Window_Prop_Icon_Name_Change;
-typedef struct _Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change;
-typedef struct _Ecore_X_Event_Window_Prop_Client_Machine_Change Ecore_X_Event_Window_Prop_Client_Machine_Change;
-typedef struct _Ecore_X_Event_Window_Prop_Name_Class_Change Ecore_X_Event_Window_Prop_Name_Class_Change;
-typedef struct _Ecore_X_Event_Window_Prop_Pid_Change Ecore_X_Event_Window_Prop_Pid_Change;
-typedef struct _Ecore_X_Event_Window_Prop_Desktop_Change Ecore_X_Event_Window_Prop_Desktop_Change;
-
-typedef struct _Ecore_X_Event_Window_Move_Resize_Request Ecore_X_Event_Window_Move_Resize_Request;
-typedef struct _Ecore_X_Event_Window_State_Request Ecore_X_Event_Window_State_Request;
-typedef struct _Ecore_X_Event_Frame_Extents_Request Ecore_X_Event_Frame_Extents_Request;
-typedef struct _Ecore_X_Event_Ping Ecore_X_Event_Ping;
-typedef struct _Ecore_X_Event_Desktop_Change Ecore_X_Event_Desktop_Change;
-
-typedef struct _Ecore_X_Event_Startup_Sequence Ecore_X_Event_Startup_Sequence;
-
-typedef struct _Ecore_X_Event_Generic Ecore_X_Event_Generic;
+typedef struct _Ecore_X_Event_Window_Delete_Request
+Ecore_X_Event_Window_Delete_Request;
+typedef struct _Ecore_X_Event_Window_Prop_Title_Change
+Ecore_X_Event_Window_Prop_Title_Change;
+typedef struct _Ecore_X_Event_Window_Prop_Visible_Title_Change
+Ecore_X_Event_Window_Prop_Visible_Title_Change;
+typedef struct _Ecore_X_Event_Window_Prop_Icon_Name_Change
+Ecore_X_Event_Window_Prop_Icon_Name_Change;
+typedef struct _Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change
+Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change;
+typedef struct _Ecore_X_Event_Window_Prop_Client_Machine_Change
+Ecore_X_Event_Window_Prop_Client_Machine_Change;
+typedef struct _Ecore_X_Event_Window_Prop_Name_Class_Change
+Ecore_X_Event_Window_Prop_Name_Class_Change;
+typedef struct _Ecore_X_Event_Window_Prop_Pid_Change
+Ecore_X_Event_Window_Prop_Pid_Change;
+typedef struct _Ecore_X_Event_Window_Prop_Desktop_Change
+Ecore_X_Event_Window_Prop_Desktop_Change;
+
+typedef struct _Ecore_X_Event_Window_Move_Resize_Request
+Ecore_X_Event_Window_Move_Resize_Request;
+typedef struct _Ecore_X_Event_Window_State_Request
+Ecore_X_Event_Window_State_Request;
+typedef struct _Ecore_X_Event_Frame_Extents_Request
+Ecore_X_Event_Frame_Extents_Request;
+typedef struct _Ecore_X_Event_Ping Ecore_X_Event_Ping;
+typedef struct _Ecore_X_Event_Desktop_Change Ecore_X_Event_Desktop_Change;
+
+typedef struct _Ecore_X_Event_Startup_Sequence Ecore_X_Event_Startup_Sequence;
+
+typedef struct _Ecore_X_Event_Generic Ecore_X_Event_Generic;
+
+typedef struct _Ecore_X_Randr_Screen_Size Ecore_X_Randr_Screen_Size;
+typedef struct _Ecore_X_Randr_Screen_Size_MM Ecore_X_Randr_Screen_Size_MM;
struct _Ecore_X_Event_Mouse_In
{
int modifiers;
int x, y;
- int same_screen;
- struct {
- int x, y;
+ int same_screen;
+ struct
+ {
+ int x, y;
} root;
- Ecore_X_Window win;
- Ecore_X_Window event_win;
- Ecore_X_Window root_win;
- Ecore_X_Event_Mode mode;
- Ecore_X_Event_Detail detail;
- Ecore_X_Time time;
+ Ecore_X_Window win;
+ Ecore_X_Window event_win;
+ Ecore_X_Window root_win;
+ Ecore_X_Event_Mode mode;
+ Ecore_X_Event_Detail detail;
+ Ecore_X_Time time;
};
struct _Ecore_X_Event_Mouse_Out
{
int modifiers;
int x, y;
- int same_screen;
- struct {
- int x, y;
+ int same_screen;
+ struct
+ {
+ int x, y;
} root;
- Ecore_X_Window win;
- Ecore_X_Window event_win;
- Ecore_X_Window root_win;
- Ecore_X_Event_Mode mode;
- Ecore_X_Event_Detail detail;
- Ecore_X_Time time;
+ Ecore_X_Window win;
+ Ecore_X_Window event_win;
+ Ecore_X_Window root_win;
+ Ecore_X_Event_Mode mode;
+ Ecore_X_Event_Detail detail;
+ Ecore_X_Time time;
};
struct _Ecore_X_Event_Window_Focus_In
struct _Ecore_X_Event_Window_Keymap
{
- Ecore_X_Window win;
+ Ecore_X_Window win;
};
struct _Ecore_X_Event_Window_Damage
{
- Ecore_X_Window win;
- int x, y, w, h;
- int count;
- Ecore_X_Time time;
+ Ecore_X_Window win;
+ int x, y, w, h;
+ int count;
+ Ecore_X_Time time;
};
struct _Ecore_X_Event_Window_Visibility_Change
{
- Ecore_X_Window win;
- int fully_obscured;
- Ecore_X_Time time;
+ Ecore_X_Window win;
+ int fully_obscured;
+ Ecore_X_Time time;
};
struct _Ecore_X_Event_Window_Create
{
- Ecore_X_Window win;
- Ecore_X_Window parent;
- int override;
- int x, y, w, h;
- int border;
- Ecore_X_Time time;
+ Ecore_X_Window win;
+ Ecore_X_Window parent;
+ int override;
+ int x, y, w, h;
+ int border;
+ Ecore_X_Time time;
};
struct _Ecore_X_Event_Window_Destroy
{
- Ecore_X_Window win;
- Ecore_X_Window event_win;
- Ecore_X_Time time;
+ Ecore_X_Window win;
+ Ecore_X_Window event_win;
+ Ecore_X_Time time;
};
struct _Ecore_X_Event_Window_Hide
{
- Ecore_X_Window win;
- Ecore_X_Window event_win;
- Ecore_X_Time time;
+ Ecore_X_Window win;
+ Ecore_X_Window event_win;
+ Ecore_X_Time time;
};
struct _Ecore_X_Event_Window_Show
{
- Ecore_X_Window win;
- Ecore_X_Window event_win;
- Ecore_X_Time time;
+ Ecore_X_Window win;
+ Ecore_X_Window event_win;
+ Ecore_X_Time time;
};
struct _Ecore_X_Event_Window_Show_Request
{
- Ecore_X_Window win;
- Ecore_X_Window parent;
- Ecore_X_Time time;
+ Ecore_X_Window win;
+ Ecore_X_Window parent;
+ Ecore_X_Time time;
};
struct _Ecore_X_Event_Window_Reparent
{
- Ecore_X_Window win;
- Ecore_X_Window event_win;
- Ecore_X_Window parent;
- Ecore_X_Time time;
+ Ecore_X_Window win;
+ Ecore_X_Window event_win;
+ Ecore_X_Window parent;
+ Ecore_X_Time time;
};
struct _Ecore_X_Event_Window_Configure
{
- Ecore_X_Window win;
- Ecore_X_Window event_win;
- Ecore_X_Window abovewin;
- int x, y, w, h;
- int border;
- unsigned int override : 1;
- unsigned int from_wm : 1;
- Ecore_X_Time time;
+ Ecore_X_Window win;
+ Ecore_X_Window event_win;
+ Ecore_X_Window abovewin;
+ int x, y, w, h;
+ int border;
+ unsigned int override : 1;
+ unsigned int from_wm : 1;
+ Ecore_X_Time time;
};
struct _Ecore_X_Event_Window_Configure_Request
{
- Ecore_X_Window win;
- Ecore_X_Window parent_win;
- Ecore_X_Window abovewin;
- int x, y, w, h;
- int border;
+ Ecore_X_Window win;
+ Ecore_X_Window parent_win;
+ Ecore_X_Window abovewin;
+ int x, y, w, h;
+ int border;
Ecore_X_Window_Stack_Mode detail;
- unsigned long value_mask;
- Ecore_X_Time time;
+ unsigned long value_mask;
+ Ecore_X_Time time;
};
struct _Ecore_X_Event_Window_Gravity
{
- Ecore_X_Window win;
- Ecore_X_Window event_win;
- Ecore_X_Time time;
+ Ecore_X_Window win;
+ Ecore_X_Window event_win;
+ Ecore_X_Time time;
};
struct _Ecore_X_Event_Window_Resize_Request
{
- Ecore_X_Window win;
- int w, h;
- Ecore_X_Time time;
+ Ecore_X_Window win;
+ int w, h;
+ Ecore_X_Time time;
};
struct _Ecore_X_Event_Window_Stack
{
- Ecore_X_Window win;
- Ecore_X_Window event_win;
+ Ecore_X_Window win;
+ Ecore_X_Window event_win;
Ecore_X_Window_Stack_Mode detail;
- Ecore_X_Time time;
+ Ecore_X_Time time;
};
struct _Ecore_X_Event_Window_Stack_Request
{
- Ecore_X_Window win;
- Ecore_X_Window parent;
+ Ecore_X_Window win;
+ Ecore_X_Window parent;
Ecore_X_Window_Stack_Mode detail;
- Ecore_X_Time time;
+ Ecore_X_Time time;
};
struct _Ecore_X_Event_Window_Property
{
- Ecore_X_Window win;
- Ecore_X_Atom atom;
- Ecore_X_Time time;
+ Ecore_X_Window win;
+ Ecore_X_Atom atom;
+ Ecore_X_Time time;
};
struct _Ecore_X_Event_Window_Colormap
struct _Ecore_X_Event_Selection_Request
{
- Ecore_X_Window owner;
- Ecore_X_Window requestor;
- Ecore_X_Time time;
- Ecore_X_Atom selection;
- Ecore_X_Atom target;
- Ecore_X_Atom property;
+ Ecore_X_Window owner;
+ Ecore_X_Window requestor;
+ Ecore_X_Time time;
+ Ecore_X_Atom selection;
+ Ecore_X_Atom target;
+ Ecore_X_Atom property;
};
struct _Ecore_X_Event_Selection_Notify
{
- Ecore_X_Window win;
- Ecore_X_Time time;
- Ecore_X_Selection selection;
- Ecore_X_Atom atom;
- char *target;
- void *data;
+ Ecore_X_Window win;
+ Ecore_X_Time time;
+ Ecore_X_Selection selection;
+ Ecore_X_Atom atom;
+ char *target;
+ void *data;
};
struct _Ecore_X_Selection_Data
{
enum {
- ECORE_X_SELECTION_CONTENT_NONE,
- ECORE_X_SELECTION_CONTENT_TEXT,
- ECORE_X_SELECTION_CONTENT_FILES,
- ECORE_X_SELECTION_CONTENT_TARGETS,
- ECORE_X_SELECTION_CONTENT_CUSTOM
+ ECORE_X_SELECTION_CONTENT_NONE,
+ ECORE_X_SELECTION_CONTENT_TEXT,
+ ECORE_X_SELECTION_CONTENT_FILES,
+ ECORE_X_SELECTION_CONTENT_TARGETS,
+ ECORE_X_SELECTION_CONTENT_CUSTOM
} content;
- unsigned char *data;
- int length;
- int format;
+ unsigned char *data;
+ int length;
+ int format;
- int (*free)(void *data);
+ int (*free)(void *data);
};
struct _Ecore_X_Selection_Data_Files
{
Ecore_X_Selection_Data data;
- char **files;
- int num_files;
+ char **files;
+ int num_files;
};
struct _Ecore_X_Selection_Data_Text
{
Ecore_X_Selection_Data data;
- char *text;
+ char *text;
};
struct _Ecore_X_Selection_Data_Targets
{
Ecore_X_Selection_Data data;
- char **targets;
- int num_targets;
+ char **targets;
+ int num_targets;
};
struct _Ecore_X_Event_Xdnd_Enter
{
- Ecore_X_Window win, source;
+ Ecore_X_Window win, source;
- char **types;
- int num_types;
+ char **types;
+ int num_types;
};
struct _Ecore_X_Event_Xdnd_Position
{
- Ecore_X_Window win, source;
- struct {
+ Ecore_X_Window win, source;
+ struct
+ {
int x, y;
} position;
- Ecore_X_Atom action;
+ Ecore_X_Atom action;
};
struct _Ecore_X_Event_Xdnd_Status
{
- Ecore_X_Window win, target;
- int will_accept;
- Ecore_X_Rectangle rectangle;
- Ecore_X_Atom action;
+ Ecore_X_Window win, target;
+ int will_accept;
+ Ecore_X_Rectangle rectangle;
+ Ecore_X_Atom action;
};
struct _Ecore_X_Event_Xdnd_Leave
{
- Ecore_X_Window win, source;
+ Ecore_X_Window win, source;
};
struct _Ecore_X_Event_Xdnd_Drop
{
- Ecore_X_Window win, source;
- Ecore_X_Atom action;
- struct {
+ Ecore_X_Window win, source;
+ Ecore_X_Atom action;
+ struct
+ {
int x, y;
} position;
};
struct _Ecore_X_Event_Xdnd_Finished
{
- Ecore_X_Window win, target;
- int completed;
- Ecore_X_Atom action;
+ Ecore_X_Window win, target;
+ int completed;
+ Ecore_X_Atom action;
};
struct _Ecore_X_Event_Client_Message
{
- Ecore_X_Window win;
- Ecore_X_Atom message_type;
- int format;
+ Ecore_X_Window win;
+ Ecore_X_Atom message_type;
+ int format;
union {
- char b[20];
- short s[10];
- long l[5];
+ char b[20];
+ short s[10];
+ long l[5];
} data;
- Ecore_X_Time time;
+ Ecore_X_Time time;
};
struct _Ecore_X_Event_Window_Shape
{
- Ecore_X_Window win;
- Ecore_X_Time time;
+ Ecore_X_Window win;
+ Ecore_X_Time time;
+ Ecore_X_Shape_Type type;
+ int x, y, w, h;
+ Eina_Bool shaped : 1;
};
struct _Ecore_X_Event_Screensaver_Notify
{
- Ecore_X_Window win;
- int on;
- Ecore_X_Time time;
+ Ecore_X_Window win;
+ int on;
+ Ecore_X_Time time;
};
struct _Ecore_X_Event_Sync_Counter
{
- Ecore_X_Time time;
+ Ecore_X_Time time;
};
struct _Ecore_X_Event_Sync_Alarm
Ecore_X_Sync_Alarm alarm;
};
+struct _Ecore_X_Randr_Screen_Size
+{
+ int width, height;
+};
+
+struct _Ecore_X_Randr_Screen_Size_MM
+{
+ int width, height, width_mm, height_mm;
+};
+
struct _Ecore_X_Event_Screen_Change
{
Ecore_X_Window win;
Ecore_X_Window root;
- int width;
- int height;
+ Ecore_X_Randr_Screen_Size_MM size; /* in pixel and millimeters */
Ecore_X_Time time;
Ecore_X_Time config_time;
- int mm_width; /* in millimeters */
- int mm_height; /* in millimeters */
- Ecore_X_Randr_Rotation rotation;
+ Ecore_X_Randr_Orientation orientation;
Ecore_X_Render_Subpixel_Order subpixel_order;
Ecore_X_Randr_Size_ID size_id;
};
struct _Ecore_X_Event_Randr_Crtc_Change
{
- Ecore_X_Window win;
- Ecore_X_Randr_Crtc crtc;
- Ecore_X_Randr_Mode mode;
- Ecore_X_Randr_Rotation rotation;
- int x;
- int y;
- int width;
- int height;
+ Ecore_X_Window win;
+ Ecore_X_Randr_Crtc crtc;
+ Ecore_X_Randr_Mode mode;
+ Ecore_X_Randr_Orientation orientation;
+ Eina_Rectangle geo;
};
struct _Ecore_X_Event_Randr_Output_Change
{
- Ecore_X_Window win;
- Ecore_X_Randr_Output output;
- Ecore_X_Randr_Crtc crtc;
- Ecore_X_Randr_Mode mode;
- Ecore_X_Randr_Rotation rotation;
- Ecore_X_Randr_Connection connection;
- Ecore_X_Render_Subpixel_Order subpixel_order;
+ Ecore_X_Window win;
+ Ecore_X_Randr_Output output;
+ Ecore_X_Randr_Crtc crtc;
+ Ecore_X_Randr_Mode mode;
+ Ecore_X_Randr_Orientation orientation;
+ Ecore_X_Randr_Connection_Status connection;
+ Ecore_X_Render_Subpixel_Order subpixel_order;
};
struct _Ecore_X_Event_Randr_Output_Property_Notify
{
- Ecore_X_Window win;
- Ecore_X_Randr_Output output;
- Ecore_X_Atom property;
- Ecore_X_Time time;
- int state; /* NewValue, Deleted */
+ Ecore_X_Window win;
+ Ecore_X_Randr_Output output;
+ Ecore_X_Atom property;
+ Ecore_X_Time time;
+ int state; /* NewValue, Deleted */
};
struct _Ecore_X_Event_Window_Delete_Request
{
- Ecore_X_Window win;
- Ecore_X_Time time;
+ Ecore_X_Window win;
+ Ecore_X_Time time;
};
struct _Ecore_X_Event_Window_Prop_Title_Change
{
- Ecore_X_Window win;
- char *title;
- Ecore_X_Time time;
+ Ecore_X_Window win;
+ char *title;
+ Ecore_X_Time time;
};
struct _Ecore_X_Event_Window_Prop_Visible_Title_Change
{
- Ecore_X_Window win;
- char *title;
- Ecore_X_Time time;
+ Ecore_X_Window win;
+ char *title;
+ Ecore_X_Time time;
};
struct _Ecore_X_Event_Window_Prop_Icon_Name_Change
{
- Ecore_X_Window win;
- char *name;
- Ecore_X_Time time;
+ Ecore_X_Window win;
+ char *name;
+ Ecore_X_Time time;
};
struct _Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change
{
- Ecore_X_Window win;
- char *name;
- Ecore_X_Time time;
+ Ecore_X_Window win;
+ char *name;
+ Ecore_X_Time time;
};
struct _Ecore_X_Event_Window_Prop_Client_Machine_Change
{
- Ecore_X_Window win;
- char *name;
- Ecore_X_Time time;
+ Ecore_X_Window win;
+ char *name;
+ Ecore_X_Time time;
};
struct _Ecore_X_Event_Window_Prop_Name_Class_Change
{
- Ecore_X_Window win;
- char *name;
- char *clas;
- Ecore_X_Time time;
+ Ecore_X_Window win;
+ char *name;
+ char *clas;
+ Ecore_X_Time time;
};
struct _Ecore_X_Event_Window_Prop_Pid_Change
{
- Ecore_X_Window win;
- pid_t pid;
- Ecore_X_Time time;
+ Ecore_X_Window win;
+ pid_t pid;
+ Ecore_X_Time time;
};
struct _Ecore_X_Event_Window_Prop_Desktop_Change
{
- Ecore_X_Window win;
- long desktop;
- Ecore_X_Time time;
+ Ecore_X_Window win;
+ long desktop;
+ Ecore_X_Time time;
};
struct _Ecore_X_Event_Startup_Sequence
{
- Ecore_X_Window win;
+ Ecore_X_Window win;
};
struct _Ecore_X_Event_Window_Move_Resize_Request
struct _Ecore_X_Event_Frame_Extents_Request
{
- Ecore_X_Window win;
+ Ecore_X_Window win;
};
struct _Ecore_X_Event_Ping
{
- Ecore_X_Window win;
- Ecore_X_Window event_win;
- Ecore_X_Time time;
+ Ecore_X_Window win;
+ Ecore_X_Window event_win;
+ Ecore_X_Time time;
};
struct _Ecore_X_Event_Desktop_Change
{
- Ecore_X_Window win;
- unsigned int desk;
- int source;
+ Ecore_X_Window win;
+ unsigned int desk;
+ int source;
};
struct _Ecore_X_Event_Generic
{
- int extension;
- int evtype;
- unsigned int cookie;
- void *data;
+ int extension;
+ int evtype;
+ unsigned int cookie;
+ void *data;
};
EAPI extern int ECORE_X_EVENT_ANY; /**< low level event dependent on
- backend in use, if Xlib will be XEvent,
- if XCB will be xcb_generic_event_t.
- @warning avoid using it.
- */
+ backend in use, if Xlib will be XEvent,
+ if XCB will be xcb_generic_event_t.
+ @warning avoid using it.
+ */
EAPI extern int ECORE_X_EVENT_MOUSE_IN;
EAPI extern int ECORE_X_EVENT_MOUSE_OUT;
EAPI extern int ECORE_X_EVENT_WINDOW_FOCUS_IN;
EAPI extern int ECORE_X_EVENT_WINDOW_DELETE_REQUEST;
/*
-EAPI extern int ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE;
-EAPI extern int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE;
-EAPI extern int ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE;
-EAPI extern int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE;
-EAPI extern int ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE;
-EAPI extern int ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE;
-EAPI extern int ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE;
-EAPI extern int ECORE_X_EVENT_WINDOW_PROP_DESKTOP_CHANGE;
-*/
+ EAPI extern int ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE;
+ EAPI extern int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE;
+ EAPI extern int ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE;
+ EAPI extern int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE;
+ EAPI extern int ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE;
+ EAPI extern int ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE;
+ EAPI extern int ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE;
+ EAPI extern int ECORE_X_EVENT_WINDOW_PROP_DESKTOP_CHANGE;
+ */
EAPI extern int ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST;
EAPI extern int ECORE_X_EVENT_WINDOW_STATE_REQUEST;
EAPI extern int ECORE_X_LOCK_NUM;
EAPI extern int ECORE_X_LOCK_CAPS;
-typedef enum _Ecore_X_WM_Protocol
+typedef enum _Ecore_X_WM_Protocol
{
/* If enabled the window manager will be asked to send a
* delete message instead of just closing (destroying) the window. */
ECORE_X_WM_PROTOCOL_NUM
} Ecore_X_WM_Protocol;
-typedef enum _Ecore_X_Window_Input_Mode
+typedef enum _Ecore_X_Window_Input_Mode
{
/* The window can never be focused */
ECORE_X_WINDOW_INPUT_MODE_NONE,
ECORE_X_WINDOW_INPUT_MODE_ACTIVE_GLOBAL
} Ecore_X_Window_Input_Mode;
-typedef enum _Ecore_X_Window_State_Hint
+typedef enum _Ecore_X_Window_State_Hint
{
/** Do not provide any state hint to the window manager */
ECORE_X_WINDOW_STATE_HINT_NONE = -1,
ECORE_X_WINDOW_STATE_HINT_ICONIC
} Ecore_X_Window_State_Hint;
-typedef enum _Ecore_X_Window_Type
-{
- ECORE_X_WINDOW_TYPE_UNKNOWN = 0,
- ECORE_X_WINDOW_TYPE_DESKTOP,
- ECORE_X_WINDOW_TYPE_DOCK,
- ECORE_X_WINDOW_TYPE_TOOLBAR,
- ECORE_X_WINDOW_TYPE_MENU,
- ECORE_X_WINDOW_TYPE_UTILITY,
- ECORE_X_WINDOW_TYPE_SPLASH,
- ECORE_X_WINDOW_TYPE_DIALOG,
- ECORE_X_WINDOW_TYPE_NORMAL,
- ECORE_X_WINDOW_TYPE_DROPDOWN_MENU,
- ECORE_X_WINDOW_TYPE_POPUP_MENU,
- ECORE_X_WINDOW_TYPE_TOOLTIP,
- ECORE_X_WINDOW_TYPE_NOTIFICATION,
- ECORE_X_WINDOW_TYPE_COMBO,
- ECORE_X_WINDOW_TYPE_DND
+typedef enum _Ecore_X_Window_Type
+{
+ ECORE_X_WINDOW_TYPE_UNKNOWN = 0,
+ ECORE_X_WINDOW_TYPE_DESKTOP,
+ ECORE_X_WINDOW_TYPE_DOCK,
+ ECORE_X_WINDOW_TYPE_TOOLBAR,
+ ECORE_X_WINDOW_TYPE_MENU,
+ ECORE_X_WINDOW_TYPE_UTILITY,
+ ECORE_X_WINDOW_TYPE_SPLASH,
+ ECORE_X_WINDOW_TYPE_DIALOG,
+ ECORE_X_WINDOW_TYPE_NORMAL,
+ ECORE_X_WINDOW_TYPE_DROPDOWN_MENU,
+ ECORE_X_WINDOW_TYPE_POPUP_MENU,
+ ECORE_X_WINDOW_TYPE_TOOLTIP,
+ ECORE_X_WINDOW_TYPE_NOTIFICATION,
+ ECORE_X_WINDOW_TYPE_COMBO,
+ ECORE_X_WINDOW_TYPE_DND
} Ecore_X_Window_Type;
-typedef enum _Ecore_X_Action
+typedef enum _Ecore_X_Action
{
ECORE_X_ACTION_MOVE,
ECORE_X_ACTION_RESIZE,
ECORE_X_ACTION_BELOW
} Ecore_X_Action;
-typedef enum _Ecore_X_Window_Configure_Mask
+typedef enum _Ecore_X_Window_Configure_Mask
{
ECORE_X_WINDOW_CONFIGURE_MASK_X = (1 << 0),
ECORE_X_WINDOW_CONFIGURE_MASK_Y = (1 << 1),
ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE = (1 << 6)
} Ecore_X_Window_Configure_Mask;
-typedef enum _Ecore_X_Virtual_Keyboard_State
+typedef enum _Ecore_X_Virtual_Keyboard_State
{
ECORE_X_VIRTUAL_KEYBOARD_STATE_UNKNOWN = 0,
ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF,
ECORE_X_VIRTUAL_KEYBOARD_STATE_J2ME
} Ecore_X_Virtual_Keyboard_State;
-typedef enum _Ecore_X_Illume_Mode
+typedef enum _Ecore_X_Illume_Mode
{
- ECORE_X_ILLUME_MODE_UNKNOWN = 0,
- ECORE_X_ILLUME_MODE_SINGLE,
- ECORE_X_ILLUME_MODE_DUAL_TOP,
+ ECORE_X_ILLUME_MODE_UNKNOWN = 0,
+ ECORE_X_ILLUME_MODE_SINGLE,
+ ECORE_X_ILLUME_MODE_DUAL_TOP,
ECORE_X_ILLUME_MODE_DUAL_LEFT
} Ecore_X_Illume_Mode;
-typedef enum _Ecore_X_Illume_Quickpanel_State
+typedef enum _Ecore_X_Illume_Quickpanel_State
{
- ECORE_X_ILLUME_QUICKPANEL_STATE_UNKNOWN = 0,
- ECORE_X_ILLUME_QUICKPANEL_STATE_OFF,
+ ECORE_X_ILLUME_QUICKPANEL_STATE_UNKNOWN = 0,
+ ECORE_X_ILLUME_QUICKPANEL_STATE_OFF,
ECORE_X_ILLUME_QUICKPANEL_STATE_ON
} Ecore_X_Illume_Quickpanel_State;
/* Window layer constants */
-#define ECORE_X_WINDOW_LAYER_BELOW 2
+#define ECORE_X_WINDOW_LAYER_BELOW 2
#define ECORE_X_WINDOW_LAYER_NORMAL 4
-#define ECORE_X_WINDOW_LAYER_ABOVE 6
+#define ECORE_X_WINDOW_LAYER_ABOVE 6
/* Property list operations */
-#define ECORE_X_PROP_LIST_REMOVE 0
-#define ECORE_X_PROP_LIST_ADD 1
-#define ECORE_X_PROP_LIST_TOGGLE 2
-
-EAPI int ecore_x_init(const char *name);
-EAPI int ecore_x_shutdown(void);
-EAPI int ecore_x_disconnect(void);
-EAPI Ecore_X_Display *ecore_x_display_get(void);
-EAPI Ecore_X_Connection *ecore_x_connection_get(void);
-EAPI int ecore_x_fd_get(void);
-EAPI Ecore_X_Screen *ecore_x_default_screen_get(void);
-EAPI void ecore_x_double_click_time_set(double t);
-EAPI double ecore_x_double_click_time_get(void);
-EAPI void ecore_x_flush(void);
-EAPI void ecore_x_sync(void);
-EAPI void ecore_x_killall(Ecore_X_Window root);
-EAPI void ecore_x_kill(Ecore_X_Window win);
-EAPI int ecore_x_dpi_get(void);
-
-EAPI Ecore_X_Time ecore_x_current_time_get(void);
-
-EAPI void ecore_x_error_handler_set(void (*func) (void *data), const void *data);
-EAPI void ecore_x_io_error_handler_set(void (*func) (void *data), const void *data);
-EAPI int ecore_x_error_request_get(void);
-EAPI int ecore_x_error_code_get(void);
-
-EAPI void ecore_x_event_mask_set(Ecore_X_Window w, Ecore_X_Event_Mask mask);
-EAPI void ecore_x_event_mask_unset(Ecore_X_Window w, Ecore_X_Event_Mask mask);
-
-EAPI int ecore_x_selection_notify_send(Ecore_X_Window requestor, Ecore_X_Atom selection, Ecore_X_Atom target, Ecore_X_Atom property, Ecore_X_Time time);
-EAPI void ecore_x_selection_primary_prefetch(void);
-EAPI void ecore_x_selection_primary_fetch(void);
-EAPI int ecore_x_selection_primary_set(Ecore_X_Window w, const void *data, int size);
-EAPI int ecore_x_selection_primary_clear(void);
-EAPI void ecore_x_selection_secondary_prefetch(void);
-EAPI void ecore_x_selection_secondary_fetch(void);
-EAPI int ecore_x_selection_secondary_set(Ecore_X_Window w, const void *data, int size);
-EAPI int ecore_x_selection_secondary_clear(void);
-EAPI void ecore_x_selection_xdnd_prefetch(void);
-EAPI void ecore_x_selection_xdnd_fetch(void);
-EAPI int ecore_x_selection_xdnd_set(Ecore_X_Window w, const void *data, int size);
-EAPI int ecore_x_selection_xdnd_clear(void);
-EAPI void ecore_x_selection_clipboard_prefetch(void);
-EAPI void ecore_x_selection_clipboard_fetch(void);
-EAPI int ecore_x_selection_clipboard_set(Ecore_X_Window w, const void *data, int size);
-EAPI int ecore_x_selection_clipboard_clear(void);
-EAPI void ecore_x_selection_primary_request(Ecore_X_Window w, const char *target);
-EAPI void ecore_x_selection_secondary_request(Ecore_X_Window w, const char *target);
-EAPI void ecore_x_selection_xdnd_request(Ecore_X_Window w, const char *target);
-EAPI void ecore_x_selection_clipboard_request(Ecore_X_Window w, const char *target);
-EAPI int ecore_x_selection_convert(Ecore_X_Atom selection, Ecore_X_Atom target, void **data_ret);
-EAPI void ecore_x_selection_converter_add(char *target, int (*func)(char *target, void *data, int size, void **data_ret, int *size_ret));
-EAPI void ecore_x_selection_converter_atom_add(Ecore_X_Atom target, int (*func)(char *target, void *data, int size, void **data_ret, int *size_ret));
-EAPI void ecore_x_selection_converter_del(char *target);
-EAPI void ecore_x_selection_converter_atom_del(Ecore_X_Atom target);
-EAPI void ecore_x_selection_parser_add(const char *target, void *(*func)(const char *target, void *data, int size, int format));
-EAPI void ecore_x_selection_parser_del(const char *target);
-
-EAPI void ecore_x_dnd_aware_set(Ecore_X_Window win, int on);
-EAPI void ecore_x_dnd_version_get_prefetch(Ecore_X_Window window);
-EAPI void ecore_x_dnd_version_get_fetch(void);
-EAPI int ecore_x_dnd_version_get(Ecore_X_Window win);
-EAPI void ecore_x_dnd_type_get_prefetch(Ecore_X_Window window);
-EAPI void ecore_x_dnd_type_get_fetch(void);
-EAPI int ecore_x_dnd_type_isset(Ecore_X_Window win, const char *type);
-EAPI void ecore_x_dnd_type_set(Ecore_X_Window win, const char *type, int on);
-EAPI void ecore_x_dnd_types_set(Ecore_X_Window win, const char **types, unsigned int num_types);
-EAPI void ecore_x_dnd_actions_set(Ecore_X_Window win, Ecore_X_Atom *actions, unsigned int num_actions);
-EAPI void ecore_x_dnd_begin_prefetch(Ecore_X_Window source);
-EAPI void ecore_x_dnd_begin_fetch(void);
-EAPI int ecore_x_dnd_begin(Ecore_X_Window source, unsigned char *data, int size);
-EAPI int ecore_x_dnd_drop(void);
-EAPI void ecore_x_dnd_send_status(int will_accept, int suppress, Ecore_X_Rectangle rectangle, Ecore_X_Atom action);
-EAPI void ecore_x_dnd_send_finished(void);
-EAPI void ecore_x_dnd_source_action_set(Ecore_X_Atom action);
-EAPI Ecore_X_Atom ecore_x_dnd_source_action_get(void);
-
-EAPI Ecore_X_Window ecore_x_window_new(Ecore_X_Window parent, int x, int y, int w, int h);
-EAPI Ecore_X_Window ecore_x_window_override_new(Ecore_X_Window parent, int x, int y, int w, int h);
-EAPI int ecore_x_window_argb_get(Ecore_X_Window win);
-EAPI Ecore_X_Window ecore_x_window_manager_argb_new(Ecore_X_Window parent, int x, int y, int w, int h);
-EAPI Ecore_X_Window ecore_x_window_argb_new(Ecore_X_Window parent, int x, int y, int w, int h);
-EAPI Ecore_X_Window ecore_x_window_override_argb_new(Ecore_X_Window parent, int x, int y, int w, int h);
-EAPI Ecore_X_Window ecore_x_window_input_new(Ecore_X_Window parent, int x, int y, int w, int h);
-EAPI void ecore_x_window_configure(Ecore_X_Window win,
- Ecore_X_Window_Configure_Mask mask,
- int x, int y, int w, int h,
- int border_width,
- Ecore_X_Window sibling,
- int stack_mode);
-EAPI void ecore_x_window_cursor_set(Ecore_X_Window win, Ecore_X_Cursor c);
-EAPI void ecore_x_window_free(Ecore_X_Window win);
-EAPI void ecore_x_window_ignore_set(Ecore_X_Window win, int ignore);
-EAPI Ecore_X_Window *ecore_x_window_ignore_list(int *num);
-
-EAPI void ecore_x_window_delete_request_send(Ecore_X_Window win);
-EAPI void ecore_x_window_show(Ecore_X_Window win);
-EAPI void ecore_x_window_hide(Ecore_X_Window win);
-EAPI void ecore_x_window_move(Ecore_X_Window win, int x, int y);
-EAPI void ecore_x_window_resize(Ecore_X_Window win, int w, int h);
-EAPI void ecore_x_window_move_resize(Ecore_X_Window win, int x, int y, int w, int h);
-EAPI void ecore_x_window_focus(Ecore_X_Window win);
-EAPI void ecore_x_window_focus_at_time(Ecore_X_Window win, Ecore_X_Time t);
-EAPI void ecore_x_get_input_focus_prefetch(void);
-EAPI void ecore_x_get_input_focus_fetch(void);
-EAPI Ecore_X_Window ecore_x_window_focus_get(void);
-EAPI void ecore_x_window_raise(Ecore_X_Window win);
-EAPI void ecore_x_window_lower(Ecore_X_Window win);
-EAPI void ecore_x_window_reparent(Ecore_X_Window win, Ecore_X_Window new_parent, int x, int y);
-EAPI void ecore_x_window_size_get(Ecore_X_Window win, int *w, int *h);
-EAPI void ecore_x_window_geometry_get(Ecore_X_Window win, int *x, int *y, int *w, int *h);
-EAPI int ecore_x_window_border_width_get(Ecore_X_Window win);
-EAPI void ecore_x_window_border_width_set(Ecore_X_Window win, int width);
-EAPI int ecore_x_window_depth_get(Ecore_X_Window win);
-EAPI void ecore_x_window_cursor_show(Ecore_X_Window win, int show);
-EAPI void ecore_x_window_defaults_set(Ecore_X_Window win);
-EAPI int ecore_x_window_visible_get(Ecore_X_Window win);
-EAPI Ecore_X_Window ecore_x_window_shadow_tree_at_xy_with_skip_get(Ecore_X_Window base, int x, int y, Ecore_X_Window *skip, int skip_num);
-EAPI Ecore_X_Window ecore_x_window_shadow_parent_get(Ecore_X_Window root, Ecore_X_Window win);
-EAPI void ecore_x_window_shadow_tree_flush(void);
-EAPI Ecore_X_Window ecore_x_window_root_get(Ecore_X_Window win);
-EAPI Ecore_X_Window ecore_x_window_at_xy_get(int x, int y);
-EAPI Ecore_X_Window ecore_x_window_at_xy_with_skip_get(int x, int y, Ecore_X_Window *skip, int skip_num);
-EAPI Ecore_X_Window ecore_x_window_at_xy_begin_get(Ecore_X_Window begin, int x, int y);
-EAPI void ecore_x_query_tree_prefetch(Ecore_X_Window window);
-EAPI void ecore_x_query_tree_fetch(void);
-EAPI Ecore_X_Window ecore_x_window_parent_get(Ecore_X_Window win);
-
-EAPI void ecore_x_window_background_color_set(Ecore_X_Window win,
- unsigned short r,
- unsigned short g,
- unsigned short b);
-EAPI void ecore_x_window_gravity_set(Ecore_X_Window win,
- Ecore_X_Gravity grav);
-EAPI void ecore_x_window_pixel_gravity_set(Ecore_X_Window win,
- Ecore_X_Gravity grav);
-EAPI void ecore_x_window_pixmap_set(Ecore_X_Window win,
- Ecore_X_Pixmap pmap);
-EAPI void ecore_x_window_area_clear(Ecore_X_Window win,
- int x, int y, int w, int h);
-EAPI void ecore_x_window_area_expose(Ecore_X_Window win,
- int x, int y, int w, int h);
-EAPI void ecore_x_window_override_set(Ecore_X_Window win, int override);
-
-EAPI void ecore_x_window_prop_card32_set(Ecore_X_Window win, Ecore_X_Atom atom,
- unsigned int *val, unsigned int num);
-EAPI void ecore_x_window_prop_card32_get_prefetch(Ecore_X_Window window,
- Ecore_X_Atom atom);
-EAPI void ecore_x_window_prop_card32_get_fetch(void);
-EAPI int ecore_x_window_prop_card32_get(Ecore_X_Window win, Ecore_X_Atom atom,
- unsigned int *val, unsigned int len);
-EAPI int ecore_x_window_prop_card32_list_get(Ecore_X_Window win,
- Ecore_X_Atom atom,
- unsigned int **plst);
-
-EAPI void ecore_x_window_prop_xid_set(Ecore_X_Window win,
- Ecore_X_Atom atom,
- Ecore_X_Atom type,
- Ecore_X_ID * lst,
- unsigned int num);
-EAPI void ecore_x_window_prop_xid_get_prefetch(Ecore_X_Window window,
- Ecore_X_Atom atom,
- Ecore_X_Atom type);
-EAPI void ecore_x_window_prop_xid_get_fetch(void);
-EAPI int ecore_x_window_prop_xid_get(Ecore_X_Window win,
- Ecore_X_Atom atom,
- Ecore_X_Atom type,
- Ecore_X_ID * lst,
- unsigned int len);
-EAPI int ecore_x_window_prop_xid_list_get(Ecore_X_Window win,
- Ecore_X_Atom atom,
- Ecore_X_Atom type,
- Ecore_X_ID ** plst);
-EAPI void ecore_x_window_prop_xid_list_change(Ecore_X_Window win,
- Ecore_X_Atom atom,
- Ecore_X_Atom type,
- Ecore_X_ID item,
- int op);
-EAPI void ecore_x_window_prop_atom_set(Ecore_X_Window win,
- Ecore_X_Atom atom,
- Ecore_X_Atom * val,
- unsigned int num);
-EAPI void ecore_x_window_prop_atom_get_prefetch(Ecore_X_Window window,
- Ecore_X_Atom atom);
-EAPI void ecore_x_window_prop_atom_get_fetch(void);
-EAPI int ecore_x_window_prop_atom_get(Ecore_X_Window win,
- Ecore_X_Atom atom,
- Ecore_X_Atom * val,
- unsigned int len);
-EAPI int ecore_x_window_prop_atom_list_get(Ecore_X_Window win,
- Ecore_X_Atom atom,
- Ecore_X_Atom ** plst);
-EAPI void ecore_x_window_prop_atom_list_change(Ecore_X_Window win,
- Ecore_X_Atom atom,
- Ecore_X_Atom item,
- int op);
-EAPI void ecore_x_window_prop_window_set(Ecore_X_Window win,
- Ecore_X_Atom atom,
- Ecore_X_Window * val,
- unsigned int num);
-EAPI void ecore_x_window_prop_window_get_prefetch(Ecore_X_Window window,
- Ecore_X_Atom atom);
-EAPI void ecore_x_window_prop_window_get_fetch(void);
-EAPI int ecore_x_window_prop_window_get(Ecore_X_Window win,
- Ecore_X_Atom atom,
- Ecore_X_Window * val,
- unsigned int len);
-EAPI int ecore_x_window_prop_window_list_get(Ecore_X_Window win,
- Ecore_X_Atom atom,
- Ecore_X_Window ** plst);
-
-EAPI Ecore_X_Atom ecore_x_window_prop_any_type(void);
-EAPI void ecore_x_window_prop_property_set(Ecore_X_Window win, Ecore_X_Atom type, Ecore_X_Atom format, int size, void *data, int number);
-EAPI void ecore_x_window_prop_property_get_prefetch(Ecore_X_Window window,
- Ecore_X_Atom property,
- Ecore_X_Atom type);
-EAPI void ecore_x_window_prop_property_get_fetch(void);
-EAPI int ecore_x_window_prop_property_get(Ecore_X_Window win, Ecore_X_Atom property, Ecore_X_Atom type, int size, unsigned char **data, int *num);
-EAPI void ecore_x_window_prop_property_del(Ecore_X_Window win, Ecore_X_Atom property);
-EAPI void ecore_x_window_prop_list_prefetch(Ecore_X_Window window);
-EAPI void ecore_x_window_prop_list_fetch(void);
-EAPI Ecore_X_Atom *ecore_x_window_prop_list(Ecore_X_Window win, int *num_ret);
-EAPI void ecore_x_window_prop_string_set(Ecore_X_Window win, Ecore_X_Atom type, const char *str);
-EAPI void ecore_x_window_prop_string_get_prefetch(Ecore_X_Window window,
- Ecore_X_Atom type);
-EAPI void ecore_x_window_prop_string_get_fetch(void);
-EAPI char *ecore_x_window_prop_string_get(Ecore_X_Window win, Ecore_X_Atom type);
-EAPI int ecore_x_window_prop_protocol_isset(Ecore_X_Window win, Ecore_X_WM_Protocol protocol);
-EAPI Ecore_X_WM_Protocol *ecore_x_window_prop_protocol_list_get(Ecore_X_Window win, int *num_ret);
-
-EAPI void ecore_x_window_shape_mask_set(Ecore_X_Window win, Ecore_X_Pixmap mask);
-EAPI void ecore_x_window_shape_window_set(Ecore_X_Window win, Ecore_X_Window shape_win);
-EAPI void ecore_x_window_shape_window_set_xy(Ecore_X_Window win, Ecore_X_Window shape_win, int x, int y);
-EAPI void ecore_x_window_shape_rectangle_set(Ecore_X_Window win, int x, int y, int w, int h);
-EAPI void ecore_x_window_shape_rectangles_set(Ecore_X_Window win, Ecore_X_Rectangle *rects, int num);
-EAPI void ecore_x_window_shape_window_add(Ecore_X_Window win, Ecore_X_Window shape_win);
-EAPI void ecore_x_window_shape_window_add_xy(Ecore_X_Window win, Ecore_X_Window shape_win, int x, int y);
-EAPI void ecore_x_window_shape_rectangle_add(Ecore_X_Window win, int x, int y, int w, int h);
-EAPI void ecore_x_window_shape_rectangle_clip(Ecore_X_Window win, int x, int y, int w, int h);
-EAPI void ecore_x_window_shape_rectangles_add(Ecore_X_Window win, Ecore_X_Rectangle *rects, int num);
-EAPI void ecore_x_window_shape_rectangles_get_prefetch(Ecore_X_Window window);
-EAPI void ecore_x_window_shape_rectangles_get_fetch(void);
-EAPI Ecore_X_Rectangle *ecore_x_window_shape_rectangles_get(Ecore_X_Window win, int *num_ret);
-EAPI void ecore_x_window_shape_events_select(Ecore_X_Window win, int on);
-EAPI void ecore_x_window_shape_input_mask_set(Ecore_X_Window win, Ecore_X_Pixmap mask);
-
-EAPI Ecore_X_Pixmap ecore_x_pixmap_new(Ecore_X_Window win, int w, int h, int dep);
-EAPI void ecore_x_pixmap_free(Ecore_X_Pixmap pmap);
-EAPI void ecore_x_pixmap_paste(Ecore_X_Pixmap pmap, Ecore_X_Drawable dest, Ecore_X_GC gc, int sx, int sy, int w, int h, int dx, int dy);
-EAPI void ecore_x_pixmap_geometry_get(Ecore_X_Pixmap pmap, int *x, int *y, int *w, int *h);
-EAPI int ecore_x_pixmap_depth_get(Ecore_X_Pixmap pmap);
-
-EAPI Ecore_X_GC ecore_x_gc_new(Ecore_X_Drawable draw, Ecore_X_GC_Value_Mask value_mask, const unsigned int *value_list);
-EAPI void ecore_x_gc_free(Ecore_X_GC gc);
-
-EAPI int ecore_x_client_message32_send(Ecore_X_Window win, Ecore_X_Atom type, Ecore_X_Event_Mask mask, long d0, long d1, long d2, long d3, long d4);
-EAPI int ecore_x_client_message8_send(Ecore_X_Window win, Ecore_X_Atom type, const void *data, int len);
-EAPI int ecore_x_mouse_move_send(Ecore_X_Window win, int x, int y);
-EAPI int ecore_x_mouse_down_send(Ecore_X_Window win, int x, int y, int b);
-EAPI int ecore_x_mouse_up_send(Ecore_X_Window win, int x, int y, int b);
-
-EAPI void ecore_x_drawable_geometry_get_prefetch(Ecore_X_Drawable drawable);
-EAPI void ecore_x_drawable_geometry_get_fetch(void);
-EAPI void ecore_x_drawable_geometry_get(Ecore_X_Drawable d, int *x, int *y, int *w, int *h);
-EAPI int ecore_x_drawable_border_width_get(Ecore_X_Drawable d);
-EAPI int ecore_x_drawable_depth_get(Ecore_X_Drawable d);
-EAPI void ecore_x_drawable_rectangle_fill(Ecore_X_Drawable d, Ecore_X_GC gc, int x, int y, int width, int height);
-
-EAPI int ecore_x_cursor_color_supported_get(void);
-EAPI Ecore_X_Cursor ecore_x_cursor_new(Ecore_X_Window win, int *pixels, int w, int h, int hot_x, int hot_y);
-EAPI void ecore_x_cursor_free(Ecore_X_Cursor c);
-EAPI Ecore_X_Cursor ecore_x_cursor_shape_get(int shape);
-EAPI void ecore_x_cursor_size_set(int size);
-EAPI int ecore_x_cursor_size_get(void);
-
+#define ECORE_X_PROP_LIST_REMOVE 0
+#define ECORE_X_PROP_LIST_ADD 1
+#define ECORE_X_PROP_LIST_TOGGLE 2
+
+EAPI int ecore_x_init(const char *name);
+EAPI int ecore_x_shutdown(void);
+EAPI int ecore_x_disconnect(void);
+EAPI Ecore_X_Display * ecore_x_display_get(void);
+EAPI Ecore_X_Connection * ecore_x_connection_get(void);
+EAPI int ecore_x_fd_get(void);
+EAPI Ecore_X_Screen * ecore_x_default_screen_get(void);
+EAPI void ecore_x_double_click_time_set(double t);
+EAPI double ecore_x_double_click_time_get(void);
+EAPI void ecore_x_flush(void);
+EAPI void ecore_x_sync(void);
+EAPI void ecore_x_killall(Ecore_X_Window root);
+EAPI void ecore_x_kill(Ecore_X_Window win);
+EAPI int ecore_x_dpi_get(void);
+EAPI Eina_Bool ecore_x_bell(int percent);
+
+EAPI Ecore_X_Time ecore_x_current_time_get(void);
+
+EAPI void ecore_x_error_handler_set(void (*func)(void *data), const void *data);
+EAPI void ecore_x_io_error_handler_set(void (*func)(
+ void *data), const void *data);
+EAPI int ecore_x_error_request_get(void);
+EAPI int ecore_x_error_code_get(void);
+
+EAPI void ecore_x_event_mask_set(Ecore_X_Window w,
+ Ecore_X_Event_Mask mask);
+EAPI void ecore_x_event_mask_unset(Ecore_X_Window w,
+ Ecore_X_Event_Mask mask);
+
+EAPI int ecore_x_selection_notify_send(Ecore_X_Window requestor,
+ Ecore_X_Atom selection,
+ Ecore_X_Atom target,
+ Ecore_X_Atom property,
+ Ecore_X_Time time);
+EAPI void ecore_x_selection_primary_prefetch(void);
+EAPI void ecore_x_selection_primary_fetch(void);
+EAPI int ecore_x_selection_primary_set(Ecore_X_Window w,
+ const void *data,
+ int size);
+EAPI int ecore_x_selection_primary_clear(void);
+EAPI void ecore_x_selection_secondary_prefetch(void);
+EAPI void ecore_x_selection_secondary_fetch(void);
+EAPI int ecore_x_selection_secondary_set(Ecore_X_Window w,
+ const void *data,
+ int size);
+EAPI int ecore_x_selection_secondary_clear(void);
+EAPI void ecore_x_selection_xdnd_prefetch(void);
+EAPI void ecore_x_selection_xdnd_fetch(void);
+EAPI int ecore_x_selection_xdnd_set(Ecore_X_Window w,
+ const void *data,
+ int size);
+EAPI int ecore_x_selection_xdnd_clear(void);
+EAPI void ecore_x_selection_clipboard_prefetch(void);
+EAPI void ecore_x_selection_clipboard_fetch(void);
+EAPI int ecore_x_selection_clipboard_set(Ecore_X_Window w,
+ const void *data,
+ int size);
+EAPI int ecore_x_selection_clipboard_clear(void);
+EAPI void ecore_x_selection_primary_request(Ecore_X_Window w,
+ const char *target);
+EAPI void ecore_x_selection_secondary_request(Ecore_X_Window w,
+ const char *target);
+EAPI void ecore_x_selection_xdnd_request(Ecore_X_Window w,
+ const char *target);
+EAPI void ecore_x_selection_clipboard_request(Ecore_X_Window w,
+ const char *target);
+EAPI int ecore_x_selection_convert(Ecore_X_Atom selection,
+ Ecore_X_Atom target,
+ void **data_ret,
+ int *len,
+ Ecore_X_Atom *targprop,
+ int *targsize);
+EAPI void ecore_x_selection_converter_add(char *target, int (*func)(
+ char *target,
+ void *data,
+ int size,
+ void **data_ret,
+ int *size_ret,
+ Ecore_X_Atom *,
+ int *));
+EAPI void ecore_x_selection_converter_atom_add(Ecore_X_Atom target, int (*func)(
+ char *target,
+ void *data,
+ int size,
+ void **data_ret,
+ int *size_ret,
+ Ecore_X_Atom *tprop,
+ int *tsize));
+EAPI void ecore_x_selection_converter_del(char *target);
+EAPI void ecore_x_selection_converter_atom_del(
+ Ecore_X_Atom target);
+EAPI void ecore_x_selection_parser_add(const char *target,
+ void *(*func)(const char *target,
+ void *data, int size,
+ int format));
+EAPI void ecore_x_selection_parser_del(const char *target);
+
+EAPI void ecore_x_dnd_aware_set(Ecore_X_Window win, int on);
+EAPI void ecore_x_dnd_version_get_prefetch(Ecore_X_Window window);
+EAPI void ecore_x_dnd_version_get_fetch(void);
+EAPI int ecore_x_dnd_version_get(Ecore_X_Window win);
+EAPI void ecore_x_dnd_type_get_prefetch(Ecore_X_Window window);
+EAPI void ecore_x_dnd_type_get_fetch(void);
+EAPI int ecore_x_dnd_type_isset(Ecore_X_Window win,
+ const char *type);
+EAPI void ecore_x_dnd_type_set(Ecore_X_Window win,
+ const char *type,
+ int on);
+EAPI void ecore_x_dnd_types_set(Ecore_X_Window win,
+ const char **types,
+ unsigned int num_types);
+EAPI void ecore_x_dnd_actions_set(Ecore_X_Window win,
+ Ecore_X_Atom *actions,
+ unsigned int num_actions);
+EAPI void ecore_x_dnd_begin_prefetch(Ecore_X_Window source);
+EAPI void ecore_x_dnd_begin_fetch(void);
+EAPI int ecore_x_dnd_begin(Ecore_X_Window source,
+ unsigned char *data,
+ int size);
+EAPI int ecore_x_dnd_drop(void);
+EAPI void ecore_x_dnd_send_status(int will_accept,
+ int suppress,
+ Ecore_X_Rectangle rectangle,
+ Ecore_X_Atom action);
+EAPI void ecore_x_dnd_send_finished(void);
+EAPI void ecore_x_dnd_source_action_set(Ecore_X_Atom action);
+EAPI Ecore_X_Atom ecore_x_dnd_source_action_get(void);
+
+EAPI Ecore_X_Window ecore_x_window_new(Ecore_X_Window parent,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI Ecore_X_Window ecore_x_window_override_new(Ecore_X_Window parent,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI int ecore_x_window_argb_get(Ecore_X_Window win);
+EAPI Ecore_X_Window ecore_x_window_manager_argb_new(Ecore_X_Window parent,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI Ecore_X_Window ecore_x_window_argb_new(Ecore_X_Window parent,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI Ecore_X_Window ecore_x_window_override_argb_new(Ecore_X_Window parent,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI Ecore_X_Window ecore_x_window_input_new(Ecore_X_Window parent,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI void ecore_x_window_configure(
+ Ecore_X_Window win,
+ Ecore_X_Window_Configure_Mask
+ mask,
+ int x,
+ int y,
+ int w,
+ int h,
+ int border_width,
+ Ecore_X_Window sibling,
+ int stack_mode);
+EAPI void ecore_x_window_cursor_set(Ecore_X_Window win,
+ Ecore_X_Cursor c);
+EAPI void ecore_x_window_free(Ecore_X_Window win);
+EAPI void ecore_x_window_ignore_set(Ecore_X_Window win,
+ int ignore);
+EAPI Ecore_X_Window * ecore_x_window_ignore_list(int *num);
+
+EAPI void ecore_x_window_delete_request_send(
+ Ecore_X_Window win);
+EAPI void ecore_x_window_show(Ecore_X_Window win);
+EAPI void ecore_x_window_hide(Ecore_X_Window win);
+EAPI void ecore_x_window_move(Ecore_X_Window win,
+ int x,
+ int y);
+EAPI void ecore_x_window_resize(Ecore_X_Window win,
+ int w,
+ int h);
+EAPI void ecore_x_window_move_resize(Ecore_X_Window win,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI void ecore_x_window_focus(Ecore_X_Window win);
+EAPI void ecore_x_window_focus_at_time(Ecore_X_Window win,
+ Ecore_X_Time t);
+EAPI void ecore_x_get_input_focus_prefetch(void);
+EAPI void ecore_x_get_input_focus_fetch(void);
+EAPI Ecore_X_Window ecore_x_window_focus_get(void);
+EAPI void ecore_x_window_raise(Ecore_X_Window win);
+EAPI void ecore_x_window_lower(Ecore_X_Window win);
+EAPI void ecore_x_window_reparent(Ecore_X_Window win,
+ Ecore_X_Window new_parent,
+ int x,
+ int y);
+EAPI void ecore_x_window_size_get(Ecore_X_Window win,
+ int *w,
+ int *h);
+EAPI void ecore_x_window_geometry_get(Ecore_X_Window win,
+ int *x,
+ int *y,
+ int *w,
+ int *h);
+EAPI int ecore_x_window_border_width_get(
+ Ecore_X_Window win);
+EAPI void ecore_x_window_border_width_set(
+ Ecore_X_Window win,
+ int width);
+EAPI int ecore_x_window_depth_get(Ecore_X_Window win);
+EAPI void ecore_x_window_cursor_show(Ecore_X_Window win,
+ int show);
+EAPI void ecore_x_window_defaults_set(Ecore_X_Window win);
+EAPI int ecore_x_window_visible_get(Ecore_X_Window win);
+EAPI Ecore_X_Window ecore_x_window_shadow_tree_at_xy_with_skip_get(
+ Ecore_X_Window base,
+ int x,
+ int y,
+ Ecore_X_Window *skip,
+ int skip_num);
+EAPI Ecore_X_Window ecore_x_window_shadow_parent_get(
+ Ecore_X_Window root,
+ Ecore_X_Window win);
+EAPI void ecore_x_window_shadow_tree_flush(void);
+EAPI Ecore_X_Window ecore_x_window_root_get(Ecore_X_Window win);
+EAPI Ecore_X_Window ecore_x_window_at_xy_get(int x, int y);
+EAPI Ecore_X_Window ecore_x_window_at_xy_with_skip_get(int x,
+ int y,
+ Ecore_X_Window *skip,
+ int skip_num);
+EAPI Ecore_X_Window ecore_x_window_at_xy_begin_get(
+ Ecore_X_Window begin,
+ int x,
+ int y);
+EAPI void ecore_x_query_tree_prefetch(
+ Ecore_X_Window window);
+EAPI void ecore_x_query_tree_fetch(void);
+EAPI Ecore_X_Window ecore_x_window_parent_get(Ecore_X_Window win);
+
+EAPI void ecore_x_window_background_color_set(
+ Ecore_X_Window win,
+ unsigned
+ short r,
+ unsigned
+ short g,
+ unsigned
+ short b);
+EAPI void ecore_x_window_gravity_set(Ecore_X_Window win,
+ Ecore_X_Gravity grav);
+EAPI void ecore_x_window_pixel_gravity_set(
+ Ecore_X_Window win,
+ Ecore_X_Gravity
+ grav);
+EAPI void ecore_x_window_pixmap_set(Ecore_X_Window win,
+ Ecore_X_Pixmap pmap);
+EAPI void ecore_x_window_area_clear(Ecore_X_Window win,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI void ecore_x_window_area_expose(Ecore_X_Window win,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI void ecore_x_window_override_set(Ecore_X_Window win,
+ int override);
+
+EAPI void ecore_x_window_prop_card32_set(
+ Ecore_X_Window win,
+ Ecore_X_Atom atom,
+ unsigned int *val,
+ unsigned int num);
+EAPI void ecore_x_window_prop_card32_get_prefetch(
+ Ecore_X_Window window,
+ Ecore_X_Atom
+ atom);
+EAPI void ecore_x_window_prop_card32_get_fetch(void);
+EAPI int ecore_x_window_prop_card32_get(
+ Ecore_X_Window win,
+ Ecore_X_Atom atom,
+ unsigned int *val,
+ unsigned int len);
+EAPI int ecore_x_window_prop_card32_list_get(
+ Ecore_X_Window win,
+ Ecore_X_Atom
+ atom,
+ unsigned int
+ **plst);
+
+EAPI void ecore_x_window_prop_xid_set(Ecore_X_Window win,
+ Ecore_X_Atom atom,
+ Ecore_X_Atom type,
+ Ecore_X_ID *lst,
+ unsigned int num);
+EAPI void ecore_x_window_prop_xid_get_prefetch(
+ Ecore_X_Window window,
+ Ecore_X_Atom
+ atom,
+ Ecore_X_Atom
+ type);
+EAPI void ecore_x_window_prop_xid_get_fetch(void);
+EAPI int ecore_x_window_prop_xid_get(Ecore_X_Window win,
+ Ecore_X_Atom atom,
+ Ecore_X_Atom type,
+ Ecore_X_ID *lst,
+ unsigned int len);
+EAPI int ecore_x_window_prop_xid_list_get(
+ Ecore_X_Window win,
+ Ecore_X_Atom
+ atom,
+ Ecore_X_Atom
+ type,
+ Ecore_X_ID **
+ plst);
+EAPI void ecore_x_window_prop_xid_list_change(
+ Ecore_X_Window win,
+ Ecore_X_Atom
+ atom,
+ Ecore_X_Atom
+ type,
+ Ecore_X_ID
+ item,
+ int op);
+EAPI void ecore_x_window_prop_atom_set(Ecore_X_Window win,
+ Ecore_X_Atom atom,
+ Ecore_X_Atom *val,
+ unsigned int num);
+EAPI void ecore_x_window_prop_atom_get_prefetch(
+ Ecore_X_Window window,
+ Ecore_X_Atom
+ atom);
+EAPI void ecore_x_window_prop_atom_get_fetch(void);
+EAPI int ecore_x_window_prop_atom_get(Ecore_X_Window win,
+ Ecore_X_Atom atom,
+ Ecore_X_Atom *val,
+ unsigned int len);
+EAPI int ecore_x_window_prop_atom_list_get(
+ Ecore_X_Window win,
+ Ecore_X_Atom
+ atom,
+ Ecore_X_Atom *
+ *plst);
+EAPI void ecore_x_window_prop_atom_list_change(
+ Ecore_X_Window win,
+ Ecore_X_Atom
+ atom,
+ Ecore_X_Atom
+ item,
+ int op);
+EAPI void ecore_x_window_prop_window_set(
+ Ecore_X_Window win,
+ Ecore_X_Atom atom,
+ Ecore_X_Window *
+ val,
+ unsigned int num);
+EAPI void ecore_x_window_prop_window_get_prefetch(
+ Ecore_X_Window window,
+ Ecore_X_Atom
+ atom);
+EAPI void ecore_x_window_prop_window_get_fetch(void);
+EAPI int ecore_x_window_prop_window_get(
+ Ecore_X_Window win,
+ Ecore_X_Atom atom,
+ Ecore_X_Window *
+ val,
+ unsigned int len);
+EAPI int ecore_x_window_prop_window_list_get(
+ Ecore_X_Window win,
+ Ecore_X_Atom
+ atom,
+ Ecore_X_Window
+ **plst);
+
+EAPI Ecore_X_Atom ecore_x_window_prop_any_type(void);
+EAPI void ecore_x_window_prop_property_set(
+ Ecore_X_Window win,
+ Ecore_X_Atom type,
+ Ecore_X_Atom format,
+ int size,
+ void *data,
+ int number);
+EAPI void ecore_x_window_prop_property_get_prefetch(
+ Ecore_X_Window window,
+ Ecore_X_Atom
+ property,
+ Ecore_X_Atom
+ type);
+EAPI void ecore_x_window_prop_property_get_fetch(void);
+EAPI int ecore_x_window_prop_property_get(
+ Ecore_X_Window win,
+ Ecore_X_Atom property,
+ Ecore_X_Atom type,
+ int size,
+ unsigned char **data,
+ int *num);
+EAPI void ecore_x_window_prop_property_del(
+ Ecore_X_Window win,
+ Ecore_X_Atom property);
+EAPI void ecore_x_window_prop_list_prefetch(
+ Ecore_X_Window window);
+EAPI void ecore_x_window_prop_list_fetch(void);
+EAPI Ecore_X_Atom * ecore_x_window_prop_list(Ecore_X_Window win,
+ int *num_ret);
+EAPI void ecore_x_window_prop_string_set(
+ Ecore_X_Window win,
+ Ecore_X_Atom type,
+ const char *str);
+EAPI void ecore_x_window_prop_string_get_prefetch(
+ Ecore_X_Window window,
+ Ecore_X_Atom
+ type);
+EAPI void ecore_x_window_prop_string_get_fetch(void);
+EAPI char * ecore_x_window_prop_string_get(
+ Ecore_X_Window win,
+ Ecore_X_Atom type);
+EAPI int ecore_x_window_prop_protocol_isset(
+ Ecore_X_Window win,
+ Ecore_X_WM_Protocol protocol);
+EAPI Ecore_X_WM_Protocol * ecore_x_window_prop_protocol_list_get(
+ Ecore_X_Window win,
+ int *num_ret);
+
+EAPI void ecore_x_window_shape_mask_set(Ecore_X_Window win,
+ Ecore_X_Pixmap mask);
+EAPI void ecore_x_window_shape_window_set(
+ Ecore_X_Window win,
+ Ecore_X_Window shape_win);
+EAPI void ecore_x_window_shape_window_set_xy(
+ Ecore_X_Window win,
+ Ecore_X_Window shape_win,
+ int x,
+ int y);
+EAPI void ecore_x_window_shape_rectangle_set(
+ Ecore_X_Window win,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI void ecore_x_window_shape_rectangles_set(
+ Ecore_X_Window win,
+ Ecore_X_Rectangle *rects,
+ int num);
+EAPI void ecore_x_window_shape_window_add(
+ Ecore_X_Window win,
+ Ecore_X_Window shape_win);
+EAPI void ecore_x_window_shape_window_add_xy(
+ Ecore_X_Window win,
+ Ecore_X_Window shape_win,
+ int x,
+ int y);
+EAPI void ecore_x_window_shape_rectangle_add(
+ Ecore_X_Window win,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI void ecore_x_window_shape_rectangle_clip(
+ Ecore_X_Window win,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI void ecore_x_window_shape_rectangles_add(
+ Ecore_X_Window win,
+ Ecore_X_Rectangle *rects,
+ int num);
+EAPI void ecore_x_window_shape_rectangles_get_prefetch(
+ Ecore_X_Window window);
+EAPI void ecore_x_window_shape_rectangles_get_fetch(void);
+EAPI Ecore_X_Rectangle * ecore_x_window_shape_rectangles_get(
+ Ecore_X_Window win,
+ int *num_ret);
+EAPI void ecore_x_window_shape_events_select(
+ Ecore_X_Window win,
+ int on);
+EAPI void ecore_x_window_shape_input_mask_set(
+ Ecore_X_Window win,
+ Ecore_X_Pixmap mask);
+
+EAPI Ecore_X_Pixmap ecore_x_pixmap_new(Ecore_X_Window win,
+ int w,
+ int h,
+ int dep);
+EAPI void ecore_x_pixmap_free(Ecore_X_Pixmap pmap);
+EAPI void ecore_x_pixmap_paste(Ecore_X_Pixmap pmap,
+ Ecore_X_Drawable dest,
+ Ecore_X_GC gc,
+ int sx,
+ int sy,
+ int w,
+ int h,
+ int dx,
+ int dy);
+EAPI void ecore_x_pixmap_geometry_get(Ecore_X_Pixmap pmap,
+ int *x,
+ int *y,
+ int *w,
+ int *h);
+EAPI int ecore_x_pixmap_depth_get(Ecore_X_Pixmap pmap);
+
+EAPI Ecore_X_GC ecore_x_gc_new(Ecore_X_Drawable draw,
+ Ecore_X_GC_Value_Mask value_mask,
+ const unsigned int *value_list);
+EAPI void ecore_x_gc_free(Ecore_X_GC gc);
+
+EAPI int ecore_x_client_message32_send(Ecore_X_Window win,
+ Ecore_X_Atom type,
+ Ecore_X_Event_Mask mask,
+ long d0,
+ long d1,
+ long d2,
+ long d3,
+ long d4);
+EAPI int ecore_x_client_message8_send(Ecore_X_Window win,
+ Ecore_X_Atom type,
+ const void *data,
+ int len);
+EAPI int ecore_x_mouse_move_send(Ecore_X_Window win,
+ int x,
+ int y);
+EAPI int ecore_x_mouse_down_send(Ecore_X_Window win,
+ int x,
+ int y,
+ int b);
+EAPI int ecore_x_mouse_up_send(Ecore_X_Window win,
+ int x,
+ int y,
+ int b);
+
+EAPI void ecore_x_drawable_geometry_get_prefetch(
+ Ecore_X_Drawable drawable);
+EAPI void ecore_x_drawable_geometry_get_fetch(void);
+EAPI void ecore_x_drawable_geometry_get(Ecore_X_Drawable d,
+ int *x,
+ int *y,
+ int *w,
+ int *h);
+EAPI int ecore_x_drawable_border_width_get(
+ Ecore_X_Drawable d);
+EAPI int ecore_x_drawable_depth_get(Ecore_X_Drawable d);
+EAPI void ecore_x_drawable_rectangle_fill(
+ Ecore_X_Drawable d,
+ Ecore_X_GC gc,
+ int x,
+ int y,
+ int width,
+ int height);
+
+EAPI int ecore_x_cursor_color_supported_get(void);
+EAPI Ecore_X_Cursor ecore_x_cursor_new(Ecore_X_Window win,
+ int *pixels,
+ int w,
+ int h,
+ int hot_x,
+ int hot_y);
+EAPI void ecore_x_cursor_free(Ecore_X_Cursor c);
+EAPI Ecore_X_Cursor ecore_x_cursor_shape_get(int shape);
+EAPI void ecore_x_cursor_size_set(int size);
+EAPI int ecore_x_cursor_size_get(void);
/* FIXME: these funcs need categorising */
-EAPI Ecore_X_Window *ecore_x_window_root_list(int *num_ret);
-EAPI Ecore_X_Window ecore_x_window_root_first_get(void);
-EAPI int ecore_x_window_manage(Ecore_X_Window win);
-EAPI void ecore_x_window_container_manage(Ecore_X_Window win);
-EAPI void ecore_x_window_client_manage(Ecore_X_Window win);
-EAPI void ecore_x_window_sniff(Ecore_X_Window win);
-EAPI void ecore_x_window_client_sniff(Ecore_X_Window win);
-EAPI void ecore_x_atom_get_prefetch(const char *name);
-EAPI void ecore_x_atom_get_fetch(void);
-EAPI Ecore_X_Atom ecore_x_atom_get(const char *name);
-EAPI void ecore_x_atoms_get(const char **names, int num, Ecore_X_Atom *atoms);
-EAPI void ecore_x_get_atom_name_prefetch(Ecore_X_Atom atom);
-EAPI void ecore_x_get_atom_name_fetch(void);
-EAPI char *ecore_x_atom_name_get(Ecore_X_Atom atom);
-
-
-EAPI void ecore_x_icccm_init(void);
-EAPI void ecore_x_icccm_state_set(Ecore_X_Window win, Ecore_X_Window_State_Hint state);
-EAPI Ecore_X_Window_State_Hint ecore_x_icccm_state_get(Ecore_X_Window win);
-EAPI void ecore_x_icccm_delete_window_send(Ecore_X_Window win, Ecore_X_Time t);
-EAPI void ecore_x_icccm_take_focus_send(Ecore_X_Window win, Ecore_X_Time t);
-EAPI void ecore_x_icccm_save_yourself_send(Ecore_X_Window win, Ecore_X_Time t);
-EAPI void ecore_x_icccm_move_resize_send(Ecore_X_Window win, int x, int y, int w, int h);
-EAPI void ecore_x_icccm_hints_set(Ecore_X_Window win,
- int 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,
- int is_urgent);
-EAPI int ecore_x_icccm_hints_get(Ecore_X_Window win,
- int *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,
- int *is_urgent);
-EAPI void ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win,
- int request_pos,
- Ecore_X_Gravity gravity,
- int min_w, int min_h,
- int max_w, int max_h,
- int base_w, int base_h,
- int step_x, int step_y,
- double min_aspect,
- double max_aspect);
-EAPI int ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win,
- int *request_pos,
- Ecore_X_Gravity *gravity,
- int *min_w, int *min_h,
- int *max_w, int *max_h,
- int *base_w, int *base_h,
- int *step_x, int *step_y,
- double *min_aspect,
- double *max_aspect);
-EAPI void ecore_x_icccm_title_set(Ecore_X_Window win, const char *t);
-EAPI char *ecore_x_icccm_title_get(Ecore_X_Window win);
-EAPI void ecore_x_icccm_protocol_atoms_set(Ecore_X_Window win,
- Ecore_X_Atom *protos, int num);
-EAPI void ecore_x_icccm_protocol_set(Ecore_X_Window win,
- Ecore_X_WM_Protocol protocol,
- int on);
-EAPI int ecore_x_icccm_protocol_isset(Ecore_X_Window win,
- Ecore_X_WM_Protocol protocol);
-EAPI void ecore_x_icccm_name_class_set(Ecore_X_Window win,
- const char *n,
- const char *c);
-EAPI void ecore_x_icccm_name_class_get(Ecore_X_Window win,
- char **n,
- char **c);
-EAPI char *ecore_x_icccm_client_machine_get(Ecore_X_Window win);
-EAPI void ecore_x_icccm_command_set(Ecore_X_Window win, int argc, char **argv);
-EAPI void ecore_x_icccm_command_get(Ecore_X_Window win, int *argc, char ***argv);
-EAPI char *ecore_x_icccm_icon_name_get(Ecore_X_Window win);
-EAPI void ecore_x_icccm_icon_name_set(Ecore_X_Window win, const char *t);
-EAPI void ecore_x_icccm_colormap_window_set(Ecore_X_Window win, Ecore_X_Window subwin);
-EAPI void ecore_x_icccm_colormap_window_unset(Ecore_X_Window win, Ecore_X_Window subwin);
-EAPI void ecore_x_icccm_transient_for_set(Ecore_X_Window win, Ecore_X_Window forwin);
-EAPI void ecore_x_icccm_transient_for_unset(Ecore_X_Window win);
-EAPI Ecore_X_Window ecore_x_icccm_transient_for_get(Ecore_X_Window win);
-EAPI void ecore_x_icccm_window_role_set(Ecore_X_Window win, const char *role);
-EAPI char *ecore_x_icccm_window_role_get(Ecore_X_Window win);
-EAPI void ecore_x_icccm_client_leader_set(Ecore_X_Window win, Ecore_X_Window l);
-EAPI Ecore_X_Window ecore_x_icccm_client_leader_get(Ecore_X_Window win);
-EAPI void ecore_x_icccm_iconic_request_send(Ecore_X_Window win, Ecore_X_Window root);
-
+EAPI Ecore_X_Window * ecore_x_window_root_list(int *num_ret);
+EAPI Ecore_X_Window ecore_x_window_root_first_get(void);
+EAPI int ecore_x_window_manage(Ecore_X_Window win);
+EAPI void ecore_x_window_container_manage(
+ Ecore_X_Window win);
+EAPI void ecore_x_window_client_manage(Ecore_X_Window win);
+EAPI void ecore_x_window_sniff(Ecore_X_Window win);
+EAPI void ecore_x_window_client_sniff(Ecore_X_Window win);
+EAPI void ecore_x_atom_get_prefetch(const char *name);
+EAPI void ecore_x_atom_get_fetch(void);
+EAPI Ecore_X_Atom ecore_x_atom_get(const char *name);
+EAPI void ecore_x_atoms_get(const char **names,
+ int num,
+ Ecore_X_Atom *atoms);
+EAPI void ecore_x_get_atom_name_prefetch(Ecore_X_Atom atom);
+EAPI void ecore_x_get_atom_name_fetch(void);
+EAPI char * ecore_x_atom_name_get(Ecore_X_Atom atom);
+
+EAPI void ecore_x_icccm_init(void);
+EAPI void ecore_x_icccm_state_set(
+ Ecore_X_Window win,
+ Ecore_X_Window_State_Hint
+ state);
+EAPI Ecore_X_Window_State_Hint ecore_x_icccm_state_get(Ecore_X_Window win);
+EAPI void ecore_x_icccm_delete_window_send(
+ Ecore_X_Window win,
+ Ecore_X_Time t);
+EAPI void ecore_x_icccm_take_focus_send(Ecore_X_Window win,
+ Ecore_X_Time t);
+EAPI void ecore_x_icccm_save_yourself_send(
+ Ecore_X_Window win,
+ Ecore_X_Time t);
+EAPI void ecore_x_icccm_move_resize_send(
+ Ecore_X_Window win,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI void ecore_x_icccm_hints_set(
+ Ecore_X_Window win,
+ int 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,
+ int is_urgent);
+EAPI int ecore_x_icccm_hints_get(Ecore_X_Window win,
+ int *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,
+ int *is_urgent);
+EAPI void ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win,
+ int request_pos,
+ Ecore_X_Gravity gravity,
+ int min_w, int min_h,
+ int max_w, int max_h,
+ int base_w, int base_h,
+ int step_x, int step_y,
+ double min_aspect,
+ double max_aspect);
+EAPI int ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win,
+ int *request_pos,
+ Ecore_X_Gravity *gravity,
+ int *min_w, int *min_h,
+ int *max_w, int *max_h,
+ int *base_w, int *base_h,
+ int *step_x, int *step_y,
+ double *min_aspect,
+ double *max_aspect);
+EAPI void ecore_x_icccm_title_set(Ecore_X_Window win, const char *t);
+EAPI char * ecore_x_icccm_title_get(Ecore_X_Window win);
+EAPI void ecore_x_icccm_protocol_atoms_set(Ecore_X_Window win,
+ Ecore_X_Atom *protos,
+ int num);
+EAPI void ecore_x_icccm_protocol_set(Ecore_X_Window win,
+ Ecore_X_WM_Protocol protocol,
+ int on);
+EAPI int ecore_x_icccm_protocol_isset(Ecore_X_Window win,
+ Ecore_X_WM_Protocol protocol);
+EAPI void ecore_x_icccm_name_class_set(Ecore_X_Window win,
+ const char *n,
+ const char *c);
+EAPI void ecore_x_icccm_name_class_get(Ecore_X_Window win,
+ char **n,
+ char **c);
+EAPI char * ecore_x_icccm_client_machine_get(Ecore_X_Window win);
+EAPI void ecore_x_icccm_command_set(Ecore_X_Window win,
+ int argc,
+ char **argv);
+EAPI void ecore_x_icccm_command_get(Ecore_X_Window win,
+ int *argc,
+ char ***argv);
+EAPI char * ecore_x_icccm_icon_name_get(Ecore_X_Window win);
+EAPI void ecore_x_icccm_icon_name_set(Ecore_X_Window win,
+ const char *t);
+EAPI void ecore_x_icccm_colormap_window_set(Ecore_X_Window win,
+ Ecore_X_Window subwin);
+EAPI void ecore_x_icccm_colormap_window_unset(Ecore_X_Window win,
+ Ecore_X_Window subwin);
+EAPI void ecore_x_icccm_transient_for_set(Ecore_X_Window win,
+ Ecore_X_Window forwin);
+EAPI void ecore_x_icccm_transient_for_unset(Ecore_X_Window win);
+EAPI Ecore_X_Window ecore_x_icccm_transient_for_get(Ecore_X_Window win);
+EAPI void ecore_x_icccm_window_role_set(Ecore_X_Window win,
+ const char *role);
+EAPI char * ecore_x_icccm_window_role_get(Ecore_X_Window win);
+EAPI void ecore_x_icccm_client_leader_set(Ecore_X_Window win,
+ Ecore_X_Window l);
+EAPI Ecore_X_Window ecore_x_icccm_client_leader_get(Ecore_X_Window win);
+EAPI void ecore_x_icccm_iconic_request_send(Ecore_X_Window win,
+ Ecore_X_Window root);
typedef enum _Ecore_X_MWM_Hint_Func
{
ECORE_X_MWM_HINT_INPUT_FULL_APPLICATION_MODAL = 3
} Ecore_X_MWM_Hint_Input;
-EAPI void ecore_x_mwm_hints_get_prefetch(Ecore_X_Window window);
-EAPI void ecore_x_mwm_hints_get_fetch(void);
-EAPI int ecore_x_mwm_hints_get(Ecore_X_Window win,
- Ecore_X_MWM_Hint_Func *fhint,
- Ecore_X_MWM_Hint_Decor *dhint,
- Ecore_X_MWM_Hint_Input *ihint);
-EAPI void ecore_x_mwm_borderless_set(Ecore_X_Window win, int borderless);
+EAPI void ecore_x_mwm_hints_get_prefetch(
+ Ecore_X_Window window);
+EAPI void ecore_x_mwm_hints_get_fetch(void);
+EAPI int ecore_x_mwm_hints_get(
+ Ecore_X_Window win,
+ Ecore_X_MWM_Hint_Func
+ *fhint,
+ Ecore_X_MWM_Hint_Decor
+ *dhint,
+ Ecore_X_MWM_Hint_Input
+ *ihint);
+EAPI void ecore_x_mwm_borderless_set(
+ Ecore_X_Window win,
+ int borderless);
/* netwm */
-EAPI void ecore_x_netwm_init(void);
-EAPI void ecore_x_netwm_shutdown(void);
-EAPI void ecore_x_netwm_wm_identify(Ecore_X_Window root, Ecore_X_Window check, const char *wm_name);
-EAPI void ecore_x_netwm_supported_set(Ecore_X_Window root, Ecore_X_Atom *supported, int num);
-EAPI void ecore_x_netwm_supported_get_prefetch(Ecore_X_Window root);
-EAPI void ecore_x_netwm_supported_get_fetch(void);
-EAPI int ecore_x_netwm_supported_get(Ecore_X_Window root, Ecore_X_Atom **supported, int *num);
-EAPI void ecore_x_netwm_desk_count_set(Ecore_X_Window root, unsigned int n_desks);
-EAPI void ecore_x_netwm_desk_roots_set(Ecore_X_Window root, Ecore_X_Window *vroots, unsigned int n_desks);
-EAPI void ecore_x_netwm_desk_names_set(Ecore_X_Window root, const char **names, unsigned int n_desks);
-EAPI void ecore_x_netwm_desk_size_set(Ecore_X_Window root, unsigned int width, unsigned int height);
-EAPI void ecore_x_netwm_desk_workareas_set(Ecore_X_Window root, unsigned int *areas, unsigned int n_desks);
-EAPI void ecore_x_netwm_desk_current_set(Ecore_X_Window root, unsigned int desk);
-EAPI void ecore_x_netwm_desk_viewports_set(Ecore_X_Window root, unsigned int *origins, unsigned int n_desks);
-EAPI void ecore_x_netwm_desk_layout_set(Ecore_X_Window root, int orientation, int columns, int rows, int starting_corner);
-EAPI void ecore_x_netwm_showing_desktop_set(Ecore_X_Window root, int on);
-EAPI void ecore_x_netwm_client_list_set(Ecore_X_Window root, Ecore_X_Window *p_clients, unsigned int n_clients);
-EAPI void ecore_x_netwm_client_list_stacking_set(Ecore_X_Window root, Ecore_X_Window *p_clients, unsigned int n_clients);
-EAPI void ecore_x_netwm_client_active_set(Ecore_X_Window root, Ecore_X_Window win);
-EAPI void ecore_x_netwm_client_active_request(Ecore_X_Window root, Ecore_X_Window win, int type, Ecore_X_Window current_win);
-EAPI void ecore_x_netwm_name_set(Ecore_X_Window win, const char *name);
-EAPI void ecore_x_netwm_name_get_prefetch(Ecore_X_Window window);
-EAPI void ecore_x_netwm_name_get_fetch(void);
-EAPI int ecore_x_netwm_name_get(Ecore_X_Window win, char **name);
-EAPI void ecore_x_netwm_startup_id_set(Ecore_X_Window win, const char *id);
-EAPI void ecore_x_netwm_startup_id_get_prefetch(Ecore_X_Window window);
-EAPI void ecore_x_netwm_startup_id_get_fetch(void);
-EAPI int ecore_x_netwm_startup_id_get(Ecore_X_Window win, char **id);
-EAPI void ecore_x_netwm_visible_name_set(Ecore_X_Window win, const char *name);
-EAPI void ecore_x_netwm_visible_name_get_prefetch(Ecore_X_Window window);
-EAPI void ecore_x_netwm_visible_name_get_fetch(void);
-EAPI int ecore_x_netwm_visible_name_get(Ecore_X_Window win, char **name);
-EAPI void ecore_x_netwm_icon_name_set(Ecore_X_Window win, const char *name);
-EAPI void ecore_x_netwm_icon_name_get_prefetch(Ecore_X_Window window);
-EAPI void ecore_x_netwm_icon_name_get_fetch(void);
-EAPI int ecore_x_netwm_icon_name_get(Ecore_X_Window win, char **name);
-EAPI void ecore_x_netwm_visible_icon_name_set(Ecore_X_Window win, const char *name);
-EAPI void ecore_x_netwm_visible_icon_name_get_prefetch(Ecore_X_Window window);
-EAPI void ecore_x_netwm_visible_icon_name_get_fetch(void);
-EAPI int ecore_x_netwm_visible_icon_name_get(Ecore_X_Window win, char **name);
-EAPI void ecore_x_netwm_desktop_set(Ecore_X_Window win, unsigned int desk);
-EAPI void ecore_x_netwm_desktop_get_prefetch(Ecore_X_Window window);
-EAPI void ecore_x_netwm_desktop_get_fetch(void);
-EAPI int ecore_x_netwm_desktop_get(Ecore_X_Window win, unsigned int *desk);
-EAPI void ecore_x_netwm_strut_set(Ecore_X_Window win, int left, int right, int top, int bottom);
-EAPI void ecore_x_netwm_strut_get_prefetch(Ecore_X_Window window);
-EAPI void ecore_x_netwm_strut_get_fetch(void);
-EAPI int ecore_x_netwm_strut_get(Ecore_X_Window win, int *left, int *right, int *top, int *bottom);
-EAPI void ecore_x_netwm_strut_partial_set(Ecore_X_Window win, int left, int right, int top, int bottom, int left_start_y, int left_end_y, int right_start_y, int right_end_y, int top_start_x, int top_end_x, int bottom_start_x, int bottom_end_x);
-EAPI void ecore_x_netwm_strut_partial_get_prefetch(Ecore_X_Window window);
-EAPI void ecore_x_netwm_strut_partial_get_fetch(void);
-EAPI int ecore_x_netwm_strut_partial_get(Ecore_X_Window win, int *left, int *right, int *top, int *bottom, int *left_start_y, int *left_end_y, int *right_start_y, int *right_end_y, int *top_start_x, int *top_end_x, int *bottom_start_x, int *bottom_end_x);
-EAPI void ecore_x_netwm_icons_get_prefetch(Ecore_X_Window window);
-EAPI void ecore_x_netwm_icons_get_fetch(void);
-EAPI int ecore_x_netwm_icons_get(Ecore_X_Window win, Ecore_X_Icon **icon, int *num);
-EAPI void ecore_x_netwm_icon_geometry_set(Ecore_X_Window win, int x, int y, int width, int height);
-EAPI void ecore_x_netwm_icon_geometry_get_prefetch(Ecore_X_Window window);
-EAPI void ecore_x_netwm_icon_geometry_get_fetch(void);
-EAPI int ecore_x_netwm_icon_geometry_get(Ecore_X_Window win, int *x, int *y, int *width, int *height);
-EAPI void ecore_x_netwm_pid_set(Ecore_X_Window win, int pid);
-EAPI void ecore_x_netwm_pid_get_prefetch(Ecore_X_Window window);
-EAPI void ecore_x_netwm_pid_get_fetch(void);
-EAPI int ecore_x_netwm_pid_get(Ecore_X_Window win, int *pid);
-EAPI void ecore_x_netwm_handled_icons_set(Ecore_X_Window win);
-EAPI void ecore_x_netwm_handled_icons_get_prefetch(Ecore_X_Window window);
-EAPI void ecore_x_netwm_handled_icons_get_fetch(void);
-EAPI int ecore_x_netwm_handled_icons_get(Ecore_X_Window win);
-EAPI void ecore_x_netwm_user_time_set(Ecore_X_Window win, unsigned int time);
-EAPI void ecore_x_netwm_user_time_get_prefetch(Ecore_X_Window window);
-EAPI void ecore_x_netwm_user_time_get_fetch(void);
-EAPI int ecore_x_netwm_user_time_get(Ecore_X_Window win, unsigned int *time);
-EAPI void ecore_x_netwm_window_state_set(Ecore_X_Window win, Ecore_X_Window_State *state, unsigned int num);
-EAPI void ecore_x_netwm_window_state_get_prefetch(Ecore_X_Window window);
-EAPI void ecore_x_netwm_window_state_get_fetch(void);
-EAPI int ecore_x_netwm_window_state_get(Ecore_X_Window win, Ecore_X_Window_State **state, unsigned int *num);
-EAPI void ecore_x_netwm_window_type_set(Ecore_X_Window win, Ecore_X_Window_Type type);
-EAPI void ecore_x_netwm_window_type_get_prefetch(Ecore_X_Window window);
-EAPI void ecore_x_netwm_window_type_get_fetch(void);
-EAPI int ecore_x_netwm_window_type_get(Ecore_X_Window win, Ecore_X_Window_Type *type);
-EAPI int ecore_x_netwm_window_types_get(Ecore_X_Window win, Ecore_X_Window_Type **types);
-EAPI int ecore_x_netwm_allowed_action_isset(Ecore_X_Window win, Ecore_X_Action action);
-EAPI void ecore_x_netwm_allowed_action_set(Ecore_X_Window win, Ecore_X_Action *action, unsigned int num);
-EAPI void ecore_x_netwm_allowed_action_get_prefetch(Ecore_X_Window window);
-EAPI void ecore_x_netwm_allowed_action_get_fetch(void);
-EAPI int ecore_x_netwm_allowed_action_get(Ecore_X_Window win, Ecore_X_Action **action, unsigned int *num);
-EAPI void ecore_x_netwm_opacity_set(Ecore_X_Window win, unsigned int opacity);
-EAPI void ecore_x_netwm_opacity_get_prefetch(Ecore_X_Window window);
-EAPI void ecore_x_netwm_opacity_get_fetch(void);
-EAPI int ecore_x_netwm_opacity_get(Ecore_X_Window win, unsigned int *opacity);
-EAPI void ecore_x_netwm_frame_size_set(Ecore_X_Window win, int fl, int fr, int ft, int fb);
-EAPI void ecore_x_netwm_frame_size_get_prefetch(Ecore_X_Window window);
-EAPI void ecore_x_netwm_frame_size_get_fetch(void);
-EAPI int ecore_x_netwm_frame_size_get(Ecore_X_Window win, int *fl, int *fr, int *ft, int *fb);
-EAPI void ecore_x_netwm_sync_counter_get_prefetch(Ecore_X_Window window);
-EAPI void ecore_x_netwm_sync_counter_get_fetch(void);
-EAPI int ecore_x_netwm_sync_counter_get(Ecore_X_Window win, Ecore_X_Sync_Counter *counter);
-EAPI void ecore_x_netwm_ping_send(Ecore_X_Window win);
-EAPI void ecore_x_netwm_sync_request_send(Ecore_X_Window win, unsigned int serial);
-EAPI void ecore_x_netwm_state_request_send(Ecore_X_Window win, Ecore_X_Window root, Ecore_X_Window_State s1, Ecore_X_Window_State s2, int set);
-EAPI void ecore_x_netwm_desktop_request_send(Ecore_X_Window win, Ecore_X_Window root, unsigned int desktop);
-
-
-EAPI void ecore_x_e_init(void);
-EAPI void ecore_x_e_frame_size_set(Ecore_X_Window win, int fl, int fr, int ft, int fb);
-EAPI void ecore_x_e_virtual_keyboard_set(Ecore_X_Window win, unsigned int is_keyboard);
-EAPI int ecore_x_e_virtual_keyboard_get(Ecore_X_Window win);
-EAPI void ecore_x_e_virtual_keyboard_state_set(Ecore_X_Window win, Ecore_X_Virtual_Keyboard_State state);
-EAPI Ecore_X_Virtual_Keyboard_State ecore_x_e_virtual_keyboard_state_get(Ecore_X_Window win);
-EAPI void ecore_x_e_virtual_keyboard_state_send(Ecore_X_Window win, Ecore_X_Virtual_Keyboard_State state);
-
+EAPI void ecore_x_netwm_init(void);
+EAPI void ecore_x_netwm_shutdown(void);
+EAPI void ecore_x_netwm_wm_identify(
+ Ecore_X_Window root,
+ Ecore_X_Window check,
+ const char *wm_name);
+EAPI void ecore_x_netwm_supported_set(
+ Ecore_X_Window root,
+ Ecore_X_Atom *supported,
+ int num);
+EAPI void ecore_x_netwm_supported_get_prefetch(
+ Ecore_X_Window root);
+EAPI void ecore_x_netwm_supported_get_fetch(void);
+EAPI int ecore_x_netwm_supported_get(
+ Ecore_X_Window root,
+ Ecore_X_Atom **supported,
+ int *num);
+EAPI void ecore_x_netwm_desk_count_set(
+ Ecore_X_Window root,
+ unsigned int n_desks);
+EAPI void ecore_x_netwm_desk_roots_set(
+ Ecore_X_Window root,
+ Ecore_X_Window *vroots,
+ unsigned int n_desks);
+EAPI void ecore_x_netwm_desk_names_set(
+ Ecore_X_Window root,
+ const char **names,
+ unsigned int n_desks);
+EAPI void ecore_x_netwm_desk_size_set(
+ Ecore_X_Window root,
+ unsigned int width,
+ unsigned int height);
+EAPI void ecore_x_netwm_desk_workareas_set(
+ Ecore_X_Window root,
+ unsigned int *areas,
+ unsigned int n_desks);
+EAPI void ecore_x_netwm_desk_current_set(
+ Ecore_X_Window root,
+ unsigned int desk);
+EAPI void ecore_x_netwm_desk_viewports_set(
+ Ecore_X_Window root,
+ unsigned int *origins,
+ unsigned int n_desks);
+EAPI void ecore_x_netwm_desk_layout_set(
+ Ecore_X_Window root,
+ int orientation,
+ int columns,
+ int rows,
+ int starting_corner);
+EAPI void ecore_x_netwm_showing_desktop_set(
+ Ecore_X_Window root,
+ int on);
+EAPI void ecore_x_netwm_client_list_set(
+ Ecore_X_Window root,
+ Ecore_X_Window *p_clients,
+ unsigned int n_clients);
+EAPI void ecore_x_netwm_client_list_stacking_set(
+ Ecore_X_Window root,
+ Ecore_X_Window *p_clients,
+ unsigned int n_clients);
+EAPI void ecore_x_netwm_client_active_set(
+ Ecore_X_Window root,
+ Ecore_X_Window win);
+EAPI void ecore_x_netwm_client_active_request(
+ Ecore_X_Window root,
+ Ecore_X_Window win,
+ int type,
+ Ecore_X_Window current_win);
+EAPI void ecore_x_netwm_name_set(Ecore_X_Window win,
+ const char *name);
+EAPI void ecore_x_netwm_name_get_prefetch(
+ Ecore_X_Window window);
+EAPI void ecore_x_netwm_name_get_fetch(void);
+EAPI int ecore_x_netwm_name_get(Ecore_X_Window win,
+ char **name);
+EAPI void ecore_x_netwm_startup_id_set(
+ Ecore_X_Window win,
+ const char *id);
+EAPI void ecore_x_netwm_startup_id_get_prefetch(
+ Ecore_X_Window window);
+EAPI void ecore_x_netwm_startup_id_get_fetch(void);
+EAPI int ecore_x_netwm_startup_id_get(
+ Ecore_X_Window win,
+ char **id);
+EAPI void ecore_x_netwm_visible_name_set(
+ Ecore_X_Window win,
+ const char *name);
+EAPI void ecore_x_netwm_visible_name_get_prefetch(
+ Ecore_X_Window window);
+EAPI void ecore_x_netwm_visible_name_get_fetch(void);
+EAPI int ecore_x_netwm_visible_name_get(
+ Ecore_X_Window win,
+ char **name);
+EAPI void ecore_x_netwm_icon_name_set(
+ Ecore_X_Window win,
+ const char *name);
+EAPI void ecore_x_netwm_icon_name_get_prefetch(
+ Ecore_X_Window window);
+EAPI void ecore_x_netwm_icon_name_get_fetch(void);
+EAPI int ecore_x_netwm_icon_name_get(
+ Ecore_X_Window win,
+ char **name);
+EAPI void ecore_x_netwm_visible_icon_name_set(
+ Ecore_X_Window win,
+ const char *name);
+EAPI void
+ ecore_x_netwm_visible_icon_name_get_prefetch(Ecore_X_Window window);
+EAPI void ecore_x_netwm_visible_icon_name_get_fetch(
+ void);
+EAPI int ecore_x_netwm_visible_icon_name_get(
+ Ecore_X_Window win,
+ char **name);
+EAPI void ecore_x_netwm_desktop_set(
+ Ecore_X_Window win,
+ unsigned int desk);
+EAPI void ecore_x_netwm_desktop_get_prefetch(
+ Ecore_X_Window window);
+EAPI void ecore_x_netwm_desktop_get_fetch(void);
+EAPI int ecore_x_netwm_desktop_get(
+ Ecore_X_Window win,
+ unsigned int *desk);
+EAPI void ecore_x_netwm_strut_set(Ecore_X_Window win,
+ int left,
+ int right,
+ int top,
+ int bottom);
+EAPI void ecore_x_netwm_strut_get_prefetch(
+ Ecore_X_Window window);
+EAPI void ecore_x_netwm_strut_get_fetch(void);
+EAPI int ecore_x_netwm_strut_get(Ecore_X_Window win,
+ int *left,
+ int *right,
+ int *top,
+ int *bottom);
+EAPI void ecore_x_netwm_strut_partial_set(
+ Ecore_X_Window win,
+ int left,
+ int right,
+ int top,
+ int bottom,
+ int left_start_y,
+ int left_end_y,
+ int right_start_y,
+ int right_end_y,
+ int top_start_x,
+ int top_end_x,
+ int bottom_start_x,
+ int bottom_end_x);
+EAPI void ecore_x_netwm_strut_partial_get_prefetch(
+ Ecore_X_Window window);
+EAPI void ecore_x_netwm_strut_partial_get_fetch(void);
+EAPI int ecore_x_netwm_strut_partial_get(
+ Ecore_X_Window win,
+ int *left,
+ int *right,
+ int *top,
+ int *bottom,
+ int *left_start_y,
+ int *left_end_y,
+ int *right_start_y,
+ int *right_end_y,
+ int *top_start_x,
+ int *top_end_x,
+ int *bottom_start_x,
+ int *bottom_end_x);
+EAPI void ecore_x_netwm_icons_get_prefetch(
+ Ecore_X_Window window);
+EAPI void ecore_x_netwm_icons_get_fetch(void);
+EAPI int ecore_x_netwm_icons_get(Ecore_X_Window win,
+ Ecore_X_Icon **icon,
+ int *num);
+EAPI void ecore_x_netwm_icon_geometry_set(
+ Ecore_X_Window win,
+ int x,
+ int y,
+ int width,
+ int height);
+EAPI void ecore_x_netwm_icon_geometry_get_prefetch(
+ Ecore_X_Window window);
+EAPI void ecore_x_netwm_icon_geometry_get_fetch(void);
+EAPI int ecore_x_netwm_icon_geometry_get(
+ Ecore_X_Window win,
+ int *x,
+ int *y,
+ int *width,
+ int *height);
+EAPI void ecore_x_netwm_pid_set(Ecore_X_Window win,
+ int pid);
+EAPI void ecore_x_netwm_pid_get_prefetch(
+ Ecore_X_Window window);
+EAPI void ecore_x_netwm_pid_get_fetch(void);
+EAPI int ecore_x_netwm_pid_get(Ecore_X_Window win,
+ int *pid);
+EAPI void ecore_x_netwm_handled_icons_set(
+ Ecore_X_Window win);
+EAPI void ecore_x_netwm_handled_icons_get_prefetch(
+ Ecore_X_Window window);
+EAPI void ecore_x_netwm_handled_icons_get_fetch(void);
+EAPI int ecore_x_netwm_handled_icons_get(
+ Ecore_X_Window win);
+EAPI void ecore_x_netwm_user_time_set(
+ Ecore_X_Window win,
+ unsigned int time);
+EAPI void ecore_x_netwm_user_time_get_prefetch(
+ Ecore_X_Window window);
+EAPI void ecore_x_netwm_user_time_get_fetch(void);
+EAPI int ecore_x_netwm_user_time_get(
+ Ecore_X_Window win,
+ unsigned int *time);
+EAPI void ecore_x_netwm_window_state_set(
+ Ecore_X_Window win,
+ Ecore_X_Window_State *state,
+ unsigned int num);
+EAPI void ecore_x_netwm_window_state_get_prefetch(
+ Ecore_X_Window window);
+EAPI void ecore_x_netwm_window_state_get_fetch(void);
+EAPI int ecore_x_netwm_window_state_get(
+ Ecore_X_Window win,
+ Ecore_X_Window_State **state,
+ unsigned int *num);
+EAPI void ecore_x_netwm_window_type_set(
+ Ecore_X_Window win,
+ Ecore_X_Window_Type type);
+EAPI void ecore_x_netwm_window_type_get_prefetch(
+ Ecore_X_Window window);
+EAPI void ecore_x_netwm_window_type_get_fetch(void);
+EAPI int ecore_x_netwm_window_type_get(
+ Ecore_X_Window win,
+ Ecore_X_Window_Type *type);
+EAPI int ecore_x_netwm_window_types_get(
+ Ecore_X_Window win,
+ Ecore_X_Window_Type **types);
+EAPI int ecore_x_netwm_allowed_action_isset(
+ Ecore_X_Window win,
+ Ecore_X_Action action);
+EAPI void ecore_x_netwm_allowed_action_set(
+ Ecore_X_Window win,
+ Ecore_X_Action *action,
+ unsigned int num);
+EAPI void ecore_x_netwm_allowed_action_get_prefetch(
+ Ecore_X_Window window);
+EAPI void ecore_x_netwm_allowed_action_get_fetch(
+ void);
+EAPI int ecore_x_netwm_allowed_action_get(
+ Ecore_X_Window win,
+ Ecore_X_Action **action,
+ unsigned int *num);
+EAPI void ecore_x_netwm_opacity_set(
+ Ecore_X_Window win,
+ unsigned int opacity);
+EAPI void ecore_x_netwm_opacity_get_prefetch(
+ Ecore_X_Window window);
+EAPI void ecore_x_netwm_opacity_get_fetch(void);
+EAPI int ecore_x_netwm_opacity_get(
+ Ecore_X_Window win,
+ unsigned int *opacity);
+EAPI void ecore_x_netwm_frame_size_set(
+ Ecore_X_Window win,
+ int fl,
+ int fr,
+ int ft,
+ int fb);
+EAPI void ecore_x_netwm_frame_size_get_prefetch(
+ Ecore_X_Window window);
+EAPI void ecore_x_netwm_frame_size_get_fetch(void);
+EAPI int ecore_x_netwm_frame_size_get(
+ Ecore_X_Window win,
+ int *fl,
+ int *fr,
+ int *ft,
+ int *fb);
+EAPI void ecore_x_netwm_sync_counter_get_prefetch(
+ Ecore_X_Window window);
+EAPI void ecore_x_netwm_sync_counter_get_fetch(void);
+EAPI int ecore_x_netwm_sync_counter_get(
+ Ecore_X_Window win,
+ Ecore_X_Sync_Counter *counter);
+EAPI void ecore_x_netwm_ping_send(Ecore_X_Window win);
+EAPI void ecore_x_netwm_sync_request_send(
+ Ecore_X_Window win,
+ unsigned int serial);
+EAPI void ecore_x_netwm_state_request_send(
+ Ecore_X_Window win,
+ Ecore_X_Window root,
+ Ecore_X_Window_State s1,
+ Ecore_X_Window_State s2,
+ int set);
+EAPI void ecore_x_netwm_desktop_request_send(
+ Ecore_X_Window win,
+ Ecore_X_Window root,
+ unsigned int desktop);
+
+EAPI void ecore_x_e_init(void);
+EAPI void ecore_x_e_frame_size_set(
+ Ecore_X_Window win,
+ int fl,
+ int fr,
+ int ft,
+ int fb);
+EAPI void ecore_x_e_virtual_keyboard_set(
+ Ecore_X_Window win,
+ unsigned int is_keyboard);
+EAPI int ecore_x_e_virtual_keyboard_get(
+ Ecore_X_Window win);
+EAPI void ecore_x_e_virtual_keyboard_state_set(
+ Ecore_X_Window win,
+ Ecore_X_Virtual_Keyboard_State state);
+EAPI Ecore_X_Virtual_Keyboard_State ecore_x_e_virtual_keyboard_state_get(
+ Ecore_X_Window win);
+EAPI void ecore_x_e_virtual_keyboard_state_send(
+ Ecore_X_Window win,
+ Ecore_X_Virtual_Keyboard_State state);
/* Illume functions */
-EAPI void ecore_x_e_illume_zone_set(Ecore_X_Window win, Ecore_X_Window zone);
-EAPI Ecore_X_Window ecore_x_e_illume_zone_get(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_zone_list_set(Ecore_X_Window win, Ecore_X_Window *zones, unsigned int n_zones);
-EAPI void ecore_x_e_illume_conformant_set(Ecore_X_Window win, unsigned int is_conformant);
-EAPI int ecore_x_e_illume_conformant_get(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_mode_set(Ecore_X_Window win, Ecore_X_Illume_Mode mode);
-EAPI Ecore_X_Illume_Mode ecore_x_e_illume_mode_get(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_mode_send(Ecore_X_Window win, Ecore_X_Illume_Mode mode);
-EAPI void ecore_x_e_illume_focus_back_send(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_focus_forward_send(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_focus_home_send(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_close_send(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_home_new_send(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_home_del_send(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_drag_set(Ecore_X_Window win, unsigned int drag);
-EAPI int ecore_x_e_illume_drag_get(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_drag_locked_set(Ecore_X_Window win, unsigned int is_locked);
-EAPI int ecore_x_e_illume_drag_locked_get(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_drag_start_send(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_drag_end_send(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_indicator_geometry_set(Ecore_X_Window win, int x, int y, int w, int h);
-EAPI int ecore_x_e_illume_indicator_geometry_get(Ecore_X_Window win, int *x, int *y, int *w, int *h);
-EAPI void ecore_x_e_illume_softkey_geometry_set(Ecore_X_Window win, int x, int y, int w, int h);
-EAPI int ecore_x_e_illume_softkey_geometry_get(Ecore_X_Window win, int *x, int *y, int *w, int *h);
-EAPI void ecore_x_e_illume_keyboard_geometry_set(Ecore_X_Window win, int x, int y, int w, int h);
-EAPI int ecore_x_e_illume_keyboard_geometry_get(Ecore_X_Window win, int *x, int *y, int *w, int *h);
-EAPI void ecore_x_e_illume_quickpanel_set(Ecore_X_Window win, unsigned int is_quickpanel);
-EAPI int ecore_x_e_illume_quickpanel_get(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_quickpanel_state_set(Ecore_X_Window win, Ecore_X_Illume_Quickpanel_State state);
-EAPI Ecore_X_Illume_Quickpanel_State ecore_x_e_illume_quickpanel_state_get(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_quickpanel_state_send(Ecore_X_Window win, Ecore_X_Illume_Quickpanel_State state);
-EAPI void ecore_x_e_illume_quickpanel_state_toggle(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_quickpanel_priority_major_set(Ecore_X_Window win, unsigned int priority);
-EAPI int ecore_x_e_illume_quickpanel_priority_major_get(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_quickpanel_priority_minor_set(Ecore_X_Window win, unsigned int priority);
-EAPI int ecore_x_e_illume_quickpanel_priority_minor_get(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_quickpanel_zone_set(Ecore_X_Window win, unsigned int zone);
-EAPI int ecore_x_e_illume_quickpanel_zone_get(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_quickpanel_zone_request_send(Ecore_X_Window win);
-EAPI void ecore_x_e_illume_quickpanel_position_update_send(Ecore_X_Window win);
-
-EAPI void ecore_x_e_comp_sync_counter_set(Ecore_X_Window win, Ecore_X_Sync_Counter counter);
-EAPI Ecore_X_Sync_Counter ecore_x_e_comp_sync_counter_get(Ecore_X_Window win);
-EAPI void ecore_x_e_comp_sync_draw_done_send(Ecore_X_Window root, Ecore_X_Window win);
-EAPI void ecore_x_e_comp_sync_supported_set(Ecore_X_Window root, Eina_Bool enabled);
-EAPI Eina_Bool ecore_x_e_comp_sync_supported_get(Ecore_X_Window root);
-EAPI void ecore_x_e_comp_sync_begin_send(Ecore_X_Window win);
-EAPI void ecore_x_e_comp_sync_end_send(Ecore_X_Window win);
-EAPI void ecore_x_e_comp_sync_cancel_send(Ecore_X_Window win);
-
-EAPI void ecore_x_e_comp_flush_send(Ecore_X_Window win);
-EAPI void ecore_x_e_comp_dump_send(Ecore_X_Window win);
-
-EAPI Ecore_X_Sync_Alarm ecore_x_sync_alarm_new(Ecore_X_Sync_Counter counter);
-EAPI int ecore_x_sync_alarm_free(Ecore_X_Sync_Alarm alarm);
-EAPI int ecore_x_sync_counter_query(Ecore_X_Sync_Counter counter, unsigned int *val);
-EAPI Ecore_X_Sync_Counter ecore_x_sync_counter_new(int val);
-EAPI void ecore_x_sync_counter_free(Ecore_X_Sync_Counter counter);
-EAPI void ecore_x_sync_counter_inc(Ecore_X_Sync_Counter counter, int by);
-EAPI void ecore_x_sync_counter_val_wait(Ecore_X_Sync_Counter counter, int val);
-
-EAPI void ecore_x_xinerama_query_screens_prefetch(void);
-EAPI void ecore_x_xinerama_query_screens_fetch(void);
-EAPI int ecore_x_xinerama_screen_count_get(void);
-EAPI int ecore_x_xinerama_screen_geometry_get(int screen, int *x, int *y, int *w, int *h);
-
-EAPI int ecore_x_screensaver_event_available_get(void);
-EAPI void ecore_x_screensaver_idle_time_prefetch(void);
-EAPI void ecore_x_screensaver_idle_time_fetch(void);
-EAPI int ecore_x_screensaver_idle_time_get(void);
-EAPI void ecore_x_get_screensaver_prefetch(void);
-EAPI void ecore_x_get_screensaver_fetch(void);
-EAPI void ecore_x_screensaver_set(int timeout, int interval, int prefer_blanking, int allow_exposures);
-EAPI void ecore_x_screensaver_timeout_set(int timeout);
-EAPI int ecore_x_screensaver_timeout_get(void);
-EAPI void ecore_x_screensaver_blank_set(int timeout);
-EAPI int ecore_x_screensaver_blank_get(void);
-EAPI void ecore_x_screensaver_expose_set(int timeout);
-EAPI int ecore_x_screensaver_expose_get(void);
-EAPI void ecore_x_screensaver_interval_set(int timeout);
-EAPI int ecore_x_screensaver_interval_get(void);
-EAPI void ecore_x_screensaver_event_listen_set(int on);
+EAPI void ecore_x_e_illume_zone_set(
+ Ecore_X_Window win,
+ Ecore_X_Window zone);
+EAPI Ecore_X_Window ecore_x_e_illume_zone_get(
+ Ecore_X_Window win);
+EAPI void ecore_x_e_illume_zone_list_set(
+ Ecore_X_Window win,
+ Ecore_X_Window *zones,
+ unsigned int n_zones);
+EAPI void ecore_x_e_illume_conformant_set(
+ Ecore_X_Window win,
+ unsigned int is_conformant);
+EAPI int ecore_x_e_illume_conformant_get(
+ Ecore_X_Window win);
+EAPI void ecore_x_e_illume_mode_set(
+ Ecore_X_Window win,
+ Ecore_X_Illume_Mode mode);
+EAPI Ecore_X_Illume_Mode ecore_x_e_illume_mode_get(
+ Ecore_X_Window win);
+EAPI void ecore_x_e_illume_mode_send(
+ Ecore_X_Window win,
+ Ecore_X_Illume_Mode mode);
+EAPI void ecore_x_e_illume_focus_back_send(
+ Ecore_X_Window win);
+EAPI void ecore_x_e_illume_focus_forward_send(
+ Ecore_X_Window win);
+EAPI void ecore_x_e_illume_focus_home_send(
+ Ecore_X_Window win);
+EAPI void ecore_x_e_illume_close_send(
+ Ecore_X_Window win);
+EAPI void ecore_x_e_illume_home_new_send(
+ Ecore_X_Window win);
+EAPI void ecore_x_e_illume_home_del_send(
+ Ecore_X_Window win);
+EAPI void ecore_x_e_illume_drag_set(
+ Ecore_X_Window win,
+ unsigned int drag);
+EAPI int ecore_x_e_illume_drag_get(
+ Ecore_X_Window win);
+EAPI void ecore_x_e_illume_drag_locked_set(
+ Ecore_X_Window win,
+ unsigned int is_locked);
+EAPI int ecore_x_e_illume_drag_locked_get(
+ Ecore_X_Window win);
+EAPI void ecore_x_e_illume_drag_start_send(
+ Ecore_X_Window win);
+EAPI void ecore_x_e_illume_drag_end_send(
+ Ecore_X_Window win);
+EAPI void ecore_x_e_illume_indicator_geometry_set(
+ Ecore_X_Window win,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI int ecore_x_e_illume_indicator_geometry_get(
+ Ecore_X_Window win,
+ int *x,
+ int *y,
+ int *w,
+ int *h);
+EAPI void ecore_x_e_illume_softkey_geometry_set(
+ Ecore_X_Window win,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI int ecore_x_e_illume_softkey_geometry_get(
+ Ecore_X_Window win,
+ int *x,
+ int *y,
+ int *w,
+ int *h);
+EAPI void ecore_x_e_illume_keyboard_geometry_set(
+ Ecore_X_Window win,
+ int x,
+ int y,
+ int w,
+ int h);
+EAPI int ecore_x_e_illume_keyboard_geometry_get(
+ Ecore_X_Window win,
+ int *x,
+ int *y,
+ int *w,
+ int *h);
+EAPI void ecore_x_e_illume_quickpanel_set(
+ Ecore_X_Window win,
+ unsigned int is_quickpanel);
+EAPI int ecore_x_e_illume_quickpanel_get(
+ Ecore_X_Window win);
+EAPI void ecore_x_e_illume_quickpanel_state_set(
+ Ecore_X_Window win,
+ Ecore_X_Illume_Quickpanel_State state);
+EAPI Ecore_X_Illume_Quickpanel_State ecore_x_e_illume_quickpanel_state_get(
+ Ecore_X_Window win);
+EAPI void ecore_x_e_illume_quickpanel_state_send(
+ Ecore_X_Window win,
+ Ecore_X_Illume_Quickpanel_State state);
+EAPI void ecore_x_e_illume_quickpanel_state_toggle(
+ Ecore_X_Window win);
+EAPI void
+ ecore_x_e_illume_quickpanel_priority_major_set(
+ Ecore_X_Window win,
+ unsigned int priority);
+EAPI int
+ ecore_x_e_illume_quickpanel_priority_major_get(
+ Ecore_X_Window win);
+EAPI void
+ ecore_x_e_illume_quickpanel_priority_minor_set(
+ Ecore_X_Window win,
+ unsigned int priority);
+EAPI int
+ ecore_x_e_illume_quickpanel_priority_minor_get(
+ Ecore_X_Window win);
+EAPI void ecore_x_e_illume_quickpanel_zone_set(
+ Ecore_X_Window win,
+ unsigned int zone);
+EAPI int ecore_x_e_illume_quickpanel_zone_get(
+ Ecore_X_Window win);
+EAPI void
+ ecore_x_e_illume_quickpanel_zone_request_send(
+ Ecore_X_Window win);
+EAPI void
+ ecore_x_e_illume_quickpanel_position_update_send(
+ Ecore_X_Window win);
+
+EAPI void ecore_x_e_comp_sync_counter_set(
+ Ecore_X_Window win,
+ Ecore_X_Sync_Counter counter);
+EAPI Ecore_X_Sync_Counter ecore_x_e_comp_sync_counter_get(
+ Ecore_X_Window win);
+EAPI void ecore_x_e_comp_sync_draw_done_send(
+ Ecore_X_Window root,
+ Ecore_X_Window win);
+EAPI void ecore_x_e_comp_sync_supported_set(
+ Ecore_X_Window root,
+ Eina_Bool enabled);
+EAPI Eina_Bool ecore_x_e_comp_sync_supported_get(
+ Ecore_X_Window root);
+EAPI void ecore_x_e_comp_sync_begin_send(
+ Ecore_X_Window win);
+EAPI void ecore_x_e_comp_sync_end_send(
+ Ecore_X_Window win);
+EAPI void ecore_x_e_comp_sync_cancel_send(
+ Ecore_X_Window win);
+
+EAPI void ecore_x_e_comp_flush_send(
+ Ecore_X_Window win);
+EAPI void ecore_x_e_comp_dump_send(
+ Ecore_X_Window win);
+EAPI void ecore_x_e_comp_pixmap_set(
+ Ecore_X_Window win,
+ Ecore_X_Pixmap pixmap);
+EAPI Ecore_X_Pixmap ecore_x_e_comp_pixmap_get(
+ Ecore_X_Window win);
+
+EAPI Ecore_X_Sync_Alarm ecore_x_sync_alarm_new(
+ Ecore_X_Sync_Counter counter);
+EAPI int ecore_x_sync_alarm_free(
+ Ecore_X_Sync_Alarm alarm);
+EAPI int ecore_x_sync_counter_query(
+ Ecore_X_Sync_Counter counter,
+ unsigned int *val);
+EAPI Ecore_X_Sync_Counter ecore_x_sync_counter_new(int val);
+EAPI void ecore_x_sync_counter_free(
+ Ecore_X_Sync_Counter counter);
+EAPI void ecore_x_sync_counter_inc(
+ Ecore_X_Sync_Counter counter,
+ int by);
+EAPI void ecore_x_sync_counter_val_wait(
+ Ecore_X_Sync_Counter counter,
+ int val);
+
+EAPI void ecore_x_xinerama_query_screens_prefetch(
+ void);
+EAPI void ecore_x_xinerama_query_screens_fetch(void);
+EAPI int ecore_x_xinerama_screen_count_get(void);
+EAPI int ecore_x_xinerama_screen_geometry_get(
+ int screen,
+ int *x,
+ int *y,
+ int *w,
+ int *h);
+
+EAPI int ecore_x_screensaver_event_available_get(
+ void);
+EAPI void ecore_x_screensaver_idle_time_prefetch(
+ void);
+EAPI void ecore_x_screensaver_idle_time_fetch(void);
+EAPI int ecore_x_screensaver_idle_time_get(void);
+EAPI void ecore_x_get_screensaver_prefetch(void);
+EAPI void ecore_x_get_screensaver_fetch(void);
+EAPI void ecore_x_screensaver_set(int timeout,
+ int interval,
+ int prefer_blanking,
+ int allow_exposures);
+EAPI void ecore_x_screensaver_timeout_set(
+ int timeout);
+EAPI int ecore_x_screensaver_timeout_get(void);
+EAPI void ecore_x_screensaver_blank_set(int timeout);
+EAPI int ecore_x_screensaver_blank_get(void);
+EAPI void ecore_x_screensaver_expose_set(int timeout);
+EAPI int ecore_x_screensaver_expose_get(void);
+EAPI void ecore_x_screensaver_interval_set(
+ int timeout);
+EAPI int ecore_x_screensaver_interval_get(void);
+EAPI void ecore_x_screensaver_event_listen_set(
+ int on);
/* FIXME: these funcs need categorising */
typedef struct _Ecore_X_Window_Attributes
{
- Ecore_X_Window root;
- int x, y, w, h;
- int border;
- int depth;
- unsigned char visible : 1;
- unsigned char viewable : 1;
- unsigned char override : 1;
- unsigned char input_only : 1;
- unsigned char save_under : 1;
- struct {
+ Ecore_X_Window root;
+ int x, y, w, h;
+ int border;
+ int depth;
+ unsigned char visible : 1;
+ unsigned char viewable : 1;
+ unsigned char override : 1;
+ unsigned char input_only : 1;
+ unsigned char save_under : 1;
+ struct
+ {
Ecore_X_Event_Mask mine;
Ecore_X_Event_Mask all;
Ecore_X_Event_Mask no_propagate;
} event_mask;
- Ecore_X_Gravity window_gravity;
- Ecore_X_Gravity pixel_gravity;
- Ecore_X_Colormap colormap;
- Ecore_X_Visual visual;
+ Ecore_X_Gravity window_gravity;
+ Ecore_X_Gravity pixel_gravity;
+ Ecore_X_Colormap colormap;
+ Ecore_X_Visual visual;
/* FIXME: missing
* int map_installed;
* Screen *screen;
*/
} Ecore_X_Window_Attributes;
-
-EAPI void ecore_x_get_window_attributes_prefetch(Ecore_X_Window window);
-EAPI void ecore_x_get_window_attributes_fetch(void);
-EAPI int ecore_x_window_attributes_get(Ecore_X_Window win, Ecore_X_Window_Attributes *att_ret);
-EAPI void ecore_x_window_save_set_add(Ecore_X_Window win);
-EAPI void ecore_x_window_save_set_del(Ecore_X_Window win);
-EAPI Ecore_X_Window *ecore_x_window_children_get(Ecore_X_Window win, int *num);
-
-EAPI int ecore_x_pointer_control_set(int accel_num, int accel_denom, int threshold);
-EAPI void ecore_x_pointer_control_get_prefetch(void);
-EAPI void ecore_x_pointer_control_get_fetch(void);
-EAPI int ecore_x_pointer_control_get(int *accel_num, int *accel_denom, int *threshold);
-EAPI int ecore_x_pointer_mapping_set(unsigned char *map, int nmap);
-EAPI void ecore_x_pointer_mapping_get_prefetch(void);
-EAPI void ecore_x_pointer_mapping_get_fetch(void);
-EAPI int ecore_x_pointer_mapping_get(unsigned char *map, int nmap);
-EAPI int ecore_x_pointer_grab(Ecore_X_Window win);
-EAPI int ecore_x_pointer_confine_grab(Ecore_X_Window win);
-EAPI void ecore_x_pointer_ungrab(void);
-EAPI int ecore_x_pointer_warp(Ecore_X_Window win, int x, int y);
-EAPI int ecore_x_keyboard_grab(Ecore_X_Window win);
-EAPI void ecore_x_keyboard_ungrab(void);
-EAPI void ecore_x_grab(void);
-EAPI void ecore_x_ungrab(void);
-EAPI void ecore_x_passive_grab_replay_func_set(int (*func) (void *data, int event_type, void *event), void *data);
-EAPI void ecore_x_window_button_grab(Ecore_X_Window win, int button,
- Ecore_X_Event_Mask event_mask,
- int mod, int any_mod);
-EAPI void ecore_x_window_button_ungrab(Ecore_X_Window win, int button,
- int mod, int any_mod);
-EAPI void ecore_x_window_key_grab(Ecore_X_Window win, const char *key,
- int mod, int any_mod);
-EAPI void ecore_x_window_key_ungrab(Ecore_X_Window win, const char *key,
- int mod, int any_mod);
-
-EAPI void ecore_x_focus_reset(void);
-EAPI void ecore_x_events_allow_all(void);
-EAPI void ecore_x_pointer_last_xy_get(int *x, int *y);
-EAPI void ecore_x_pointer_xy_get_prefetch(Ecore_X_Window window);
-EAPI void ecore_x_pointer_xy_get_fetch(void);
-EAPI void ecore_x_pointer_xy_get(Ecore_X_Window win, int *x, int *y);
+
+EAPI void ecore_x_get_window_attributes_prefetch(
+ Ecore_X_Window window);
+EAPI void ecore_x_get_window_attributes_fetch(void);
+EAPI int ecore_x_window_attributes_get(
+ Ecore_X_Window win,
+ Ecore_X_Window_Attributes *
+ att_ret);
+EAPI void ecore_x_window_save_set_add(Ecore_X_Window win);
+EAPI void ecore_x_window_save_set_del(Ecore_X_Window win);
+EAPI Ecore_X_Window * ecore_x_window_children_get(Ecore_X_Window win, int *num);
+
+EAPI int ecore_x_pointer_control_set(int accel_num,
+ int accel_denom,
+ int threshold);
+EAPI void ecore_x_pointer_control_get_prefetch(void);
+EAPI void ecore_x_pointer_control_get_fetch(void);
+EAPI int ecore_x_pointer_control_get(int *accel_num,
+ int *accel_denom,
+ int *threshold);
+EAPI int ecore_x_pointer_mapping_set(unsigned char *map, int nmap);
+EAPI void ecore_x_pointer_mapping_get_prefetch(void);
+EAPI void ecore_x_pointer_mapping_get_fetch(void);
+EAPI int ecore_x_pointer_mapping_get(unsigned char *map, int nmap);
+EAPI int ecore_x_pointer_grab(Ecore_X_Window win);
+EAPI int ecore_x_pointer_confine_grab(Ecore_X_Window win);
+EAPI void ecore_x_pointer_ungrab(void);
+EAPI int ecore_x_pointer_warp(Ecore_X_Window win, int x, int y);
+EAPI int ecore_x_keyboard_grab(Ecore_X_Window win);
+EAPI void ecore_x_keyboard_ungrab(void);
+EAPI void ecore_x_grab(void);
+EAPI void ecore_x_ungrab(void);
+EAPI void ecore_x_passive_grab_replay_func_set(Eina_Bool (*func)(void *data,
+ int event_type,
+ void *event),
+ void *data);
+EAPI void ecore_x_window_button_grab(Ecore_X_Window win, int button,
+ Ecore_X_Event_Mask event_mask,
+ int mod, int any_mod);
+EAPI void ecore_x_window_button_ungrab(Ecore_X_Window win,
+ int button,
+ int mod,
+ int any_mod);
+EAPI void ecore_x_window_key_grab(Ecore_X_Window win,
+ const char *key,
+ int mod,
+ int any_mod);
+EAPI void ecore_x_window_key_ungrab(Ecore_X_Window win,
+ const char *key,
+ int mod,
+ int any_mod);
+
+EAPI void ecore_x_focus_reset(void);
+EAPI void ecore_x_events_allow_all(void);
+EAPI void ecore_x_pointer_last_xy_get(int *x, int *y);
+EAPI void ecore_x_pointer_xy_get_prefetch(Ecore_X_Window window);
+EAPI void ecore_x_pointer_xy_get_fetch(void);
+EAPI void ecore_x_pointer_xy_get(Ecore_X_Window win, int *x, int *y);
/* ecore_x_region.c */
-EAPI Ecore_X_XRegion *ecore_x_xregion_new();
-EAPI void ecore_x_xregion_free(Ecore_X_XRegion *region);
-EAPI int ecore_x_xregion_set(Ecore_X_XRegion *region, Ecore_X_GC gc);
-EAPI void ecore_x_xregion_translate(Ecore_X_XRegion *region, int x, int y);
-EAPI int ecore_x_xregion_intersect(Ecore_X_XRegion *dst, Ecore_X_XRegion *r1, Ecore_X_XRegion *r2);
-EAPI int ecore_x_xregion_union(Ecore_X_XRegion *dst, Ecore_X_XRegion *r1, Ecore_X_XRegion *r2);
-EAPI int ecore_x_xregion_union_rect(Ecore_X_XRegion *dst, Ecore_X_XRegion *src, Ecore_X_Rectangle *rect);
-EAPI int ecore_x_xregion_subtract(Ecore_X_XRegion *dst, Ecore_X_XRegion *r1, Ecore_X_XRegion *r2);
-EAPI int ecore_x_xregion_is_empty(Ecore_X_XRegion *region);
-EAPI int ecore_x_xregion_is_equal(Ecore_X_XRegion *r1, Ecore_X_XRegion *r2);
-EAPI int ecore_x_xregion_point_contain(Ecore_X_XRegion *region, int x, int y);
-EAPI int ecore_x_xregion_rect_contain(Ecore_X_XRegion *region, Ecore_X_Rectangle *rect);
+EAPI Ecore_X_XRegion * ecore_x_xregion_new();
+EAPI void ecore_x_xregion_free(Ecore_X_XRegion *region);
+EAPI int ecore_x_xregion_set(Ecore_X_XRegion *region,
+ Ecore_X_GC gc);
+EAPI void ecore_x_xregion_translate(Ecore_X_XRegion *region,
+ int x,
+ int y);
+EAPI int ecore_x_xregion_intersect(Ecore_X_XRegion *dst,
+ Ecore_X_XRegion *r1,
+ Ecore_X_XRegion *r2);
+EAPI int ecore_x_xregion_union(Ecore_X_XRegion *dst,
+ Ecore_X_XRegion *r1,
+ Ecore_X_XRegion *r2);
+EAPI int ecore_x_xregion_union_rect(Ecore_X_XRegion *dst,
+ Ecore_X_XRegion *src,
+ Ecore_X_Rectangle *rect);
+EAPI int ecore_x_xregion_subtract(Ecore_X_XRegion *dst,
+ Ecore_X_XRegion *r1,
+ Ecore_X_XRegion *r2);
+EAPI int ecore_x_xregion_is_empty(Ecore_X_XRegion *region);
+EAPI int ecore_x_xregion_is_equal(Ecore_X_XRegion *r1,
+ Ecore_X_XRegion *r2);
+EAPI int ecore_x_xregion_point_contain(Ecore_X_XRegion *region,
+ int x,
+ int y);
+EAPI int ecore_x_xregion_rect_contain(Ecore_X_XRegion *region,
+ Ecore_X_Rectangle *rect);
/* ecore_x_randr.c */
-typedef struct _Ecore_X_Screen_Size Ecore_X_Screen_Size;
-struct _Ecore_X_Screen_Size
-{
- int width, height;
-};
-
-typedef struct _Ecore_X_Screen_Refresh_Rate Ecore_X_Screen_Refresh_Rate;
-struct _Ecore_X_Screen_Refresh_Rate
-{
- int rate;
-};
-EAPI int ecore_x_randr_query(void);
-EAPI int ecore_x_randr_events_select(Ecore_X_Window win, int on);
-EAPI void ecore_x_randr_get_screen_info_prefetch(Ecore_X_Window window);
-EAPI void ecore_x_randr_get_screen_info_fetch(void);
-EAPI Ecore_X_Randr_Rotation ecore_x_randr_screen_rotations_get(Ecore_X_Window root);
-EAPI Ecore_X_Randr_Rotation ecore_x_randr_screen_rotation_get(Ecore_X_Window root);
-EAPI void ecore_x_randr_screen_rotation_set(Ecore_X_Window root, Ecore_X_Randr_Rotation rot);
-EAPI Ecore_X_Screen_Size *ecore_x_randr_screen_sizes_get(Ecore_X_Window root, int *num);
-EAPI Ecore_X_Screen_Size ecore_x_randr_current_screen_size_get(Ecore_X_Window root);
-EAPI int ecore_x_randr_screen_size_set(Ecore_X_Window root, Ecore_X_Screen_Size size);
-
-EAPI Ecore_X_Screen_Refresh_Rate *ecore_x_randr_screen_refresh_rates_get(Ecore_X_Window root, int size_id, int *num);
-EAPI Ecore_X_Screen_Refresh_Rate ecore_x_randr_current_screen_refresh_rate_get(Ecore_X_Window root);
+/* The usage of 'Ecore_X_Randr_None' or 'Ecore_X_Randr_Unset'
+ * depends on the context. In most cases 'Ecore_X_Randr_Unset'
+ * can be used, but in some cases -1 is a special value to
+ * functions, thus 'Ecore_X_Randr_None' (=0) musst be used.
+ */
-EAPI int ecore_x_randr_screen_refresh_rate_set(Ecore_X_Window root, Ecore_X_Screen_Size size, Ecore_X_Screen_Refresh_Rate rate);
+typedef short Ecore_X_Randr_Refresh_Rate;
+typedef int Ecore_X_Randr_Crtc_Gamma;
+typedef int Ecore_X_Randr_Signal_Format;
+typedef int Ecore_X_Randr_Signal_Property;
+typedef int Ecore_X_Randr_Connector_Type;
+
+typedef struct _Ecore_X_Randr_Mode_Info
+{
+ Ecore_X_ID xid;
+ unsigned int width;
+ unsigned int height;
+ unsigned long dotClock;
+ unsigned int hSyncStart;
+ unsigned int hSyncEnd;
+ unsigned int hTotal;
+ unsigned int hSkew;
+ unsigned int vSyncStart;
+ unsigned int vSyncEnd;
+ unsigned int vTotal;
+ char *name;
+ unsigned int nameLength;
+ unsigned long modeFlags;
+} Ecore_X_Randr_Mode_Info;
+
+EAPI int ecore_x_randr_version_get(
+ void);
+EAPI Eina_Bool ecore_x_randr_query(void);
+
+/* ecore_x_randr_11.c */
+EAPI Ecore_X_Randr_Orientation
+ ecore_x_randr_screen_primary_output_orientations_get(
+ Ecore_X_Window root);
+EAPI Ecore_X_Randr_Orientation
+ ecore_x_randr_screen_primary_output_orientation_get(
+ Ecore_X_Window root);
+EAPI Eina_Bool
+ ecore_x_randr_screen_primary_output_orientation_set(
+ Ecore_X_Window root,
+ Ecore_X_Randr_Orientation
+ orientation);
+EAPI Ecore_X_Randr_Screen_Size_MM *
+ ecore_x_randr_screen_primary_output_sizes_get(
+ Ecore_X_Window root,
+ int *num);
+EAPI void
+ ecore_x_randr_screen_primary_output_current_size_get(
+ Ecore_X_Window root,
+ int *w,
+ int *h,
+ int *w_mm,
+ int *h_mm,
+ int *size_index);
+EAPI Eina_Bool
+ecore_x_randr_screen_primary_output_size_set(Ecore_X_Window root,
+ int size_index);
+EAPI Ecore_X_Randr_Refresh_Rate
+ecore_x_randr_screen_primary_output_current_refresh_rate_get(
+ Ecore_X_Window root);
+EAPI Ecore_X_Randr_Refresh_Rate *
+ecore_x_randr_screen_primary_output_refresh_rates_get(Ecore_X_Window root,
+ int size_index,
+ int *num);
+EAPI Eina_Bool
+ecore_x_randr_screen_primary_output_refresh_rate_set(
+ Ecore_X_Window root,
+ int size_index,
+ Ecore_X_Randr_Refresh_Rate
+ rate);
+
+/* ecore_x_randr_12.c */
+EAPI void
+ecore_x_randr_events_select(Ecore_X_Window win,
+ Eina_Bool on);
+
+EAPI void
+ecore_x_randr_screen_current_size_get(Ecore_X_Window root,
+ int *w,
+ int *h,
+ int *w_mm,
+ int *h_mm);
+EAPI void
+ ecore_x_randr_screen_size_range_get(Ecore_X_Window root,
+ int *wmin,
+ int *hmin,
+ int *wmax,
+ int *hmax);
+EAPI void ecore_x_randr_screen_reset(
+ Ecore_X_Window root);
+EAPI Eina_Bool
+ ecore_x_randr_screen_current_size_set(Ecore_X_Window root,
+ int w,
+ int h,
+ int w_mm,
+ int h_mm);
+EAPI Ecore_X_Randr_Mode_Info **
+ ecore_x_randr_modes_info_get(Ecore_X_Window root,
+ int *num);
+EAPI Ecore_X_Randr_Mode_Info *
+ ecore_x_randr_mode_info_get(Ecore_X_Window root,
+ Ecore_X_Randr_Mode mode);
+EAPI void
+ ecore_x_randr_mode_info_free(
+ Ecore_X_Randr_Mode_Info *mode_info);
+EAPI Ecore_X_Randr_Crtc * ecore_x_randr_crtcs_get(
+ Ecore_X_Window root,
+ int *num);
+EAPI Ecore_X_Randr_Output *ecore_x_randr_outputs_get(
+ Ecore_X_Window root,
+ int *num);
+EAPI Ecore_X_Randr_Output *
+ ecore_x_randr_current_output_get(
+ Ecore_X_Window window,
+ int *num);
+EAPI Ecore_X_Randr_Crtc *
+ ecore_x_randr_current_crtc_get(Ecore_X_Window window,
+ int *num);
+EAPI Ecore_X_Randr_Output *
+ ecore_x_randr_crtc_outputs_get(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc,
+ int *num);
+EAPI Ecore_X_Randr_Output *
+ ecore_x_randr_crtc_possible_outputs_get(
+ Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc,
+ int *num);
+EAPI void
+ ecore_x_randr_crtc_geometry_get(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc,
+ int *x,
+ int *y,
+ int *w,
+ int *h);
+EAPI void
+ecore_x_randr_crtc_pos_get(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc,
+ int *x,
+ int *y);
+EAPI Eina_Bool
+ecore_x_randr_crtc_pos_set(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc,
+ int x,
+ int y);
+EAPI Ecore_X_Randr_Mode
+ecore_x_randr_crtc_mode_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc);
+EAPI Eina_Bool
+ecore_x_randr_crtc_mode_set(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc,
+ Ecore_X_Randr_Output *outputs,
+ int noutputs,
+ Ecore_X_Randr_Mode mode);
+EAPI void
+ecore_x_randr_crtc_size_get(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc,
+ int *w,
+ int *h);
+EAPI Ecore_X_Randr_Refresh_Rate
+ecore_x_randr_crtc_refresh_rate_get(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc,
+ Ecore_X_Randr_Mode mode);
+EAPI Ecore_X_Randr_Orientation
+ecore_x_randr_crtc_orientations_get(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc);
+EAPI Ecore_X_Randr_Orientation
+ecore_x_randr_crtc_orientation_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc);
+EAPI Eina_Bool
+ecore_x_randr_crtc_orientation_set(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc,
+ const Ecore_X_Randr_Orientation orientation);
+EAPI Eina_Bool
+ecore_x_randr_crtc_clone_set(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc original,
+ Ecore_X_Randr_Crtc clone);
+EAPI Eina_Bool
+ecore_x_randr_crtc_settings_set(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc,
+ Ecore_X_Randr_Output *outputs,
+ int noutputs,
+ int x,
+ int y,
+ Ecore_X_Randr_Mode mode,
+ Ecore_X_Randr_Orientation orientation);
+EAPI Eina_Bool
+ecore_x_randr_crtc_pos_relative_set(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc_r1,
+ Ecore_X_Randr_Crtc crtc_r2,
+ Ecore_X_Randr_Output_Policy policy,
+ Ecore_X_Randr_Relative_Alignment alignment);
+EAPI Ecore_X_Randr_Mode *
+ ecore_x_randr_output_modes_get(Ecore_X_Window root,
+ Ecore_X_Randr_Output output,
+ int *num,
+ int *npreferred);
+EAPI Ecore_X_Randr_Output * ecore_x_randr_output_clones_get(Ecore_X_Window root, Ecore_X_Randr_Output output, int *num);
+EAPI Ecore_X_Randr_Crtc * ecore_x_randr_output_possible_crtcs_get(Ecore_X_Window root, Ecore_X_Randr_Output output, int *num);
+EAPI Ecore_X_Randr_Crtc
+ ecore_x_randr_output_crtc_get(Ecore_X_Window root,
+ Ecore_X_Randr_Output output);
+EAPI char *
+ ecore_x_randr_output_name_get(Ecore_X_Window root,
+ Ecore_X_Randr_Output output,
+ int *len);
+EAPI int
+ ecore_x_randr_crtc_gamma_ramp_size_get(
+ Ecore_X_Randr_Crtc crtc);
+EAPI Ecore_X_Randr_Crtc_Gamma **
+ ecore_x_randr_crtc_gamma_ramps_get(Ecore_X_Randr_Crtc crtc);
+EAPI Eina_Bool
+ ecore_x_randr_crtc_gamma_ramps_set(Ecore_X_Randr_Crtc crtc,
+ const Ecore_X_Randr_Crtc_Gamma *red,
+ const Ecore_X_Randr_Crtc_Gamma *green,
+ const Ecore_X_Randr_Crtc_Gamma *blue);
+EAPI Eina_Bool
+ ecore_x_randr_move_all_crtcs_but(Ecore_X_Window root,
+ const Ecore_X_Randr_Crtc *not_moved,
+ int nnot_moved,
+ int dx,
+ int dy);
+EAPI Eina_Bool ecore_x_randr_move_crtcs(
+ Ecore_X_Window root,
+ const Ecore_X_Randr_Crtc *crtcs,
+ int ncrtc,
+ int dx,
+ int dy);
+EAPI void
+ecore_x_randr_mode_size_get(Ecore_X_Window root,
+ Ecore_X_Randr_Mode mode,
+ int *w,
+ int *h);
+EAPI Ecore_X_Randr_Connection_Status
+ecore_x_randr_output_connection_status_get(Ecore_X_Window root,
+ Ecore_X_Randr_Output output);
+EAPI void
+ecore_x_randr_output_size_mm_get(Ecore_X_Window root,
+ Ecore_X_Randr_Output output,
+ int *w,
+ int *h);
+EAPI Eina_Bool
+ecore_x_randr_output_crtc_set(Ecore_X_Window root,
+ Ecore_X_Randr_Output output,
+ const Ecore_X_Randr_Crtc crtc);
+
+/* ecore_x_randr_13.c */
+EAPI void
+ecore_x_randr_screen_backlight_level_set(Ecore_X_Window root, double level);
+EAPI double
+ecore_x_randr_output_backlight_level_get(Ecore_X_Window root,
+ Ecore_X_Randr_Output output);
+EAPI Eina_Bool
+ecore_x_randr_output_backlight_level_set(Ecore_X_Window root,
+ Ecore_X_Randr_Output output,
+ double level);
+EAPI Ecore_X_Randr_Output
+ecore_x_randr_primary_output_get(Ecore_X_Window root);
+EAPI void
+ecore_x_randr_primary_output_set(Ecore_X_Window root,
+ Ecore_X_Randr_Output output);
+EAPI Ecore_X_Render_Subpixel_Order
+ecore_x_randr_output_subpixel_order_get(Ecore_X_Window root,
+ Ecore_X_Randr_Output output);
+EAPI unsigned char *
+ecore_x_randr_output_edid_get(Ecore_X_Window root,
+ Ecore_X_Randr_Output output,
+ unsigned long *length);
+EAPI Ecore_X_Randr_Output *
+ecore_x_randr_output_wired_clones_get(Ecore_X_Window root,
+ Ecore_X_Randr_Output output,
+ int *num);
+EAPI Ecore_X_Randr_Output **
+ecore_x_randr_output_compatibility_list_get(Ecore_X_Window root,
+ Ecore_X_Randr_Output output,
+ int *num);
+EAPI Ecore_X_Randr_Signal_Format *
+ecore_x_randr_output_signal_formats_get(Ecore_X_Window root,
+ Ecore_X_Randr_Output output,
+ int *num);
+EAPI Eina_Bool
+ecore_x_randr_output_signal_format_set(Ecore_X_Window root,
+ Ecore_X_Randr_Output output,
+ Ecore_X_Randr_Signal_Format *signal);
+EAPI Ecore_X_Randr_Signal_Property *
+ecore_x_randr_output_signal_properties_get(Ecore_X_Window root,
+ Ecore_X_Randr_Output output,
+ int *num);
+EAPI int
+ecore_x_randr_output_connector_number_get(Ecore_X_Window root,
+ Ecore_X_Randr_Output output);
+EAPI Ecore_X_Randr_Connector_Type
+ecore_x_randr_output_connector_type_get(Ecore_X_Window root,
+ Ecore_X_Randr_Output output);
+EAPI Eina_Rectangle *
+ecore_x_randr_crtc_panning_area_get(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc,
+ int *x,
+ int *y,
+ int *w,
+ int *h);
+EAPI Eina_Bool
+ecore_x_randr_crtc_panning_area_set(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc,
+ int x,
+ const int y,
+ const int w,
+ const int h);
+EAPI Eina_Rectangle *
+ecore_x_randr_crtc_tracking_area_get(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc,
+ int *x,
+ int *y,
+ int *w,
+ int *h);
+EAPI Eina_Bool
+ecore_x_randr_crtc_tracking_area_set(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc,
+ int x,
+ const int y,
+ const int w,
+ const int h);
+EAPI Eina_Rectangle *
+ecore_x_randr_crtc_border_area_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc);
+EAPI Eina_Bool
+ecore_x_randr_crtc_border_area_set(Ecore_X_Window root,
+ Ecore_X_Randr_Crtc crtc,
+ int left,
+ const int top,
+ const int right,
+ const int bottom);
/* XRender Support (horrendously incomplete) */
-typedef Ecore_X_ID Ecore_X_Picture;
+typedef Ecore_X_ID Ecore_X_Picture;
/* XFixes Extension Support */
-typedef Ecore_X_ID Ecore_X_Region;
+typedef Ecore_X_ID Ecore_X_Region;
typedef enum _Ecore_X_Region_Type {
- ECORE_X_REGION_BOUNDING,
- ECORE_X_REGION_CLIP
+ ECORE_X_REGION_BOUNDING,
+ ECORE_X_REGION_CLIP
} Ecore_X_Region_Type;
-EAPI Ecore_X_Region ecore_x_region_new(Ecore_X_Rectangle *rects, int num);
-EAPI Ecore_X_Region ecore_x_region_new_from_bitmap(Ecore_X_Pixmap bitmap);
-EAPI Ecore_X_Region ecore_x_region_new_from_window(Ecore_X_Window win, Ecore_X_Region_Type type);
-EAPI Ecore_X_Region ecore_x_region_new_from_gc(Ecore_X_GC gc);
-EAPI Ecore_X_Region ecore_x_region_new_from_picture(Ecore_X_Picture picture);
-EAPI void ecore_x_region_free(Ecore_X_Region region);
-EAPI void ecore_x_region_set(Ecore_X_Region region, Ecore_X_Rectangle *rects, int num);
-EAPI void ecore_x_region_copy(Ecore_X_Region dest, Ecore_X_Region source);
-EAPI void ecore_x_region_combine(Ecore_X_Region dest, Ecore_X_Region source1, Ecore_X_Region source2);
-EAPI void ecore_x_region_intersect(Ecore_X_Region dest, Ecore_X_Region source1, Ecore_X_Region source2);
-EAPI void ecore_x_region_subtract(Ecore_X_Region dest, Ecore_X_Region source1, Ecore_X_Region source2);
-EAPI void ecore_x_region_invert(Ecore_X_Region dest, Ecore_X_Rectangle *bounds, Ecore_X_Region source);
-EAPI void ecore_x_region_translate(Ecore_X_Region region, int dx, int dy);
-EAPI void ecore_x_region_extents(Ecore_X_Region dest, Ecore_X_Region source);
-EAPI void ecore_x_region_fetch_prefetch(Ecore_X_Region region);
-EAPI void ecore_x_region_fetch_fetch(void);
-EAPI Ecore_X_Rectangle *ecore_x_region_fetch(Ecore_X_Region region, int *num, Ecore_X_Rectangle *bounds);
-EAPI void ecore_x_region_expand(Ecore_X_Region dest, Ecore_X_Region source, unsigned int left, unsigned int right, unsigned int top, unsigned int bottom);
-EAPI void ecore_x_region_gc_clip_set(Ecore_X_Region region, Ecore_X_GC gc, int x_origin, int y_origin);
-EAPI void ecore_x_region_window_shape_set(Ecore_X_Region region, Ecore_X_Window win, Ecore_X_Shape_Type type, int x_offset, int y_offset);
-EAPI void ecore_x_region_picture_clip_set(Ecore_X_Region region, Ecore_X_Picture picture, int x_origin, int y_origin);
+EAPI Ecore_X_Region ecore_x_region_new(Ecore_X_Rectangle *rects, int num);
+EAPI Ecore_X_Region ecore_x_region_new_from_bitmap(Ecore_X_Pixmap bitmap);
+EAPI Ecore_X_Region ecore_x_region_new_from_window(Ecore_X_Window win,
+ Ecore_X_Region_Type type);
+EAPI Ecore_X_Region ecore_x_region_new_from_gc(Ecore_X_GC gc);
+EAPI Ecore_X_Region ecore_x_region_new_from_picture(Ecore_X_Picture picture);
+EAPI void ecore_x_region_free(Ecore_X_Region region);
+EAPI void ecore_x_region_set(Ecore_X_Region region,
+ Ecore_X_Rectangle *rects,
+ int num);
+EAPI void ecore_x_region_copy(Ecore_X_Region dest,
+ Ecore_X_Region source);
+EAPI void ecore_x_region_combine(Ecore_X_Region dest,
+ Ecore_X_Region source1,
+ Ecore_X_Region source2);
+EAPI void ecore_x_region_intersect(Ecore_X_Region dest,
+ Ecore_X_Region source1,
+ Ecore_X_Region source2);
+EAPI void ecore_x_region_subtract(Ecore_X_Region dest,
+ Ecore_X_Region source1,
+ Ecore_X_Region source2);
+EAPI void ecore_x_region_invert(Ecore_X_Region dest,
+ Ecore_X_Rectangle *bounds,
+ Ecore_X_Region source);
+EAPI void ecore_x_region_translate(Ecore_X_Region region,
+ int dx,
+ int dy);
+EAPI void ecore_x_region_extents(Ecore_X_Region dest,
+ Ecore_X_Region source);
+EAPI void ecore_x_region_fetch_prefetch(Ecore_X_Region region);
+EAPI void ecore_x_region_fetch_fetch(void);
+EAPI Ecore_X_Rectangle * ecore_x_region_fetch(Ecore_X_Region region,
+ int *num,
+ Ecore_X_Rectangle *bounds);
+EAPI void ecore_x_region_expand(Ecore_X_Region dest,
+ Ecore_X_Region source,
+ unsigned int left,
+ unsigned int right,
+ unsigned int top,
+ unsigned int bottom);
+EAPI void ecore_x_region_gc_clip_set(Ecore_X_Region region,
+ Ecore_X_GC gc,
+ int x_origin,
+ int y_origin);
+EAPI void ecore_x_region_window_shape_set(Ecore_X_Region region,
+ Ecore_X_Window win,
+ Ecore_X_Shape_Type type,
+ int x_offset,
+ int y_offset);
+EAPI void ecore_x_region_picture_clip_set(Ecore_X_Region region,
+ Ecore_X_Picture picture,
+ int x_origin,
+ int y_origin);
/* XComposite Extension Support */
-EAPI int ecore_x_composite_query(void);
-EAPI void ecore_x_composite_redirect_window(Ecore_X_Window win, Ecore_X_Composite_Update_Type type);
-EAPI void ecore_x_composite_redirect_subwindows(Ecore_X_Window win, Ecore_X_Composite_Update_Type type);
-EAPI void ecore_x_composite_unredirect_window(Ecore_X_Window win, Ecore_X_Composite_Update_Type type);
-EAPI void ecore_x_composite_unredirect_subwindows(Ecore_X_Window win, Ecore_X_Composite_Update_Type type);
-EAPI Ecore_X_Pixmap ecore_x_composite_name_window_pixmap_get(Ecore_X_Window win);
-EAPI Ecore_X_Window ecore_x_composite_render_window_enable(Ecore_X_Window root);
-EAPI void ecore_x_composite_render_window_disable(Ecore_X_Window root);
-
+EAPI int ecore_x_composite_query(void);
+EAPI void ecore_x_composite_redirect_window(Ecore_X_Window win,
+ Ecore_X_Composite_Update_Type type);
+EAPI void ecore_x_composite_redirect_subwindows(Ecore_X_Window win,
+ Ecore_X_Composite_Update_Type type);
+EAPI void ecore_x_composite_unredirect_window(Ecore_X_Window win,
+ Ecore_X_Composite_Update_Type type);
+EAPI void ecore_x_composite_unredirect_subwindows(Ecore_X_Window win,
+ Ecore_X_Composite_Update_Type type);
+EAPI Ecore_X_Pixmap ecore_x_composite_name_window_pixmap_get(Ecore_X_Window win);
+EAPI void ecore_x_composite_window_events_disable(Ecore_X_Window win);
+EAPI void ecore_x_composite_window_events_enable(Ecore_X_Window win);
+EAPI Ecore_X_Window ecore_x_composite_render_window_enable(Ecore_X_Window root);
+EAPI void ecore_x_composite_render_window_disable(Ecore_X_Window root);
+
/* XDamage Extension Support */
-typedef Ecore_X_ID Ecore_X_Damage;
+typedef Ecore_X_ID Ecore_X_Damage;
typedef enum _Ecore_X_Damage_Report_Level {
- ECORE_X_DAMAGE_REPORT_RAW_RECTANGLES,
- ECORE_X_DAMAGE_REPORT_DELTA_RECTANGLES,
- ECORE_X_DAMAGE_REPORT_BOUNDING_BOX,
- ECORE_X_DAMAGE_REPORT_NON_EMPTY
+ ECORE_X_DAMAGE_REPORT_RAW_RECTANGLES,
+ ECORE_X_DAMAGE_REPORT_DELTA_RECTANGLES,
+ ECORE_X_DAMAGE_REPORT_BOUNDING_BOX,
+ ECORE_X_DAMAGE_REPORT_NON_EMPTY
} Ecore_X_Damage_Report_Level;
-struct _Ecore_X_Event_Damage {
- Ecore_X_Damage_Report_Level level;
- Ecore_X_Drawable drawable;
- Ecore_X_Damage damage;
- int more;
- Ecore_X_Time time;
- Ecore_X_Rectangle area;
- Ecore_X_Rectangle geometry;
+struct _Ecore_X_Event_Damage
+{
+ Ecore_X_Damage_Report_Level level;
+ Ecore_X_Drawable drawable;
+ Ecore_X_Damage damage;
+ int more;
+ Ecore_X_Time time;
+ Ecore_X_Rectangle area;
+ Ecore_X_Rectangle geometry;
};
-typedef struct _Ecore_X_Event_Damage Ecore_X_Event_Damage;
-
-EAPI int ecore_x_damage_query(void);
-EAPI Ecore_X_Damage ecore_x_damage_new(Ecore_X_Drawable d, Ecore_X_Damage_Report_Level level);
-EAPI void ecore_x_damage_free(Ecore_X_Damage damage);
-EAPI void ecore_x_damage_subtract(Ecore_X_Damage damage, Ecore_X_Region repair, Ecore_X_Region parts);
-
-EAPI int ecore_x_screen_is_composited(int screen);
-EAPI void ecore_x_screen_is_composited_set(int screen, Ecore_X_Window win);
-
-EAPI int ecore_x_dpms_query(void);
-EAPI void ecore_x_dpms_capable_get_prefetch(void);
-EAPI void ecore_x_dpms_capable_get_fetch(void);
-EAPI int ecore_x_dpms_capable_get(void);
-EAPI void ecore_x_dpms_enable_get_prefetch(void);
-EAPI void ecore_x_dpms_enable_get_fetch(void);
-EAPI int ecore_x_dpms_enabled_get(void);
-EAPI void ecore_x_dpms_enabled_set(int enabled);
-EAPI void ecore_x_dpms_timeouts_get_prefetch(void);
-EAPI void ecore_x_dpms_timeouts_get_fetch(void);
-EAPI void ecore_x_dpms_timeouts_get(unsigned int *standby, unsigned int *suspend, unsigned int *off);
-EAPI int ecore_x_dpms_timeouts_set(unsigned int standby, unsigned int suspend, unsigned int off);
-EAPI unsigned int ecore_x_dpms_timeout_standby_get(void);
-EAPI unsigned int ecore_x_dpms_timeout_suspend_get(void);
-EAPI unsigned int ecore_x_dpms_timeout_off_get(void);
-EAPI void ecore_x_dpms_timeout_standby_set(unsigned int new_timeout);
-EAPI void ecore_x_dpms_timeout_suspend_set(unsigned int new_timeout);
-EAPI void ecore_x_dpms_timeout_off_set(unsigned int new_timeout);
-
-EAPI int ecore_x_test_fake_key_down(const char *key);
-EAPI int ecore_x_test_fake_key_up(const char *key);
-EAPI int ecore_x_test_fake_key_press(const char *key);
-EAPI const char *ecore_x_keysym_string_get(int keysym);
-
-typedef struct _Ecore_X_Image Ecore_X_Image;
-
-EAPI Ecore_X_Image *ecore_x_image_new(int w, int h, Ecore_X_Visual vis, int depth);
-EAPI void ecore_x_image_free(Ecore_X_Image *im);
-EAPI Eina_Bool ecore_x_image_get(Ecore_X_Image *im, Ecore_X_Drawable draw, int x, int y, int sx, int sy, int w, int h);
-EAPI void ecore_x_image_put(Ecore_X_Image *im, Ecore_X_Drawable draw, int x, int y, int sx, int sy, int w, int h);
-EAPI void *ecore_x_image_data_get(Ecore_X_Image *im, int *bpl, int *rows, int *bpp);
-
-EAPI Eina_Bool ecore_x_input_multi_select(Ecore_X_Window win);
-
+typedef struct _Ecore_X_Event_Damage Ecore_X_Event_Damage;
+
+EAPI int ecore_x_damage_query(void);
+EAPI Ecore_X_Damage ecore_x_damage_new(Ecore_X_Drawable d,
+ Ecore_X_Damage_Report_Level level);
+EAPI void ecore_x_damage_free(Ecore_X_Damage damage);
+EAPI void ecore_x_damage_subtract(Ecore_X_Damage damage,
+ Ecore_X_Region repair,
+ Ecore_X_Region parts);
+
+EAPI int ecore_x_screen_is_composited(int screen);
+EAPI void ecore_x_screen_is_composited_set(int screen,
+ Ecore_X_Window win);
+
+EAPI int ecore_x_dpms_query(void);
+EAPI void ecore_x_dpms_capable_get_prefetch(void);
+EAPI void ecore_x_dpms_capable_get_fetch(void);
+EAPI int ecore_x_dpms_capable_get(void);
+EAPI void ecore_x_dpms_enable_get_prefetch(void);
+EAPI void ecore_x_dpms_enable_get_fetch(void);
+EAPI int ecore_x_dpms_enabled_get(void);
+EAPI void ecore_x_dpms_enabled_set(int enabled);
+EAPI void ecore_x_dpms_timeouts_get_prefetch(void);
+EAPI void ecore_x_dpms_timeouts_get_fetch(void);
+EAPI void ecore_x_dpms_timeouts_get(unsigned int *standby,
+ unsigned int *suspend,
+ unsigned int *off);
+EAPI int ecore_x_dpms_timeouts_set(unsigned int standby,
+ unsigned int suspend,
+ unsigned int off);
+EAPI unsigned int ecore_x_dpms_timeout_standby_get(void);
+EAPI unsigned int ecore_x_dpms_timeout_suspend_get(void);
+EAPI unsigned int ecore_x_dpms_timeout_off_get(void);
+EAPI void ecore_x_dpms_timeout_standby_set(unsigned int new_timeout);
+EAPI void ecore_x_dpms_timeout_suspend_set(unsigned int new_timeout);
+EAPI void ecore_x_dpms_timeout_off_set(unsigned int new_timeout);
+
+EAPI int ecore_x_test_fake_key_down(const char *key);
+EAPI int ecore_x_test_fake_key_up(const char *key);
+EAPI int ecore_x_test_fake_key_press(const char *key);
+EAPI const char * ecore_x_keysym_string_get(int keysym);
+
+typedef struct _Ecore_X_Image Ecore_X_Image;
+
+EAPI Ecore_X_Image * ecore_x_image_new(int w,
+ int h,
+ Ecore_X_Visual vis,
+ int depth);
+EAPI void ecore_x_image_free(Ecore_X_Image *im);
+EAPI Eina_Bool ecore_x_image_get(Ecore_X_Image *im,
+ Ecore_X_Drawable draw,
+ int x,
+ int y,
+ int sx,
+ int sy,
+ int w,
+ int h);
+EAPI void ecore_x_image_put(Ecore_X_Image *im,
+ Ecore_X_Drawable draw,
+ int x,
+ int y,
+ int sx,
+ int sy,
+ int w,
+ int h);
+EAPI void * ecore_x_image_data_get(Ecore_X_Image *im,
+ int *bpl,
+ int *rows,
+ int *bpp);
+
+EAPI Eina_Bool ecore_x_input_multi_select(Ecore_X_Window win);
+
#ifdef __cplusplus
}
-#endif
+#endif // ifdef __cplusplus
#include <Ecore_X_Atoms.h>
#include <Ecore_X_Cursor.h>
-#endif
+#endif // ifndef _ECORE_X_H
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
#ifndef _ECORE_X_ATOMS_H
#define _ECORE_X_ATOMS_H
EAPI extern Ecore_X_Atom ECORE_X_ATOM_TEXT;
EAPI extern Ecore_X_Atom ECORE_X_ATOM_UTF8_STRING;
EAPI extern Ecore_X_Atom ECORE_X_ATOM_WINDOW;
+EAPI extern Ecore_X_Atom ECORE_X_ATOM_PIXMAP;
/* dnd atoms */
EAPI extern Ecore_X_Atom ECORE_X_ATOM_SELECTION_XDND;
EAPI extern Ecore_X_Atom ECORE_X_DND_ACTION_LINK;
EAPI extern Ecore_X_Atom ECORE_X_DND_ACTION_ASK;
EAPI extern Ecore_X_Atom ECORE_X_DND_ACTION_PRIVATE;
-
+
/* old E atom */
EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_FRAME_SIZE;
/* currenly E specific virtual keyboard extension, aim to submit to netwm spec
* later */
-EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD;
-EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE;
-EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON;
-EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF;
-EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ALPHA;
-EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_NUMERIC;
-EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PIN;
-EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PHONE_NUMBER;
-EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HEX;
-EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_TERMINAL;
-EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PASSWORD;
-EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_IP;
-EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HOST;
-EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_FILE;
-EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_URL;
-EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_KEYPAD;
-EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_J2ME;
-
+EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD;
+EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE;
+EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON;
+EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF;
+EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ALPHA;
+EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_NUMERIC;
+EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PIN;
+EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PHONE_NUMBER;
+EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HEX;
+EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_TERMINAL;
+EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PASSWORD;
+EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_IP;
+EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HOST;
+EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_FILE;
+EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_URL;
+EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_KEYPAD;
+EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_J2ME;
/* Illume specific atoms */
EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ZONE;
EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE;
EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE;
-
EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_COUNTER;
EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE;
EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED;
EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_CANCEL;
EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_COMP_FLUSH;
EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_COMP_DUMP;
+EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_COMP_PIXMAP;
#endif /* _ECORE_X_ATOMS_H */
* @brief Defines the various cursor types for the X Windows system.
*/
-#define ECORE_X_CURSOR_X 0
-#define ECORE_X_CURSOR_ARROW 2
-#define ECORE_X_CURSOR_BASED_ARROW_DOWN 4
-#define ECORE_X_CURSOR_UP 6
-#define ECORE_X_CURSOR_BOAT 8
-#define ECORE_X_CURSOR_BOTTOM_LEFT_CORNER 12
+#define ECORE_X_CURSOR_X 0
+#define ECORE_X_CURSOR_ARROW 2
+#define ECORE_X_CURSOR_BASED_ARROW_DOWN 4
+#define ECORE_X_CURSOR_UP 6
+#define ECORE_X_CURSOR_BOAT 8
+#define ECORE_X_CURSOR_BOTTOM_LEFT_CORNER 12
#define ECORE_X_CURSOR_BOTTOM_RIGHT_CORNER 14
-#define ECORE_X_CURSOR_BOTTOM_SIDE 16
-#define ECORE_X_CURSOR_BOTTOM_TEE 18
-#define ECORE_X_CURSOR_BOX_SPIRAL 20
-#define ECORE_X_CURSOR_CENTER_PTR 22
-#define ECORE_X_CURSOR_CIRCLE 24
-#define ECORE_X_CURSOR_CLOCK 26
-#define ECORE_X_CURSOR_COFFEE_MUG 28
-#define ECORE_X_CURSOR_CROSS 30
-#define ECORE_X_CURSOR_CROSS_REVERSE 32
-#define ECORE_X_CURSOR_CROSSHAIR 34
-#define ECORE_X_CURSOR_DIAMOND_CROSS 36
-#define ECORE_X_CURSOR_DOT 38
-#define ECORE_X_CURSOR_DOT_BOX_MASK 40
-#define ECORE_X_CURSOR_DOUBLE_ARROW 42
-#define ECORE_X_CURSOR_DRAFT_LARGE 44
-#define ECORE_X_CURSOR_DRAFT_SMALL 46
-#define ECORE_X_CURSOR_DRAPED_BOX 48
-#define ECORE_X_CURSOR_EXCHANGE 50
-#define ECORE_X_CURSOR_FLEUR 52
-#define ECORE_X_CURSOR_GOBBLER 54
-#define ECORE_X_CURSOR_GUMBY 56
-#define ECORE_X_CURSOR_HAND1 58
-#define ECORE_X_CURSOR_HAND2 60
-#define ECORE_X_CURSOR_HEART 62
-#define ECORE_X_CURSOR_ICON 64
-#define ECORE_X_CURSOR_IRON_CROSS 66
-#define ECORE_X_CURSOR_LEFT_PTR 68
-#define ECORE_X_CURSOR_LEFT_SIDE 70
-#define ECORE_X_CURSOR_LEFT_TEE 72
-#define ECORE_X_CURSOR_LEFTBUTTON 74
-#define ECORE_X_CURSOR_LL_ANGLE 76
-#define ECORE_X_CURSOR_LR_ANGLE 78
-#define ECORE_X_CURSOR_MAN 80
-#define ECORE_X_CURSOR_MIDDLEBUTTON 82
-#define ECORE_X_CURSOR_MOUSE 84
-#define ECORE_X_CURSOR_PENCIL 86
-#define ECORE_X_CURSOR_PIRATE 88
-#define ECORE_X_CURSOR_PLUS 90
-#define ECORE_X_CURSOR_QUESTION_ARROW 92
-#define ECORE_X_CURSOR_RIGHT_PTR 94
-#define ECORE_X_CURSOR_RIGHT_SIDE 96
-#define ECORE_X_CURSOR_RIGHT_TEE 98
-#define ECORE_X_CURSOR_RIGHTBUTTON 100
-#define ECORE_X_CURSOR_RTL_LOGO 102
-#define ECORE_X_CURSOR_SAILBOAT 104
-#define ECORE_X_CURSOR_SB_DOWN_ARROW 106
-#define ECORE_X_CURSOR_SB_H_DOUBLE_ARROW 108
-#define ECORE_X_CURSOR_SB_LEFT_ARROW 110
-#define ECORE_X_CURSOR_SB_RIGHT_ARROW 112
-#define ECORE_X_CURSOR_SB_UP_ARROW 114
-#define ECORE_X_CURSOR_SB_V_DOUBLE_ARROW 116
-#define ECORE_X_CURSOR_SHUTTLE 118
-#define ECORE_X_CURSOR_SIZING 120
-#define ECORE_X_CURSOR_SPIDER 122
-#define ECORE_X_CURSOR_SPRAYCAN 124
-#define ECORE_X_CURSOR_STAR 126
-#define ECORE_X_CURSOR_TARGET 128
-#define ECORE_X_CURSOR_TCROSS 130
-#define ECORE_X_CURSOR_TOP_LEFT_ARROW 132
-#define ECORE_X_CURSOR_TOP_LEFT_CORNER 134
-#define ECORE_X_CURSOR_TOP_RIGHT_CORNER 136
-#define ECORE_X_CURSOR_TOP_SIDE 138
-#define ECORE_X_CURSOR_TOP_TEE 140
-#define ECORE_X_CURSOR_TREK 142
-#define ECORE_X_CURSOR_UL_ANGLE 144
-#define ECORE_X_CURSOR_UMBRELLA 146
-#define ECORE_X_CURSOR_UR_ANGLE 148
-#define ECORE_X_CURSOR_WATCH 150
-#define ECORE_X_CURSOR_XTERM 152
+#define ECORE_X_CURSOR_BOTTOM_SIDE 16
+#define ECORE_X_CURSOR_BOTTOM_TEE 18
+#define ECORE_X_CURSOR_BOX_SPIRAL 20
+#define ECORE_X_CURSOR_CENTER_PTR 22
+#define ECORE_X_CURSOR_CIRCLE 24
+#define ECORE_X_CURSOR_CLOCK 26
+#define ECORE_X_CURSOR_COFFEE_MUG 28
+#define ECORE_X_CURSOR_CROSS 30
+#define ECORE_X_CURSOR_CROSS_REVERSE 32
+#define ECORE_X_CURSOR_CROSSHAIR 34
+#define ECORE_X_CURSOR_DIAMOND_CROSS 36
+#define ECORE_X_CURSOR_DOT 38
+#define ECORE_X_CURSOR_DOT_BOX_MASK 40
+#define ECORE_X_CURSOR_DOUBLE_ARROW 42
+#define ECORE_X_CURSOR_DRAFT_LARGE 44
+#define ECORE_X_CURSOR_DRAFT_SMALL 46
+#define ECORE_X_CURSOR_DRAPED_BOX 48
+#define ECORE_X_CURSOR_EXCHANGE 50
+#define ECORE_X_CURSOR_FLEUR 52
+#define ECORE_X_CURSOR_GOBBLER 54
+#define ECORE_X_CURSOR_GUMBY 56
+#define ECORE_X_CURSOR_HAND1 58
+#define ECORE_X_CURSOR_HAND2 60
+#define ECORE_X_CURSOR_HEART 62
+#define ECORE_X_CURSOR_ICON 64
+#define ECORE_X_CURSOR_IRON_CROSS 66
+#define ECORE_X_CURSOR_LEFT_PTR 68
+#define ECORE_X_CURSOR_LEFT_SIDE 70
+#define ECORE_X_CURSOR_LEFT_TEE 72
+#define ECORE_X_CURSOR_LEFTBUTTON 74
+#define ECORE_X_CURSOR_LL_ANGLE 76
+#define ECORE_X_CURSOR_LR_ANGLE 78
+#define ECORE_X_CURSOR_MAN 80
+#define ECORE_X_CURSOR_MIDDLEBUTTON 82
+#define ECORE_X_CURSOR_MOUSE 84
+#define ECORE_X_CURSOR_PENCIL 86
+#define ECORE_X_CURSOR_PIRATE 88
+#define ECORE_X_CURSOR_PLUS 90
+#define ECORE_X_CURSOR_QUESTION_ARROW 92
+#define ECORE_X_CURSOR_RIGHT_PTR 94
+#define ECORE_X_CURSOR_RIGHT_SIDE 96
+#define ECORE_X_CURSOR_RIGHT_TEE 98
+#define ECORE_X_CURSOR_RIGHTBUTTON 100
+#define ECORE_X_CURSOR_RTL_LOGO 102
+#define ECORE_X_CURSOR_SAILBOAT 104
+#define ECORE_X_CURSOR_SB_DOWN_ARROW 106
+#define ECORE_X_CURSOR_SB_H_DOUBLE_ARROW 108
+#define ECORE_X_CURSOR_SB_LEFT_ARROW 110
+#define ECORE_X_CURSOR_SB_RIGHT_ARROW 112
+#define ECORE_X_CURSOR_SB_UP_ARROW 114
+#define ECORE_X_CURSOR_SB_V_DOUBLE_ARROW 116
+#define ECORE_X_CURSOR_SHUTTLE 118
+#define ECORE_X_CURSOR_SIZING 120
+#define ECORE_X_CURSOR_SPIDER 122
+#define ECORE_X_CURSOR_SPRAYCAN 124
+#define ECORE_X_CURSOR_STAR 126
+#define ECORE_X_CURSOR_TARGET 128
+#define ECORE_X_CURSOR_TCROSS 130
+#define ECORE_X_CURSOR_TOP_LEFT_ARROW 132
+#define ECORE_X_CURSOR_TOP_LEFT_CORNER 134
+#define ECORE_X_CURSOR_TOP_RIGHT_CORNER 136
+#define ECORE_X_CURSOR_TOP_SIDE 138
+#define ECORE_X_CURSOR_TOP_TEE 140
+#define ECORE_X_CURSOR_TREK 142
+#define ECORE_X_CURSOR_UL_ANGLE 144
+#define ECORE_X_CURSOR_UMBRELLA 146
+#define ECORE_X_CURSOR_UR_ANGLE 148
+#define ECORE_X_CURSOR_WATCH 150
+#define ECORE_X_CURSOR_XTERM 152
-#endif
+#endif // ifndef _ECORE_X_CURSOR_H
libecore_x_la_LDFLAGS = -version-info @version_info@ @release_info@
libecore_x_la_DEPENDENCIES = $(DEP)
-include_HEADERS = \
+includes_HEADERS = \
Ecore_X.h \
Ecore_X_Atoms.h \
Ecore_X_Cursor.h
+includesdir = $(includedir)/ecore-@VMAJ@
endif
/* generic atoms */
-EAPI Ecore_X_Atom ECORE_X_ATOM_ATOM = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_CARDINAL = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_COMPOUND_TEXT = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_FILE_NAME = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_STRING = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_TEXT = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_UTF8_STRING = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_WINDOW = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_ATOM = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_CARDINAL = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_COMPOUND_TEXT = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_FILE_NAME = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_STRING = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_TEXT = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_UTF8_STRING = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_WINDOW = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_PIXMAP = 0;
/* dnd atoms */
-EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_XDND = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_XDND = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_AWARE = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ENTER = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_TYPE_LIST = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_POSITION = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_COPY = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_MOVE = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_PRIVATE = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_ASK = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_LIST = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_LINK = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_DESCRIPTION = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_PROXY = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_STATUS = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_LEAVE = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_DROP = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_FINISHED = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_XDND = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_XDND = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_AWARE = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ENTER = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_TYPE_LIST = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_POSITION = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_COPY = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_MOVE = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_PRIVATE = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_ASK = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_LIST = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_LINK = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_DESCRIPTION = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_PROXY = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_STATUS = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_LEAVE = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_DROP = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_FINISHED = 0;
/* dnd atoms that need to be exposed to the application interface */
-EAPI Ecore_X_Atom ECORE_X_DND_ACTION_COPY = 0;
-EAPI Ecore_X_Atom ECORE_X_DND_ACTION_MOVE = 0;
-EAPI Ecore_X_Atom ECORE_X_DND_ACTION_LINK = 0;
-EAPI Ecore_X_Atom ECORE_X_DND_ACTION_ASK = 0;
-EAPI Ecore_X_Atom ECORE_X_DND_ACTION_PRIVATE = 0;
+EAPI Ecore_X_Atom ECORE_X_DND_ACTION_COPY = 0;
+EAPI Ecore_X_Atom ECORE_X_DND_ACTION_MOVE = 0;
+EAPI Ecore_X_Atom ECORE_X_DND_ACTION_LINK = 0;
+EAPI Ecore_X_Atom ECORE_X_DND_ACTION_ASK = 0;
+EAPI Ecore_X_Atom ECORE_X_DND_ACTION_PRIVATE = 0;
/* old E atom */
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_FRAME_SIZE = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_FRAME_SIZE = 0;
/* old Gnome atom */
-EAPI Ecore_X_Atom ECORE_X_ATOM_WIN_LAYER = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_WIN_LAYER = 0;
/* ICCCM atoms */
/* ICCCM: client properties */
-EAPI Ecore_X_Atom ECORE_X_ATOM_WM_NAME = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_WM_ICON_NAME = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_WM_NORMAL_HINTS = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_WM_SIZE_HINTS = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_WM_HINTS = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_WM_CLASS = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_WM_TRANSIENT_FOR = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_WM_PROTOCOLS = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_WM_COLORMAP_WINDOWS = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_WM_COMMAND = 0; /* obsolete */
-EAPI Ecore_X_Atom ECORE_X_ATOM_WM_CLIENT_MACHINE = 0; /* obsolete */
+EAPI Ecore_X_Atom ECORE_X_ATOM_WM_NAME = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_WM_ICON_NAME = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_WM_NORMAL_HINTS = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_WM_SIZE_HINTS = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_WM_HINTS = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_WM_CLASS = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_WM_TRANSIENT_FOR = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_WM_PROTOCOLS = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_WM_COLORMAP_WINDOWS = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_WM_COMMAND = 0; /* obsolete */
+EAPI Ecore_X_Atom ECORE_X_ATOM_WM_CLIENT_MACHINE = 0; /* obsolete */
/* ICCCM: window manager properties */
-EAPI Ecore_X_Atom ECORE_X_ATOM_WM_STATE = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_WM_ICON_SIZE = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_WM_STATE = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_WM_ICON_SIZE = 0;
/* ICCCM: WM_STATE property */
-EAPI Ecore_X_Atom ECORE_X_ATOM_WM_CHANGE_STATE = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_WM_CHANGE_STATE = 0;
/* ICCCM: WM_PROTOCOLS properties */
-EAPI Ecore_X_Atom ECORE_X_ATOM_WM_TAKE_FOCUS = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_WM_SAVE_YOURSELF = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_WM_DELETE_WINDOW = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_WM_TAKE_FOCUS = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_WM_SAVE_YOURSELF = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_WM_DELETE_WINDOW = 0;
/* ICCCM: WM_COLORMAP properties */
-EAPI Ecore_X_Atom ECORE_X_ATOM_WM_COLORMAP_NOTIFY = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_WM_COLORMAP_NOTIFY = 0;
/* ICCCM: session management properties */
-EAPI Ecore_X_Atom ECORE_X_ATOM_SM_CLIENT_ID = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_WM_CLIENT_LEADER = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_WM_WINDOW_ROLE = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_SM_CLIENT_ID = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_WM_CLIENT_LEADER = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_WM_WINDOW_ROLE = 0;
/* Motif WM atom */
-EAPI Ecore_X_Atom ECORE_X_ATOM_MOTIF_WM_HINTS = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_MOTIF_WM_HINTS = 0;
/* NetWM 1.3 atoms (http://standards.freedesktop.org/wm-spec/wm-spec-1.3.html) */
* NetWM: Root Window Properties and related messages (complete)
*/
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_SUPPORTED = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_CLIENT_LIST = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_CLIENT_LIST_STACKING = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_GEOMETRY = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_VIEWPORT = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_CURRENT_DESKTOP = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_NAMES = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_ACTIVE_WINDOW = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WORKAREA = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_VIRTUAL_ROOTS = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_LAYOUT = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_SHOWING_DESKTOP = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_SUPPORTED = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_CLIENT_LIST = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_CLIENT_LIST_STACKING = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_GEOMETRY = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_VIEWPORT = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_CURRENT_DESKTOP = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_NAMES = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_ACTIVE_WINDOW = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WORKAREA = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_VIRTUAL_ROOTS = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_LAYOUT = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_SHOWING_DESKTOP = 0;
/*
* NetWM: Other Root Window Messages (complete)
*/
/* pager */
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_CLOSE_WINDOW = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_MOVERESIZE_WINDOW = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_MOVERESIZE = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_RESTACK_WINDOW = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_CLOSE_WINDOW = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_MOVERESIZE_WINDOW = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_MOVERESIZE = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_RESTACK_WINDOW = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS = 0;
/*
* NetWM: Application Window Properties (complete)
*/
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_NAME = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_VISIBLE_NAME = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON_NAME = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_DESKTOP = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_NAME = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_VISIBLE_NAME = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON_NAME = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_DESKTOP = 0;
/* window type */
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DROPDOWN_MENU = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_POPUP_MENU = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLTIP = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NOTIFICATION = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_COMBO = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DND = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DROPDOWN_MENU = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_POPUP_MENU = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLTIP = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NOTIFICATION = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_COMBO = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DND = 0;
/* state */
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_MODAL = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_STICKY = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_SHADED = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_HIDDEN = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_ABOVE = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_BELOW = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_MODAL = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_STICKY = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_SHADED = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_HIDDEN = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_ABOVE = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_BELOW = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION = 0;
/* allowed actions */
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MOVE = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_RESIZE = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_SHADE = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_STICK = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_CLOSE = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_ABOVE = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_BELOW = 0;
-
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STRUT = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STRUT_PARTIAL = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON_GEOMETRY = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_PID = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_HANDLED_ICONS = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_USER_TIME = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_STARTUP_ID = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_FRAME_EXTENTS = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MOVE = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_RESIZE = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_SHADE = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_STICK = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_CLOSE = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_ABOVE = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_BELOW = 0;
+
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STRUT = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STRUT_PARTIAL = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON_GEOMETRY = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_PID = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_HANDLED_ICONS = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_USER_TIME = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_STARTUP_ID = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_FRAME_EXTENTS = 0;
/*
* NetWM: Window Manager Protocols (complete)
*/
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_PING = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_SYNC_REQUEST = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_PING = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_SYNC_REQUEST = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER = 0;
/*
* NetWM: Not in the spec
*/
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_OPACITY = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_SHADOW = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_SHADE = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_OPACITY = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_SHADOW = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_SHADE = 0;
/*
* Startup Notification (http://standards.freedesktop.org/startup-notification-spec/startup-notification-0.1.txt)
*/
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_STARTUP_INFO_BEGIN = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_NET_STARTUP_INFO = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_STARTUP_INFO_BEGIN = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_NET_STARTUP_INFO = 0;
/* selection atoms */
-EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_TARGETS = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_PRIMARY = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_SECONDARY = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_CLIPBOARD = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_PRIMARY = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_SECONDARY = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_TARGETS = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_PRIMARY = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_SECONDARY = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_CLIPBOARD = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_PRIMARY = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_SECONDARY = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD = 0;
/* currently E specific virtual keyboard extension, aim to submit to netwm spec
* later */
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ALPHA = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_NUMERIC = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PIN = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PHONE_NUMBER= 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HEX = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_TERMINAL = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PASSWORD = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_IP = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HOST = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_FILE = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_URL = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_KEYPAD = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_J2ME = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ALPHA = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_NUMERIC = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PIN = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PHONE_NUMBER = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HEX = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_TERMINAL = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PASSWORD = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_IP = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HOST = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_FILE = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_URL = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_KEYPAD = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_J2ME = 0;
/* currently E specific illume extension */
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ZONE = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ZONE_LIST = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CONFORMANT = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_MODE = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_MODE_SINGLE = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_MODE_DUAL_TOP = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_FOCUS_BACK = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_FOCUS_FORWARD = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_FOCUS_HOME = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CLOSE = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_HOME_NEW = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_HOME_DEL = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_DRAG = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_DRAG_START = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_DRAG_END = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE_TOGGLE = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE = 0;
-EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE = 0;
-
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ZONE = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ZONE_LIST = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CONFORMANT = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_MODE = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_MODE_SINGLE = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_MODE_DUAL_TOP = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_FOCUS_BACK = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_FOCUS_FORWARD = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_FOCUS_HOME = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CLOSE = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_HOME_NEW = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_HOME_DEL = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_DRAG = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_DRAG_START = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_DRAG_END = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE_TOGGLE = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_COUNTER = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_E_COMP_FLUSH = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_E_COMP_DUMP = 0;
+EAPI Ecore_X_Atom ECORE_X_ATOM_E_COMP_PIXMAP = 0;
$(top_builddir)/src/lib/ecore_input/libecore_input.la \
@EINA_LIBS@
-libecore_x_xcb_la_LDFLAGS = -version-info @version_info@
-
endif
EXTRA_DIST = ecore_xcb_private.h
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#include <string.h>
#include <X11/keysym.h>
#include "ecore_xcb_private.h"
#include "Ecore_X_Atoms.h"
-static int _ecore_xcb_fd_handler(void *data, Ecore_Fd_Handler *fd_handler);
-static int _ecore_xcb_fd_handler_buf(void *data, Ecore_Fd_Handler *fd_handler);
-static int _ecore_xcb_key_mask_get(xcb_keysym_t sym);
-static int _ecore_xcb_event_modifier(unsigned int state);
+static Eina_Bool _ecore_xcb_fd_handler(void *data, Ecore_Fd_Handler *fd_handler);
+static Eina_Bool _ecore_xcb_fd_handler_buf(void *data, Ecore_Fd_Handler *fd_handler);
+static int _ecore_xcb_key_mask_get(xcb_keysym_t sym);
+static int _ecore_xcb_event_modifier(unsigned int state);
-static void *_ecore_xcb_event_filter_start(void *data);
-static int _ecore_xcb_event_filter_filter(void *data, void *loop_data,int type, void *event);
-static void _ecore_xcb_event_filter_end(void *data, void *loop_data);
+static void * _ecore_xcb_event_filter_start(void *data);
+static Eina_Bool _ecore_xcb_event_filter_filter(void *data, void *loop_data,int type, void *event);
+static void _ecore_xcb_event_filter_end(void *data, void *loop_data);
static Ecore_Fd_Handler *_ecore_xcb_fd_handler_handle = NULL;
static Ecore_Event_Filter *_ecore_xcb_filter_handler = NULL;
int _ecore_x11xcb_log_dom = -1;
Ecore_X_Connection *_ecore_xcb_conn = NULL;
-Ecore_X_Screen *_ecore_xcb_screen = NULL;
-double _ecore_xcb_double_click_time = 0.25;
-Ecore_X_Time _ecore_xcb_event_last_time = XCB_NONE;
-Ecore_X_Window _ecore_xcb_event_last_window = XCB_NONE;
-int16_t _ecore_xcb_event_last_root_x = 0;
-int16_t _ecore_xcb_event_last_root_y = 0;
-int _ecore_xcb_xcursor = 0;
+Ecore_X_Screen *_ecore_xcb_screen = NULL;
+double _ecore_xcb_double_click_time = 0.25;
+Ecore_X_Time _ecore_xcb_event_last_time = XCB_NONE;
+Ecore_X_Window _ecore_xcb_event_last_window = XCB_NONE;
+int16_t _ecore_xcb_event_last_root_x = 0;
+int16_t _ecore_xcb_event_last_root_y = 0;
+int _ecore_xcb_xcursor = 0;
-Ecore_X_Window _ecore_xcb_private_window = 0;
+Ecore_X_Window _ecore_xcb_private_window = 0;
/* FIXME - These are duplicates after making ecore atoms public */
-Ecore_X_Atom _ecore_xcb_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_NUM];
+Ecore_X_Atom _ecore_xcb_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_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_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_SELECTION_CLEAR = 0;
-EAPI int ECORE_X_EVENT_SELECTION_REQUEST = 0;
-EAPI int ECORE_X_EVENT_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_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_WINDOW_DELETE_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_SELECTION_CLEAR = 0;
+EAPI int ECORE_X_EVENT_SELECTION_REQUEST = 0;
+EAPI int ECORE_X_EVENT_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_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_WINDOW_DELETE_REQUEST = 0;
/*
-EAPI int ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE = 0;
-EAPI int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE = 0;
-EAPI int ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE = 0;
-EAPI int ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE = 0;
-EAPI int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE = 0;
-EAPI int ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE = 0;
-EAPI int ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE = 0;
-EAPI int ECORE_X_EVENT_WINDOW_PROP_DESKTOP_CHANGE = 0;
-*/
+ EAPI int ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE = 0;
+ EAPI int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE = 0;
+ EAPI int ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE = 0;
+ EAPI int ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE = 0;
+ EAPI int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE = 0;
+ EAPI int ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE = 0;
+ EAPI int ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE = 0;
+ EAPI int ECORE_X_EVENT_WINDOW_PROP_DESKTOP_CHANGE = 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_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_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_MODIFIER_SHIFT = 0;
-EAPI int ECORE_X_MODIFIER_CTRL = 0;
-EAPI int ECORE_X_MODIFIER_ALT = 0;
-EAPI int ECORE_X_MODIFIER_WIN = 0;
+EAPI int ECORE_X_MODIFIER_SHIFT = 0;
+EAPI int ECORE_X_MODIFIER_CTRL = 0;
+EAPI int ECORE_X_MODIFIER_ALT = 0;
+EAPI int ECORE_X_MODIFIER_WIN = 0;
-EAPI int ECORE_X_LOCK_SCROLL = 0;
-EAPI int ECORE_X_LOCK_NUM = 0;
-EAPI int ECORE_X_LOCK_CAPS = 0;
+EAPI int ECORE_X_LOCK_SCROLL = 0;
+EAPI int ECORE_X_LOCK_NUM = 0;
+EAPI int ECORE_X_LOCK_CAPS = 0;
/**
* @defgroup Ecore_Xcb_Init_Group X Library Init and Shutdown Functions
EAPI int
ecore_x_init(const char *name)
{
- xcb_screen_iterator_t iter;
- int screen;
- uint32_t max_request_length;
+ xcb_screen_iterator_t iter;
+ int screen;
+ uint32_t max_request_length;
const xcb_query_extension_reply_t *reply_big_requests;
#ifdef ECORE_XCB_DAMAGE
const xcb_query_extension_reply_t *reply_damage;
const xcb_query_extension_reply_t *reply_shape;
#endif /* ECORE_XCB_SHAPE */
#ifdef ECORE_XCB_SYNC
- xcb_sync_initialize_cookie_t cookie_sync_init;
- xcb_sync_initialize_reply_t *reply_sync_init;
+ xcb_sync_initialize_cookie_t cookie_sync_init;
+ xcb_sync_initialize_reply_t *reply_sync_init;
const xcb_query_extension_reply_t *reply_sync;
#endif /* ECORE_XCB_SYNC */
#ifdef ECORE_XCB_FIXES
const xcb_query_extension_reply_t *reply_xprint;
#endif /* ECORE_XCB_XPRINT */
- xcb_intern_atom_cookie_t atom_cookies[ECORE_X_ATOMS_COUNT];
+ xcb_intern_atom_cookie_t atom_cookies[ECORE_X_ATOMS_COUNT];
if (++_ecore_xcb_init_count != 1)
- return _ecore_xcb_init_count;
+ return _ecore_xcb_init_count;
+
+ /* We init some components (not related to XCB) */
+ if (!eina_init())
+ return --_ecore_xcb_init_count;
+
_ecore_x11xcb_log_dom = eina_log_domain_register("EcoreXCB", ECORE_XLIB_XCB_DEFAULT_LOG_COLOR);
- if(_ecore_x11xcb_log_dom < 0)
+ if (_ecore_x11xcb_log_dom < 0)
{
- EINA_LOG_ERR("Impossible to create a log domain the Ecore XCB module.");
- return --_ecore_xcb_init_count;
+ EINA_LOG_ERR("Impossible to create a log domain the Ecore XCB module.");
+ goto shutdown_eina;
}
+
+ if (!ecore_init())
+ goto shutdown_eina;
+ if (!ecore_event_init())
+ goto shutdown_ecore;
+
_ecore_xcb_conn = xcb_connect(name, &screen);
- if (xcb_connection_has_error(_ecore_xcb_conn)) {
- eina_log_domain_unregister(_ecore_x11xcb_log_dom);
- _ecore_x11xcb_log_dom = -1;
- return --_ecore_xcb_init_count;
- }
+ if (xcb_connection_has_error(_ecore_xcb_conn))
+ goto shutdown_ecore_event;
+
/* FIXME: no error code right now */
/* _ecore_xcb_error_handler_init(); */
*
*/
-
/* We request the atoms (non blocking) */
_ecore_x_atom_init(atom_cookies);
xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_x_print_id);
#endif /* ECORE_XCB_XPRINT */
- /* We init some components (not related to XCB) */
- if (!ecore_event_init())
- goto close_connection;
-
_ecore_x_reply_init();
_ecore_x_dnd_init();
ecore_x_netwm_init();
/* We get the default screen */
iter = xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn));
for (; iter.rem; --screen, xcb_screen_next (&iter))
- if (screen == 0)
- {
- _ecore_xcb_screen = iter.data;
- break;
- }
+ if (screen == 0)
+ {
+ _ecore_xcb_screen = iter.data;
+ break;
+ }
/*
* Blocking stuff:
#ifdef ECORE_XCB_DAMAGE
reply_damage = xcb_get_extension_data(_ecore_xcb_conn, &xcb_damage_id);
if (reply_damage)
- _ecore_xcb_event_damage_id = reply_damage->first_event + XCB_DAMAGE_NOTIFY;
+ _ecore_xcb_event_damage_id = reply_damage->first_event + XCB_DAMAGE_NOTIFY;
+
if (_ecore_xcb_event_damage_id >= _ecore_xcb_event_handlers_num)
- _ecore_xcb_event_handlers_num = _ecore_xcb_event_damage_id + 1;
+ _ecore_xcb_event_handlers_num = _ecore_xcb_event_damage_id + 1;
+
#endif /* ECORE_XCB_DAMAGE */
#ifdef ECORE_XCB_COMPOSITE
#ifdef ECORE_XCB_RANDR
reply_randr = xcb_get_extension_data(_ecore_xcb_conn, &xcb_randr_id);
if (reply_randr)
- _ecore_xcb_event_randr_id = reply_randr->first_event + XCB_RANDR_SCREEN_CHANGE_NOTIFY;
+ _ecore_xcb_event_randr_id = reply_randr->first_event + XCB_RANDR_SCREEN_CHANGE_NOTIFY;
+
if (_ecore_xcb_event_randr_id >= _ecore_xcb_event_handlers_num)
- _ecore_xcb_event_handlers_num = _ecore_xcb_event_randr_id + 1;
+ _ecore_xcb_event_handlers_num = _ecore_xcb_event_randr_id + 1;
+
#endif /* ECORE_XCB_RANDR */
#ifdef ECORE_XCB_SCREENSAVER
reply_screensaver = xcb_get_extension_data(_ecore_xcb_conn, &xcb_screensaver_id);
if (reply_screensaver)
- _ecore_xcb_event_screensaver_id = reply_screensaver->first_event + XCB_SCREENSAVER_NOTIFY;
+ _ecore_xcb_event_screensaver_id = reply_screensaver->first_event + XCB_SCREENSAVER_NOTIFY;
+
if (_ecore_xcb_event_screensaver_id >= _ecore_xcb_event_handlers_num)
- _ecore_xcb_event_handlers_num = _ecore_xcb_event_screensaver_id + 1;
+ _ecore_xcb_event_handlers_num = _ecore_xcb_event_screensaver_id + 1;
+
#endif /* ECORE_XCB_SCREENSAVER */
#ifdef ECORE_XCB_SHAPE
reply_shape = xcb_get_extension_data(_ecore_xcb_conn, &xcb_shape_id);
if (reply_shape)
- _ecore_xcb_event_shape_id = reply_shape->first_event + XCB_SHAPE_NOTIFY;
+ _ecore_xcb_event_shape_id = reply_shape->first_event + XCB_SHAPE_NOTIFY;
+
if (_ecore_xcb_event_shape_id >= _ecore_xcb_event_handlers_num)
- _ecore_xcb_event_handlers_num = _ecore_xcb_event_shape_id + 1;
+ _ecore_xcb_event_handlers_num = _ecore_xcb_event_shape_id + 1;
+
#endif /* ECORE_XCB_SHAPE */
#ifdef ECORE_XCB_SYNC
reply_sync = xcb_get_extension_data(_ecore_xcb_conn, &xcb_sync_id);
if (reply_sync)
{
- _ecore_xcb_event_sync_id = reply_sync->first_event;
+ _ecore_xcb_event_sync_id = reply_sync->first_event;
reply_sync_init = xcb_sync_initialize_reply(_ecore_xcb_conn,
cookie_sync_init, NULL);
- if (!reply_sync_init)
- _ecore_xcb_event_sync_id = 0;
+ if (!reply_sync_init)
+ _ecore_xcb_event_sync_id = 0;
else
- free(reply_sync_init);
+ free(reply_sync_init);
}
+
if (_ecore_xcb_event_sync_id + XCB_SYNC_ALARM_NOTIFY >= _ecore_xcb_event_handlers_num)
- _ecore_xcb_event_handlers_num = _ecore_xcb_event_sync_id + XCB_SYNC_ALARM_NOTIFY + 1;
+ _ecore_xcb_event_handlers_num = _ecore_xcb_event_sync_id + XCB_SYNC_ALARM_NOTIFY + 1;
+
#endif /* ECORE_XCB_SYNC */
#ifdef ECORE_XCB_FIXES
reply_xfixes = xcb_get_extension_data(_ecore_xcb_conn, &xcb_xfixes_id);
if (reply_xfixes)
- _ecore_xcb_event_fixes_selection_id = reply_xfixes->first_event + XCB_XFIXES_SELECTION_NOTIFY;
+ _ecore_xcb_event_fixes_selection_id = reply_xfixes->first_event + XCB_XFIXES_SELECTION_NOTIFY;
+
if (_ecore_xcb_event_fixes_selection_id >= _ecore_xcb_event_handlers_num)
- _ecore_xcb_event_handlers_num = _ecore_xcb_event_fixes_selection_id + 1;
+ _ecore_xcb_event_handlers_num = _ecore_xcb_event_fixes_selection_id + 1;
+
#endif /* ECORE_XCB_FIXES */
#ifdef ECORE_XCB_XINERAMA
_ecore_xcb_event_handlers = calloc(_ecore_xcb_event_handlers_num, sizeof(void *));
if (!_ecore_xcb_event_handlers)
- goto finalize_extensions;
+ goto finalize_extensions;
#ifdef ECORE_XCB_CURSOR
_ecore_xcb_xcursor = XcursorSupportsARGB(_ecore_xcb_conn);
#endif /* ECORE_XCB_CURSOR */
- _ecore_xcb_event_handlers[XCB_EVENT_ANY] = _ecore_x_event_handle_any_event;
- _ecore_xcb_event_handlers[XCB_KEY_PRESS] = _ecore_x_event_handle_key_press;
- _ecore_xcb_event_handlers[XCB_KEY_RELEASE] = _ecore_x_event_handle_key_release;
- _ecore_xcb_event_handlers[XCB_BUTTON_PRESS] = _ecore_x_event_handle_button_press;
- _ecore_xcb_event_handlers[XCB_BUTTON_RELEASE] = _ecore_x_event_handle_button_release;
- _ecore_xcb_event_handlers[XCB_MOTION_NOTIFY] = _ecore_x_event_handle_motion_notify;
- _ecore_xcb_event_handlers[XCB_ENTER_NOTIFY] = _ecore_x_event_handle_enter_notify;
- _ecore_xcb_event_handlers[XCB_LEAVE_NOTIFY] = _ecore_x_event_handle_leave_notify;
- _ecore_xcb_event_handlers[XCB_FOCUS_IN] = _ecore_x_event_handle_focus_in;
- _ecore_xcb_event_handlers[XCB_FOCUS_OUT] = _ecore_x_event_handle_focus_out;
- _ecore_xcb_event_handlers[XCB_KEYMAP_NOTIFY] = _ecore_x_event_handle_keymap_notify;
- _ecore_xcb_event_handlers[XCB_EXPOSE] = _ecore_x_event_handle_expose;
+ _ecore_xcb_event_handlers[XCB_EVENT_ANY] = _ecore_x_event_handle_any_event;
+ _ecore_xcb_event_handlers[XCB_KEY_PRESS] = _ecore_x_event_handle_key_press;
+ _ecore_xcb_event_handlers[XCB_KEY_RELEASE] = _ecore_x_event_handle_key_release;
+ _ecore_xcb_event_handlers[XCB_BUTTON_PRESS] = _ecore_x_event_handle_button_press;
+ _ecore_xcb_event_handlers[XCB_BUTTON_RELEASE] = _ecore_x_event_handle_button_release;
+ _ecore_xcb_event_handlers[XCB_MOTION_NOTIFY] = _ecore_x_event_handle_motion_notify;
+ _ecore_xcb_event_handlers[XCB_ENTER_NOTIFY] = _ecore_x_event_handle_enter_notify;
+ _ecore_xcb_event_handlers[XCB_LEAVE_NOTIFY] = _ecore_x_event_handle_leave_notify;
+ _ecore_xcb_event_handlers[XCB_FOCUS_IN] = _ecore_x_event_handle_focus_in;
+ _ecore_xcb_event_handlers[XCB_FOCUS_OUT] = _ecore_x_event_handle_focus_out;
+ _ecore_xcb_event_handlers[XCB_KEYMAP_NOTIFY] = _ecore_x_event_handle_keymap_notify;
+ _ecore_xcb_event_handlers[XCB_EXPOSE] = _ecore_x_event_handle_expose;
_ecore_xcb_event_handlers[XCB_GRAPHICS_EXPOSURE] = _ecore_x_event_handle_graphics_expose;
_ecore_xcb_event_handlers[XCB_VISIBILITY_NOTIFY] = _ecore_x_event_handle_visibility_notify;
- _ecore_xcb_event_handlers[XCB_CREATE_NOTIFY] = _ecore_x_event_handle_create_notify;
- _ecore_xcb_event_handlers[XCB_DESTROY_NOTIFY] = _ecore_x_event_handle_destroy_notify;
- _ecore_xcb_event_handlers[XCB_UNMAP_NOTIFY] = _ecore_x_event_handle_unmap_notify;
- _ecore_xcb_event_handlers[XCB_MAP_NOTIFY] = _ecore_x_event_handle_map_notify;
- _ecore_xcb_event_handlers[XCB_MAP_REQUEST] = _ecore_x_event_handle_map_request;
- _ecore_xcb_event_handlers[XCB_REPARENT_NOTIFY] = _ecore_x_event_handle_reparent_notify;
- _ecore_xcb_event_handlers[XCB_CONFIGURE_NOTIFY] = _ecore_x_event_handle_configure_notify;
+ _ecore_xcb_event_handlers[XCB_CREATE_NOTIFY] = _ecore_x_event_handle_create_notify;
+ _ecore_xcb_event_handlers[XCB_DESTROY_NOTIFY] = _ecore_x_event_handle_destroy_notify;
+ _ecore_xcb_event_handlers[XCB_UNMAP_NOTIFY] = _ecore_x_event_handle_unmap_notify;
+ _ecore_xcb_event_handlers[XCB_MAP_NOTIFY] = _ecore_x_event_handle_map_notify;
+ _ecore_xcb_event_handlers[XCB_MAP_REQUEST] = _ecore_x_event_handle_map_request;
+ _ecore_xcb_event_handlers[XCB_REPARENT_NOTIFY] = _ecore_x_event_handle_reparent_notify;
+ _ecore_xcb_event_handlers[XCB_CONFIGURE_NOTIFY] = _ecore_x_event_handle_configure_notify;
_ecore_xcb_event_handlers[XCB_CONFIGURE_REQUEST] = _ecore_x_event_handle_configure_request;
- _ecore_xcb_event_handlers[XCB_GRAVITY_NOTIFY] = _ecore_x_event_handle_gravity_notify;
- _ecore_xcb_event_handlers[XCB_RESIZE_REQUEST] = _ecore_x_event_handle_resize_request;
- _ecore_xcb_event_handlers[XCB_CIRCULATE_NOTIFY] = _ecore_x_event_handle_circulate_notify;
+ _ecore_xcb_event_handlers[XCB_GRAVITY_NOTIFY] = _ecore_x_event_handle_gravity_notify;
+ _ecore_xcb_event_handlers[XCB_RESIZE_REQUEST] = _ecore_x_event_handle_resize_request;
+ _ecore_xcb_event_handlers[XCB_CIRCULATE_NOTIFY] = _ecore_x_event_handle_circulate_notify;
_ecore_xcb_event_handlers[XCB_CIRCULATE_REQUEST] = _ecore_x_event_handle_circulate_request;
- _ecore_xcb_event_handlers[XCB_PROPERTY_NOTIFY] = _ecore_x_event_handle_property_notify;
- _ecore_xcb_event_handlers[XCB_SELECTION_CLEAR] = _ecore_x_event_handle_selection_clear;
+ _ecore_xcb_event_handlers[XCB_PROPERTY_NOTIFY] = _ecore_x_event_handle_property_notify;
+ _ecore_xcb_event_handlers[XCB_SELECTION_CLEAR] = _ecore_x_event_handle_selection_clear;
_ecore_xcb_event_handlers[XCB_SELECTION_REQUEST] = _ecore_x_event_handle_selection_request;
- _ecore_xcb_event_handlers[XCB_SELECTION_NOTIFY] = _ecore_x_event_handle_selection_notify;
- _ecore_xcb_event_handlers[XCB_COLORMAP_NOTIFY] = _ecore_x_event_handle_colormap_notify;
- _ecore_xcb_event_handlers[XCB_CLIENT_MESSAGE] = _ecore_x_event_handle_client_message;
- _ecore_xcb_event_handlers[XCB_MAPPING_NOTIFY] = _ecore_x_event_handle_mapping_notify;
+ _ecore_xcb_event_handlers[XCB_SELECTION_NOTIFY] = _ecore_x_event_handle_selection_notify;
+ _ecore_xcb_event_handlers[XCB_COLORMAP_NOTIFY] = _ecore_x_event_handle_colormap_notify;
+ _ecore_xcb_event_handlers[XCB_CLIENT_MESSAGE] = _ecore_x_event_handle_client_message;
+ _ecore_xcb_event_handlers[XCB_MAPPING_NOTIFY] = _ecore_x_event_handle_mapping_notify;
#ifdef ECORE_XCB_DAMAGE
if (_ecore_xcb_event_damage_id)
- _ecore_xcb_event_handlers[_ecore_xcb_event_damage_id] = _ecore_x_event_handle_damage_notify;
+ _ecore_xcb_event_handlers[_ecore_xcb_event_damage_id] = _ecore_x_event_handle_damage_notify;
+
#endif /* ECORE_XCB_DAMAGE */
#ifdef ECORE_XCB_RANDR
if (_ecore_xcb_event_randr_id)
- _ecore_xcb_event_handlers[_ecore_xcb_event_randr_id] = _ecore_x_event_handle_randr_change;
+ _ecore_xcb_event_handlers[_ecore_xcb_event_randr_id] = _ecore_x_event_handle_randr_change;
+
#endif /* ECORE_XCB_RANDR */
#ifdef ECORE_XCB_SCREENSAVER
if (_ecore_xcb_event_screensaver_id)
- _ecore_xcb_event_handlers[_ecore_xcb_event_screensaver_id] = _ecore_x_event_handle_screensaver_notify;
+ _ecore_xcb_event_handlers[_ecore_xcb_event_screensaver_id] = _ecore_x_event_handle_screensaver_notify;
+
#endif /* ECORE_XCB_SCREENSAVER */
#ifdef ECORE_XCB_SHAPE
if (_ecore_xcb_event_shape_id)
- _ecore_xcb_event_handlers[_ecore_xcb_event_shape_id] = _ecore_x_event_handle_shape_change;
+ _ecore_xcb_event_handlers[_ecore_xcb_event_shape_id] = _ecore_x_event_handle_shape_change;
+
#endif /* ECORE_XCB_SHAPE */
#ifdef ECORE_XCB_SYNC
if (_ecore_xcb_event_sync_id)
{
- _ecore_xcb_event_handlers[_ecore_xcb_event_sync_id + XCB_SYNC_COUNTER_NOTIFY] =
- _ecore_x_event_handle_sync_counter;
- _ecore_xcb_event_handlers[_ecore_xcb_event_sync_id + XCB_SYNC_ALARM_NOTIFY] =
- _ecore_x_event_handle_sync_alarm;
+ _ecore_xcb_event_handlers[_ecore_xcb_event_sync_id + XCB_SYNC_COUNTER_NOTIFY] =
+ _ecore_x_event_handle_sync_counter;
+ _ecore_xcb_event_handlers[_ecore_xcb_event_sync_id + XCB_SYNC_ALARM_NOTIFY] =
+ _ecore_x_event_handle_sync_alarm;
}
+
#endif /* ECORE_XCB_SYNC */
#ifdef ECORE_XCB_FIXES
if (_ecore_xcb_event_fixes_selection_id)
- _ecore_xcb_event_handlers[_ecore_xcb_event_fixes_selection_id] = _ecore_x_event_handle_fixes_selection_notify;
+ _ecore_xcb_event_handlers[_ecore_xcb_event_fixes_selection_id] = _ecore_x_event_handle_fixes_selection_notify;
+
#endif /* ECORE_XCB_FIXES */
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_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_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_DAMAGE_NOTIFY = ecore_event_type_new();
-
- ECORE_X_EVENT_WINDOW_DELETE_REQUEST = ecore_event_type_new();
- /*
- ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_PROP_DESKTOP_CHANGE = 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_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_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_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_DAMAGE_NOTIFY = ecore_event_type_new();
+
+ ECORE_X_EVENT_WINDOW_DELETE_REQUEST = ecore_event_type_new();
+ /*
+ ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_PROP_DESKTOP_CHANGE = 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();
}
/* everything has these... unless its like a pda... :) */
ECORE_X_MODIFIER_SHIFT = _ecore_xcb_key_mask_get(XK_Shift_L);
- ECORE_X_MODIFIER_CTRL = _ecore_xcb_key_mask_get(XK_Control_L);
+ ECORE_X_MODIFIER_CTRL = _ecore_xcb_key_mask_get(XK_Control_L);
/* apple's xdarwin has no alt!!!! */
- ECORE_X_MODIFIER_ALT = _ecore_xcb_key_mask_get(XK_Alt_L);
+ ECORE_X_MODIFIER_ALT = _ecore_xcb_key_mask_get(XK_Alt_L);
if (!ECORE_X_MODIFIER_ALT)
- ECORE_X_MODIFIER_ALT = _ecore_xcb_key_mask_get(XK_Meta_L);
+ ECORE_X_MODIFIER_ALT = _ecore_xcb_key_mask_get(XK_Meta_L);
+
if (!ECORE_X_MODIFIER_ALT)
- ECORE_X_MODIFIER_ALT = _ecore_xcb_key_mask_get(XK_Super_L);
+ ECORE_X_MODIFIER_ALT = _ecore_xcb_key_mask_get(XK_Super_L);
/* the windows key... a valid modifier :) */
- ECORE_X_MODIFIER_WIN = _ecore_xcb_key_mask_get(XK_Super_L);
+ ECORE_X_MODIFIER_WIN = _ecore_xcb_key_mask_get(XK_Super_L);
if (!ECORE_X_MODIFIER_WIN)
- ECORE_X_MODIFIER_WIN = _ecore_xcb_key_mask_get(XK_Mode_switch);
+ ECORE_X_MODIFIER_WIN = _ecore_xcb_key_mask_get(XK_Mode_switch);
+
if (!ECORE_X_MODIFIER_WIN)
- ECORE_X_MODIFIER_WIN = _ecore_xcb_key_mask_get(XK_Meta_L);
+ ECORE_X_MODIFIER_WIN = _ecore_xcb_key_mask_get(XK_Meta_L);
if (ECORE_X_MODIFIER_WIN == ECORE_X_MODIFIER_ALT)
- ECORE_X_MODIFIER_WIN = 0;
+ ECORE_X_MODIFIER_WIN = 0;
+
if (ECORE_X_MODIFIER_ALT == ECORE_X_MODIFIER_CTRL)
- ECORE_X_MODIFIER_ALT = 0;
+ ECORE_X_MODIFIER_ALT = 0;
- ECORE_X_LOCK_SCROLL = _ecore_xcb_key_mask_get(XK_Scroll_Lock);
- ECORE_X_LOCK_NUM = _ecore_xcb_key_mask_get(XK_Num_Lock);
- ECORE_X_LOCK_CAPS = _ecore_xcb_key_mask_get(XK_Caps_Lock);
+ ECORE_X_LOCK_SCROLL = _ecore_xcb_key_mask_get(XK_Scroll_Lock);
+ ECORE_X_LOCK_NUM = _ecore_xcb_key_mask_get(XK_Num_Lock);
+ ECORE_X_LOCK_CAPS = _ecore_xcb_key_mask_get(XK_Caps_Lock);
_ecore_xcb_fd_handler_handle =
- ecore_main_fd_handler_add(xcb_get_file_descriptor(_ecore_xcb_conn),
- ECORE_FD_READ,
- _ecore_xcb_fd_handler, _ecore_xcb_conn,
- _ecore_xcb_fd_handler_buf, _ecore_xcb_conn);
+ ecore_main_fd_handler_add(xcb_get_file_descriptor(_ecore_xcb_conn),
+ ECORE_FD_READ,
+ _ecore_xcb_fd_handler, _ecore_xcb_conn,
+ _ecore_xcb_fd_handler_buf, _ecore_xcb_conn);
if (!_ecore_xcb_fd_handler_handle)
- goto free_event_handlers;
+ goto free_event_handlers;
_ecore_xcb_filter_handler = ecore_event_filter_add(_ecore_xcb_event_filter_start, _ecore_xcb_event_filter_filter, _ecore_xcb_event_filter_end, NULL);
return _ecore_xcb_init_count;
- free_event_handlers:
+free_event_handlers:
free(_ecore_xcb_event_handlers);
_ecore_xcb_event_handlers = NULL;
- finalize_extensions:
+finalize_extensions:
/* We get the replies of the QueryVersion request because we leave */
#ifdef ECORE_XCB_DAMAGE
_ecore_x_damage_init_finalize();
#ifdef ECORE_XCB_XINERAMA
_ecore_x_xinerama_init_finalize();
#endif /* ECORE_XCB_XINERAMA */
+shutdown_ecore_event:
ecore_event_shutdown();
- close_connection:
- _ecore_x_atom_init_finalize(atom_cookies);
- xcb_disconnect(_ecore_xcb_conn);
- _ecore_xcb_fd_handler_handle = NULL;
- _ecore_xcb_conn = NULL;
+shutdown_ecore:
+ ecore_shutdown();
+shutdown_eina:
+ eina_log_domain_unregister(_ecore_x11xcb_log_dom);
+ _ecore_x11xcb_log_dom = -1;
+ eina_shutdown();
return --_ecore_xcb_init_count;
-}
+} /* ecore_x_init */
static int
_ecore_x_shutdown(int close_display)
{
if (--_ecore_xcb_init_count != 0)
- return _ecore_xcb_init_count;
+ return _ecore_xcb_init_count;
- if (!_ecore_xcb_conn) return _ecore_xcb_init_count;
+ if (!_ecore_xcb_conn)
+ return _ecore_xcb_init_count;
+ ecore_main_fd_handler_del(_ecore_xcb_fd_handler_handle);
if (close_display)
xcb_disconnect(_ecore_xcb_conn);
else
close(xcb_get_file_descriptor(_ecore_xcb_conn));
- ecore_event_shutdown();
+
free(_ecore_xcb_event_handlers);
- ecore_main_fd_handler_del(_ecore_xcb_fd_handler_handle);
ecore_event_filter_del(_ecore_xcb_filter_handler);
_ecore_xcb_fd_handler_handle = NULL;
_ecore_xcb_filter_handler = NULL;
ecore_x_netwm_shutdown();
_ecore_x_reply_shutdown();
+ ecore_event_shutdown();
+ ecore_shutdown();
+
+ eina_log_domain_unregister(_ecore_x11xcb_log_dom);
+ _ecore_x11xcb_log_dom = -1;
+ eina_shutdown();
+
return _ecore_xcb_init_count;
-}
+} /* _ecore_x_shutdown */
/**
* Shuts down the Ecore X library.
ecore_x_shutdown(void)
{
return _ecore_x_shutdown(1);
-}
+} /* ecore_x_shutdown */
/**
* Shuts down the Ecore X library.
ecore_x_disconnect(void)
{
return _ecore_x_shutdown(0);
-}
+} /* ecore_x_disconnect */
/**
* @defgroup Ecore_Xcb_Display_Attr_Group X Display Attributes
ecore_x_display_get(void)
{
return NULL;
-}
+} /* ecore_x_display_get */
/**
* Retrieves the Ecore_X_Connection handle used for the current X connection.
ecore_x_connection_get(void)
{
return (Ecore_X_Connection *)_ecore_xcb_conn;
-}
+} /* ecore_x_connection_get */
/**
* Retrieves the X display file descriptor.
ecore_x_fd_get(void)
{
return xcb_get_file_descriptor(_ecore_xcb_conn);
-}
+} /* ecore_x_fd_get */
/**
* Retrieves the Ecore_X_Screen handle used for the current X connection.
ecore_x_default_screen_get(void)
{
return (Ecore_X_Screen *)_ecore_xcb_screen;
-}
+} /* ecore_x_default_screen_get */
/**
* Sets the timeout for a double and triple clicks to be flagged.
EAPI void
ecore_x_double_click_time_set(double t)
{
- if (t < 0.0) t = 0.0;
+ if (t < 0.0)
+ t = 0.0;
+
_ecore_xcb_double_click_time = t;
-}
+} /* ecore_x_double_click_time_set */
/**
* Retrieves the double and triple click flag timeout.
ecore_x_double_click_time_get(void)
{
return _ecore_xcb_double_click_time;
-}
+} /* ecore_x_double_click_time_get */
/**
* @defgroup Ecore_Xcb_Flush_Group X Synchronization Functions
ecore_x_flush(void)
{
xcb_flush(_ecore_xcb_conn);
-}
+} /* ecore_x_flush */
/**
* Flushes the command buffer and waits until all requests have been
ecore_x_sync(void)
{
free(xcb_get_input_focus_reply(_ecore_xcb_conn, xcb_get_input_focus(_ecore_xcb_conn), NULL));
-}
+} /* ecore_x_sync */
/**
* Kill all clients with subwindows under a given window.
reply = xcb_query_tree_reply(_ecore_xcb_conn, cookie, NULL);
if (reply)
{
- xcb_window_iterator_t iter;
-
- iter = xcb_query_tree_children_iterator(reply);
- for (; iter.rem; xcb_window_next(&iter))
- xcb_kill_client(_ecore_xcb_conn, *iter.data);
- free(reply);
+ xcb_window_t *wins = NULL;
+ int tree_c_len;
+ int i;
+
+ wins = xcb_query_tree_children(reply);
+ tree_c_len = xcb_query_tree_children_length(reply);
+ for (i = 0; i < tree_c_len; i++)
+ xcb_kill_client(_ecore_xcb_conn, wins[i]);
+ free(reply);
}
}
xcb_ungrab_server(_ecore_xcb_conn);
free(xcb_get_input_focus_reply(_ecore_xcb_conn, xcb_get_input_focus(_ecore_xcb_conn), NULL));
-}
+} /* ecore_x_killall */
/**
* Kill a specific client
ecore_x_kill(Ecore_X_Window window)
{
xcb_kill_client(_ecore_xcb_conn, window);
-}
+} /* ecore_x_kill */
+
+/**
+ * TODO: Invoke the standard system beep to alert users
+ */
+EAPI Eina_Bool
+ecore_x_bell(int percent)
+{
+ return 0;
+} /* ecore_x_bell */
/**
* Return the last event time
ecore_x_current_time_get(void)
{
return _ecore_xcb_event_last_time;
-}
+} /* ecore_x_current_time_get */
static void
handle_event(xcb_generic_event_t *ev)
if (response_type < _ecore_xcb_event_handlers_num)
{
- if (_ecore_xcb_event_handlers[XCB_EVENT_ANY])
- _ecore_xcb_event_handlers[XCB_EVENT_ANY] (ev);
+ if (_ecore_xcb_event_handlers[XCB_EVENT_ANY])
+ _ecore_xcb_event_handlers[XCB_EVENT_ANY] (ev);
- if (_ecore_xcb_event_handlers[response_type])
- _ecore_xcb_event_handlers[response_type] (ev);
+ if (_ecore_xcb_event_handlers[response_type])
+ _ecore_xcb_event_handlers[response_type] (ev);
}
-}
+} /* handle_event */
-static int
+static Eina_Bool
_ecore_xcb_fd_handler(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
{
- xcb_connection_t *c;
+ xcb_connection_t *c;
xcb_generic_event_t *ev;
c = (xcb_connection_t *)data;
/* We check if _ecore_xcb_event_buffered is NULL or not */
if (_ecore_xcb_event_buffered)
- handle_event(_ecore_xcb_event_buffered);
+ {
+ handle_event(_ecore_xcb_event_buffered);
+ _ecore_xcb_event_buffered = NULL;
+ }
while ((ev = xcb_poll_for_event(c)))
- handle_event(ev);
+ handle_event(ev);
- return 1;
-}
+ return ECORE_CALLBACK_RENEW;
+} /* _ecore_xcb_fd_handler */
-static int
+static Eina_Bool
_ecore_xcb_fd_handler_buf(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
{
xcb_connection_t *c;
_ecore_xcb_event_buffered = xcb_poll_for_event(c);
if (!_ecore_xcb_event_buffered)
- return 0;
+ return ECORE_CALLBACK_CANCEL;
- return 1;
-}
+ return ECORE_CALLBACK_RENEW;
+} /* _ecore_xcb_fd_handler_buf */
/* FIXME: possible roundtrip */
/* FIXME: fix xcb_keysyms. It's ugly !! (reply in xcb_key_symbols_get_keysym) */
static int
_ecore_xcb_key_mask_get(xcb_keysym_t sym)
{
- xcb_keycode_iterator_t iter;
xcb_get_modifier_mapping_cookie_t cookie;
xcb_get_modifier_mapping_reply_t *reply;
- xcb_key_symbols_t *symbols;
- xcb_keysym_t sym2;
- int i, j;
- const int masks[8] =
- {
- XCB_MOD_MASK_SHIFT,
- XCB_MOD_MASK_LOCK,
- XCB_MOD_MASK_CONTROL,
- XCB_MOD_MASK_1,
- XCB_MOD_MASK_2,
- XCB_MOD_MASK_3,
- XCB_MOD_MASK_4,
- XCB_MOD_MASK_5
- };
+ xcb_key_symbols_t *symbols;
+ xcb_keysym_t sym2;
+ int i, j;
+ xcb_keycode_t *keycodes = NULL;
+ int mod_keys_len;
+ const int masks[8] =
+ {
+ XCB_MOD_MASK_SHIFT,
+ XCB_MOD_MASK_LOCK,
+ XCB_MOD_MASK_CONTROL,
+ XCB_MOD_MASK_1,
+ XCB_MOD_MASK_2,
+ XCB_MOD_MASK_3,
+ XCB_MOD_MASK_4,
+ XCB_MOD_MASK_5
+ };
cookie = xcb_get_modifier_mapping_unchecked(_ecore_xcb_conn);
symbols = xcb_key_symbols_alloc(_ecore_xcb_conn);
return 0;
}
- iter = xcb_get_modifier_mapping_keycodes_iterator(reply);
-
- for (i = 0; iter.rem; xcb_keycode_next(&iter), i++)
+ keycodes = xcb_get_modifier_mapping_keycodes(reply);
+ mod_keys_len = xcb_get_modifier_mapping_keycodes_length(reply);
+ for (i = 0; i < mod_keys_len; i++)
{
- for (j = 0; j < 8; j++)
- {
- sym2 = xcb_key_symbols_get_keysym(symbols, *iter.data, j);
- if (sym2 != 0) break;
- }
- if (sym2 == sym)
- {
- int mask;
-
- mask = masks[j];
- free(reply);
- xcb_key_symbols_free(symbols);
- return mask;
- }
+ for (j = 0; j < 8; j++)
+ {
+ sym2 = xcb_key_symbols_get_keysym(symbols, keycodes[i], j);
+ if (sym2 != 0)
+ break;
+ }
+ if (sym2 == sym)
+ {
+ int mask;
+
+ mask = masks[j];
+ free(reply);
+ xcb_key_symbols_free(symbols);
+ return mask;
+ }
}
free(reply);
xcb_key_symbols_free(symbols);
- return 0;
-}
+ return 0;
+} /* _ecore_xcb_key_mask_get */
-typedef struct _Ecore_X_Filter_Data Ecore_X_Filter_Data;
+typedef struct _Ecore_X_Filter_Data Ecore_X_Filter_Data;
struct _Ecore_X_Filter_Data
{
filter_data = calloc(1, sizeof(Ecore_X_Filter_Data));
return filter_data;
-}
+} /* _ecore_xcb_event_filter_start */
-static int
+static Eina_Bool
_ecore_xcb_event_filter_filter(void *data __UNUSED__, void *loop_data,int type, void *event __UNUSED__)
{
Ecore_X_Filter_Data *filter_data;
filter_data = loop_data;
- if (!filter_data) return 1;
+ if (!filter_data)
+ return EINA_TRUE;
+
if (type == ECORE_EVENT_MOUSE_MOVE)
{
- if ((filter_data->last_event_type) == ECORE_EVENT_MOUSE_MOVE)
- {
- filter_data->last_event_type = type;
- return 0;
- }
+ if ((filter_data->last_event_type) == ECORE_EVENT_MOUSE_MOVE)
+ {
+ filter_data->last_event_type = type;
+ return EINA_FALSE;
+ }
}
+
filter_data->last_event_type = type;
- return 1;
-}
+ return EINA_TRUE;
+} /* _ecore_xcb_event_filter_filter */
static void
_ecore_xcb_event_filter_end(void *data __UNUSED__, void *loop_data)
Ecore_X_Filter_Data *filter_data;
filter_data = loop_data;
- if (filter_data) free(filter_data);
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ if (filter_data)
+ free(filter_data);
+} /* _ecore_xcb_event_filter_end */
/*****************************************************************************/
/*****************************************************************************/
/* FIXME: these funcs need categorising */
/*****************************************************************************/
-
-
-
/**
* Get a list of all the root windows on the server.
*
ecore_x_window_root_list(int *num_ret)
{
xcb_screen_iterator_t iter;
- const xcb_setup_t *setup;
- uint8_t i;
- uint8_t num;
- Ecore_X_Window *roots;
+ const xcb_setup_t *setup;
+ uint8_t i;
+ uint8_t num;
+ Ecore_X_Window *roots;
/* #ifdef ECORE_XCBXPRINT */
/* int xp_base, xp_err_base; */
/* #endif /\* ECORE_XCBXPRINT *\/ */
- if (!num_ret) return NULL;
+ if (!num_ret)
+ return NULL;
+
*num_ret = 0;
/* FIXME: todo... */
iter = xcb_setup_roots_iterator (setup);
num = setup->roots_len;
roots = malloc(num * sizeof(Ecore_X_Window));
- if (!roots) return NULL;
+ if (!roots)
+ return NULL;
*num_ret = num;
for (i = 0; iter.rem; xcb_screen_next(&iter), i++)
- roots[i] = iter.data->root;
+ roots[i] = iter.data->root;
/* #endif /\* ECORE_XCBXPRINT *\/ */
return roots;
-}
+} /* ecore_x_window_root_list */
EAPI Ecore_X_Window
ecore_x_window_root_first_get(void)
{
Ecore_X_Window *roots = NULL;
- Ecore_X_Window root;
- int num;
+ Ecore_X_Window root;
+ int num;
roots = ecore_x_window_root_list(&num);
- if(!(roots)) return 0;
+ if(!(roots))
+ return 0;
if (num > 0)
root = roots[0];
free(roots);
return root;
-}
+} /* ecore_x_window_root_first_get */
/* FIXME: todo */
-static void _ecore_x_window_manage_error(void *data);
+static void _ecore_x_window_manage_error(void *data);
static int _ecore_xcb_window_manage_failed = 0;
static void
/* if ((ecore_xcb_error_request_get() == X_ChangeWindowAttributes) && */
/* (ecore_xcb_error_code_get() == BadAccess)) */
/* _ecore_xcb_window_manage_failed = 1; */
-}
+} /* _ecore_x_window_manage_error */
/* FIXME: round trip */
EAPI int
ecore_x_window_manage(Ecore_X_Window window)
{
xcb_get_window_attributes_cookie_t cookie_attr;
- xcb_get_input_focus_cookie_t cookie_sync;
+ xcb_get_input_focus_cookie_t cookie_sync;
xcb_get_window_attributes_reply_t *reply_attr;
- xcb_get_input_focus_reply_t *reply_sync;
- uint32_t value_list;
+ xcb_get_input_focus_reply_t *reply_sync;
+ uint32_t value_list;
cookie_attr = xcb_get_window_attributes_unchecked(_ecore_xcb_conn, window);
cookie_sync = xcb_get_input_focus_unchecked(_ecore_xcb_conn);
if (!reply_attr)
{
reply_sync = xcb_get_input_focus_reply(_ecore_xcb_conn, cookie_sync, NULL);
- if (reply_sync) free(reply_sync);
+ if (reply_sync)
+ free(reply_sync);
+
return 0;
}
reply_sync = xcb_get_input_focus_reply(_ecore_xcb_conn, cookie_sync, NULL);
- if (reply_sync) free(reply_sync);
+ if (reply_sync)
+ free(reply_sync);
_ecore_xcb_window_manage_failed = 0;
/* FIXME: no error code yet */
/* ecore_xcb_error_handler_set(_ecore_xcb_window_manage_error, NULL); */
value_list =
- XCB_EVENT_MASK_KEY_PRESS |
- XCB_EVENT_MASK_KEY_RELEASE |
- XCB_EVENT_MASK_ENTER_WINDOW |
- XCB_EVENT_MASK_LEAVE_WINDOW |
- XCB_EVENT_MASK_STRUCTURE_NOTIFY |
- XCB_EVENT_MASK_RESIZE_REDIRECT |
- XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY |
- XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT |
- XCB_EVENT_MASK_PROPERTY_CHANGE |
- reply_attr->your_event_mask;
+ XCB_EVENT_MASK_KEY_PRESS |
+ XCB_EVENT_MASK_KEY_RELEASE |
+ XCB_EVENT_MASK_ENTER_WINDOW |
+ XCB_EVENT_MASK_LEAVE_WINDOW |
+ XCB_EVENT_MASK_STRUCTURE_NOTIFY |
+ XCB_EVENT_MASK_RESIZE_REDIRECT |
+ XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY |
+ XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT |
+ XCB_EVENT_MASK_PROPERTY_CHANGE |
+ reply_attr->your_event_mask;
xcb_change_window_attributes(_ecore_xcb_conn, window,
XCB_CW_EVENT_MASK,
&value_list);
free(reply_attr);
cookie_sync = xcb_get_input_focus_unchecked(_ecore_xcb_conn);
- if (reply_sync) free(reply_sync);
+ if (reply_sync)
+ free(reply_sync);
/* FIXME: no error code yet */
/* ecore_xcb_error_handler_set(NULL, NULL); */
if (_ecore_xcb_window_manage_failed)
{
- _ecore_xcb_window_manage_failed = 0;
- return 0;
+ _ecore_xcb_window_manage_failed = 0;
+ return 0;
}
return 1;
-}
-
-
-
-
-
-
-
+} /* ecore_x_window_manage */
EAPI int
ecore_x_pointer_control_set(int accel_num,
int accel_denom,
int threshold)
{
- xcb_change_pointer_control(_ecore_xcb_conn,
+ xcb_change_pointer_control(_ecore_xcb_conn,
accel_num, accel_denom, threshold,
1, 1);
return 1;
-}
+} /* ecore_x_pointer_control_set */
EAPI void
ecore_x_pointer_control_get_prefetch(void)
cookie = xcb_get_pointer_control_unchecked(_ecore_xcb_conn);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_pointer_control_get_prefetch */
EAPI void
ecore_x_pointer_control_get_fetch(void)
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_pointer_control_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_pointer_control_get_fetch */
EAPI int
ecore_x_pointer_control_get(int *accel_num,
{
xcb_get_pointer_control_reply_t *reply;
- if (accel_num) *accel_num = 0;
- if (accel_denom) *accel_denom = 1;
- if (threshold) *threshold = 0;
+ if (accel_num)
+ *accel_num = 0;
+
+ if (accel_denom)
+ *accel_denom = 1;
+
+ if (threshold)
+ *threshold = 0;
reply = _ecore_xcb_reply_get();
- if (!reply) return 0;
+ if (!reply)
+ return 0;
- if (accel_num) *accel_num = reply->acceleration_numerator;
- if (accel_denom) *accel_denom = reply->acceleration_denominator;
- if (threshold) *threshold = reply->threshold;
+ if (accel_num)
+ *accel_num = reply->acceleration_numerator;
+
+ if (accel_denom)
+ *accel_denom = reply->acceleration_denominator;
+
+ if (threshold)
+ *threshold = reply->threshold;
return 1;
-}
+} /* ecore_x_pointer_control_get */
EAPI int
ecore_x_pointer_mapping_set(unsigned char *map,
- int nmap)
+ int nmap)
{
xcb_set_pointer_mapping(_ecore_xcb_conn, nmap, map);
return 1;
-}
+} /* ecore_x_pointer_mapping_set */
EAPI void
ecore_x_pointer_mapping_get_prefetch(void)
cookie = xcb_get_pointer_mapping_unchecked(_ecore_xcb_conn);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_pointer_mapping_get_prefetch */
EAPI void
ecore_x_pointer_mapping_get_fetch(void)
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_pointer_mapping_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_pointer_mapping_get_fetch */
EAPI int
ecore_x_pointer_mapping_get(unsigned char *map,
- int nmap)
+ int nmap)
{
xcb_get_pointer_mapping_cookie_t cookie;
xcb_get_pointer_mapping_reply_t *reply;
- uint8_t *tmp;
- int i;
+ uint8_t *tmp;
+ int i;
cookie = xcb_get_pointer_mapping_unchecked(_ecore_xcb_conn);
reply = xcb_get_pointer_mapping_reply(_ecore_xcb_conn, cookie, NULL);
- if (!reply) return 0;
+ if (!reply)
+ return 0;
if (nmap > xcb_get_pointer_mapping_map_length(reply))
- return 0;
+ return 0;
tmp = xcb_get_pointer_mapping_map(reply);
for (i = 0; i < nmap; i++)
- map[i] = tmp[i];
+ map[i] = tmp[i];
return 1;
-}
+} /* ecore_x_pointer_mapping_get */
EAPI int
ecore_x_pointer_grab(Ecore_X_Window window)
xcb_grab_pointer_reply_t *reply;
cookie = xcb_grab_pointer_unchecked(_ecore_xcb_conn, 0, window,
- XCB_EVENT_MASK_BUTTON_PRESS |
+ XCB_EVENT_MASK_BUTTON_PRESS |
XCB_EVENT_MASK_BUTTON_RELEASE |
- XCB_EVENT_MASK_ENTER_WINDOW |
- XCB_EVENT_MASK_LEAVE_WINDOW |
+ XCB_EVENT_MASK_ENTER_WINDOW |
+ XCB_EVENT_MASK_LEAVE_WINDOW |
XCB_EVENT_MASK_POINTER_MOTION,
XCB_GRAB_MODE_ASYNC,
XCB_GRAB_MODE_ASYNC,
free(reply);
return 1;
-}
+} /* ecore_x_pointer_grab */
EAPI int
ecore_x_pointer_confine_grab(Ecore_X_Window window)
xcb_grab_pointer_reply_t *reply;
cookie = xcb_grab_pointer_unchecked(_ecore_xcb_conn, 0, window,
- XCB_EVENT_MASK_BUTTON_PRESS |
+ XCB_EVENT_MASK_BUTTON_PRESS |
XCB_EVENT_MASK_BUTTON_RELEASE |
- XCB_EVENT_MASK_ENTER_WINDOW |
- XCB_EVENT_MASK_LEAVE_WINDOW |
+ XCB_EVENT_MASK_ENTER_WINDOW |
+ XCB_EVENT_MASK_LEAVE_WINDOW |
XCB_EVENT_MASK_POINTER_MOTION,
XCB_GRAB_MODE_ASYNC,
XCB_GRAB_MODE_ASYNC,
free(reply);
return 1;
-}
+} /* ecore_x_pointer_confine_grab */
EAPI void
ecore_x_pointer_ungrab(void)
{
xcb_ungrab_pointer(_ecore_xcb_conn, XCB_CURRENT_TIME);
-}
+} /* ecore_x_pointer_ungrab */
EAPI int
ecore_x_pointer_warp(Ecore_X_Window window,
int x,
int y)
{
- xcb_warp_pointer(_ecore_xcb_conn, XCB_NONE, window, 0, 0, 0, 0, x, y);
+ xcb_warp_pointer(_ecore_xcb_conn, XCB_NONE, window, 0, 0, 0, 0, x, y);
- return 1;
-}
+ return 1;
+} /* ecore_x_pointer_warp */
EAPI int
ecore_x_keyboard_grab(Ecore_X_Window window)
free(reply);
return 1;
-}
+} /* ecore_x_keyboard_grab */
EAPI void
ecore_x_keyboard_ungrab(void)
{
xcb_ungrab_keyboard(_ecore_xcb_conn, XCB_CURRENT_TIME);
-}
+} /* ecore_x_keyboard_ungrab */
EAPI void
ecore_x_grab(void)
if (_ecore_xcb_grab_count == 1)
xcb_grab_server(_ecore_xcb_conn);
-}
+} /* ecore_x_grab */
EAPI void
ecore_x_ungrab(void)
_ecore_xcb_grab_count = 0;
if (_ecore_xcb_grab_count == 0)
- {
- xcb_ungrab_server(_ecore_xcb_conn);
- free(xcb_get_input_focus_reply(_ecore_xcb_conn, xcb_get_input_focus(_ecore_xcb_conn), NULL));
- }
-}
+ {
+ xcb_ungrab_server(_ecore_xcb_conn);
+ free(xcb_get_input_focus_reply(_ecore_xcb_conn, xcb_get_input_focus(_ecore_xcb_conn), NULL));
+ }
+} /* ecore_x_ungrab */
-int _ecore_window_grabs_num = 0;
-Ecore_X_Window *_ecore_window_grabs = NULL;
-int (*_ecore_window_grab_replay_func) (void *data, int event_type, void *event);
-void *_ecore_window_grab_replay_data;
+int _ecore_window_grabs_num = 0;
+Ecore_X_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(int (*func) (void *data,
- int event_type,
- void *event),
- void *data)
+ecore_x_passive_grab_replay_func_set(Eina_Bool (*func)(void *data,
+ int event_type,
+ void *event),
+ void *data)
{
_ecore_window_grab_replay_func = func;
_ecore_window_grab_replay_data = data;
-}
+} /* ecore_x_passive_grab_replay_func_set */
EAPI void
ecore_x_window_button_grab(Ecore_X_Window window,
int mod,
int any_mod)
{
- int i;
+ int i;
uint16_t m;
uint16_t locks[8];
uint16_t ev;
m = _ecore_xcb_event_modifier(mod);
- if (any_mod) m = XCB_BUTTON_MASK_ANY;
+ if (any_mod)
+ m = XCB_BUTTON_MASK_ANY;
+
locks[0] = 0;
locks[1] = ECORE_X_LOCK_CAPS;
locks[2] = ECORE_X_LOCK_NUM;
locks[3] = ECORE_X_LOCK_SCROLL;
- locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM;
- locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL;
- locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
- locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
+ 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++)
- xcb_grab_button(_ecore_xcb_conn, 0, window, ev,
- XCB_GRAB_MODE_SYNC, XCB_GRAB_MODE_ASYNC,
- XCB_NONE, XCB_NONE, button, m | locks[i]);
+ xcb_grab_button(_ecore_xcb_conn, 0, window, ev,
+ XCB_GRAB_MODE_SYNC, XCB_GRAB_MODE_ASYNC,
+ XCB_NONE, XCB_NONE, button, m | locks[i]);
_ecore_window_grabs_num++;
_ecore_window_grabs = realloc(_ecore_window_grabs,
- _ecore_window_grabs_num * sizeof(Ecore_X_Window));
+ _ecore_window_grabs_num * sizeof(Ecore_X_Window));
_ecore_window_grabs[_ecore_window_grabs_num - 1] = window;
-}
+} /* ecore_x_window_button_grab */
void
_ecore_x_sync_magic_send(int val,
xcb_send_event(_ecore_xcb_conn, 0, _ecore_xcb_private_window,
XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
-}
+} /* _ecore_x_sync_magic_send */
void
_ecore_x_window_grab_remove(Ecore_X_Window window)
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] == window))
- shuffle = 1;
- }
- if (shuffle)
- {
- _ecore_window_grabs_num--;
- _ecore_window_grabs = realloc(_ecore_window_grabs,
- _ecore_window_grabs_num * sizeof(Ecore_X_Window));
- }
+ 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] == window))
+ shuffle = 1;
+ }
+ if (shuffle)
+ {
+ _ecore_window_grabs_num--;
+ _ecore_window_grabs = realloc(_ecore_window_grabs,
+ _ecore_window_grabs_num * sizeof(Ecore_X_Window));
+ }
}
-}
+} /* _ecore_x_window_grab_remove */
EAPI void
ecore_x_window_button_ungrab(Ecore_X_Window window,
int mod,
int any_mod)
{
- int i;
+ int i;
uint16_t m;
uint16_t locks[8];
m = _ecore_xcb_event_modifier(mod);
- if (any_mod) m = XCB_BUTTON_MASK_ANY;
+ if (any_mod)
+ m = XCB_BUTTON_MASK_ANY;
+
locks[0] = 0;
locks[1] = ECORE_X_LOCK_CAPS;
locks[2] = ECORE_X_LOCK_NUM;
locks[3] = ECORE_X_LOCK_SCROLL;
- locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM;
- locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL;
- locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
- locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
+ locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM;
+ locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL;
+ locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
+ locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
for (i = 0; i < 8; i++)
- xcb_ungrab_button(_ecore_xcb_conn, button, window, m | locks[i]);
+ xcb_ungrab_button(_ecore_xcb_conn, button, window, m | locks[i]);
_ecore_x_sync_magic_send(1, window);
-}
+} /* ecore_x_window_button_ungrab */
-int _ecore_key_grabs_num = 0;
-Ecore_X_Window *_ecore_key_grabs = NULL;
+int _ecore_key_grabs_num = 0;
+Ecore_X_Window *_ecore_key_grabs = NULL;
EAPI void
ecore_x_window_key_grab(Ecore_X_Window window,
int any_mod)
{
xcb_keycode_t keycode = 0;
- uint16_t m;
- uint16_t locks[8];
- int i;
+ uint16_t m;
+ uint16_t locks[8];
+ int i;
if (!strncmp(key, "Keycode-", 8))
- keycode = atoi(key + 8);
+ keycode = atoi(key + 8);
+
/* FIXME: TODO... */
/* else */
/* if (keysym == NoSymbol) return; */
/* keycode = XKeysymToKeycode(_ecore_xcb_conn, XStringToKeysym(key)); */
/* } */
- if (keycode == 0) return;
+ if (keycode == 0)
+ return;
m = _ecore_xcb_event_modifier(mod);
- if (any_mod) m = XCB_BUTTON_MASK_ANY;
+ if (any_mod)
+ m = XCB_BUTTON_MASK_ANY;
+
locks[0] = 0;
locks[1] = ECORE_X_LOCK_CAPS;
locks[2] = ECORE_X_LOCK_NUM;
locks[3] = ECORE_X_LOCK_SCROLL;
- locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM;
- locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL;
- locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
- locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
+ locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM;
+ locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL;
+ locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
+ locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
for (i = 0; i < 8; i++)
- xcb_grab_key(_ecore_xcb_conn, 1, window, m | locks[i], keycode,
- XCB_GRAB_MODE_SYNC, XCB_GRAB_MODE_ASYNC);
+ xcb_grab_key(_ecore_xcb_conn, 1, window, m | locks[i], keycode,
+ XCB_GRAB_MODE_SYNC, XCB_GRAB_MODE_ASYNC);
_ecore_key_grabs_num++;
_ecore_key_grabs = realloc(_ecore_key_grabs,
- _ecore_key_grabs_num * sizeof(Ecore_X_Window));
+ _ecore_key_grabs_num * sizeof(Ecore_X_Window));
_ecore_key_grabs[_ecore_key_grabs_num - 1] = window;
-}
+} /* ecore_x_window_key_grab */
void
_ecore_x_key_grab_remove(Ecore_X_Window window)
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] == window))
- shuffle = 1;
- }
- if (shuffle)
- {
- _ecore_key_grabs_num--;
- _ecore_key_grabs = realloc(_ecore_key_grabs,
- _ecore_key_grabs_num * sizeof(Ecore_X_Window));
- }
+ 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] == window))
+ shuffle = 1;
+ }
+ if (shuffle)
+ {
+ _ecore_key_grabs_num--;
+ _ecore_key_grabs = realloc(_ecore_key_grabs,
+ _ecore_key_grabs_num * sizeof(Ecore_X_Window));
+ }
}
-}
+} /* _ecore_x_key_grab_remove */
EAPI void
ecore_x_window_key_ungrab(Ecore_X_Window window,
int any_mod)
{
xcb_keycode_t keycode = 0;
- uint16_t m;
- uint16_t locks[8];
- int i;
+ uint16_t m;
+ uint16_t locks[8];
+ int i;
if (!strncmp(key, "Keycode-", 8))
- keycode = atoi(key + 8);
+ keycode = atoi(key + 8);
+
/* FIXME: todo... */
/* else */
/* if (keysym == NoSymbol) return; */
/* keycode = XKeysymToKeycode(_ecore_xcb_conn, XStringToKeysym(key)); */
/* } */
- if (keycode == 0) return;
+ if (keycode == 0)
+ return;
m = _ecore_xcb_event_modifier(mod);
- if (any_mod) m = XCB_BUTTON_MASK_ANY;
+ if (any_mod)
+ m = XCB_BUTTON_MASK_ANY;
+
locks[0] = 0;
locks[1] = ECORE_X_LOCK_CAPS;
locks[2] = ECORE_X_LOCK_NUM;
locks[3] = ECORE_X_LOCK_SCROLL;
- locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM;
- locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL;
- locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
- locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
+ locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM;
+ locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL;
+ locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
+ locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
for (i = 0; i < 8; i++)
- xcb_ungrab_key(_ecore_xcb_conn, keycode, window, m | locks[i]);
+ xcb_ungrab_key(_ecore_xcb_conn, keycode, window, m | locks[i]);
_ecore_x_sync_magic_send(2, window);
-}
+} /* ecore_x_window_key_ungrab */
/**
* Send client message with given type and format 32.
long d3,
long d4)
{
- xcb_client_message_event_t ev;
+ xcb_client_message_event_t ev;
- ev.response_type = XCB_CLIENT_MESSAGE | 0x80;
- ev.format = 32;
- ev.window = window;
- ev.type = type;
- ev.data.data32[0] = d0;
- ev.data.data32[1] = d1;
- ev.data.data32[2] = d2;
- ev.data.data32[3] = d3;
- ev.data.data32[4] = d4;
+ ev.response_type = XCB_CLIENT_MESSAGE | 0x80;
+ ev.format = 32;
+ ev.window = window;
+ ev.type = type;
+ ev.data.data32[0] = d0;
+ ev.data.data32[1] = d1;
+ ev.data.data32[2] = d2;
+ ev.data.data32[3] = d3;
+ ev.data.data32[4] = d4;
- xcb_send_event(_ecore_xcb_conn, 0, window, mask, (const char *)&ev);
+ xcb_send_event(_ecore_xcb_conn, 0, window, mask, (const char *)&ev);
- return 1;
-}
+ return 1;
+} /* ecore_x_client_message32_send */
/**
* Send client message with given type and format 8.
ev.type = type;
if (len > 20)
len = 20;
+
memcpy(ev.data.data8, data, len);
memset(ev.data.data8 + len, 0, 20 - len);
xcb_send_event(_ecore_xcb_conn, 0, window, XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
return 1;
-}
+} /* ecore_x_client_message8_send */
/* FIXME: round trip */
EAPI int
int x,
int y)
{
- xcb_motion_notify_event_t ev;
- xcb_get_geometry_cookie_t cookie_geom;
+ xcb_motion_notify_event_t ev;
+ xcb_get_geometry_cookie_t cookie_geom;
xcb_translate_coordinates_cookie_t cookie_trans;
- xcb_get_geometry_reply_t *reply_geom;
+ xcb_get_geometry_reply_t *reply_geom;
xcb_translate_coordinates_reply_t *reply_trans;
cookie_geom = xcb_get_geometry_unchecked(_ecore_xcb_conn, window);
reply_geom = xcb_get_geometry_reply(_ecore_xcb_conn, cookie_geom, NULL);
- if (!reply_geom) return 0;
+ if (!reply_geom)
+ return 0;
cookie_trans = xcb_translate_coordinates_unchecked(_ecore_xcb_conn, window, reply_geom->root, x, y);
reply_trans = xcb_translate_coordinates_reply(_ecore_xcb_conn, cookie_trans, NULL);
free(reply_trans);
return 1;
-}
+} /* ecore_x_mouse_move_send */
/* FIXME: round trip */
EAPI int
ecore_x_mouse_down_send(Ecore_X_Window window,
int x,
int y,
- int button)
+ int button)
{
- xcb_button_press_event_t ev;
- xcb_get_geometry_cookie_t cookie_geom;
+ xcb_button_press_event_t ev;
+ xcb_get_geometry_cookie_t cookie_geom;
xcb_translate_coordinates_cookie_t cookie_trans;
- xcb_get_geometry_reply_t *reply_geom;
+ xcb_get_geometry_reply_t *reply_geom;
xcb_translate_coordinates_reply_t *reply_trans;
cookie_geom = xcb_get_geometry_unchecked(_ecore_xcb_conn, window);
reply_geom = xcb_get_geometry_reply(_ecore_xcb_conn, cookie_geom, NULL);
- if (!reply_geom) return 0;
+ if (!reply_geom)
+ return 0;
cookie_trans = xcb_translate_coordinates_unchecked(_ecore_xcb_conn, window, reply_geom->root, x, y);
reply_trans = xcb_translate_coordinates_reply(_ecore_xcb_conn, cookie_trans, NULL);
free(reply_trans);
return 1;
-}
+} /* ecore_x_mouse_down_send */
/* FIXME: round trip */
EAPI int
int y,
int button)
{
- xcb_button_release_event_t ev;
- xcb_get_geometry_cookie_t cookie_geom;
+ xcb_button_release_event_t ev;
+ xcb_get_geometry_cookie_t cookie_geom;
xcb_translate_coordinates_cookie_t cookie_trans;
- xcb_get_geometry_reply_t *reply_geom;
+ xcb_get_geometry_reply_t *reply_geom;
xcb_translate_coordinates_reply_t *reply_trans;
cookie_geom = xcb_get_geometry_unchecked(_ecore_xcb_conn, window);
reply_geom = xcb_get_geometry_reply(_ecore_xcb_conn, cookie_geom, NULL);
- if (!reply_geom) return 0;
+ if (!reply_geom)
+ return 0;
cookie_trans = xcb_translate_coordinates_unchecked(_ecore_xcb_conn, window, reply_geom->root, x, y);
reply_trans = xcb_translate_coordinates_reply(_ecore_xcb_conn, cookie_trans, NULL);
free(reply_trans);
return 1;
-}
+} /* ecore_x_mouse_up_send */
EAPI void
ecore_x_focus_reset(void)
(uint8_t)XCB_INPUT_FOCUS_POINTER_ROOT,
XCB_INPUT_FOCUS_POINTER_ROOT,
XCB_CURRENT_TIME);
-}
+} /* ecore_x_focus_reset */
EAPI void
ecore_x_events_allow_all(void)
{
xcb_allow_events(_ecore_xcb_conn, XCB_ALLOW_ASYNC_BOTH, XCB_CURRENT_TIME);
-}
+} /* ecore_x_events_allow_all */
EAPI void
ecore_x_pointer_last_xy_get(int *x,
int *y)
{
- if (x) *x = _ecore_xcb_event_last_root_x;
- if (y) *y = _ecore_xcb_event_last_root_y;
-}
+ if (x)
+ *x = _ecore_xcb_event_last_root_x;
+ if (y)
+ *y = _ecore_xcb_event_last_root_y;
+} /* ecore_x_pointer_last_xy_get */
/*****************************************************************************/
/*****************************************************************************/
{
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_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;
return xmodifiers;
-}
+} /* _ecore_xcb_event_modifier */
+
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#include <string.h>
#include "ecore_xcb_private.h"
-
/**
* @defgroup Ecore_X_Atom_Group XCB Atom Functions
*
_ecore_xcb_atom_init_finalize. The first one gets the cookies and
the second one gets the replies and set the atoms. */
-#define FETCH_ATOM(s) \
- atom_cookies[i] = xcb_intern_atom(_ecore_xcb_conn, 0, strlen(s), s); \
+#define FETCH_ATOM(s)\
+ atom_cookies[i] = xcb_intern_atom(_ecore_xcb_conn, 0, strlen(s), s);\
i++
-#define FETCH_ATOM_FINALIZE(x) \
- reply = xcb_intern_atom_reply(_ecore_xcb_conn, atom_cookies[i], NULL); \
- x = reply->atom; \
- free(reply); \
+#define FETCH_ATOM_FINALIZE(x)\
+ reply = xcb_intern_atom_reply(_ecore_xcb_conn, atom_cookies[i], NULL);\
+ x = reply->atom;\
+ free(reply);\
i++;
void
FETCH_ATOM("_ECORE_SELECTION_CLIPBOARD");
/* These atoms are already internally defined */
- ECORE_X_ATOM_SELECTION_PRIMARY = 1;
+ ECORE_X_ATOM_SELECTION_PRIMARY = 1;
ECORE_X_ATOM_SELECTION_SECONDARY = 2;
- ECORE_X_ATOM_ATOM = 4;
- ECORE_X_ATOM_CARDINAL = 6;
- ECORE_X_ATOM_STRING = 31;
- ECORE_X_ATOM_WINDOW = 33;
- ECORE_X_ATOM_WM_NAME = 39;
- ECORE_X_ATOM_WM_ICON_NAME = 37;
- ECORE_X_ATOM_WM_NORMAL_HINTS = 40;
- ECORE_X_ATOM_WM_SIZE_HINTS = 41;
- ECORE_X_ATOM_WM_HINTS = 35;
- ECORE_X_ATOM_WM_CLASS = 67;
- ECORE_X_ATOM_WM_TRANSIENT_FOR = 68;
- ECORE_X_ATOM_WM_COMMAND = 34;
- ECORE_X_ATOM_WM_CLIENT_MACHINE = 36;
- ECORE_X_ATOM_WM_ICON_SIZE = 38;
+ ECORE_X_ATOM_ATOM = 4;
+ ECORE_X_ATOM_CARDINAL = 6;
+ ECORE_X_ATOM_STRING = 31;
+ ECORE_X_ATOM_WINDOW = 33;
+ ECORE_X_ATOM_WM_NAME = 39;
+ ECORE_X_ATOM_WM_ICON_NAME = 37;
+ ECORE_X_ATOM_WM_NORMAL_HINTS = 40;
+ ECORE_X_ATOM_WM_SIZE_HINTS = 41;
+ ECORE_X_ATOM_WM_HINTS = 35;
+ ECORE_X_ATOM_WM_CLASS = 67;
+ ECORE_X_ATOM_WM_TRANSIENT_FOR = 68;
+ ECORE_X_ATOM_WM_COMMAND = 34;
+ ECORE_X_ATOM_WM_CLIENT_MACHINE = 36;
+ ECORE_X_ATOM_WM_ICON_SIZE = 38;
/* Initialize the globally defined xdnd atoms */
- ECORE_X_DND_ACTION_COPY = ECORE_X_ATOM_XDND_ACTION_COPY;
- ECORE_X_DND_ACTION_MOVE = ECORE_X_ATOM_XDND_ACTION_MOVE;
- ECORE_X_DND_ACTION_LINK = ECORE_X_ATOM_XDND_ACTION_LINK;
- ECORE_X_DND_ACTION_ASK = ECORE_X_ATOM_XDND_ACTION_ASK;
- ECORE_X_DND_ACTION_PRIVATE = ECORE_X_ATOM_XDND_ACTION_PRIVATE;
-}
+ ECORE_X_DND_ACTION_COPY = ECORE_X_ATOM_XDND_ACTION_COPY;
+ ECORE_X_DND_ACTION_MOVE = ECORE_X_ATOM_XDND_ACTION_MOVE;
+ ECORE_X_DND_ACTION_LINK = ECORE_X_ATOM_XDND_ACTION_LINK;
+ ECORE_X_DND_ACTION_ASK = ECORE_X_ATOM_XDND_ACTION_ASK;
+ ECORE_X_DND_ACTION_PRIVATE = ECORE_X_ATOM_XDND_ACTION_PRIVATE;
+} /* _ecore_x_atom_init */
void
_ecore_x_atom_init_finalize(xcb_intern_atom_cookie_t *atom_cookies)
FETCH_ATOM_FINALIZE(ECORE_X_ATOM_SELECTION_PROP_PRIMARY);
FETCH_ATOM_FINALIZE(ECORE_X_ATOM_SELECTION_PROP_SECONDARY);
FETCH_ATOM_FINALIZE(ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD);
-}
-
+} /* _ecore_x_atom_init_finalize */
/**
* Sends the InternAtom request.
cookie = xcb_intern_atom_unchecked(_ecore_xcb_conn, 0, strlen(name), name);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_atom_get_prefetch */
/**
* Gets the reply of the InternAtom request sent by ecore_x_atom_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_atom_get_fetch */
/**
* Retrieves the atom value associated to a name.
xcb_intern_atom_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return XCB_NONE;
+ if (!reply)
+ return XCB_NONE;
return reply->atom;
-}
-
+} /* ecore_x_atom_get */
/**
* Sends the GetAtomName request.
cookie = xcb_get_atom_name_unchecked(_ecore_xcb_conn, atom);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_get_atom_name_prefetch */
/**
* Gets the reply of the GetAtomName request sent by ecore_x_get_atom_name_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_atom_name_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_get_atom_name_fetch */
/**
* Retrieves the name of the given atom.
ecore_x_atom_name_get(Ecore_X_Atom atom)
{
xcb_get_atom_name_reply_t *reply;
- char *name;
- int length;
+ char *name;
+ int length;
reply = _ecore_xcb_reply_get();
- if (!reply) return NULL;
+ if (!reply)
+ return NULL;
length = xcb_get_atom_name_name_length(reply);
name = (char *)malloc(sizeof(char) * (length + 1));
- if (!name) return NULL;
+ if (!name)
+ return NULL;
memcpy(name, xcb_get_atom_name_name(reply), length);
name[length] = '\0';
return name;
-}
+} /* ecore_x_atom_name_get */
+
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#include "ecore_xcb_private.h"
/**
static xcb_composite_query_version_cookie_t _ecore_xcb_composite_init_cookie;
#endif /* ECORE_XCB_COMPOSITE */
-
/* To avoid round trips, the initialization is separated in 2
functions: _ecore_xcb_composite_init and
_ecore_xcb_composite_init_finalize. The first one gets the cookies and
#ifdef ECORE_XCB_COMPOSITE
if (reply && reply->present)
_ecore_xcb_composite_init_cookie = xcb_composite_query_version_unchecked(_ecore_xcb_conn, XCB_COMPOSITE_MAJOR_VERSION, XCB_COMPOSITE_MINOR_VERSION);
+
#endif /* ECORE_XCB_COMPOSITE */
-}
+} /* _ecore_x_composite_init */
void
_ecore_x_composite_init_finalize(void)
xcb_composite_query_version_reply_t *reply;
reply = xcb_composite_query_version_reply(_ecore_xcb_conn,
- _ecore_xcb_composite_init_cookie,
- NULL);
+ _ecore_xcb_composite_init_cookie,
+ NULL);
if (reply)
{
if ((reply->major_version == XCB_COMPOSITE_MAJOR_VERSION) &&
- (reply->minor_version >= XCB_COMPOSITE_MINOR_VERSION))
- _composite_available = 1;
+ (reply->minor_version >= XCB_COMPOSITE_MINOR_VERSION))
+ _composite_available = 1;
+
free(reply);
}
+
#endif /* ECORE_XCB_COMPOSITE */
-}
+} /* _ecore_x_composite_init_finalize */
/**
* Return whether the Composite Extension is available.
{
#ifdef ECORE_XCB_COMPOSITE
return _composite_available;
-#else
+#else /* ifdef ECORE_XCB_COMPOSITE */
return 0;
#endif /* ECORE_XCB_COMPOSITE */
-}
+} /* ecore_x_composite_query */
+
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#include "ecore_xcb_private.h"
#include <xcb/shm.h>
#include <xcb/xcb_image.h>
-
extern int _ecore_xcb_xcursor;
-
EAPI int
ecore_x_cursor_color_supported_get(void)
{
return _ecore_xcb_xcursor;
-}
+} /* ecore_x_cursor_color_supported_get */
EAPI Ecore_X_Cursor
ecore_x_cursor_new(Ecore_X_Window window,
#ifdef ECORE_XCB_CURSOR
if (_ecore_x_xcursor)
{
- Cursor c;
- XcursorImage *xci;
+ Cursor c;
+ XcursorImage *xci;
- xci = XcursorImageCreate(w, h);
- if (xci)
- {
- int i;
+ 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++)
- {
+ 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];
+ xci->pixels[i] = pixels[i];
// (a << 24) | (r << 16) | (g << 8) | (b);
- }
- c = XcursorImageLoadCursor(_ecore_x_disp, xci);
- XcursorImageDestroy(xci);
- return c;
- }
+ }
+ c = XcursorImageLoadCursor(_ecore_x_disp, xci);
+ XcursorImageDestroy(xci);
+ return c;
+ }
}
else
#endif /* ECORE_XCB_CURSOR */
- {
- const uint32_t dither[2][2] =
- {
- {0, 2},
- {3, 1}
- };
- Ecore_X_Drawable draw;
- Ecore_X_Pixmap pixmap;
- Ecore_X_Pixmap mask;
- Ecore_X_GC gc;
- xcb_image_t *image;
- uint32_t *pix;
- uint8_t fr;
- uint8_t fg;
- uint8_t fb;
- uint8_t br;
- uint8_t bg;
- uint8_t bb;
- uint32_t brightest = 0;
- uint32_t darkest = 255 * 3;
- uint16_t x;
- uint16_t y;
+ {
+ const uint32_t dither[2][2] =
+ {
+ {0, 2},
+ {3, 1}
+ };
+ Ecore_X_Drawable draw;
+ Ecore_X_Pixmap pixmap;
+ Ecore_X_Pixmap mask;
+ Ecore_X_GC gc;
+ xcb_image_t *image;
+ uint32_t *pix;
+ uint8_t fr;
+ uint8_t fg;
+ uint8_t fb;
+ uint8_t br;
+ uint8_t bg;
+ uint8_t bb;
+ uint32_t brightest = 0;
+ uint32_t darkest = 255 * 3;
+ uint16_t x;
+ uint16_t y;
- draw = window;
- pixmap = xcb_generate_id(_ecore_xcb_conn);
- xcb_create_pixmap(_ecore_xcb_conn,
- 1, pixmap, draw,
- 1, 1);
- mask = xcb_generate_id(_ecore_xcb_conn);
- xcb_create_pixmap(_ecore_xcb_conn,
- 1, mask, draw,
- 1, 1);
+ draw = window;
+ pixmap = xcb_generate_id(_ecore_xcb_conn);
+ xcb_create_pixmap(_ecore_xcb_conn,
+ 1, pixmap, draw,
+ 1, 1);
+ mask = xcb_generate_id(_ecore_xcb_conn);
+ xcb_create_pixmap(_ecore_xcb_conn,
+ 1, mask, draw,
+ 1, 1);
- image = xcb_image_create_native(_ecore_xcb_conn, w, h,
- XCB_IMAGE_FORMAT_Z_PIXMAP,
- 32, NULL, ~0, NULL);
- image->data = malloc(image->size);
+ image = xcb_image_create_native(_ecore_xcb_conn, w, h,
+ XCB_IMAGE_FORMAT_Z_PIXMAP,
+ 32, NULL, ~0, NULL);
+ image->data = malloc(image->size);
- fr = 0x00; fg = 0x00; fb = 0x00;
- br = 0xff; bg = 0xff; bb = 0xff;
- pix = (uint32_t *)pixels;
- for (y = 0; y < h; y++)
- {
- for (x = 0; x < w; x++)
- {
- uint8_t r, g, b, a;
+ fr = 0x00; fg = 0x00; fb = 0x00;
+ br = 0xff; bg = 0xff; bb = 0xff;
+ pix = (uint32_t *)pixels;
+ for (y = 0; y < h; y++)
+ {
+ for (x = 0; x < w; x++)
+ {
+ uint8_t r, g, b, a;
- a = (pix[0] >> 24) & 0xff;
- r = (pix[0] >> 16) & 0xff;
- g = (pix[0] >> 8 ) & 0xff;
- b = (pix[0] ) & 0xff;
- if (a > 0)
- {
- if ((uint32_t)(r + g + b) > brightest)
- {
- brightest = r + g + b;
- br = r;
- bg = g;
- bb = b;
- }
- if ((uint32_t)(r + g + b) < darkest)
- {
- darkest = r + g + b;
- fr = r;
- fg = g;
- fb = b;
- }
- }
- pix++;
- }
- }
+ a = (pix[0] >> 24) & 0xff;
+ r = (pix[0] >> 16) & 0xff;
+ g = (pix[0] >> 8) & 0xff;
+ b = (pix[0]) & 0xff;
+ if (a > 0)
+ {
+ if ((uint32_t)(r + g + b) > brightest)
+ {
+ brightest = r + g + b;
+ br = r;
+ bg = g;
+ bb = b;
+ }
- pix = (uint32_t *)pixels;
- for (y = 0; y < h; y++)
- {
- for (x = 0; x < w; x++)
- {
- uint32_t v;
- uint8_t r, g, b;
- int32_t d1, d2;
+ if ((uint32_t)(r + g + b) < darkest)
+ {
+ darkest = r + g + b;
+ fr = r;
+ fg = g;
+ fb = b;
+ }
+ }
- r = (pix[0] >> 16) & 0xff;
- g = (pix[0] >> 8 ) & 0xff;
- b = (pix[0] ) & 0xff;
- d1 =
- ((r - fr) * (r - fr)) +
- ((g - fg) * (g - fg)) +
- ((b - fb) * (b - fb));
- d2 =
- ((r - br) * (r - br)) +
- ((g - bg) * (g - bg)) +
- ((b - bb) * (b - bb));
- if (d1 + d2)
- {
- v = (((d2 * 255) / (d1 + d2)) * 5) / 256;
- if (v > dither[x & 0x1][y & 0x1]) v = 1;
- else v = 0;
- }
- else
- {
- v = 0;
- }
- xcb_image_put_pixel(image, x, y, v);
- pix++;
- }
- }
- draw = pixmap;
- gc = xcb_generate_id(_ecore_xcb_conn);
- xcb_create_gc(_ecore_xcb_conn, gc, draw, 0, NULL);
- xcb_image_put(_ecore_xcb_conn, draw, gc, image, 0, 0, 0);
- xcb_free_gc(_ecore_xcb_conn, gc);
+ pix++;
+ }
+ }
- pix = (uint32_t *)pixels;
- for (y = 0; y < h; y++)
- {
- for (x = 0; x < w; x++)
- {
- uint32_t v;
+ pix = (uint32_t *)pixels;
+ for (y = 0; y < h; y++)
+ {
+ for (x = 0; x < w; x++)
+ {
+ uint32_t v;
+ uint8_t r, g, b;
+ int32_t d1, d2;
- v = (((pix[0] >> 24) & 0xff) * 5) / 256;
- if (v > dither[x & 0x1][y & 0x1]) v = 1;
- else v = 0;
- xcb_image_put_pixel(image, x, y, v);
- pix++;
- }
- }
- draw = mask;
- gc = xcb_generate_id(_ecore_xcb_conn);
- xcb_create_gc (_ecore_xcb_conn, gc, draw, 0, NULL);
- xcb_image_put(_ecore_xcb_conn, draw, gc, image, 0, 0, 0);
- xcb_free_gc(_ecore_xcb_conn, gc);
+ 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;
+ }
- free(image->data);
- image->data = NULL;
- xcb_image_destroy(image);
+ xcb_image_put_pixel(image, x, y, v);
+ pix++;
+ }
+ }
+ draw = pixmap;
+ gc = xcb_generate_id(_ecore_xcb_conn);
+ xcb_create_gc(_ecore_xcb_conn, gc, draw, 0, NULL);
+ xcb_image_put(_ecore_xcb_conn, draw, gc, image, 0, 0, 0);
+ xcb_free_gc(_ecore_xcb_conn, gc);
- cursor = xcb_generate_id(_ecore_xcb_conn);
- xcb_create_cursor (_ecore_xcb_conn, cursor,
- pixmap, mask,
- fr << 8 | fr,
- fg << 8 | fg,
- fb << 8 | fb,
- br << 8 | br,
- bg << 8 | bg,
- bb << 8 | bb,
- hot_x,
- hot_y);
- xcb_free_pixmap(_ecore_xcb_conn, pixmap);
- xcb_free_pixmap(_ecore_xcb_conn, mask);
+ pix = (uint32_t *)pixels;
+ for (y = 0; y < h; y++)
+ {
+ for (x = 0; x < w; x++)
+ {
+ uint32_t v;
+
+ v = (((pix[0] >> 24) & 0xff) * 5) / 256;
+ if (v > dither[x & 0x1][y & 0x1])
+ v = 1;
+ else
+ v = 0;
+
+ xcb_image_put_pixel(image, x, y, v);
+ pix++;
+ }
+ }
+ draw = mask;
+ gc = xcb_generate_id(_ecore_xcb_conn);
+ xcb_create_gc (_ecore_xcb_conn, gc, draw, 0, NULL);
+ xcb_image_put(_ecore_xcb_conn, draw, gc, image, 0, 0, 0);
+ xcb_free_gc(_ecore_xcb_conn, gc);
+
+ free(image->data);
+ image->data = NULL;
+ xcb_image_destroy(image);
+
+ cursor = xcb_generate_id(_ecore_xcb_conn);
+ xcb_create_cursor (_ecore_xcb_conn, cursor,
+ pixmap, mask,
+ fr << 8 | fr,
+ fg << 8 | fg,
+ fb << 8 | fb,
+ br << 8 | br,
+ bg << 8 | bg,
+ bb << 8 | bb,
+ hot_x,
+ hot_y);
+ xcb_free_pixmap(_ecore_xcb_conn, pixmap);
+ xcb_free_pixmap(_ecore_xcb_conn, mask);
+
+ return cursor;
+ }
- return cursor;
- }
return 0;
-}
+} /* ecore_x_cursor_new */
EAPI void
ecore_x_cursor_free(Ecore_X_Cursor cursor)
{
xcb_free_cursor(_ecore_xcb_conn, cursor);
-}
+} /* ecore_x_cursor_free */
/*
* Returns the cursor for the given shape.
ecore_x_cursor_shape_get(int shape)
{
Ecore_X_Cursor cursor;
- xcb_font_t font;
+ xcb_font_t font;
/* Shapes are defined in Ecore_X_Cursor.h */
font = xcb_generate_id(_ecore_xcb_conn);
xcb_close_font(_ecore_xcb_conn, font);
return cursor;
-}
+} /* ecore_x_cursor_shape_get */
EAPI void
ecore_x_cursor_size_set(int size)
{
#ifdef ECORE_XCB_CURSOR
XcursorSetDefaultSize(_ecore_x_disp, size);
-#else
+#else /* ifdef ECORE_XCB_CURSOR */
size = 0;
#endif /* ECORE_XCB_CURSOR */
-}
+} /* ecore_x_cursor_size_set */
EAPI int
ecore_x_cursor_size_get(void)
{
#ifdef ECORE_XCB_CURSOR
return XcursorGetDefaultSize(_ecore_x_disp);
-#else
+#else /* ifdef ECORE_XCB_CURSOR */
return 0;
#endif /* ECORE_XCB_CURSOR */
-}
+} /* ecore_x_cursor_size_get */
+
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#include "ecore_xcb_private.h"
-
/**
* @defgroup Ecore_X_Damage_Group X Damage Extension Functions
*
* Functions related to the X Damage extension.
*/
-
#ifdef ECORE_XCB_DAMAGE
static uint8_t _damage_available = 0;
static xcb_damage_query_version_cookie_t _ecore_xcb_damage_init_cookie;
#endif /* ECORE_XCB_DAMAGE */
-
/* To avoid round trips, the initialization is separated in 2
functions: _ecore_xcb_damage_init and
_ecore_xcb_damage_init_finalize. The first one gets the cookies and
#ifdef ECORE_XCB_DAMAGE
if (reply && (reply->present))
_ecore_xcb_damage_init_cookie = xcb_damage_query_version_unchecked(_ecore_xcb_conn, 1, 1);
+
#endif /* ECORE_XCB_DAMAGE */
-}
+} /* _ecore_x_damage_init */
void
_ecore_x_damage_init_finalize(void)
if (reply)
{
if (reply->major_version >= 1)
- _damage_available = 1;
+ _damage_available = 1;
+
free(reply);
}
-#endif /* ECORE_XCB_DAMAGE */
-}
+#endif /* ECORE_XCB_DAMAGE */
+} /* _ecore_x_damage_init_finalize */
/**
* Return whether the Damage Extension is available.
{
#ifdef ECORE_XCB_DAMAGE
return _damage_available;
-#else
+#else /* ifdef ECORE_XCB_DAMAGE */
return 0;
#endif /* ECORE_XCB_DAMAGE */
-}
-
+} /* ecore_x_damage_query */
/**
* Creates a damage object.
#endif /* ECORE_XCB_DAMAGE */
return damage;
-}
-
+} /* ecore_x_damage_new */
/**
* Destroys a damage object.
#ifdef ECORE_XCB_DAMAGE
xcb_damage_destroy(_ecore_xcb_conn, damage);
#endif /* ECORE_XCB_DAMAGE */
-}
-
+} /* ecore_x_damage_free */
/**
* Synchronously modifies the region.
#ifdef ECORE_XCB_DAMAGE
xcb_damage_subtract(_ecore_xcb_conn, damage, repair, parts);
#endif /* ECORE_XCB_DAMAGE */
-}
+} /* ecore_x_damage_subtract */
+
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#include <string.h>
#include "Ecore.h"
#include "ecore_xcb_private.h"
#include "Ecore_X_Atoms.h"
-
-EAPI int ECORE_X_EVENT_XDND_ENTER = 0;
+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_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;
-
void
_ecore_x_dnd_init(void)
{
if (!_ecore_x_dnd_init_count)
{
-
- _source = calloc(1, sizeof(Ecore_X_DND_Source));
- _source->version = ECORE_X_DND_VERSION;
- _source->win = XCB_NONE;
- _source->dest = XCB_NONE;
- _source->state = ECORE_X_DND_SOURCE_IDLE;
- _source->prev.window = 0;
-
- _target = calloc(1, sizeof(Ecore_X_DND_Target));
- _target->win = XCB_NONE;
- _target->source = XCB_NONE;
- _target->state = ECORE_X_DND_TARGET_IDLE;
-
- ECORE_X_EVENT_XDND_ENTER = ecore_event_type_new();
- ECORE_X_EVENT_XDND_POSITION = ecore_event_type_new();
- ECORE_X_EVENT_XDND_STATUS = ecore_event_type_new();
- ECORE_X_EVENT_XDND_LEAVE = ecore_event_type_new();
- ECORE_X_EVENT_XDND_DROP = ecore_event_type_new();
- ECORE_X_EVENT_XDND_FINISHED = ecore_event_type_new();
+ _source = calloc(1, sizeof(Ecore_X_DND_Source));
+ _source->version = ECORE_X_DND_VERSION;
+ _source->win = XCB_NONE;
+ _source->dest = XCB_NONE;
+ _source->state = ECORE_X_DND_SOURCE_IDLE;
+ _source->prev.window = 0;
+
+ _target = calloc(1, sizeof(Ecore_X_DND_Target));
+ _target->win = XCB_NONE;
+ _target->source = XCB_NONE;
+ _target->state = ECORE_X_DND_TARGET_IDLE;
+
+ ECORE_X_EVENT_XDND_ENTER = ecore_event_type_new();
+ ECORE_X_EVENT_XDND_POSITION = ecore_event_type_new();
+ ECORE_X_EVENT_XDND_STATUS = ecore_event_type_new();
+ ECORE_X_EVENT_XDND_LEAVE = ecore_event_type_new();
+ ECORE_X_EVENT_XDND_DROP = ecore_event_type_new();
+ ECORE_X_EVENT_XDND_FINISHED = ecore_event_type_new();
}
_ecore_x_dnd_init_count++;
-}
+} /* _ecore_x_dnd_init */
void
_ecore_x_dnd_shutdown(void)
{
_ecore_x_dnd_init_count--;
if (_ecore_x_dnd_init_count > 0)
- return;
+ return;
if (_source)
- free(_source);
+ free(_source);
+
_source = NULL;
if (_target)
- free(_target);
+ free(_target);
+
_target = NULL;
_ecore_x_dnd_init_count = 0;
-}
+} /* _ecore_x_dnd_shutdown */
EAPI void
ecore_x_dnd_aware_set(Ecore_X_Window window,
Ecore_X_Atom prop_data = ECORE_X_DND_VERSION;
if (on)
- ecore_x_window_prop_property_set(window, ECORE_X_ATOM_XDND_AWARE,
- ECORE_X_ATOM_ATOM, 32, &prop_data, 1);
+ ecore_x_window_prop_property_set(window, ECORE_X_ATOM_XDND_AWARE,
+ ECORE_X_ATOM_ATOM, 32, &prop_data, 1);
else
- ecore_x_window_prop_property_del(window, ECORE_X_ATOM_XDND_AWARE);
-}
+ ecore_x_window_prop_property_del(window, ECORE_X_ATOM_XDND_AWARE);
+} /* ecore_x_dnd_aware_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_ATOM,
0, LONG_MAX);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
-
+} /* ecore_x_dnd_version_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_dnd_version_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_dnd_version_get_fetch */
/**
* Get the DnD version.
EAPI int
ecore_x_dnd_version_get(Ecore_X_Window window)
{
- unsigned char *prop_data;
- int num;
+ unsigned char *prop_data;
+ int num;
if (ecore_x_window_prop_property_get(window, ECORE_X_ATOM_XDND_AWARE,
ECORE_X_ATOM_ATOM, 32, &prop_data, &num))
{
- int version = (int) *prop_data;
- free(prop_data);
- return version;
+ int version = (int)*prop_data;
+ free(prop_data);
+ return version;
}
else
- return 0;
-}
+ return 0;
+} /* ecore_x_dnd_version_get */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_ATOM,
0, LONG_MAX);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
-
+} /* ecore_x_dnd_type_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_dnd_type_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_dnd_type_get_fetch */
/* FIXME: round trip (InternAtomGet request) */
{
xcb_intern_atom_cookie_t cookie;
xcb_intern_atom_reply_t *reply;
- Ecore_X_Atom *atoms;
- unsigned char *data;
- int num;
- int i;
- uint8_t ret = 0;
+ Ecore_X_Atom *atoms;
+ unsigned char *data;
+ int num;
+ int i;
+ uint8_t ret = 0;
cookie = xcb_intern_atom_unchecked(_ecore_xcb_conn, 0,
strlen(type), type);
if (!ecore_x_window_prop_property_get(window, ECORE_X_ATOM_XDND_TYPE_LIST,
- ECORE_X_ATOM_ATOM, 32, &data, &num))
+ ECORE_X_ATOM_ATOM, 32, &data, &num))
{
reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookie, NULL);
- if (reply) free(reply);
+ if (reply)
+ free(reply);
+
return ret;
}
free(data);
return 0;
}
+
atoms = (Ecore_X_Atom *)data;
for (i = 0; i < num; ++i)
{
- if (reply->atom == atoms[i])
- {
- ret = 1;
- break;
- }
+ if (reply->atom == atoms[i])
+ {
+ ret = 1;
+ break;
+ }
}
free(data);
free(reply);
return ret;
-}
+} /* ecore_x_dnd_type_isset */
/* FIXME: round trip (InternAtomGet request) */
{
xcb_intern_atom_cookie_t cookie;
xcb_intern_atom_reply_t *reply;
- Ecore_X_Atom *oldset = NULL;
- Ecore_X_Atom *newset = NULL;
- unsigned char *data = NULL;
- unsigned char *old_data = NULL;
- Ecore_X_Atom atom;
- int i, j = 0, num = 0;
+ Ecore_X_Atom *oldset = NULL;
+ Ecore_X_Atom *newset = NULL;
+ unsigned char *data = NULL;
+ unsigned char *old_data = NULL;
+ Ecore_X_Atom atom;
+ int i, j = 0, num = 0;
cookie = xcb_intern_atom_unchecked(_ecore_xcb_conn, 0,
strlen(type), type);
32, &old_data, &num))
{
reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookie, NULL);
- if (reply) free(reply);
+ if (reply)
+ free(reply);
+
return;
}
+
oldset = (Ecore_X_Atom *)old_data;
if (on)
{
- if (ecore_x_dnd_type_isset(window, type))
- {
- free(old_data);
+ if (ecore_x_dnd_type_isset(window, type))
+ {
+ free(old_data);
reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookie, NULL);
- if (reply) free(reply);
- return;
- }
- data = calloc(num + 1, sizeof(Ecore_X_Atom));
- if (!data)
+ if (reply)
+ free(reply);
+
+ return;
+ }
+
+ data = calloc(num + 1, sizeof(Ecore_X_Atom));
+ if (!data)
{
- free(old_data);
+ free(old_data);
reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookie, NULL);
- if (reply) free(reply);
+ if (reply)
+ free(reply);
+
return;
}
- newset = (Ecore_X_Atom *)data;
- for (i = 0; i < num; i++)
- newset[i + 1] = oldset[i];
- /* prepend the new type */
+ newset = (Ecore_X_Atom *)data;
+
+ for (i = 0; i < num; i++)
+ newset[i + 1] = oldset[i];
+ /* prepend the new type */
reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookie, NULL);
if (!reply)
{
- free(old_data);
- return;
+ free(old_data);
+ return;
}
- newset[0] = reply->atom;
+
+ newset[0] = reply->atom;
free(reply);
- ecore_x_window_prop_property_set(window,
+ ecore_x_window_prop_property_set(window,
ECORE_X_ATOM_XDND_TYPE_LIST,
ECORE_X_ATOM_ATOM,
32, data, num + 1);
}
else
{
- if (!ecore_x_dnd_type_isset(window, type))
- {
- free(old_data);
- return;
- }
- newset = calloc(num - 1, sizeof(Ecore_X_Atom));
- if (!newset)
- {
- free(old_data);
- return;
- }
- data = (unsigned char *)newset;
- for (i = 0; i < num; i++)
- if (oldset[i] != atom)
- newset[j++] = oldset[i];
-
- ecore_x_window_prop_property_set(window,
+ if (!ecore_x_dnd_type_isset(window, type))
+ {
+ free(old_data);
+ return;
+ }
+
+ newset = calloc(num - 1, sizeof(Ecore_X_Atom));
+ if (!newset)
+ {
+ free(old_data);
+ return;
+ }
+
+ data = (unsigned char *)newset;
+ for (i = 0; i < num; i++)
+ if (oldset[i] != atom)
+ newset[j++] = oldset[i];
+
+ ecore_x_window_prop_property_set(window,
ECORE_X_ATOM_XDND_TYPE_LIST,
ECORE_X_ATOM_ATOM,
32, data, num - 1);
free(oldset);
free(newset);
-}
+} /* ecore_x_dnd_type_set */
/* FIXME: round trips, but I don't think we can do much, here */
unsigned int num_types)
{
Ecore_X_Atom *newset = NULL;
- void *data = NULL;
- uint32_t i;
+ void *data = NULL;
+ uint32_t i;
if (!num_types)
{
- ecore_x_window_prop_property_del(window, ECORE_X_ATOM_XDND_TYPE_LIST);
+ ecore_x_window_prop_property_del(window, ECORE_X_ATOM_XDND_TYPE_LIST);
}
else
{
xcb_intern_atom_cookie_t *cookies;
- xcb_intern_atom_reply_t *reply;
+ xcb_intern_atom_reply_t *reply;
cookies = (xcb_intern_atom_cookie_t *)malloc(sizeof(xcb_intern_atom_cookie_t));
- if (!cookies) return;
- for (i = 0; i < num_types; i++)
- cookies[i] = xcb_intern_atom_unchecked(_ecore_xcb_conn, 0,
- strlen(types[i]), types[i]);
+ if (!cookies)
+ return;
+
+ for (i = 0; i < num_types; i++)
+ cookies[i] = xcb_intern_atom_unchecked(_ecore_xcb_conn, 0,
+ strlen(types[i]), types[i]);
data = calloc(num_types, sizeof(Ecore_X_Atom));
- if (!data)
+ if (!data)
{
- for (i = 0; i < num_types; i++)
- {
- reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookies[i], NULL);
- if (reply) free(reply);
- }
- free(cookies);
- return;
+ for (i = 0; i < num_types; i++)
+ {
+ reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookies[i], NULL);
+ if (reply)
+ free(reply);
+ }
+ free(cookies);
+ return;
}
- newset = data;
- for (i = 0; i < num_types; i++)
+
+ newset = data;
+ for (i = 0; i < num_types; i++)
{
reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookies[i], NULL);
if (reply)
free(reply);
}
else
- newset[i] = XCB_NONE;
+ newset[i] = XCB_NONE;
}
free(cookies);
- ecore_x_window_prop_property_set(window, ECORE_X_ATOM_XDND_TYPE_LIST,
+ ecore_x_window_prop_property_set(window, ECORE_X_ATOM_XDND_TYPE_LIST,
ECORE_X_ATOM_ATOM, 32, data, num_types);
- free(data);
+ free(data);
}
-}
+} /* ecore_x_dnd_types_set */
Ecore_X_DND_Source *
_ecore_x_dnd_source_get(void)
{
return _source;
-}
+} /* _ecore_x_dnd_source_get */
Ecore_X_DND_Target *
_ecore_x_dnd_target_get(void)
{
return _target;
-}
+} /* _ecore_x_dnd_target_get */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_ATOM,
0, LONG_MAX);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
-
+} /* ecore_x_dnd_begin_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_dnd_begin_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_dnd_begin_fetch */
/* FIXME: round trip */
ecore_x_selection_xdnd_prefetch();
ecore_x_selection_xdnd_fetch();
if (!ecore_x_selection_xdnd_set(source, data, size))
- return 0;
+ return 0;
_source->win = source;
ecore_x_window_ignore_set(_source->win, 1);
_source->action = ECORE_X_ATOM_XDND_ACTION_COPY;
_source->accepted_action = XCB_NONE;
return 1;
-}
+} /* ecore_x_dnd_begin */
EAPI int
ecore_x_dnd_drop(void)
{
xcb_client_message_event_t ev;
- ev.response_type = XCB_CLIENT_MESSAGE;
- ev.format = 32;
- ev.window = _source->dest;
-
- if (_source->will_accept)
- {
- ev.type = ECORE_X_ATOM_XDND_DROP;
- ev.data.data32[0] = _source->win;
- ev.data.data32[1] = 0;
- ev.data.data32[2] = _source->time;
- xcb_send_event(_ecore_xcb_conn, 0, _source->dest, 0, (const char *)&ev);
- _source->state = ECORE_X_DND_SOURCE_DROPPED;
- status = 1;
- }
- else
- {
- ev.type = ECORE_X_ATOM_XDND_LEAVE;
- ev.data.data32[0] = _source->win;
- ev.data.data32[1] = 0;
- xcb_send_event(_ecore_xcb_conn, 0, _source->dest, 0, (const char *)&ev);
- _source->state = ECORE_X_DND_SOURCE_IDLE;
- }
+ ev.response_type = XCB_CLIENT_MESSAGE;
+ ev.format = 32;
+ ev.window = _source->dest;
+
+ if (_source->will_accept)
+ {
+ ev.type = ECORE_X_ATOM_XDND_DROP;
+ ev.data.data32[0] = _source->win;
+ ev.data.data32[1] = 0;
+ ev.data.data32[2] = _source->time;
+ xcb_send_event(_ecore_xcb_conn, 0, _source->dest, 0, (const char *)&ev);
+ _source->state = ECORE_X_DND_SOURCE_DROPPED;
+ status = 1;
+ }
+ else
+ {
+ ev.type = ECORE_X_ATOM_XDND_LEAVE;
+ ev.data.data32[0] = _source->win;
+ ev.data.data32[1] = 0;
+ xcb_send_event(_ecore_xcb_conn, 0, _source->dest, 0, (const char *)&ev);
+ _source->state = ECORE_X_DND_SOURCE_IDLE;
+ }
}
else
{
- /* Dropping on nothing */
- ecore_x_selection_xdnd_clear();
- _source->state = ECORE_X_DND_SOURCE_IDLE;
+ /* 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;
_source->dest = XCB_NONE;
return status;
-}
+} /* ecore_x_dnd_drop */
EAPI void
ecore_x_dnd_send_status(int will_accept,
xcb_client_message_event_t ev;
if (_target->state == ECORE_X_DND_TARGET_IDLE)
- return;
+ return;
_target->will_accept = will_accept;
ev.data.data32[0] = _target->win;
ev.data.data32[1] = 0;
if (will_accept)
- ev.data.data32[1] |= 0x1UL;
+ ev.data.data32[1] |= 0x1UL;
+
if (!suppress)
- ev.data.data32[1] |= 0x2UL;
+ ev.data.data32[1] |= 0x2UL;
/* Set rectangle information */
ev.data.data32[2] = rectangle.x;
if (will_accept)
{
- ev.data.data32[4] = action;
- _target->accepted_action = action;
+ ev.data.data32[4] = action;
+ _target->accepted_action = action;
}
else
{
- ev.data.data32[4] = XCB_NONE;
- _target->accepted_action = action;
+ ev.data.data32[4] = XCB_NONE;
+ _target->accepted_action = action;
}
xcb_send_event(_ecore_xcb_conn, 0, _target->source, 0, (const char *)&ev);
-}
+} /* ecore_x_dnd_send_status */
EAPI void
ecore_x_dnd_send_finished(void)
xcb_client_message_event_t ev;
if (_target->state == ECORE_X_DND_TARGET_IDLE)
- return;
+ return;
ev.response_type = XCB_CLIENT_MESSAGE;
ev.format = 32;
ev.data.data32[2] = 0;
if (_target->will_accept)
{
- ev.data.data32[1] |= 0x1UL;
- ev.data.data32[2] = _target->accepted_action;
+ ev.data.data32[1] |= 0x1UL;
+ ev.data.data32[2] = _target->accepted_action;
}
+
xcb_send_event(_ecore_xcb_conn, 0, _target->source, 0, (const char *)&ev);
_target->state = ECORE_X_DND_TARGET_IDLE;
-}
+} /* ecore_x_dnd_send_finished */
void
ecore_x_dnd_source_action_set(Ecore_X_Atom action)
{
_source->action = action;
if (_source->prev.window)
- _ecore_x_dnd_drag(_source->prev.window, _source->prev.x, _source->prev.y);
-}
+ _ecore_x_dnd_drag(_source->prev.window, _source->prev.x, _source->prev.y);
+} /* ecore_x_dnd_source_action_set */
Ecore_X_Atom
ecore_x_dnd_source_action_get(void)
{
return _source->action;
-}
+} /* ecore_x_dnd_source_action_get */
void
_ecore_x_dnd_drag(Ecore_X_Window root,
- int x,
- int y)
+ int x,
+ int y)
{
xcb_client_message_event_t ev;
- Ecore_X_Window win;
- Ecore_X_Window *skip;
- int num;
+ Ecore_X_Window win;
+ Ecore_X_Window *skip;
+ int num;
if (_source->state != ECORE_X_DND_SOURCE_DRAGGING)
- return;
+ return;
ev.response_type = XCB_CLIENT_MESSAGE;
ev.format = 32;
if (ecore_x_dnd_version_get(win))
{
reply_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_tree, NULL);
- if (reply_tree) free(reply_tree);
+ if (reply_tree)
+ free(reply_tree);
+
break;
}
+
reply_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_tree, NULL);
if (reply_tree)
{
- win = reply_tree->parent;
- free(reply_tree);
+ win = reply_tree->parent;
+ free(reply_tree);
}
}
/* Send XdndLeave to current destination window if we have left it */
if ((_source->dest) && (win != _source->dest))
{
- ev.window = _source->dest;
- ev.type = ECORE_X_ATOM_XDND_LEAVE;
- ev.data.data32[0] = _source->win;
- ev.data.data32[1] = 0;
+ ev.window = _source->dest;
+ ev.type = ECORE_X_ATOM_XDND_LEAVE;
+ ev.data.data32[0] = _source->win;
+ ev.data.data32[1] = 0;
- xcb_send_event(_ecore_xcb_conn, 0, _source->dest, 0, (const char *)&ev);
- _source->suppress = 0;
+ xcb_send_event(_ecore_xcb_conn, 0, _source->dest, 0, (const char *)&ev);
+ _source->suppress = 0;
}
if (win)
{
- int16_t x1;
- int16_t x2;
- int16_t y1;
- int16_t y2;
+ int16_t x1;
+ int16_t x2;
+ int16_t y1;
+ int16_t y2;
ecore_x_dnd_version_get_prefetch(win);
ecore_x_dnd_type_get_prefetch(_source->win);
ecore_x_dnd_version_get_fetch();
if (!ecore_x_dnd_version_get(win))
{
- ecore_x_dnd_type_get_fetch();
- return;
+ ecore_x_dnd_type_get_fetch();
+ return;
}
- _source->version = MIN(ECORE_X_DND_VERSION,
+ _source->version = MIN(ECORE_X_DND_VERSION,
ecore_x_dnd_version_get(win));
- if (win != _source->dest)
- {
- unsigned char *data;
- Ecore_X_Atom *types;
- int num;
- int i;
+ if (win != _source->dest)
+ {
+ unsigned char *data;
+ Ecore_X_Atom *types;
+ int num;
+ int i;
ecore_x_dnd_type_get_fetch();
if (!ecore_x_window_prop_property_get(_source->win,
ECORE_X_ATOM_XDND_TYPE_LIST,
ECORE_X_ATOM_ATOM,
32, &data, &num))
- return;
-
- types = (Ecore_X_Atom *)data;
-
- /* Entered new window, send XdndEnter */
- ev.window = win;
- ev.type = ECORE_X_ATOM_XDND_ENTER;
- ev.data.data32[0] = _source->win;
- ev.data.data32[1] = 0;
- if (num > 3)
- ev.data.data32[1] |= 0x1UL;
- else
- ev.data.data32[1] &= 0xfffffffeUL;
- ev.data.data32[1] |= ((unsigned long) _source->version) << 24;
-
- for (i = 2; i < 5; i++)
- ev.data.data32[i] = 0;
- for (i = 0; i < MIN(num, 3); ++i)
- ev.data.data32[i + 2] = types[i];
- free(data);
- xcb_send_event(_ecore_xcb_conn, 0, win, 0, (const char *)&ev);
- _source->await_status = 0;
- _source->will_accept = 0;
- }
+ return;
+
+ types = (Ecore_X_Atom *)data;
+
+ /* Entered new window, send XdndEnter */
+ ev.window = win;
+ ev.type = ECORE_X_ATOM_XDND_ENTER;
+ ev.data.data32[0] = _source->win;
+ ev.data.data32[1] = 0;
+ if (num > 3)
+ ev.data.data32[1] |= 0x1UL;
+ else
+ ev.data.data32[1] &= 0xfffffffeUL;
+
+ ev.data.data32[1] |= ((unsigned long)_source->version) << 24;
+
+ for (i = 2; i < 5; i++)
+ ev.data.data32[i] = 0;
+ for (i = 0; i < MIN(num, 3); ++i)
+ ev.data.data32[i + 2] = types[i];
+ free(data);
+ xcb_send_event(_ecore_xcb_conn, 0, win, 0, (const char *)&ev);
+ _source->await_status = 0;
+ _source->will_accept = 0;
+ }
else
- ecore_x_dnd_type_get_fetch();
-
- /* 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)))
- {
- ev.window = win;
- ev.type = ECORE_X_ATOM_XDND_POSITION;
- ev.data.data32[0] = _source->win;
- ev.data.data32[1] = 0; /* Reserved */
- ev.data.data32[2] = ((x << 16) & 0xffff0000) | (y & 0xffff);
- ev.data.data32[3] = _source->time; /* Version 1 */
- ev.data.data32[4] = _source->action; /* Version 2, Needs to be pre-set */
- xcb_send_event(_ecore_xcb_conn, 0, win, 0, (const char *)&ev);
-
- _source->await_status = 1;
- }
+ ecore_x_dnd_type_get_fetch();
+
+ /* 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)))
+ {
+ ev.window = win;
+ ev.type = ECORE_X_ATOM_XDND_POSITION;
+ ev.data.data32[0] = _source->win;
+ ev.data.data32[1] = 0; /* Reserved */
+ ev.data.data32[2] = ((x << 16) & 0xffff0000) | (y & 0xffff);
+ ev.data.data32[3] = _source->time; /* Version 1 */
+ ev.data.data32[4] = _source->action; /* Version 2, Needs to be pre-set */
+ xcb_send_event(_ecore_xcb_conn, 0, win, 0, (const char *)&ev);
+
+ _source->await_status = 1;
+ }
}
_source->prev.x = x;
_source->prev.y = y;
_source->prev.window = root;
_source->dest = win;
-}
+} /* _ecore_x_dnd_drag */
+
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#include "ecore_xcb_private.h"
-
/**
* @defgroup Ecore_X_DPMS_Group X DPMS Extension Functions
*
* Functions related to the X DPMS extension.
*/
-
#ifdef ECORE_XCB_DPMS
static int _dpms_available = 0;
static xcb_dpms_get_version_cookie_t _ecore_xcb_dpms_init_cookie;
#ifdef ECORE_XCB_DPMS
if (reply && (reply->present))
_ecore_xcb_dpms_init_cookie = xcb_dpms_get_version_unchecked(_ecore_xcb_conn, 0, 0);
+
#endif /* ECORE_XCB_DPMS */
-}
+} /* _ecore_x_dpms_init */
void
_ecore_x_dpms_init_finalize(void)
if (reply)
{
if (reply->server_major_version >= 1)
- _dpms_available = 1;
+ _dpms_available = 1;
+
free(reply);
}
-#endif /* ECORE_XCB_DPMS */
-}
+#endif /* ECORE_XCB_DPMS */
+} /* _ecore_x_dpms_init_finalize */
/**
* Checks if the DPMS extension is available or not.
{
#ifdef ECORE_XCB_DPMS
return _dpms_available;
-#else
+#else /* ifdef ECORE_XCB_DPMS */
return 0;
#endif /* ECORE_XCB_DPMS */
-}
-
+} /* ecore_x_dpms_query */
/**
* Sends the DPMSCapable request.
cookie = xcb_dpms_capable_unchecked(_ecore_xcb_conn);
_ecore_xcb_cookie_cache(cookie.sequence);
#endif /* ECORE_XCB_DPMS */
-}
-
+} /* ecore_x_dpms_capable_get_prefetch */
/**
* Gets the reply of the DPMSCapable request sent by ecore_x_dpms_capable_get_prefetch().
reply = xcb_dpms_capable_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
#endif /* ECORE_XCB_DPMS */
-}
-
+} /* ecore_x_dpms_capable_get_fetch */
/**
* Checks if the X server is capable of DPMS.
EAPI int
ecore_x_dpms_capable_get(void)
{
- int capable = 0;
+ int capable = 0;
#ifdef ECORE_XCB_DPMS
xcb_dpms_capable_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return 0;
+ if (!reply)
+ return 0;
capable = reply->capable;
#endif /* ECORE_XCB_DPMS */
return capable;
-}
-
+} /* ecore_x_dpms_capable_get */
/**
* Sends the DPMSInfo request.
cookie = xcb_dpms_info_unchecked(_ecore_xcb_conn);
_ecore_xcb_cookie_cache(cookie.sequence);
#endif /* ECORE_XCB_DPMS */
-}
-
+} /* ecore_x_dpms_enable_get_prefetch */
/**
* Gets the reply of the DPMSInfo request sent by ecore_x_dpms_enable_get_prefetch().
reply = xcb_dpms_info_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
#endif /* ECORE_XCB_DPMS */
-}
-
+} /* ecore_x_dpms_enable_get_fetch */
/**
* Checks the DPMS state of the display.
EAPI int
ecore_x_dpms_enable_get(void)
{
- int enable = 0;
+ int enable = 0;
#ifdef ECORE_XCB_DPMS
xcb_dpms_info_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return 0;
+ if (!reply)
+ return 0;
enable = reply->state;
#endif /* ECORE_XCB_DPMS */
return enable;
-}
-
+} /* ecore_x_dpms_enable_get */
/**
* Sets the DPMS state of the display.
xcb_dpms_enable(_ecore_xcb_conn);
else
xcb_dpms_disable(_ecore_xcb_conn);
-#endif /* ECORE_XCB_DPMS */
-}
+#endif /* ECORE_XCB_DPMS */
+} /* ecore_x_dpms_enabled_set */
/**
* Sets the timeouts. The values are in unit of seconds.
#endif /* ECORE_XCB_DPMS */
return 1;
-}
-
+} /* ecore_x_dpms_timeouts_set */
/**
* Sends the DPMSGetTimeouts request.
cookie = xcb_dpms_get_timeouts_unchecked(_ecore_xcb_conn);
_ecore_xcb_cookie_cache(cookie.sequence);
#endif /* ECORE_XCB_DPMS */
-}
-
+} /* ecore_x_dpms_timeouts_get_prefetch */
/**
* Gets the reply of the DPMSGetTimeouts request sent by ecore_x_dpms_timeouts_get_prefetch().
reply = xcb_dpms_get_timeouts_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
#endif /* ECORE_XCB_DPMS */
-}
-
+} /* ecore_x_dpms_timeouts_get_fetch */
/**
* Gets the timeouts. The values are in unit of seconds.
reply = _ecore_xcb_reply_get();
if (reply)
{
- if (standby) *standby = reply->standby_timeout;
- if (suspend) *suspend = reply->suspend_timeout;
- if (off) *off = 0;
+ if (standby)
+ *standby = reply->standby_timeout;
+
+ if (suspend)
+ *suspend = reply->suspend_timeout;
+
+ if (off)
+ *off = 0;
}
else
#endif /* ECORE_XCB_DPMS */
- {
- if (standby) *standby = 0;
- if (suspend) *suspend = 0;
- if (off) *off = 0;
- }
-}
+ {
+ if (standby)
+ *standby = 0;
+ if (suspend)
+ *suspend = 0;
+
+ if (off)
+ *off = 0;
+ }
+} /* ecore_x_dpms_timeouts_get */
/**
* Returns the amount of time of inactivity before standby mode is invoked.
EAPI unsigned int
ecore_x_dpms_timeout_standby_get(void)
{
- int standby = 0;
+ int standby = 0;
#ifdef ECORE_XCB_DPMS
xcb_dpms_get_timeouts_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return 0;
+ if (!reply)
+ return 0;
standby = reply->standby_timeout;
#endif /* ECORE_XCB_DPMS */
return standby;
-}
-
+} /* ecore_x_dpms_timeout_standby_get */
/**
* Returns the amount of time of inactivity before the second level of
EAPI unsigned int
ecore_x_dpms_timeout_suspend_get(void)
{
- int suspend = 0;;
+ int suspend = 0;
#ifdef ECORE_XCB_DPMS
xcb_dpms_get_timeouts_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return 0;
+ if (!reply)
+ return 0;
suspend = reply->suspend_timeout;
#endif /* ECORE_XCB_DPMS */
return suspend;
-}
-
+} /* ecore_x_dpms_timeout_suspend_get */
/**
* Returns the amount of time of inactivity before the third and final
EAPI unsigned int
ecore_x_dpms_timeout_off_get(void)
{
- int off = 0;
+ int off = 0;
#ifdef ECORE_XCB_DPMS
xcb_dpms_get_timeouts_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return 0;
+ if (!reply)
+ return 0;
off = reply->off_timeout;
#endif /* ECORE_XCB_DPMS */
return off;
-}
-
+} /* ecore_x_dpms_timeout_off_get */
/**
* Sets the standby timeout (in unit of seconds).
xcb_dpms_get_timeouts_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return;
+ if (!reply)
+ return;
xcb_dpms_set_timeouts(_ecore_xcb_conn,
new_standby,
reply->suspend_timeout,
reply->off_timeout);
#endif /* ECORE_XCB_DPMS */
-}
-
+} /* ecore_x_dpms_timeout_standby_set */
/**
* Sets the suspend timeout (in unit of seconds).
xcb_dpms_get_timeouts_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return;
+ if (!reply)
+ return;
xcb_dpms_set_timeouts(_ecore_xcb_conn,
reply->standby_timeout,
new_suspend,
reply->off_timeout);
#endif /* ECORE_XCB_DPMS */
-}
-
+} /* ecore_x_dpms_timeout_suspend_set */
/**
* Sets the off timeout (in unit of seconds).
xcb_dpms_get_timeouts_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return;
+ if (!reply)
+ return;
xcb_dpms_set_timeouts(_ecore_xcb_conn,
reply->standby_timeout,
reply->suspend_timeout,
new_off);
#endif /* ECORE_XCB_DPMS */
-}
+} /* ecore_x_dpms_timeout_off_set */
+
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#include "ecore_xcb_private.h"
#include <xcb/xcb.h>
-
/**
* @defgroup Ecore_X_Drawable_Group X Drawable Functions
*
* Functions that operate on drawables.
*/
-
/**
* Sends the GetGeometry request.
* @param drawable Drawable whose characteristics are sought.
cookie = xcb_get_geometry_unchecked(_ecore_xcb_conn, drawable);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
-
+} /* ecore_x_drawable_geometry_get_prefetch */
/**
* Gets the reply of the GetGeometry request sent by ecore_x_atom_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_geometry_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
-
+} /* ecore_x_drawable_geometry_get_fetch */
/**
* Retrieves the geometry of the given drawable.
*/
EAPI void
ecore_x_drawable_geometry_get(Ecore_X_Drawable drawable __UNUSED__,
- int *x,
- int *y,
- int *width,
- int *height)
+ int *x,
+ int *y,
+ int *width,
+ int *height)
{
xcb_get_geometry_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply)
{
- if (x) *x = 0;
- if (y) *y = 0;
- if (width) *width = 0;
- if (height) *height = 0;
+ if (x)
+ *x = 0;
+
+ if (y)
+ *y = 0;
+
+ if (width)
+ *width = 0;
+
+ if (height)
+ *height = 0;
+
return;
}
- if (x) *x = reply->x;
- if (y) *y = reply->y;
- if (width) *width = reply->width;
- if (height) *height = reply->height;
-}
+ if (x)
+ *x = reply->x;
+
+ if (y)
+ *y = reply->y;
+ if (width)
+ *width = reply->width;
+
+ if (height)
+ *height = reply->height;
+} /* ecore_x_drawable_geometry_get */
/**
* Retrieves the width of the border of the given drawable.
reply = _ecore_xcb_reply_get();
if (!reply)
- return 0;
+ return 0;
return reply->border_width;
-}
-
+} /* ecore_x_drawable_border_width_get */
/**
* Retrieves the depth of the given drawable.
reply = _ecore_xcb_reply_get();
if (!reply)
- return 0;
+ return 0;
return reply->depth;
-}
+} /* ecore_x_drawable_depth_get */
/**
* Fill the specified rectangle on a drawable.
rectangle.width = width;
rectangle.height = height;
xcb_poly_fill_rectangle(_ecore_xcb_conn, d, gc, 1, &rectangle);
-}
+} /* ecore_x_drawable_rectangle_fill */
+
/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
-/*
* OLD E hints
*/
#include "ecore_xcb_private.h"
#include "Ecore_X_Atoms.h"
-
EAPI void
ecore_x_e_frame_size_set(Ecore_X_Window window,
int fl,
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
ECORE_X_ATOM_E_FRAME_SIZE, ECORE_X_ATOM_CARDINAL, 32,
4, (const void *)frames);
-}
+} /* ecore_x_e_frame_size_set */
+
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#include <stdlib.h>
#include <stdio.h>
#include "ecore_xcb_private.h"
#include "Ecore_X_Atoms.h"
-
/** OpenBSD does not define CODESET
* FIXME ??
*/
#ifndef CODESET
#define CODESET "INVALID"
-#endif
+#endif /* ifndef CODESET */
#if 0
-static void _ecore_x_event_free_window_prop_name_class_change(void *data, void *ev);
-static void _ecore_x_event_free_window_prop_title_change(void *data, void *ev);
-static void _ecore_x_event_free_window_prop_visible_title_change(void *data, void *ev);
-static void _ecore_x_event_free_window_prop_icon_name_change(void *data, void *ev);
-static void _ecore_x_event_free_window_prop_visible_icon_name_change(void *data, void *ev);
-static void _ecore_x_event_free_window_prop_client_machine_change(void *data, void *ev);
-#endif
+static void _ecore_x_event_free_window_prop_name_class_change(void *data, void *ev);
+static void _ecore_x_event_free_window_prop_title_change(void *data, void *ev);
+static void _ecore_x_event_free_window_prop_visible_title_change(void *data, void *ev);
+static void _ecore_x_event_free_window_prop_icon_name_change(void *data, void *ev);
+static void _ecore_x_event_free_window_prop_visible_icon_name_change(void *data, void *ev);
+static void _ecore_x_event_free_window_prop_client_machine_change(void *data, void *ev);
+#endif /* if 0 */
static Ecore_X_Window _ecore_xcb_mouse_down_last_window = 0;
static Ecore_X_Window _ecore_xcb_mouse_down_last_last_window = 0;
static Ecore_X_Window _ecore_xcb_mouse_down_last_event_window = 0;
static Ecore_X_Window _ecore_xcb_mouse_down_last_last_event_window = 0;
-static Ecore_X_Time _ecore_xcb_mouse_down_last_time = 0;
-static Ecore_X_Time _ecore_xcb_mouse_down_last_last_time = 0;
-static int _ecore_xcb_mouse_up_count = 0;
-static int _ecore_xcb_mouse_down_did_triple = 0;
-static int _ecore_xcb_last_event_mouse_move = 0;
-static Ecore_Event *_ecore_xcb_last_event_mouse_move_event = NULL;
+static Ecore_X_Time _ecore_xcb_mouse_down_last_time = 0;
+static Ecore_X_Time _ecore_xcb_mouse_down_last_last_time = 0;
+static int _ecore_xcb_mouse_up_count = 0;
+static int _ecore_xcb_mouse_down_did_triple = 0;
+static int _ecore_xcb_last_event_mouse_move = 0;
+static Ecore_Event *_ecore_xcb_last_event_mouse_move_event = NULL;
static void
_ecore_x_event_free_mouse_move(void *data __UNUSED__, void *ev)
e = ev;
if (_ecore_xcb_last_event_mouse_move)
{
- _ecore_xcb_last_event_mouse_move_event = NULL;
- _ecore_xcb_last_event_mouse_move = 0;
+ _ecore_xcb_last_event_mouse_move_event = NULL;
+ _ecore_xcb_last_event_mouse_move = 0;
}
- free(e);
-}
+ free(e);
+} /* _ecore_x_event_free_mouse_move */
/* FIXME: roundtrip */
EAPI void
{
xcb_get_window_attributes_cookie_t cookie;
xcb_get_window_attributes_reply_t *reply;
- uint32_t value_list;
+ uint32_t value_list;
if (!window)
window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
cookie = xcb_get_window_attributes_unchecked(_ecore_xcb_conn, window);
reply = xcb_get_window_attributes_reply(_ecore_xcb_conn, cookie, NULL);
- if (!reply) return;
+ if (!reply)
+ return;
value_list = mask | reply->your_event_mask;
xcb_change_window_attributes(_ecore_xcb_conn, window, XCB_CW_EVENT_MASK, &value_list);
free(reply);
-}
+} /* ecore_x_event_mask_set */
/* FIXME: roundtrip */
EAPI void
cookie = xcb_get_window_attributes_unchecked(_ecore_xcb_conn, window);
reply = xcb_get_window_attributes_reply(_ecore_xcb_conn, cookie, NULL);
- if (!reply) return;
+ if (!reply)
+ return;
value_list = reply->your_event_mask & ~mask;
xcb_change_window_attributes(_ecore_xcb_conn, window, XCB_CW_EVENT_MASK, &value_list);
free(reply);
-}
+} /* ecore_x_event_mask_unset */
#if 0
static void
Ecore_X_Event_Window_Prop_Name_Class_Change *e;
e = ev;
- if (e->name) free(e->name);
- if (e->clas) free(e->clas);
+ if (e->name)
+ free(e->name);
+
+ if (e->clas)
+ free(e->clas);
+
free(e);
-}
+} /* _ecore_x_event_free_window_prop_name_class_change */
static void
_ecore_x_event_free_window_prop_title_change(void *data, void *ev)
Ecore_X_Event_Window_Prop_Title_Change *e;
e = ev;
- if (e->title) free(e->title);
+ if (e->title)
+ free(e->title);
+
free(e);
-}
+} /* _ecore_x_event_free_window_prop_title_change */
static void
_ecore_x_event_free_window_prop_visible_title_change(void *data, void *ev)
Ecore_X_Event_Window_Prop_Visible_Title_Change *e;
e = ev;
- if (e->title) free(e->title);
+ if (e->title)
+ free(e->title);
+
free(e);
-}
+} /* _ecore_x_event_free_window_prop_visible_title_change */
static void
_ecore_x_event_free_window_prop_icon_name_change(void *data, void *ev)
Ecore_X_Event_Window_Prop_Icon_Name_Change *e;
e = ev;
- if (e->name) free(e->name);
+ if (e->name)
+ free(e->name);
+
free(e);
-}
+} /* _ecore_x_event_free_window_prop_icon_name_change */
static void
_ecore_x_event_free_window_prop_visible_icon_name_change(void *data, void *ev)
Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change *e;
e = ev;
- if (e->name) free(e->name);
+ if (e->name)
+ free(e->name);
+
free(e);
-}
+} /* _ecore_x_event_free_window_prop_visible_icon_name_change */
static void
_ecore_x_event_free_window_prop_client_machine_change(void *data, void *ev)
Ecore_X_Event_Window_Prop_Client_Machine_Change *e;
e = ev;
- if (e->name) free(e->name);
+ if (e->name)
+ free(e->name);
+
free(e);
-}
-#endif
+} /* _ecore_x_event_free_window_prop_client_machine_change */
+
+#endif /* if 0 */
static void
_ecore_x_event_free_xdnd_enter(void *data __UNUSED__, void *ev)
{
Ecore_X_Event_Xdnd_Enter *e;
- int i;
+ int i;
e = ev;
for (i = 0; i < e->num_types; i++)
- free(e->types[i]);
+ free(e->types[i]);
free(e->types);
free(e);
-}
+} /* _ecore_x_event_free_xdnd_enter */
static void
_ecore_x_event_free_selection_notify(void *data __UNUSED__, void *ev)
{
Ecore_X_Event_Selection_Notify *e;
- Ecore_X_Selection_Data *sel;
+ Ecore_X_Selection_Data *sel;
e = ev;
sel = e->data;
if (sel->free)
- sel->free(sel);
+ sel->free(sel);
+
free(e->target);
free(e);
-}
+} /* _ecore_x_event_free_selection_notify */
static unsigned int
_ecore_x_event_modifiers(unsigned int state)
{
- unsigned int modifiers = 0;
+ 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_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_CAPS)
+ modifiers |= ECORE_EVENT_LOCK_CAPS;
return modifiers;
-}
+} /* _ecore_x_event_modifiers */
static 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 x, int y,
+ int x_root, int y_root,
+ unsigned int event_window,
+ unsigned int window,
+ unsigned int root_win,
+ int same_screen)
{
Ecore_Event_Mouse_Move *e;
- Ecore_Event *event;
+ Ecore_Event *event;
e = malloc(sizeof(Ecore_Event_Mouse_Move));
- if (!e) return ;
+ if (!e)
+ return;
e->window = window;
e->root_window = root_win;
_ecore_xcb_event_last_root_y = y_root;
_ecore_xcb_last_event_mouse_move_event = event;
-}
+} /* _ecore_mouse_move */
static void
_ecore_key_press(int event,
- xcb_generic_event_t *ev)
+ xcb_generic_event_t *ev)
{
- /*
- Ecore_Event_Key *e;
- const 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_xcb_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;
- if (!keyname) return ;
- }
+ /*
+ Ecore_Event_Key *e;
+ const 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_xcb_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;
+ if (!keyname) return ;
+ }
- sym = 0;
- key = NULL;
- compose = NULL;
- if (_ecore_x_ic)
- {
- Status mbstatus;
-#ifdef X_HAVE_UTF8_STRING
- val = Xutf8LookupString(_ecore_x_ic, (XKeyEvent *)xevent, compose_buffer, sizeof(compose_buffer) - 1, &sym, &mbstatus);
-#else
- val = XmbLookupString(_ecore_x_ic, (XKeyEvent *)xevent, compose_buffer, sizeof(compose_buffer) - 1, &sym, &mbstatus);
-#endif
- if (mbstatus == XBufferOverflow)
- {
- tmp = malloc(sizeof (char) * (val + 1));
- if (!tmp) return ;
-
- compose = tmp;
-
-#ifdef X_HAVE_UTF8_STRING
- val = Xutf8LookupString(_ecore_x_ic, (XKeyEvent *)xevent, tmp, val, &sym, &mbstatus);
-#else
- val = XmbLookupString(_ecore_x_ic, (XKeyEvent *)xevent, tmp, val, &sym, &mbstatus);
-#endif
- if (val > 0)
- {
- tmp[val] = 0;
-
-#ifndef X_HAVE_UTF8_STRING
- compose = eina_str_convert(nl_langinfo(CODESET), "UTF-8", tmp);
- free(tmp);
- tmp = compose;
-#endif
- }
- else compose = NULL;
- }
- else
- if (val > 0)
- {
- compose_buffer[val] = 0;
-#ifdef X_HAVE_UTF8_STRING
- compose = compose_buffer;
-#else
- compose = eina_str_convert(nl_langinfo(CODESET), "UTF-8", compose_buffer);
- tmp = compose;
-#endif
- }
- }
- else
- {
- 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);
- tmp = compose;
- }
- }
+ sym = 0;
+ key = NULL;
+ compose = NULL;
+ if (_ecore_x_ic)
+ {
+ Status mbstatus;
+ #ifdef X_HAVE_UTF8_STRING
+ val = Xutf8LookupString(_ecore_x_ic, (XKeyEvent *)xevent, compose_buffer, sizeof(compose_buffer) - 1, &sym, &mbstatus);
+ #else
+ val = XmbLookupString(_ecore_x_ic, (XKeyEvent *)xevent, compose_buffer, sizeof(compose_buffer) - 1, &sym, &mbstatus);
+ #endif
+ if (mbstatus == XBufferOverflow)
+ {
+ tmp = malloc(sizeof (char) * (val + 1));
+ if (!tmp) return ;
+
+ compose = tmp;
+
+ #ifdef X_HAVE_UTF8_STRING
+ val = Xutf8LookupString(_ecore_x_ic, (XKeyEvent *)xevent, tmp, val, &sym, &mbstatus);
+ #else
+ val = XmbLookupString(_ecore_x_ic, (XKeyEvent *)xevent, tmp, val, &sym, &mbstatus);
+ #endif
+ if (val > 0)
+ {
+ tmp[val] = 0;
+
+ #ifndef X_HAVE_UTF8_STRING
+ compose = eina_str_convert(nl_langinfo(CODESET), "UTF-8", tmp);
+ free(tmp);
+ tmp = compose;
+ #endif
+ }
+ else compose = NULL;
+ }
+ else
+ if (val > 0)
+ {
+ compose_buffer[val] = 0;
+ #ifdef X_HAVE_UTF8_STRING
+ compose = compose_buffer;
+ #else
+ compose = eina_str_convert(nl_langinfo(CODESET), "UTF-8", compose_buffer);
+ tmp = compose;
+ #endif
+ }
+ }
+ else
+ {
+ 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);
+ tmp = compose;
+ }
+ }
- key = XKeysymToString(sym);
- if (!key) key = keyname;
- if (!key) goto on_error;
+ key = XKeysymToString(sym);
+ if (!key) key = keyname;
+ if (!key) goto on_error;
- e = malloc(sizeof(Ecore_Event_Key) + strlen(key) + strlen(keyname) + (compose ? strlen(compose) : 0) + 3);
- if (!e) goto on_error;
+ 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;
+ 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);
+ 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->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;
+ 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_event_add(event, e, NULL, NULL);
- _ecore_xcb_event_last_time = e->timestamp;
+ _ecore_xcb_event_last_time = e->timestamp;
- on_error:
- if (tmp) free(tmp);
- */
-}
+ on_error:
+ if (tmp) free(tmp);
+ */
+} /* _ecore_key_press */
-static Ecore_Event_Mouse_Button*
+static 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)
+ 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)
{
Ecore_Event_Mouse_Button *e;
e = malloc(sizeof(Ecore_Event_Mouse_Button));
- if (!e) return NULL;
+ if (!e)
+ return NULL;
e->window = window;
e->root_window = root_win;
if (event_window == window)
{
- if (((int)(timestamp - _ecore_xcb_mouse_down_last_time) <=
- (int)(1000 * _ecore_xcb_double_click_time)) &&
- (window == _ecore_xcb_mouse_down_last_window) &&
- (event_window == _ecore_xcb_mouse_down_last_event_window)
- )
- e->double_click = 1;
- if (((int)(timestamp - _ecore_xcb_mouse_down_last_last_time) <=
- (int)(2 * 1000 * _ecore_xcb_double_click_time)) &&
- (window == _ecore_xcb_mouse_down_last_window) &&
- (window == _ecore_xcb_mouse_down_last_last_window) &&
- (event_window == _ecore_xcb_mouse_down_last_event_window) &&
- (event_window == _ecore_xcb_mouse_down_last_last_event_window)
- )
- {
- e->triple_click = 1;
- _ecore_xcb_mouse_down_did_triple = 1;
- }
- else
- _ecore_xcb_mouse_down_did_triple = 0;
+ if (((int)(timestamp - _ecore_xcb_mouse_down_last_time) <=
+ (int)(1000 * _ecore_xcb_double_click_time)) &&
+ (window == _ecore_xcb_mouse_down_last_window) &&
+ (event_window == _ecore_xcb_mouse_down_last_event_window)
+ )
+ e->double_click = 1;
+
+ if (((int)(timestamp - _ecore_xcb_mouse_down_last_last_time) <=
+ (int)(2 * 1000 * _ecore_xcb_double_click_time)) &&
+ (window == _ecore_xcb_mouse_down_last_window) &&
+ (window == _ecore_xcb_mouse_down_last_last_window) &&
+ (event_window == _ecore_xcb_mouse_down_last_event_window) &&
+ (event_window == _ecore_xcb_mouse_down_last_last_event_window)
+ )
+ {
+ e->triple_click = 1;
+ _ecore_xcb_mouse_down_did_triple = 1;
+ }
+ else
+ _ecore_xcb_mouse_down_did_triple = 0;
}
if (event == ECORE_EVENT_MOUSE_BUTTON_DOWN
&& !e->double_click
&& !e->triple_click)
- _ecore_xcb_mouse_up_count = 0;
+ _ecore_xcb_mouse_up_count = 0;
_ecore_xcb_event_last_time = e->timestamp;
_ecore_xcb_event_last_window = e->window;
ecore_event_add(event, e, NULL, NULL);
return e;
-}
+} /* _ecore_mouse_button */
void
_ecore_x_event_handle_any_event(xcb_generic_event_t *event)
{
- xcb_generic_event_t* ev = malloc(sizeof(xcb_generic_event_t));
+ xcb_generic_event_t *ev = malloc(sizeof(xcb_generic_event_t));
memcpy(ev, event, sizeof(xcb_generic_event_t));
ecore_event_add(ECORE_X_EVENT_ANY, ev, NULL, NULL);
-}
+} /* _ecore_x_event_handle_any_event */
/* FIXME: handle this event */
void
_ecore_key_press(ECORE_EVENT_KEY_DOWN, event);
free(event);
-}
+} /* _ecore_x_event_handle_key_press */
/* FIXME: handle this event */
void
_ecore_key_press(ECORE_EVENT_KEY_DOWN, event);
free(event);
-}
+} /* _ecore_x_event_handle_key_release */
void
_ecore_x_event_handle_button_press(xcb_generic_event_t *event)
{
xcb_button_press_event_t *ev;
- int i;
+ int i;
ev = (xcb_button_press_event_t *)event;
if ((ev->detail > 3) && (ev->detail < 8))
{
- Ecore_Event_Mouse_Wheel *e;
-
- e = malloc(sizeof(Ecore_Event_Mouse_Wheel));
- if (!e) return;
-
- e->timestamp = ev->time;
- e->modifiers = _ecore_x_event_modifiers(ev->state);
- switch (ev->detail)
- {
- case 4: e->direction = 0; e->z = -1; break;
- case 5: e->direction = 0; e->z = 1; break;
- case 6: e->direction = 1; e->z = -1; break;
- case 7: e->direction = 1; e->z = 1; break;
+ Ecore_Event_Mouse_Wheel *e;
+
+ e = malloc(sizeof(Ecore_Event_Mouse_Wheel));
+ if (!e)
+ return;
+
+ e->timestamp = ev->time;
+ e->modifiers = _ecore_x_event_modifiers(ev->state);
+ switch (ev->detail)
+ {
+ case 4: e->direction = 0; e->z = -1; break;
+
+ case 5: e->direction = 0; e->z = 1; break;
+
+ case 6: e->direction = 1; e->z = -1; break;
+
+ case 7: e->direction = 1; e->z = 1; break;
+
default: e->direction = 0; e->z = 0; break;
- }
-
- e->x = ev->event_x;
- e->y = ev->event_y;
- e->root.x = ev->root_x;
- e->root.y = ev->root_y;
-
- if (ev->child)
- e->window = ev->child;
- else
- e->window = ev->event;
-
- e->event_window = ev->event;
- e->same_screen = ev->same_screen;
- e->root_window = ev->root;
- _ecore_xcb_event_last_time = e->timestamp;
- _ecore_xcb_event_last_window = e->window;
- _ecore_xcb_event_last_root_x = e->root.x;
- _ecore_xcb_event_last_root_y = e->root.y;
- ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, e, NULL, NULL);
- for (i = 0; i < _ecore_window_grabs_num; i++)
- {
- if ((_ecore_window_grabs[i] == ev->event) ||
- (_ecore_window_grabs[i] == ev->child))
- {
- int replay = 0;
-
- if (_ecore_window_grab_replay_func)
- replay = _ecore_window_grab_replay_func(_ecore_window_grab_replay_data,
- ECORE_EVENT_MOUSE_WHEEL,
- e);
+ } /* switch */
+
+ e->x = ev->event_x;
+ e->y = ev->event_y;
+ e->root.x = ev->root_x;
+ e->root.y = ev->root_y;
+
+ if (ev->child)
+ e->window = ev->child;
+ else
+ e->window = ev->event;
+
+ e->event_window = ev->event;
+ e->same_screen = ev->same_screen;
+ e->root_window = ev->root;
+ _ecore_xcb_event_last_time = e->timestamp;
+ _ecore_xcb_event_last_window = e->window;
+ _ecore_xcb_event_last_root_x = e->root.x;
+ _ecore_xcb_event_last_root_y = e->root.y;
+ ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, e, NULL, NULL);
+ for (i = 0; i < _ecore_window_grabs_num; i++)
+ {
+ if ((_ecore_window_grabs[i] == ev->event) ||
+ (_ecore_window_grabs[i] == ev->child))
+ {
+ 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);
+
/* FIXME: xcb_key_press_event_t does not save the */
/* connection. So I use the current one */
- if (replay)
- xcb_allow_events(_ecore_xcb_conn,
- XCB_ALLOW_REPLAY_POINTER,
- ev->time);
- else
- xcb_allow_events(_ecore_xcb_conn,
- XCB_ALLOW_ASYNC_POINTER,
- ev->time);
- break;
- }
- }
+ if (replay)
+ xcb_allow_events(_ecore_xcb_conn,
+ XCB_ALLOW_REPLAY_POINTER,
+ ev->time);
+ else
+ xcb_allow_events(_ecore_xcb_conn,
+ XCB_ALLOW_ASYNC_POINTER,
+ ev->time);
+
+ break;
+ }
+ }
}
else
{
{
- _ecore_mouse_move(ev->time, ev->state,
- ev->event_x, ev->event_y,
- ev->root_x, ev->root_y,
- ev->event,
- (ev->child ? ev->child : ev->event),
- ev->root,
- ev->same_screen);
+ _ecore_mouse_move(ev->time, ev->state,
+ ev->event_x, ev->event_y,
+ ev->root_x, ev->root_y,
+ ev->event,
+ (ev->child ? ev->child : ev->event),
+ ev->root,
+ ev->same_screen);
}
{
Ecore_Event_Mouse_Button *e;
- Ecore_X_Window event_window;
- Ecore_X_Window child_window;
+ Ecore_X_Window event_window;
+ Ecore_X_Window child_window;
if (_ecore_xcb_mouse_down_did_triple)
{
_ecore_xcb_mouse_down_last_time = 0;
_ecore_xcb_mouse_down_last_last_time = 0;
}
+
event_window = ev->child;
child_window = ev->child ? ev->child : ev->event;
- e = _ecore_mouse_button(ECORE_EVENT_MOUSE_BUTTON_DOWN,
- ev->time, ev->state,
- ev->detail,
- ev->event_x, ev->event_y,
- ev->root_x, ev->root_y,
- event_window, child_window,
- ev->root, ev->same_screen);
+ e = _ecore_mouse_button(ECORE_EVENT_MOUSE_BUTTON_DOWN,
+ ev->time, ev->state,
+ ev->detail,
+ ev->event_x, ev->event_y,
+ ev->root_x, ev->root_y,
+ event_window, child_window,
+ ev->root, ev->same_screen);
+
+ if (!e)
+ return;
- if (!e) return;
for (i = 0; i < _ecore_window_grabs_num; i++)
{
if ((_ecore_window_grabs[i] == ev->event) ||
(_ecore_window_grabs[i] == ev->child))
{
- int replay = 0;
+ 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);
+ replay = _ecore_window_grab_replay_func(_ecore_window_grab_replay_data,
+ ECORE_EVENT_MOUSE_BUTTON_DOWN,
+ e);
+
/* FIXME: xcb_key_press_event_t does not save the */
/* connection. So I use the current one */
if (replay)
- xcb_allow_events(_ecore_xcb_conn,
- XCB_ALLOW_REPLAY_POINTER,
- ev->time);
+ xcb_allow_events(_ecore_xcb_conn,
+ XCB_ALLOW_REPLAY_POINTER,
+ ev->time);
else
- xcb_allow_events(_ecore_xcb_conn,
- XCB_ALLOW_ASYNC_POINTER,
- ev->time);
+ xcb_allow_events(_ecore_xcb_conn,
+ XCB_ALLOW_ASYNC_POINTER,
+ ev->time);
+
break;
}
}
{
_ecore_xcb_mouse_down_last_last_window = _ecore_xcb_mouse_down_last_window;
if (ev->child)
- _ecore_xcb_mouse_down_last_window = ev->child;
+ _ecore_xcb_mouse_down_last_window = ev->child;
else
- _ecore_xcb_mouse_down_last_window = ev->event;
+ _ecore_xcb_mouse_down_last_window = ev->event;
+
_ecore_xcb_mouse_down_last_last_event_window = _ecore_xcb_mouse_down_last_event_window;
_ecore_xcb_mouse_down_last_event_window = ev->event;
_ecore_xcb_mouse_down_last_last_time = _ecore_xcb_mouse_down_last_time;
}
free(event);
-}
+} /* _ecore_x_event_handle_button_press */
void
_ecore_x_event_handle_button_release(xcb_generic_event_t *event)
/* filter out wheel buttons */
if ((ev->detail <= 3) || (ev->detail > 7))
{
- _ecore_mouse_move(ev->time, ev->state,
- ev->event_x, ev->event_y,
- ev->root_x, ev->root_y,
- ev->event,
- (ev->child ? ev->child : ev->event),
- ev->root,
- ev->same_screen);
-
- _ecore_mouse_button(ECORE_EVENT_MOUSE_BUTTON_UP,
- ev->time, ev->state,
- ev->detail,
- ev->event_x, ev->event_y,
- ev->root_x, ev->root_y,
- ev->event,
- (ev->child ? ev->child : ev->event),
- ev->root,
- ev->same_screen);
+ _ecore_mouse_move(ev->time, ev->state,
+ ev->event_x, ev->event_y,
+ ev->root_x, ev->root_y,
+ ev->event,
+ (ev->child ? ev->child : ev->event),
+ ev->root,
+ ev->same_screen);
+
+ _ecore_mouse_button(ECORE_EVENT_MOUSE_BUTTON_UP,
+ ev->time, ev->state,
+ ev->detail,
+ ev->event_x, ev->event_y,
+ ev->root_x, ev->root_y,
+ ev->event,
+ (ev->child ? ev->child : ev->event),
+ ev->root,
+ ev->same_screen);
}
free(event);
-}
+} /* _ecore_x_event_handle_button_release */
void
_ecore_x_event_handle_motion_notify(xcb_generic_event_t *event)
}
_ecore_mouse_move(ev->time, ev->state,
- ev->event_x, ev->event_y,
- ev->root_x, ev->root_y,
- ev->event,
- (ev->child ? ev->child : ev->event),
- ev->root,
- ev->same_screen);
+ ev->event_x, ev->event_y,
+ ev->root_x, ev->root_y,
+ ev->event,
+ (ev->child ? ev->child : ev->event),
+ ev->root,
+ ev->same_screen);
_ecore_xcb_last_event_mouse_move = 1;
_ecore_x_dnd_drag(ev->root, ev->root_x, ev->root_y);
free(event);
-}
+} /* _ecore_x_event_handle_motion_notify */
void
_ecore_x_event_handle_enter_notify(xcb_generic_event_t *event)
Ecore_X_Event_Mouse_In *e;
e = calloc(1, sizeof(Ecore_X_Event_Mouse_In));
- if (!e) return;
+ if (!e)
+ return;
+
e->modifiers = _ecore_x_event_modifiers(ev->state);
e->x = ev->event_x;
e->y = ev->event_y;
e->root.x = ev->root_x;
e->root.y = ev->root_y;
- if (ev->child) e->win = ev->child;
- else e->win = ev->event;
+ if (ev->child)
+ e->win = ev->child;
+ else
+ e->win = ev->event;
+
e->same_screen = ev->same_screen_focus;
e->root_win = ev->root;
e->event_win = ev->event;
switch (ev->mode) {
- case XCB_NOTIFY_MODE_NORMAL:
- e->mode = ECORE_X_EVENT_MODE_NORMAL;
- break;
- case XCB_NOTIFY_MODE_GRAB:
- e->mode = ECORE_X_EVENT_MODE_GRAB;
- break;
- case XCB_NOTIFY_MODE_UNGRAB:
- e->mode = ECORE_X_EVENT_MODE_UNGRAB;
- break;
- default:
- e->mode = ECORE_X_EVENT_MODE_NORMAL;
- break;
- }
+ case XCB_NOTIFY_MODE_NORMAL:
+ e->mode = ECORE_X_EVENT_MODE_NORMAL;
+ break;
+
+ case XCB_NOTIFY_MODE_GRAB:
+ e->mode = ECORE_X_EVENT_MODE_GRAB;
+ break;
+
+ case XCB_NOTIFY_MODE_UNGRAB:
+ e->mode = ECORE_X_EVENT_MODE_UNGRAB;
+ break;
+
+ default:
+ e->mode = ECORE_X_EVENT_MODE_NORMAL;
+ break;
+ } /* switch */
switch (ev->detail) {
- case XCB_NOTIFY_DETAIL_ANCESTOR:
- e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
- break;
- case XCB_NOTIFY_DETAIL_VIRTUAL:
- e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL;
- break;
- case XCB_NOTIFY_DETAIL_INFERIOR:
- e->detail = ECORE_X_EVENT_DETAIL_INFERIOR;
- break;
- case XCB_NOTIFY_DETAIL_NONLINEAR:
- e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR;
- break;
- case XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL:
- e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL;
- break;
- default:
- e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
- break;
- }
+ case XCB_NOTIFY_DETAIL_ANCESTOR:
+ e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
+ break;
+
+ case XCB_NOTIFY_DETAIL_VIRTUAL:
+ e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL;
+ break;
+
+ case XCB_NOTIFY_DETAIL_INFERIOR:
+ e->detail = ECORE_X_EVENT_DETAIL_INFERIOR;
+ break;
+
+ case XCB_NOTIFY_DETAIL_NONLINEAR:
+ e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR;
+ break;
+
+ case XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL:
+ e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL;
+ break;
+
+ default:
+ e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
+ break;
+ } /* switch */
e->time = ev->time;
_ecore_xcb_event_last_time = e->time;
ecore_event_add(ECORE_X_EVENT_MOUSE_IN, e, NULL, NULL);
}
free(event);
-}
+} /* _ecore_x_event_handle_enter_notify */
void
_ecore_x_event_handle_leave_notify(xcb_generic_event_t *event)
Ecore_X_Event_Mouse_Out *e;
e = calloc(1, sizeof(Ecore_X_Event_Mouse_Out));
- if (!e) return;
+ if (!e)
+ return;
+
e->modifiers = _ecore_x_event_modifiers(ev->state);
e->x = ev->event_x;
e->y = ev->event_y;
e->root.x = ev->root_x;
e->root.y = ev->root_y;
- if (ev->child) e->win = ev->child;
- else e->win = ev->event;
+ if (ev->child)
+ e->win = ev->child;
+ else
+ e->win = ev->event;
+
e->same_screen = ev->same_screen_focus;
e->root_win = ev->root;
e->event_win = ev->event;
switch (ev->mode) {
- case XCB_NOTIFY_MODE_NORMAL:
- e->mode = ECORE_X_EVENT_MODE_NORMAL;
- break;
- case XCB_NOTIFY_MODE_GRAB:
- e->mode = ECORE_X_EVENT_MODE_GRAB;
- break;
- case XCB_NOTIFY_MODE_UNGRAB:
- e->mode = ECORE_X_EVENT_MODE_UNGRAB;
- break;
- default:
- e->mode = ECORE_X_EVENT_MODE_NORMAL;
- break;
- }
+ case XCB_NOTIFY_MODE_NORMAL:
+ e->mode = ECORE_X_EVENT_MODE_NORMAL;
+ break;
+
+ case XCB_NOTIFY_MODE_GRAB:
+ e->mode = ECORE_X_EVENT_MODE_GRAB;
+ break;
+
+ case XCB_NOTIFY_MODE_UNGRAB:
+ e->mode = ECORE_X_EVENT_MODE_UNGRAB;
+ break;
+
+ default:
+ e->mode = ECORE_X_EVENT_MODE_NORMAL;
+ break;
+ } /* switch */
switch (ev->detail) {
- case XCB_NOTIFY_DETAIL_ANCESTOR:
- e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
- break;
- case XCB_NOTIFY_DETAIL_VIRTUAL:
- e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL;
- break;
- case XCB_NOTIFY_DETAIL_INFERIOR:
- e->detail = ECORE_X_EVENT_DETAIL_INFERIOR;
- break;
- case XCB_NOTIFY_DETAIL_NONLINEAR:
- e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR;
- break;
- case XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL:
- e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL;
- break;
- default:
- e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
- break;
- }
+ case XCB_NOTIFY_DETAIL_ANCESTOR:
+ e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
+ break;
+
+ case XCB_NOTIFY_DETAIL_VIRTUAL:
+ e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL;
+ break;
+
+ case XCB_NOTIFY_DETAIL_INFERIOR:
+ e->detail = ECORE_X_EVENT_DETAIL_INFERIOR;
+ break;
+
+ case XCB_NOTIFY_DETAIL_NONLINEAR:
+ e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR;
+ break;
+
+ case XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL:
+ e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL;
+ break;
+
+ default:
+ e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
+ break;
+ } /* switch */
e->time = ev->time;
_ecore_xcb_event_last_time = e->time;
_ecore_xcb_event_last_window = e->win;
}
free(event);
-}
+} /* _ecore_x_event_handle_leave_notify */
void
_ecore_x_event_handle_focus_in(xcb_generic_event_t *event)
{
- xcb_focus_in_event_t *ev;
+ xcb_focus_in_event_t *ev;
Ecore_X_Event_Window_Focus_In *e;
ev = (xcb_focus_in_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Window_Focus_In));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->event;
switch (ev->mode) {
- case XCB_NOTIFY_MODE_NORMAL:
- e->mode = ECORE_X_EVENT_MODE_NORMAL;
- break;
- case XCB_NOTIFY_MODE_GRAB:
- e->mode = ECORE_X_EVENT_MODE_GRAB;
- break;
- case XCB_NOTIFY_MODE_UNGRAB:
- e->mode = ECORE_X_EVENT_MODE_UNGRAB;
- break;
- case XCB_NOTIFY_MODE_WHILE_GRABBED:
- e->mode = ECORE_X_EVENT_MODE_WHILE_GRABBED;
- break;
- }
+ case XCB_NOTIFY_MODE_NORMAL:
+ e->mode = ECORE_X_EVENT_MODE_NORMAL;
+ break;
+
+ case XCB_NOTIFY_MODE_GRAB:
+ e->mode = ECORE_X_EVENT_MODE_GRAB;
+ break;
+
+ case XCB_NOTIFY_MODE_UNGRAB:
+ e->mode = ECORE_X_EVENT_MODE_UNGRAB;
+ break;
+
+ case XCB_NOTIFY_MODE_WHILE_GRABBED:
+ e->mode = ECORE_X_EVENT_MODE_WHILE_GRABBED;
+ break;
+ } /* switch */
switch (ev->detail) {
- case XCB_NOTIFY_DETAIL_ANCESTOR:
- e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
- break;
- case XCB_NOTIFY_DETAIL_VIRTUAL:
- e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL;
- break;
- case XCB_NOTIFY_DETAIL_INFERIOR:
- e->detail = ECORE_X_EVENT_DETAIL_INFERIOR;
- break;
- case XCB_NOTIFY_DETAIL_NONLINEAR:
- e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR;
- break;
- case XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL:
- e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL;
- break;
- case XCB_NOTIFY_DETAIL_POINTER:
- e->detail = ECORE_X_EVENT_DETAIL_POINTER;
- break;
- case XCB_NOTIFY_DETAIL_POINTER_ROOT:
- e->detail = ECORE_X_EVENT_DETAIL_POINTER_ROOT;
- break;
- case XCB_NOTIFY_DETAIL_NONE:
- e->detail = ECORE_X_EVENT_DETAIL_DETAIL_NONE;
- break;
- }
+ case XCB_NOTIFY_DETAIL_ANCESTOR:
+ e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
+ break;
+
+ case XCB_NOTIFY_DETAIL_VIRTUAL:
+ e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL;
+ break;
+
+ case XCB_NOTIFY_DETAIL_INFERIOR:
+ e->detail = ECORE_X_EVENT_DETAIL_INFERIOR;
+ break;
+
+ case XCB_NOTIFY_DETAIL_NONLINEAR:
+ e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR;
+ break;
+
+ case XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL:
+ e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL;
+ break;
+
+ case XCB_NOTIFY_DETAIL_POINTER:
+ e->detail = ECORE_X_EVENT_DETAIL_POINTER;
+ break;
+
+ case XCB_NOTIFY_DETAIL_POINTER_ROOT:
+ e->detail = ECORE_X_EVENT_DETAIL_POINTER_ROOT;
+ break;
+
+ case XCB_NOTIFY_DETAIL_NONE:
+ e->detail = ECORE_X_EVENT_DETAIL_DETAIL_NONE;
+ break;
+ } /* switch */
e->time = _ecore_xcb_event_last_time;
_ecore_xcb_event_last_time = e->time;
ecore_event_add(ECORE_X_EVENT_WINDOW_FOCUS_IN, e, NULL, NULL);
free(event);
-}
+} /* _ecore_x_event_handle_focus_in */
void
_ecore_x_event_handle_focus_out(xcb_generic_event_t *event)
{
- xcb_focus_out_event_t *ev;
+ xcb_focus_out_event_t *ev;
Ecore_X_Event_Window_Focus_Out *e;
ev = (xcb_focus_out_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Window_Focus_Out));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->event;
switch (ev->mode) {
- case XCB_NOTIFY_MODE_NORMAL:
- e->mode = ECORE_X_EVENT_MODE_NORMAL;
- break;
- case XCB_NOTIFY_MODE_GRAB:
- e->mode = ECORE_X_EVENT_MODE_GRAB;
- break;
- case XCB_NOTIFY_MODE_UNGRAB:
- e->mode = ECORE_X_EVENT_MODE_UNGRAB;
- break;
- case XCB_NOTIFY_MODE_WHILE_GRABBED:
- e->mode = ECORE_X_EVENT_MODE_WHILE_GRABBED;
- break;
- }
+ case XCB_NOTIFY_MODE_NORMAL:
+ e->mode = ECORE_X_EVENT_MODE_NORMAL;
+ break;
+
+ case XCB_NOTIFY_MODE_GRAB:
+ e->mode = ECORE_X_EVENT_MODE_GRAB;
+ break;
+
+ case XCB_NOTIFY_MODE_UNGRAB:
+ e->mode = ECORE_X_EVENT_MODE_UNGRAB;
+ break;
+
+ case XCB_NOTIFY_MODE_WHILE_GRABBED:
+ e->mode = ECORE_X_EVENT_MODE_WHILE_GRABBED;
+ break;
+ } /* switch */
switch (ev->detail) {
- case XCB_NOTIFY_DETAIL_ANCESTOR:
- e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
- break;
- case XCB_NOTIFY_DETAIL_VIRTUAL:
- e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL;
- break;
- case XCB_NOTIFY_DETAIL_INFERIOR:
- e->detail = ECORE_X_EVENT_DETAIL_INFERIOR;
- break;
- case XCB_NOTIFY_DETAIL_NONLINEAR:
- e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR;
- break;
- case XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL:
- e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL;
- break;
- case XCB_NOTIFY_DETAIL_POINTER:
- e->detail = ECORE_X_EVENT_DETAIL_POINTER;
- break;
- case XCB_NOTIFY_DETAIL_POINTER_ROOT:
- e->detail = ECORE_X_EVENT_DETAIL_POINTER_ROOT;
- break;
- case XCB_NOTIFY_DETAIL_NONE:
- e->detail = ECORE_X_EVENT_DETAIL_DETAIL_NONE;
- break;
- }
+ case XCB_NOTIFY_DETAIL_ANCESTOR:
+ e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
+ break;
+
+ case XCB_NOTIFY_DETAIL_VIRTUAL:
+ e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL;
+ break;
+
+ case XCB_NOTIFY_DETAIL_INFERIOR:
+ e->detail = ECORE_X_EVENT_DETAIL_INFERIOR;
+ break;
+
+ case XCB_NOTIFY_DETAIL_NONLINEAR:
+ e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR;
+ break;
+
+ case XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL:
+ e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL;
+ break;
+
+ case XCB_NOTIFY_DETAIL_POINTER:
+ e->detail = ECORE_X_EVENT_DETAIL_POINTER;
+ break;
+
+ case XCB_NOTIFY_DETAIL_POINTER_ROOT:
+ e->detail = ECORE_X_EVENT_DETAIL_POINTER_ROOT;
+ break;
+
+ case XCB_NOTIFY_DETAIL_NONE:
+ e->detail = ECORE_X_EVENT_DETAIL_DETAIL_NONE;
+ break;
+ } /* switch */
e->time = _ecore_xcb_event_last_time;
_ecore_xcb_event_last_time = e->time;
ecore_event_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT, e, NULL, NULL);
free(event);
-}
+} /* _ecore_x_event_handle_focus_out */
void
_ecore_x_event_handle_keymap_notify(xcb_generic_event_t *event)
/* FIXME: handle this event type */
free(event);
-}
+} /* _ecore_x_event_handle_keymap_notify */
void
_ecore_x_event_handle_expose(xcb_generic_event_t *event)
{
- xcb_expose_event_t *ev;
+ xcb_expose_event_t *ev;
Ecore_X_Event_Window_Damage *e;
ev = (xcb_expose_event_t *)event,
e = calloc(1, sizeof(Ecore_X_Event_Window_Damage));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->window;
e->time = _ecore_xcb_event_last_time;
e->x = ev->x;
ecore_event_add(ECORE_X_EVENT_WINDOW_DAMAGE, e, NULL, NULL);
free(event);
-}
+} /* _ecore_x_event_handle_expose */
void
_ecore_x_event_handle_graphics_expose(xcb_generic_event_t *event)
ev = (xcb_graphics_exposure_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Window_Damage));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->drawable;
e->time = _ecore_xcb_event_last_time;
e->x = ev->x;
ecore_event_add(ECORE_X_EVENT_WINDOW_DAMAGE, e, NULL, NULL);
free(event);
-}
+} /* _ecore_x_event_handle_graphics_expose */
void
_ecore_x_event_handle_visibility_notify(xcb_generic_event_t *event)
ev = (xcb_visibility_notify_event_t *)event;
if (ev->state != XCB_VISIBILITY_PARTIALLY_OBSCURED)
- {
- Ecore_X_Event_Window_Visibility_Change *e;
+ {
+ Ecore_X_Event_Window_Visibility_Change *e;
- e = calloc(1, sizeof(Ecore_X_Event_Window_Visibility_Change));
- if (!e) return;
- e->win = ev->window;
- e->time = _ecore_xcb_event_last_time;
- if (ev->state == XCB_VISIBILITY_FULLY_OBSCURED)
- e->fully_obscured = 1;
- else
- e->fully_obscured = 0;
- ecore_event_add(ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE, e, NULL, NULL);
- }
+ e = calloc(1, sizeof(Ecore_X_Event_Window_Visibility_Change));
+ if (!e)
+ return;
+
+ e->win = ev->window;
+ e->time = _ecore_xcb_event_last_time;
+ if (ev->state == XCB_VISIBILITY_FULLY_OBSCURED)
+ e->fully_obscured = 1;
+ else
+ e->fully_obscured = 0;
+
+ ecore_event_add(ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE, e, NULL, NULL);
+ }
free(event);
-}
+} /* _ecore_x_event_handle_visibility_notify */
void
_ecore_x_event_handle_create_notify(xcb_generic_event_t *event)
{
- xcb_create_notify_event_t *ev;
+ xcb_create_notify_event_t *ev;
Ecore_X_Event_Window_Create *e;
ev = (xcb_create_notify_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Window_Create));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->window;
if (ev->override_redirect)
e->override = 1;
else
e->override = 0;
+
e->time = _ecore_xcb_event_last_time;
ecore_event_add(ECORE_X_EVENT_WINDOW_CREATE, e, NULL, NULL);
free(event);
-}
+} /* _ecore_x_event_handle_create_notify */
void
_ecore_x_event_handle_destroy_notify(xcb_generic_event_t *event)
{
- xcb_destroy_notify_event_t *ev;
+ xcb_destroy_notify_event_t *ev;
Ecore_X_Event_Window_Destroy *e;
ev = (xcb_destroy_notify_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Window_Destroy));
- if (!e) return;
- e->win = ev->window;
+ if (!e)
+ return;
+
+ e->win = ev->window;
e->time = _ecore_xcb_event_last_time;
- if (e->win == _ecore_xcb_event_last_window) _ecore_xcb_event_last_window = 0;
+ if (e->win == _ecore_xcb_event_last_window)
+ _ecore_xcb_event_last_window = 0;
+
ecore_event_add(ECORE_X_EVENT_WINDOW_DESTROY, e, NULL, NULL);
free(event);
-}
+} /* _ecore_x_event_handle_destroy_notify */
void
_ecore_x_event_handle_unmap_notify(xcb_generic_event_t *event)
{
- xcb_unmap_notify_event_t *ev;
+ xcb_unmap_notify_event_t *ev;
Ecore_X_Event_Window_Hide *e;
ev = (xcb_unmap_notify_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Window_Hide));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->window;
e->time = _ecore_xcb_event_last_time;
ecore_event_add(ECORE_X_EVENT_WINDOW_HIDE, e, NULL, NULL);
free(event);
-}
+} /* _ecore_x_event_handle_unmap_notify */
void
_ecore_x_event_handle_map_notify(xcb_generic_event_t *event)
{
- xcb_map_notify_event_t *ev;
+ xcb_map_notify_event_t *ev;
Ecore_X_Event_Window_Show *e;
ev = (xcb_map_notify_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Window_Show));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->window;
e->time = _ecore_xcb_event_last_time;
ecore_event_add(ECORE_X_EVENT_WINDOW_SHOW, e, NULL, NULL);
free(event);
-}
+} /* _ecore_x_event_handle_map_notify */
void
_ecore_x_event_handle_map_request(xcb_generic_event_t *event)
{
- xcb_map_request_event_t *ev;
+ xcb_map_request_event_t *ev;
Ecore_X_Event_Window_Show_Request *e;
ev = (xcb_map_request_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Window_Show_Request));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->window;
e->parent = ev->parent;
e->time = _ecore_xcb_event_last_time;
ecore_event_add(ECORE_X_EVENT_WINDOW_SHOW_REQUEST, e, NULL, NULL);
free(event);
-}
+} /* _ecore_x_event_handle_map_request */
void
_ecore_x_event_handle_reparent_notify(xcb_generic_event_t *event)
{
- xcb_reparent_notify_event_t *ev;
+ xcb_reparent_notify_event_t *ev;
Ecore_X_Event_Window_Reparent *e;
ev = (xcb_reparent_notify_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Window_Reparent));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->window;
e->parent = ev->parent;
e->time = _ecore_xcb_event_last_time;
ecore_event_add(ECORE_X_EVENT_WINDOW_REPARENT, e, NULL, NULL);
free(event);
-}
+} /* _ecore_x_event_handle_reparent_notify */
void
_ecore_x_event_handle_configure_notify(xcb_generic_event_t *event)
{
- xcb_configure_notify_event_t *ev;
+ xcb_configure_notify_event_t *ev;
Ecore_X_Event_Window_Configure *e;
ev = (xcb_configure_notify_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Window_Configure));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->window;
e->abovewin = ev->above_sibling;
e->x = ev->x;
ecore_event_add(ECORE_X_EVENT_WINDOW_CONFIGURE, e, NULL, NULL);
free(event);
-}
+} /* _ecore_x_event_handle_configure_notify */
void
_ecore_x_event_handle_configure_request(xcb_generic_event_t *event)
{
- xcb_configure_request_event_t *ev;
+ xcb_configure_request_event_t *ev;
Ecore_X_Event_Window_Configure_Request *e;
ev = (xcb_configure_request_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Window_Configure_Request));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->window;
e->abovewin = ev->sibling;
e->x = ev->x;
e->border = ev->border_width;
e->value_mask = ev->value_mask;
switch (ev->stack_mode) {
- case XCB_STACK_MODE_ABOVE:
- e->detail = ECORE_X_WINDOW_STACK_ABOVE;
- break;
- case XCB_STACK_MODE_BELOW:
- e->detail = ECORE_X_WINDOW_STACK_BELOW;
- break;
- case XCB_STACK_MODE_TOP_IF:
- e->detail = ECORE_X_WINDOW_STACK_TOP_IF;
- break;
- case XCB_STACK_MODE_BOTTOM_IF:
- e->detail = ECORE_X_WINDOW_STACK_BOTTOM_IF;
- break;
- case XCB_STACK_MODE_OPPOSITE:
- e->detail = ECORE_X_WINDOW_STACK_OPPOSITE;
- break;
- }
+ case XCB_STACK_MODE_ABOVE:
+ e->detail = ECORE_X_WINDOW_STACK_ABOVE;
+ break;
+
+ case XCB_STACK_MODE_BELOW:
+ e->detail = ECORE_X_WINDOW_STACK_BELOW;
+ break;
+
+ case XCB_STACK_MODE_TOP_IF:
+ e->detail = ECORE_X_WINDOW_STACK_TOP_IF;
+ break;
+
+ case XCB_STACK_MODE_BOTTOM_IF:
+ e->detail = ECORE_X_WINDOW_STACK_BOTTOM_IF;
+ break;
+
+ case XCB_STACK_MODE_OPPOSITE:
+ e->detail = ECORE_X_WINDOW_STACK_OPPOSITE;
+ break;
+ } /* switch */
e->time = _ecore_xcb_event_last_time;
ecore_event_add(ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST, e, NULL, NULL);
free(event);
-}
+} /* _ecore_x_event_handle_configure_request */
void
_ecore_x_event_handle_gravity_notify(xcb_generic_event_t *event)
/* FIXME: handle this event type */
free(event);
-}
+} /* _ecore_x_event_handle_gravity_notify */
void
_ecore_x_event_handle_resize_request(xcb_generic_event_t *event)
{
- xcb_resize_request_event_t *ev;
+ xcb_resize_request_event_t *ev;
Ecore_X_Event_Window_Resize_Request *e;
ev = (xcb_resize_request_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Window_Resize_Request));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->window;
e->w = ev->width;
e->h = ev->height;
ecore_event_add(ECORE_X_EVENT_WINDOW_RESIZE_REQUEST, e, NULL, NULL);
free(event);
-}
+} /* _ecore_x_event_handle_resize_request */
void
_ecore_x_event_handle_circulate_notify(xcb_generic_event_t *event)
ev = (xcb_circulate_notify_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Window_Stack));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->window;
e->event_win = ev->event;
if (ev->place == XCB_PLACE_ON_TOP)
- e->detail = ECORE_X_WINDOW_STACK_ABOVE;
+ e->detail = ECORE_X_WINDOW_STACK_ABOVE;
else
- e->detail = ECORE_X_WINDOW_STACK_BELOW;
+ e->detail = ECORE_X_WINDOW_STACK_BELOW;
+
e->time = _ecore_xcb_event_last_time;
ecore_event_add(ECORE_X_EVENT_WINDOW_STACK, e, NULL, NULL);
free(event);
-}
+} /* _ecore_x_event_handle_circulate_notify */
void
_ecore_x_event_handle_circulate_request(xcb_generic_event_t *event)
{
- xcb_circulate_request_event_t *ev;
+ xcb_circulate_request_event_t *ev;
Ecore_X_Event_Window_Stack_Request *e;
ev = (xcb_circulate_request_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Window_Stack_Request));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->window;
e->parent = ev->event;
if (ev->place == XCB_PLACE_ON_TOP)
- e->detail = ECORE_X_WINDOW_STACK_ABOVE;
+ e->detail = ECORE_X_WINDOW_STACK_ABOVE;
else
- e->detail = ECORE_X_WINDOW_STACK_BELOW;
+ e->detail = ECORE_X_WINDOW_STACK_BELOW;
+
e->time = _ecore_xcb_event_last_time;
ecore_event_add(ECORE_X_EVENT_WINDOW_STACK_REQUEST, e, NULL, NULL);
free(event);
-}
+} /* _ecore_x_event_handle_circulate_request */
void
_ecore_x_event_handle_property_notify(xcb_generic_event_t *event)
*/
if (xevent->xproperty.atom == ECORE_X_ATOM_WM_CLASS)
{
- Ecore_X_Event_Window_Prop_Name_Class_Change *e;
-
- e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Name_Class_Change));
- if (!e) return;
- ecore_x_window_prop_name_class_get(xevent->xproperty.window,
- &(e->name), &(e->clas));
- e->time = xevent->xproperty.time;
- _ecore_x_event_last_time = e->time;
- ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE, e, _ecore_x_event_free_window_prop_name_class_change, NULL);
+ Ecore_X_Event_Window_Prop_Name_Class_Change *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Name_Class_Change));
+ if (!e)
+ return;
+
+ ecore_x_window_prop_name_class_get(xevent->xproperty.window,
+ &(e->name), &(e->clas));
+ e->time = xevent->xproperty.time;
+ _ecore_x_event_last_time = e->time;
+ ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE, e, _ecore_x_event_free_window_prop_name_class_change, NULL);
}
else if ((xevent->xproperty.atom == ECORE_X_ATOM_WM_NAME) || (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_NAME))
{
- Ecore_X_Event_Window_Prop_Title_Change *e;
-
- e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Title_Change));
- if (!e) return;
- e->title = ecore_x_window_prop_title_get(xevent->xproperty.window);
- e->time = xevent->xproperty.time;
- _ecore_x_event_last_time = e->time;
- ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE, e, _ecore_x_event_free_window_prop_title_change, NULL);
+ Ecore_X_Event_Window_Prop_Title_Change *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Title_Change));
+ if (!e)
+ return;
+
+ e->title = ecore_x_window_prop_title_get(xevent->xproperty.window);
+ e->time = xevent->xproperty.time;
+ _ecore_x_event_last_time = e->time;
+ ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE, e, _ecore_x_event_free_window_prop_title_change, NULL);
}
else if (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_VISIBLE_NAME)
{
- Ecore_X_Event_Window_Prop_Visible_Title_Change *e;
-
- e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Visible_Title_Change));
- if (!e) return;
- e->title = ecore_x_window_prop_visible_title_get(xevent->xproperty.window);
- e->time = xevent->xproperty.time;
- _ecore_x_event_last_time = e->time;
- ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE, e, _ecore_x_event_free_window_prop_visible_title_change, NULL);
+ Ecore_X_Event_Window_Prop_Visible_Title_Change *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Visible_Title_Change));
+ if (!e)
+ return;
+
+ e->title = ecore_x_window_prop_visible_title_get(xevent->xproperty.window);
+ e->time = xevent->xproperty.time;
+ _ecore_x_event_last_time = e->time;
+ ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE, e, _ecore_x_event_free_window_prop_visible_title_change, NULL);
}
else if ((xevent->xproperty.atom == ECORE_X_ATOM_WM_ICON_NAME) || (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_ICON_NAME))
{
- Ecore_X_Event_Window_Prop_Icon_Name_Change *e;
-
- e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Icon_Name_Change));
- if (!e) return;
- e->name = ecore_x_window_prop_icon_name_get(xevent->xproperty.window);
- e->time = xevent->xproperty.time;
- _ecore_x_event_last_time = e->time;
- ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE, e, _ecore_x_event_free_window_prop_icon_name_change, NULL);
+ Ecore_X_Event_Window_Prop_Icon_Name_Change *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Icon_Name_Change));
+ if (!e)
+ return;
+
+ e->name = ecore_x_window_prop_icon_name_get(xevent->xproperty.window);
+ e->time = xevent->xproperty.time;
+ _ecore_x_event_last_time = e->time;
+ ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE, e, _ecore_x_event_free_window_prop_icon_name_change, NULL);
}
else if (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME)
{
- Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change *e;
-
- e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change));
- if (!e) return;
- e->name = ecore_x_window_prop_visible_icon_name_get(xevent->xproperty.window);
- e->time = xevent->xproperty.time;
- _ecore_x_event_last_time = e->time;
- ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE, e, _ecore_x_event_free_window_prop_visible_icon_name_change, NULL);
+ Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change));
+ if (!e)
+ return;
+
+ e->name = ecore_x_window_prop_visible_icon_name_get(xevent->xproperty.window);
+ e->time = xevent->xproperty.time;
+ _ecore_x_event_last_time = e->time;
+ ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE, e, _ecore_x_event_free_window_prop_visible_icon_name_change, NULL);
}
else if (xevent->xproperty.atom == ECORE_X_ATOM_WM_CLIENT_MACHINE)
{
- Ecore_X_Event_Window_Prop_Client_Machine_Change *e;
-
- e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Client_Machine_Change));
- if (!e) return;
- e->name = ecore_x_window_prop_client_machine_get(xevent->xproperty.window);
- e->time = xevent->xproperty.time;
- _ecore_x_event_last_time = e->time;
- ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE, e, _ecore_x_event_free_window_prop_client_machine_change, NULL);
+ Ecore_X_Event_Window_Prop_Client_Machine_Change *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Client_Machine_Change));
+ if (!e)
+ return;
+
+ e->name = ecore_x_window_prop_client_machine_get(xevent->xproperty.window);
+ e->time = xevent->xproperty.time;
+ _ecore_x_event_last_time = e->time;
+ ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE, e, _ecore_x_event_free_window_prop_client_machine_change, NULL);
}
else if (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_PID)
{
- Ecore_X_Event_Window_Prop_Pid_Change *e;
-
- e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Pid_Change));
- if (!e) return;
- e->pid = ecore_x_window_prop_pid_get(xevent->xproperty.window);
- e->time = xevent->xproperty.time;
- _ecore_x_event_last_time = e->time;
- ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE, e, NULL, NULL);
+ Ecore_X_Event_Window_Prop_Pid_Change *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Pid_Change));
+ if (!e)
+ return;
+
+ e->pid = ecore_x_window_prop_pid_get(xevent->xproperty.window);
+ e->time = xevent->xproperty.time;
+ _ecore_x_event_last_time = e->time;
+ ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE, e, NULL, NULL);
}
else if (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_DESKTOP)
{
- Ecore_X_Event_Window_Prop_Desktop_Change *e;
+ Ecore_X_Event_Window_Prop_Desktop_Change *e;
- e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Desktop_Change));
- if (!e) return;
- e->desktop = ecore_x_window_prop_desktop_get(xevent->xproperty.window);
- ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE, e, NULL, NULL);
+ e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Desktop_Change));
+ if (!e)
+ return;
+
+ e->desktop = ecore_x_window_prop_desktop_get(xevent->xproperty.window);
+ ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE, e, NULL, NULL);
}
else
-#endif
+#endif /* if 0 */
{
- xcb_property_notify_event_t *ev;
+ xcb_property_notify_event_t *ev;
Ecore_X_Event_Window_Property *e;
ev = (xcb_property_notify_event_t *)event;
e = calloc(1,sizeof(Ecore_X_Event_Window_Property));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->window;
e->atom = ev->atom;
e->time = ev->time;
}
free(event);
-}
+} /* _ecore_x_event_handle_property_notify */
void
_ecore_x_event_handle_selection_clear(xcb_generic_event_t *event)
{
- xcb_selection_clear_event_t *ev;
- Ecore_X_Selection_Intern *d;
+ xcb_selection_clear_event_t *ev;
+ Ecore_X_Selection_Intern *d;
Ecore_X_Event_Selection_Clear *e;
- Ecore_X_Atom sel;
+ Ecore_X_Atom sel;
ev = (xcb_selection_clear_event_t *)event;
d = _ecore_x_selection_get(ev->selection);
if (d && (ev->time > d->time))
{
- _ecore_x_selection_set(XCB_NONE, NULL, 0,
+ _ecore_x_selection_set(XCB_NONE, NULL, 0,
ev->selection);
}
e->time = ev->time;
e->atom = sel = ev->selection;
if (sel == ECORE_X_ATOM_SELECTION_PRIMARY)
- e->selection = ECORE_X_SELECTION_PRIMARY;
+ e->selection = ECORE_X_SELECTION_PRIMARY;
else if (sel == ECORE_X_ATOM_SELECTION_SECONDARY)
- e->selection = ECORE_X_SELECTION_SECONDARY;
+ e->selection = ECORE_X_SELECTION_SECONDARY;
else if (sel == ECORE_X_ATOM_SELECTION_CLIPBOARD)
- e->selection = ECORE_X_SELECTION_CLIPBOARD;
+ e->selection = ECORE_X_SELECTION_CLIPBOARD;
else
- e->selection = ECORE_X_SELECTION_OTHER;
+ e->selection = ECORE_X_SELECTION_OTHER;
+
ecore_event_add(ECORE_X_EVENT_SELECTION_CLEAR, e, NULL, NULL);
free(event);
-}
+} /* _ecore_x_event_handle_selection_clear */
void
_ecore_x_event_handle_selection_request(xcb_generic_event_t *event)
{
xcb_selection_request_event_t *ev;
- Ecore_X_Selection_Intern *sd;
- xcb_selection_notify_event_t sn_event;
- void *data;
+ Ecore_X_Event_Selection_Request *e;
+ Ecore_X_Selection_Intern *sd;
+ void *data;
+ int len;
+ int typesize;
ev = (xcb_selection_request_event_t *)event;
- /* FIXME: is it the correct value ? */
- sn_event.response_type = XCB_SELECTION_NOTIFY;
- sn_event.pad0 = 0;
- /* FIXME: is it the correct value ? */
- sn_event.sequence = 0;
- sn_event.time = XCB_CURRENT_TIME;
- sn_event.requestor = ev->requestor;
- sn_event.selection = ev->selection;
- sn_event.target = ev->target;
+ _ecore_xcb_last_event_mouse_move = 0;
+
+ /*
+ * Generate a selection request event.
+ */
+ e = malloc(sizeof(Ecore_X_Event_Selection_Request));
+ e->owner = ev->owner;
+ e->requestor = ev->requestor;
+ e->time = ev->time;
+ e->selection = ev->selection;
+ e->target = ev->target;
+ e->property = ev->property;
+ ecore_event_add(ECORE_X_EVENT_SELECTION_REQUEST, e, NULL, NULL);
if ((sd = _ecore_x_selection_get(ev->selection)) &&
(sd->win == ev->owner))
{
- if (!ecore_x_selection_convert(ev->selection, ev->target,
- &data))
- {
- /* Refuse selection, conversion to requested target failed */
- sn_event.property = XCB_NONE;
- }
- else
- {
- /* FIXME: This does not properly handle large data transfers */
- ecore_x_window_prop_property_set(ev->requestor,
- ev->property,
- ev->target,
- 8, data, sd->length);
- sn_event.property = ev->property;
- free(data);
- }
- }
- else
- {
- sn_event.property = XCB_NONE;
- return;
- }
+ Ecore_X_Selection_Intern *si;
- /* FIXME: I use _ecore_xcb_conn, as ev has no information on the connection */
- xcb_send_event(_ecore_xcb_conn, 0,
- ev->requestor, 0, (const char *)&sn_event);
+ si = _ecore_x_selection_get(ev->selection);
+ if (si->data)
+ {
+ Ecore_X_Atom property;
+ Ecore_X_Atom type;
- free(event);
-}
+ /* Set up defaults for strings first */
+ type = ev->target;
+ typesize = 8;
+ len = sd->length;
+
+ if (!ecore_x_selection_convert(ev->selection, ev->target,
+ &data, &len, &type, &typesize))
+ {
+ /* Refuse selection, conversion to requested target failed */
+ property = XCB_NONE;
+ }
+ else
+ {
+ /* FIXME: This does not properly handle large data transfers */
+ ecore_x_window_prop_property_set(ev->requestor,
+ ev->property,
+ ev->target,
+ 8, data, sd->length);
+ property = ev->property;
+ free(data);
+ }
+
+ ecore_x_selection_notify_send(ev->requestor,
+ ev->selection,
+ ev->target,
+ property,
+ ev->time);
+ }
+ }
+} /* _ecore_x_event_handle_selection_request */
/* FIXME: round trip */
void
_ecore_x_event_handle_selection_notify(xcb_generic_event_t *event)
{
- xcb_selection_notify_event_t *ev;
+ xcb_selection_notify_event_t *ev;
Ecore_X_Event_Selection_Notify *e;
- unsigned char *data = NULL;
- Ecore_X_Atom selection;
- int num_ret;
- uint8_t format;
+ unsigned char *data = NULL;
+ Ecore_X_Atom selection;
+ int num_ret;
+ uint8_t format;
ev = (xcb_selection_notify_event_t *)event;
selection = ev->selection;
32,
&data,
&num_ret);
- if (!format) return;
+ if (!format)
+ return;
}
else
{
8,
&data,
&num_ret);
- if (!format) return;
+ if (!format)
+ return;
}
e = calloc(1, sizeof(Ecore_X_Event_Selection_Notify));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->requestor;
e->time = ev->time;
e->atom = selection;
e->target = _ecore_x_selection_target_get(ev->target);
if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
- e->selection = ECORE_X_SELECTION_PRIMARY;
+ e->selection = ECORE_X_SELECTION_PRIMARY;
else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
- e->selection = ECORE_X_SELECTION_SECONDARY;
+ e->selection = ECORE_X_SELECTION_SECONDARY;
else if (selection == ECORE_X_ATOM_SELECTION_XDND)
- e->selection = ECORE_X_SELECTION_XDND;
+ e->selection = ECORE_X_SELECTION_XDND;
else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
- e->selection = ECORE_X_SELECTION_CLIPBOARD;
+ e->selection = ECORE_X_SELECTION_CLIPBOARD;
else
- e->selection = ECORE_X_SELECTION_OTHER;
+ 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);
free(event);
-}
+} /* _ecore_x_event_handle_selection_notify */
void
_ecore_x_event_handle_colormap_notify(xcb_generic_event_t *event)
{
- xcb_colormap_notify_event_t *ev;
+ xcb_colormap_notify_event_t *ev;
Ecore_X_Event_Window_Colormap *e;
ev = (xcb_colormap_notify_event_t *)event;
e = calloc(1,sizeof(Ecore_X_Event_Window_Colormap));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->window;
e->cmap = ev->colormap;
if (ev->state == XCB_COLORMAP_STATE_INSTALLED)
e->installed = 1;
else
e->installed = 0;
+
e->time = _ecore_xcb_event_last_time;
ecore_event_add(ECORE_X_EVENT_WINDOW_COLORMAP, e, NULL, NULL);
free(event);
-}
+} /* _ecore_x_event_handle_colormap_notify */
void
_ecore_x_event_handle_client_message(xcb_generic_event_t *event)
(ev->format == 32) &&
(ev->data.data32[0] == (uint32_t)ECORE_X_ATOM_WM_DELETE_WINDOW))
{
- Ecore_X_Event_Window_Delete_Request *e;
+ Ecore_X_Event_Window_Delete_Request *e;
- e = calloc(1, sizeof(Ecore_X_Event_Window_Delete_Request));
- if (!e) return;
- e->win = ev->window;
- e->time = _ecore_xcb_event_last_time;
- ecore_event_add(ECORE_X_EVENT_WINDOW_DELETE_REQUEST, e, NULL, NULL);
- }
+ e = calloc(1, sizeof(Ecore_X_Event_Window_Delete_Request));
+ if (!e)
+ return;
+ e->win = ev->window;
+ e->time = _ecore_xcb_event_last_time;
+ ecore_event_add(ECORE_X_EVENT_WINDOW_DELETE_REQUEST, e, NULL, NULL);
+ }
else if ((ev->type == ECORE_X_ATOM_NET_WM_MOVERESIZE) &&
- (ev->format == 32) &&
- /* Ignore move and resize with keyboard */
- (ev->data.data32[2] < 9))
+ (ev->format == 32) &&
+ /* Ignore move and resize with keyboard */
+ (ev->data.data32[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 = ev->window;
- e->x = ev->data.data32[0];
- e->y = ev->data.data32[1];
- e->direction = ev->data.data32[2];
- e->button = ev->data.data32[3];
- e->source = ev->data.data32[4];
- ecore_event_add(ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST, e, NULL, NULL);
+ Ecore_X_Event_Window_Move_Resize_Request *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Window_Move_Resize_Request));
+ if (!e)
+ return;
+
+ e->win = ev->window;
+ e->x = ev->data.data32[0];
+ e->y = ev->data.data32[1];
+ e->direction = ev->data.data32[2];
+ e->button = ev->data.data32[3];
+ e->source = ev->data.data32[4];
+ ecore_event_add(ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST, e, NULL, NULL);
}
-
/* Xdnd Client Message Handling Begin */
/* Message Type: XdndEnter target */
else if (ev->type == ECORE_X_ATOM_XDND_ENTER)
{
- Ecore_X_Event_Xdnd_Enter *e;
- Ecore_X_DND_Target *target;
- uint32_t three;
-
- e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Enter));
- if (!e) return;
-
- target = _ecore_x_dnd_target_get();
- target->state = ECORE_X_DND_TARGET_ENTERED;
-
- target = _ecore_x_dnd_target_get();
- target->source = ev->data.data32[0];
- target->win = ev->window;
- target->version = ev->data.data32[1] >> 24;
- if (target->version > ECORE_X_DND_VERSION)
- {
+ Ecore_X_Event_Xdnd_Enter *e;
+ Ecore_X_DND_Target *target;
+ uint32_t three;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Enter));
+ if (!e)
+ return;
+
+ target = _ecore_x_dnd_target_get();
+ target->state = ECORE_X_DND_TARGET_ENTERED;
+
+ target = _ecore_x_dnd_target_get();
+ target->source = ev->data.data32[0];
+ target->win = ev->window;
+ target->version = ev->data.data32[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);
- return;
- }
+ ECORE_X_DND_VERSION);
+ return;
+ }
/* FIXME: roud trip, but I don't know how to suppress it */
- if ((three = ev->data.data32[1] & 0x1UL))
- {
- /* source supports more than 3 types, fetch property */
- unsigned char *data;
- Ecore_X_Atom *types;
- int num_ret;
- int i;
- uint8_t format;
+ if ((three = ev->data.data32[1] & 0x1UL))
+ {
+ /* source supports more than 3 types, fetch property */
+ unsigned char *data;
+ Ecore_X_Atom *types;
+ int num_ret;
+ int i;
+ uint8_t format;
ecore_x_window_prop_property_get_prefetch(target->source,
ECORE_X_ATOM_XDND_TYPE_LIST,
&data,
&num_ret);
if (!format)
- {
- ERR("DND: Could not fetch data type list from source window, aborting.");
- return;
- }
- types = (Ecore_X_Atom *)data;
- e->types = calloc(num_ret, sizeof(char *));
- if (e->types)
- {
+ {
+ ERR("DND: Could not fetch data type list from source window, aborting.");
+ return;
+ }
+
+ types = (Ecore_X_Atom *)data;
+ e->types = calloc(num_ret, sizeof(char *));
+ if (e->types)
+ {
xcb_get_atom_name_cookie_t *cookies;
cookies = (xcb_get_atom_name_cookie_t *)malloc(sizeof(xcb_get_atom_name_cookie_t) * num_ret);
for (i = 0; i < num_ret; i++)
- cookies[i] = xcb_get_atom_name_unchecked(_ecore_xcb_conn, types[i]);
- for (i = 0; i < num_ret; i++)
+ cookies[i] = xcb_get_atom_name_unchecked(_ecore_xcb_conn, types[i]);
+ for (i = 0; i < num_ret; i++)
{
xcb_get_atom_name_reply_t *reply;
- char *name;
+ char *name;
reply = xcb_get_atom_name_reply(_ecore_xcb_conn, cookies[i], NULL);
if (reply)
}
}
free(cookies);
- }
- e->num_types = num_ret;
- }
- else
- {
- int i = 0;
-
- e->types = calloc(3, sizeof(char *));
- if (e->types)
- {
+ }
+
+ e->num_types = num_ret;
+ }
+ else
+ {
+ int i = 0;
+
+ e->types = calloc(3, sizeof(char *));
+ if (e->types)
+ {
xcb_get_atom_name_cookie_t cookies[3];
for (i = 0; i < 3; i++)
- cookies[i] = xcb_get_atom_name_unchecked(_ecore_xcb_conn, ev->data.data32[i + 2]);
+ cookies[i] = xcb_get_atom_name_unchecked(_ecore_xcb_conn, ev->data.data32[i + 2]);
for (i = 0; i < 3; i++)
{
xcb_get_atom_name_reply_t *reply;
- char *name;
+ char *name;
reply = xcb_get_atom_name_reply(_ecore_xcb_conn, cookies[i], NULL);
if (reply && (ev->data.data32[i + 2]))
name[reply->name_len] = '\0';
e->types[i] = name;
}
- if (reply) free(reply);
+
+ if (reply)
+ free(reply);
}
- }
- 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);
- }
+ 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 (ev->type == ECORE_X_ATOM_XDND_POSITION)
{
- Ecore_X_Event_Xdnd_Position *e;
- Ecore_X_DND_Target *target;
-
- target = _ecore_x_dnd_target_get();
- if ((target->source != (Ecore_X_Window)ev->data.data32[0]) ||
- (target->win != ev->window))
- return;
-
- target->pos.x = (int16_t)ev->data.data32[2] >> 16;
- target->pos.y = (int16_t)ev->data.data32[2] & 0xFFFFUL;
- target->action = ev->data.data32[4]; /* Version 2 */
-
- target->time = (target->version >= 1) ?
- ev->data.data32[3] : XCB_CURRENT_TIME;
-
- e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Position));
- if (!e) return;
- e->win = target->win;
- e->source = target->source;
- e->position.x = target->pos.x;
- e->position.y = target->pos.y;
- e->action = target->action;
- ecore_event_add(ECORE_X_EVENT_XDND_POSITION, e, NULL, NULL);
+ Ecore_X_Event_Xdnd_Position *e;
+ Ecore_X_DND_Target *target;
+
+ target = _ecore_x_dnd_target_get();
+ if ((target->source != (Ecore_X_Window)ev->data.data32[0]) ||
+ (target->win != ev->window))
+ return;
+
+ target->pos.x = (int16_t)ev->data.data32[2] >> 16;
+ target->pos.y = (int16_t)ev->data.data32[2] & 0xFFFFUL;
+ target->action = ev->data.data32[4]; /* Version 2 */
+
+ target->time = (target->version >= 1) ?
+ ev->data.data32[3] : XCB_CURRENT_TIME;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Position));
+ if (!e)
+ return;
+
+ e->win = target->win;
+ e->source = target->source;
+ e->position.x = target->pos.x;
+ e->position.y = target->pos.y;
+ e->action = target->action;
+ ecore_event_add(ECORE_X_EVENT_XDND_POSITION, e, NULL, NULL);
}
-
/* Message Type: XdndStatus source */
else if (ev->type == ECORE_X_ATOM_XDND_STATUS)
{
- Ecore_X_Event_Xdnd_Status *e;
- Ecore_X_DND_Source *source;
-
- source = _ecore_x_dnd_source_get();
- /* Make sure source/target match */
- if ((source->win != ev->window ) ||
- (source->dest != ev->data.data32[0]))
- return;
-
- source->await_status = 0;
-
- source->will_accept = ev->data.data32[1] & 0x1UL;
- source->suppress = (ev->data.data32[1] & 0x2UL) ? 0 : 1;
-
- source->rectangle.x = (int16_t)ev->data.data32[2] >> 16;
- source->rectangle.y = (int16_t)ev->data.data32[2] & 0xFFFFUL;
- source->rectangle.width = (uint16_t)ev->data.data32[3] >> 16;
- source->rectangle.height = (uint16_t)ev->data.data32[3] & 0xFFFFUL;
-
- source->accepted_action = ev->data.data32[4];
-
- e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Status));
- if (!e) return;
- e->win = source->win;
- e->target = source->dest;
- e->will_accept = source->will_accept;
- e->rectangle.x = source->rectangle.x;
- e->rectangle.y = source->rectangle.y;
- e->rectangle.width = source->rectangle.width;
- e->rectangle.height = source->rectangle.height;
- e->action = source->accepted_action;
-
- ecore_event_add(ECORE_X_EVENT_XDND_STATUS, e, NULL, NULL);
- }
+ Ecore_X_Event_Xdnd_Status *e;
+ Ecore_X_DND_Source *source;
+
+ source = _ecore_x_dnd_source_get();
+ /* Make sure source/target match */
+ if ((source->win != ev->window) ||
+ (source->dest != ev->data.data32[0]))
+ return;
+ source->await_status = 0;
+
+ source->will_accept = ev->data.data32[1] & 0x1UL;
+ source->suppress = (ev->data.data32[1] & 0x2UL) ? 0 : 1;
+
+ source->rectangle.x = (int16_t)ev->data.data32[2] >> 16;
+ source->rectangle.y = (int16_t)ev->data.data32[2] & 0xFFFFUL;
+ source->rectangle.width = (uint16_t)ev->data.data32[3] >> 16;
+ source->rectangle.height = (uint16_t)ev->data.data32[3] & 0xFFFFUL;
+
+ source->accepted_action = ev->data.data32[4];
+
+ e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Status));
+ if (!e)
+ return;
+
+ e->win = source->win;
+ e->target = source->dest;
+ e->will_accept = source->will_accept;
+ e->rectangle.x = source->rectangle.x;
+ e->rectangle.y = source->rectangle.y;
+ e->rectangle.width = source->rectangle.width;
+ e->rectangle.height = source->rectangle.height;
+ e->action = source->accepted_action;
+
+ ecore_event_add(ECORE_X_EVENT_XDND_STATUS, e, NULL, NULL);
+ }
/* Message Type: XdndLeave target */
/* Pretend the whole thing never happened, sort of */
else if (ev->type == ECORE_X_ATOM_XDND_LEAVE)
{
- Ecore_X_Event_Xdnd_Leave *e;
- Ecore_X_DND_Target *target;
+ Ecore_X_Event_Xdnd_Leave *e;
+ Ecore_X_DND_Target *target;
- target = _ecore_x_dnd_target_get();
- if ((target->source != (Ecore_X_Window)ev->data.data32[0]) ||
- (target->win != ev->window))
- return;
+ target = _ecore_x_dnd_target_get();
+ if ((target->source != (Ecore_X_Window)ev->data.data32[0]) ||
+ (target->win != ev->window))
+ return;
- target->state = ECORE_X_DND_TARGET_IDLE;
+ target->state = ECORE_X_DND_TARGET_IDLE;
- e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Leave));
- if (!e) return;
- e->win = ev->window;
- e->source = ev->data.data32[0];
- ecore_event_add(ECORE_X_EVENT_XDND_LEAVE, e, NULL, NULL);
- }
+ e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Leave));
+ if (!e)
+ return;
+ e->win = ev->window;
+ e->source = ev->data.data32[0];
+ ecore_event_add(ECORE_X_EVENT_XDND_LEAVE, e, NULL, NULL);
+ }
/* Message Type: XdndDrop target */
else if (ev->type == ECORE_X_ATOM_XDND_DROP)
{
- Ecore_X_Event_Xdnd_Drop *e;
- Ecore_X_DND_Target *target;
-
- target = _ecore_x_dnd_target_get();
- /* Match source/target */
- if ((target->source != (Ecore_X_Window)ev->data.data32[0]) ||
- (target->win != ev->window))
- return;
-
- target->time = (target->version >= 1) ?
- ev->data.data32[2] : _ecore_xcb_event_last_time;
-
- e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Drop));
- if (!e) return;
- e->win = target->win;
- e->source = target->source;
- e->action = target->action;
- e->position.x = target->pos.x;
- e->position.y = target->pos.y;
- ecore_event_add(ECORE_X_EVENT_XDND_DROP, e, NULL, NULL);
+ Ecore_X_Event_Xdnd_Drop *e;
+ Ecore_X_DND_Target *target;
+
+ target = _ecore_x_dnd_target_get();
+ /* Match source/target */
+ if ((target->source != (Ecore_X_Window)ev->data.data32[0]) ||
+ (target->win != ev->window))
+ return;
+
+ target->time = (target->version >= 1) ?
+ ev->data.data32[2] : _ecore_xcb_event_last_time;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Drop));
+ if (!e)
+ return;
+
+ e->win = target->win;
+ e->source = target->source;
+ e->action = target->action;
+ e->position.x = target->pos.x;
+ e->position.y = target->pos.y;
+ ecore_event_add(ECORE_X_EVENT_XDND_DROP, e, NULL, NULL);
}
-
/* Message Type: XdndFinished source */
else if (ev->type == ECORE_X_ATOM_XDND_FINISHED)
{
- Ecore_X_Event_Xdnd_Finished *e;
- Ecore_X_DND_Source *source;
- uint8_t completed = 1;
-
- source = _ecore_x_dnd_source_get();
- /* Match source/target */
- if ((source->win != ev->window) ||
- (source->dest != ev->data.data32[0]))
- return;
-
- if ((source->version >= 5) && (ev->data.data32[1] & 0x1UL))
- {
- /* Target successfully performed drop action */
- ecore_x_selection_xdnd_clear();
- source->state = ECORE_X_DND_SOURCE_IDLE;
- }
- else
- {
- completed = 0;
- 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 = ev->data.data32[2];
- e->action = source->accepted_action;
- }
- else
- {
- source->accepted_action = 0;
- e->action = source->action;
- }
-
- ecore_event_add(ECORE_X_EVENT_XDND_FINISHED, e, NULL, NULL);
+ Ecore_X_Event_Xdnd_Finished *e;
+ Ecore_X_DND_Source *source;
+ uint8_t completed = 1;
+
+ source = _ecore_x_dnd_source_get();
+ /* Match source/target */
+ if ((source->win != ev->window) ||
+ (source->dest != ev->data.data32[0]))
+ return;
+
+ if ((source->version >= 5) && (ev->data.data32[1] & 0x1UL))
+ {
+ /* Target successfully performed drop action */
+ ecore_x_selection_xdnd_clear();
+ source->state = ECORE_X_DND_SOURCE_IDLE;
+ }
+ else
+ {
+ completed = 0;
+ 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 = ev->data.data32[2];
+ e->action = source->accepted_action;
+ }
+ else
+ {
+ source->accepted_action = 0;
+ e->action = source->action;
+ }
+
+ ecore_event_add(ECORE_X_EVENT_XDND_FINISHED, e, NULL, NULL);
}
else if (ev->type == ECORE_X_ATOM_NET_WM_STATE)
{
- Ecore_X_Event_Window_State_Request *e;
-
- e = calloc(1, sizeof(Ecore_X_Event_Window_State_Request));
- if (!e) return;
- e->win = ev->window;
- if (ev->data.data32[0] == 0)
- e->action = ECORE_X_WINDOW_STATE_ACTION_REMOVE;
- else if (ev->data.data32[0] == 1)
- e->action = ECORE_X_WINDOW_STATE_ACTION_ADD;
- else if (ev->data.data32[0] == 2)
- e->action = ECORE_X_WINDOW_STATE_ACTION_TOGGLE;
- else
- {
- free(e);
- return;
- }
- e->state[0] = _ecore_x_netwm_state_get(ev->data.data32[1]);
- if (e->state[0] == ECORE_X_WINDOW_STATE_UNKNOWN)
- {
+ Ecore_X_Event_Window_State_Request *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Window_State_Request));
+ if (!e)
+ return;
+
+ e->win = ev->window;
+ if (ev->data.data32[0] == 0)
+ e->action = ECORE_X_WINDOW_STATE_ACTION_REMOVE;
+ else if (ev->data.data32[0] == 1)
+ e->action = ECORE_X_WINDOW_STATE_ACTION_ADD;
+ else if (ev->data.data32[0] == 2)
+ e->action = ECORE_X_WINDOW_STATE_ACTION_TOGGLE;
+ else
+ {
+ free(e);
+ return;
+ }
+
+ e->state[0] = _ecore_x_netwm_state_get(ev->data.data32[1]);
+ if (e->state[0] == ECORE_X_WINDOW_STATE_UNKNOWN)
+ {
xcb_get_atom_name_reply_t *reply;
- char *name;
+ char *name;
/* FIXME: round trip */
reply = xcb_get_atom_name_reply(_ecore_xcb_conn,
xcb_get_atom_name_unchecked(_ecore_xcb_conn, ev->data.data32[1]),
NULL);
- if (reply)
+ if (reply)
{
- name = (char *)malloc(sizeof (char) * (reply->name_len + 1));
- memcpy(name,
- xcb_get_atom_name_name(reply),
- reply->name_len);
- name[reply->name_len] = '\0';
- ERR("Unknown state: %s", name);
- free(name);
- free(reply);
+ name = (char *)malloc(sizeof (char) * (reply->name_len + 1));
+ memcpy(name,
+ xcb_get_atom_name_name(reply),
+ reply->name_len);
+ name[reply->name_len] = '\0';
+ ERR("Unknown state: %s", name);
+ free(name);
+ free(reply);
}
- }
- e->state[1] = _ecore_x_netwm_state_get(ev->data.data32[2]);
- if (e->state[1] == ECORE_X_WINDOW_STATE_UNKNOWN)
- {
+ }
+
+ e->state[1] = _ecore_x_netwm_state_get(ev->data.data32[2]);
+ if (e->state[1] == ECORE_X_WINDOW_STATE_UNKNOWN)
+ {
xcb_get_atom_name_reply_t *reply;
- char *name;
+ char *name;
reply = xcb_get_atom_name_reply(_ecore_xcb_conn,
xcb_get_atom_name_unchecked(_ecore_xcb_conn, ev->data.data32[2]),
NULL);
- if (reply)
+ if (reply)
{
- name = (char *)malloc(sizeof (char) * (reply->name_len + 1));
- memcpy(name,
- xcb_get_atom_name_name(reply),
- reply->name_len);
- name[reply->name_len] = '\0';
- WRN("Unknown state: %s", name);
- free(name);
+ name = (char *)malloc(sizeof (char) * (reply->name_len + 1));
+ memcpy(name,
+ xcb_get_atom_name_name(reply),
+ reply->name_len);
+ name[reply->name_len] = '\0';
+ WRN("Unknown state: %s", name);
+ free(name);
}
- }
- e->source = ev->data.data32[3];
+ }
+
+ e->source = ev->data.data32[3];
- ecore_event_add(ECORE_X_EVENT_WINDOW_STATE_REQUEST, e, NULL, NULL);
+ ecore_event_add(ECORE_X_EVENT_WINDOW_STATE_REQUEST, e, NULL, NULL);
}
else if ((ev->type == ECORE_X_ATOM_WM_CHANGE_STATE)
- && (ev->format == 32)
- && (ev->data.data32[0] == XCB_WM_HINT_STATE))
+ && (ev->format == 32)
+ && (ev->data.data32[0] == XCB_WM_HINT_STATE))
{
- Ecore_X_Event_Window_State_Request *e;
+ Ecore_X_Event_Window_State_Request *e;
- e = calloc(1, sizeof(Ecore_X_Event_Window_State_Request));
- if (!e) return;
- e->win = ev->window;
- e->action = ECORE_X_WINDOW_STATE_ACTION_ADD;
- e->state[0] = ECORE_X_WINDOW_STATE_ICONIFIED;
+ e = calloc(1, sizeof(Ecore_X_Event_Window_State_Request));
+ if (!e)
+ return;
- ecore_event_add(ECORE_X_EVENT_WINDOW_STATE_REQUEST, e, NULL, NULL);
+ e->win = ev->window;
+ e->action = ECORE_X_WINDOW_STATE_ACTION_ADD;
+ e->state[0] = ECORE_X_WINDOW_STATE_ICONIFIED;
+
+ ecore_event_add(ECORE_X_EVENT_WINDOW_STATE_REQUEST, e, NULL, NULL);
}
else if ((ev->type == ECORE_X_ATOM_NET_WM_DESKTOP)
- && (ev->format == 32))
+ && (ev->format == 32))
{
- Ecore_X_Event_Desktop_Change *e;
+ Ecore_X_Event_Desktop_Change *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Desktop_Change));
+ if (!e)
+ return;
- e = calloc(1, sizeof(Ecore_X_Event_Desktop_Change));
- if (!e) return;
- e->win = ev->window;
- e->desk = ev->data.data32[0];
- e->source = ev->data.data32[1];
+ e->win = ev->window;
+ e->desk = ev->data.data32[0];
+ e->source = ev->data.data32[1];
- ecore_event_add(ECORE_X_EVENT_DESKTOP_CHANGE, e, NULL, NULL);
+ ecore_event_add(ECORE_X_EVENT_DESKTOP_CHANGE, e, NULL, NULL);
}
else if ((ev->type == ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS))
{
- Ecore_X_Event_Frame_Extents_Request *e;
+ Ecore_X_Event_Frame_Extents_Request *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Frame_Extents_Request));
+ if (!e)
+ return;
- e = calloc(1, sizeof(Ecore_X_Event_Frame_Extents_Request));
- if (!e) return;
- e->win = ev->window;
+ e->win = ev->window;
- ecore_event_add(ECORE_X_EVENT_FRAME_EXTENTS_REQUEST, e, NULL, NULL);
+ ecore_event_add(ECORE_X_EVENT_FRAME_EXTENTS_REQUEST, e, NULL, NULL);
}
else if ((ev->type == ECORE_X_ATOM_WM_PROTOCOLS)
- && ((Ecore_X_Atom)ev->data.data32[0] == ECORE_X_ATOM_NET_WM_PING)
- && (ev->format == 32))
+ && ((Ecore_X_Atom)ev->data.data32[0] == ECORE_X_ATOM_NET_WM_PING)
+ && (ev->format == 32))
{
- Ecore_X_Event_Ping *e;
+ Ecore_X_Event_Ping *e;
- e = calloc(1, sizeof(Ecore_X_Event_Ping));
- if (!e) return;
- e->win = ev->window;
- e->time = ev->data.data32[1];
- e->event_win = ev->data.data32[2];
+ e = calloc(1, sizeof(Ecore_X_Event_Ping));
+ if (!e)
+ return;
- ecore_event_add(ECORE_X_EVENT_PING, e, NULL, NULL);
+ e->win = ev->window;
+ e->time = ev->data.data32[1];
+ e->event_win = ev->data.data32[2];
+
+ ecore_event_add(ECORE_X_EVENT_PING, e, NULL, NULL);
}
else if ((ev->type == ECORE_X_ATOM_NET_STARTUP_INFO_BEGIN) &&
- (ev->format == 8))
+ (ev->format == 8))
{
- _ecore_x_netwm_startup_info_begin(ev->window, (char *)ev->data.data8);
+ _ecore_x_netwm_startup_info_begin(ev->window, (char *)ev->data.data8);
}
else if ((ev->type == ECORE_X_ATOM_NET_STARTUP_INFO) &&
- (ev->format == 8))
+ (ev->format == 8))
{
- _ecore_x_netwm_startup_info(ev->window, (char *)ev->data.data8);
+ _ecore_x_netwm_startup_info(ev->window, (char *)ev->data.data8);
}
else if ((ev->type == 27777)
- && (ev->data.data32[0] == 0x7162534)
- && (ev->format == 32)
- && (ev->window == _ecore_xcb_private_window))
+ && (ev->data.data32[0] == 0x7162534)
+ && (ev->format == 32)
+ && (ev->window == _ecore_xcb_private_window))
{
- /* a grab sync marker */
- if (ev->data.data32[1] == 0x10000001)
- _ecore_x_window_grab_remove(ev->data.data32[2]);
- else if (ev->data.data32[1] == 0x10000002)
- _ecore_x_key_grab_remove(ev->data.data32[2]);
+ /* a grab sync marker */
+ if (ev->data.data32[1] == 0x10000001)
+ _ecore_x_window_grab_remove(ev->data.data32[2]);
+ else if (ev->data.data32[1] == 0x10000002)
+ _ecore_x_key_grab_remove(ev->data.data32[2]);
}
else
{
- Ecore_X_Event_Client_Message *e;
- int i;
-
- e = calloc(1, sizeof(Ecore_X_Event_Client_Message));
- if (!e) return;
- e->win = ev->window;
- e->message_type = ev->type;
- e->format = ev->format;
- for (i = 0; i < 5; i++)
- e->data.l[i] = ev->data.data32[i];
-
- ecore_event_add(ECORE_X_EVENT_CLIENT_MESSAGE, e, NULL, NULL);
+ Ecore_X_Event_Client_Message *e;
+ int i;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Client_Message));
+ if (!e)
+ return;
+
+ e->win = ev->window;
+ e->message_type = ev->type;
+ e->format = ev->format;
+ for (i = 0; i < 5; i++)
+ e->data.l[i] = ev->data.data32[i];
+
+ ecore_event_add(ECORE_X_EVENT_CLIENT_MESSAGE, e, NULL, NULL);
}
free(event);
-}
+} /* _ecore_x_event_handle_client_message */
void
_ecore_x_event_handle_mapping_notify(xcb_generic_event_t *event)
/* FIXME: handle this event type */
free(event);
-}
+} /* _ecore_x_event_handle_mapping_notify */
void
_ecore_x_event_handle_shape_change(xcb_generic_event_t *event)
{
#ifdef ECORE_X_SHAPE
- xcb_shape_notify_event_t *ev;
+ xcb_shape_notify_event_t *ev;
Ecore_X_Event_Window_Shape *e;
ev = (xcb_shape_notify_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Window_Shape));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->affected_window;
e->time = ev->server_time;
ecore_event_add(ECORE_X_EVENT_WINDOW_SHAPE, e, NULL, NULL);
#endif /* ECORE_X_SHAPE */
free(event);
-}
+} /* _ecore_x_event_handle_shape_change */
void
_ecore_x_event_handle_screensaver_notify(xcb_generic_event_t *event)
{
#ifdef ECORE_X_SCREENSAVER
- xcb_screensaver_notify_event_t *ev;
+ xcb_screensaver_notify_event_t *ev;
Ecore_X_Event_Screensaver_Notify *e;
ev = (xcb_screensaver_notify_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Screensaver_Notify));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->window;
if (ev->state == XCB_SCREENSAVER_STATE_ON)
- e->on = 1;
+ e->on = 1;
else
- e->on = 0;
+ e->on = 0;
+
e->time = ev->time;
ecore_event_add(ECORE_X_EVENT_SCREENSAVER_NOTIFY, e, NULL, NULL);
#endif /* ECORE_X_SCREENSAVER */
free(event);
-}
+} /* _ecore_x_event_handle_screensaver_notify */
void
_ecore_x_event_handle_sync_counter(xcb_generic_event_t *event)
{
#ifdef ECORE_X_SYNC
xcb_sync_counter_notify_event_t *ev;
- Ecore_X_Event_Sync_Counter *e;
+ Ecore_X_Event_Sync_Counter *e;
ev = (xcb_sync_counter_notify_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Sync_Counter));
- if (!e) return;
+ if (!e)
+ return;
+
e->time = ev->timestamp;
ecore_event_add(ECORE_X_EVENT_SYNC_COUNTER, e, NULL, NULL);
#endif /* ECORE_X_SYNC */
free(event);
-}
+} /* _ecore_x_event_handle_sync_counter */
void
_ecore_x_event_handle_sync_alarm(xcb_generic_event_t *event)
{
#ifdef ECORE_X_SYNC
xcb_sync_alarm_notify_event_t *ev;
- Ecore_X_Event_Sync_Alarm *e;
+ Ecore_X_Event_Sync_Alarm *e;
ev = (xcb_sync_alarm_notify_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Sync_Alarm));
- if (!e) return;
+ if (!e)
+ return;
+
e->time = ev->timestamp;
e->alarm = ev->alarm;
ecore_event_add(ECORE_X_EVENT_SYNC_ALARM, e, NULL, NULL);
#endif /* ECORE_X_SYNC */
free(event);
-}
+} /* _ecore_x_event_handle_sync_alarm */
/* FIXME: round trip */
void
{
#ifdef ECORE_X_RANDR
xcb_randr_screen_change_notify_event_t *ev;
- Ecore_X_Event_Screen_Change *e;
+ Ecore_X_Event_Screen_Change *e;
ev = (xcb_randr_screen_change_notify_event_t *)event;
if ((ev->response_type & ~0x80) != XCB_CONFIGURE_NOTIFY)
{
- xcb_query_extension_reply_t *rep;
-
- rep = xcb_query_extension_reply(_ecore_xcb_conn,
- xcb_query_extension_unchecked(_ecore_xcb_conn,
- strlen("randr"),
- "randr"),
- NULL);
-
- if ((!rep) ||
- (((ev->response_type & ~0x80) - rep->first_event) != XCB_RANDR_SCREEN_CHANGE_NOTIFY))
- WRN("ERROR: Can't update RandR config!");
- if (rep)
- free(rep);
+ xcb_query_extension_reply_t *rep;
+
+ rep = xcb_query_extension_reply(_ecore_xcb_conn,
+ xcb_query_extension_unchecked(_ecore_xcb_conn,
+ strlen("randr"),
+ "randr"),
+ NULL);
+
+ if ((!rep) ||
+ (((ev->response_type & ~0x80) - rep->first_event) != XCB_RANDR_SCREEN_CHANGE_NOTIFY))
+ WRN("ERROR: Can't update RandR config!");
+
+ if (rep)
+ free(rep);
}
e = calloc(1, sizeof(Ecore_X_Event_Screen_Change));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->request_window;
e->root = ev->root;
e->width = ev->width;
#endif /* ECORE_X_RANDR */
free(event);
-}
+} /* _ecore_x_event_handle_randr_change */
void
_ecore_x_event_handle_fixes_selection_notify(xcb_generic_event_t *event)
#endif /* ECORE_X_FIXES */
free(event);
-}
+} /* _ecore_x_event_handle_fixes_selection_notify */
void
_ecore_x_event_handle_damage_notify(xcb_generic_event_t *event)
{
#ifdef ECORE_XCBDAMAGE
xcb_damage_notify_event_t *ev;
- Ecore_X_Event_Damage *e;
+ Ecore_X_Event_Damage *e;
ev = (xcb_damage_notify_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Damage));
- if (!e) return;
+ if (!e)
+ return;
e->level = ev->level;
e->drawable = ev->drawable;
#endif /* ECORE_XCBDAMAGE */
free(event);
-}
+} /* _ecore_x_event_handle_damage_notify */
+
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#include "ecore_xcb_private.h"
-
/**
* @defgroup Ecore_X_Fixes_Group X Fixes Extension Functions
*
* Functions related to the X Fixes extension.
*/
-
#ifdef ECORE_XCB_FIXES
static int _xfixes_available = 0;
static xcb_xfixes_query_version_cookie_t _ecore_xcb_xfixes_init_cookie;
#endif /* ECORE_XCB_FIXES */
-
/* To avoid round trips, the initialization is separated in 2
functions: _ecore_xcb_xfixes_init and
_ecore_xcb_xfixes_init_finalize. The first one gets the cookies and
#ifdef ECORE_XCB_FIXES
if (reply && (reply->present))
_ecore_xcb_xfixes_init_cookie = xcb_xfixes_query_version_unchecked(_ecore_xcb_conn, 4, 0);
+
#endif /* ECORE_XCB_FIXES */
-}
+} /* _ecore_x_xfixes_init */
void
_ecore_x_xfixes_init_finalize(void)
if (reply)
{
if (reply->major_version >= 3)
- _xfixes_available = 1;
+ _xfixes_available = 1;
+
free(reply);
}
-#endif /* ECORE_XCB_FIXES */
-}
+#endif /* ECORE_XCB_FIXES */
+} /* _ecore_x_xfixes_init_finalize */
/**
* Return whether the X server supports the Fixes Extension.
{
#ifdef ECORE_XCB_FIXES
return _xfixes_available;
-#else
+#else /* ifdef ECORE_XCB_FIXES */
return 0;
#endif /* ECORE_XCB_FIXES */
-}
-
+} /* ecore_x_xfixes_query */
/**
* Create a region from rectangles.
#endif /* ECORE_XCB_FIXES */
return region;
-}
-
+} /* ecore_x_region_new */
/**
* Create a region from a pixmap.
#endif /* ECORE_XCB_FIXES */
return region;
-}
-
+} /* ecore_x_region_new_from_bitmap */
/**
* Create a region from a window.
#endif /* ECORE_XCB_FIXES */
return region;
-}
-
+} /* ecore_x_region_new_from_window */
/**
* Create a region from a graphic context.
#endif /* ECORE_XCB_FIXES */
return region;
-}
-
+} /* ecore_x_region_new_from_gc */
/**
* Create a region from a picture.
#endif /* ECORE_XCB_FIXES */
return region;
-}
-
+} /* ecore_x_region_new_from_picture */
/**
* Destroy a region.
#ifdef ECORE_XCB_FIXES
xcb_xfixes_destroy_region(_ecore_xcb_conn, region);
#endif /* ECORE_XCB_FIXES */
-}
-
+} /* ecore_x_region_free */
/**
* Set the content of a region.
#ifdef ECORE_XCB_FIXES
xcb_xfixes_set_region(_ecore_xcb_conn, region, num, (xcb_rectangle_t *)rects);
#endif /* ECORE_XCB_FIXES */
-}
-
+} /* ecore_x_region_set */
/**
* Copy the content of a region.
#ifdef ECORE_XCB_FIXES
xcb_xfixes_copy_region(_ecore_xcb_conn, source, dest);
#endif /* ECORE_XCB_FIXES */
-}
-
+} /* ecore_x_region_copy */
/**
* Make the union of two regions.
#ifdef ECORE_XCB_FIXES
xcb_xfixes_union_region(_ecore_xcb_conn, source1, source2, dest);
#endif /* ECORE_XCB_FIXES */
-}
-
+} /* ecore_x_region_combine */
/**
* Make the intersection of two regions.
#ifdef ECORE_XCB_FIXES
xcb_xfixes_intersect_region(_ecore_xcb_conn, source1, source2, dest);
#endif /* ECORE_XCB_FIXES */
-}
-
+} /* ecore_x_region_intersect */
/**
* Make the substraction of two regions.
#ifdef ECORE_XCB_FIXES
xcb_xfixes_subtract_region(_ecore_xcb_conn, source1, source2, dest);
#endif /* ECORE_XCB_FIXES */
-}
-
+} /* ecore_x_region_subtract */
/**
* Make the substraction of regions by bounds.
rect.height = bounds->height;
xcb_xfixes_invert_region(_ecore_xcb_conn, source, rect, dest);
#endif /* ECORE_XCB_FIXES */
-}
-
+} /* ecore_x_region_invert */
/**
* Translate a region.
#ifdef ECORE_XCB_FIXES
xcb_xfixes_translate_region(_ecore_xcb_conn, region, dx, dy);
#endif /* ECORE_XCB_FIXES */
-}
-
+} /* ecore_x_region_translate */
/**
* Extent a region.
#ifdef ECORE_XCB_FIXES
xcb_xfixes_region_extents(_ecore_xcb_conn, source, dest);
#endif /* ECORE_XCB_FIXES */
-}
-
+} /* ecore_x_region_extents */
/**
* Sends the XFixesFetchRegion request.
cookie = xcb_xfixes_fetch_region_unchecked(_ecore_xcb_conn, region);
_ecore_xcb_cookie_cache(cookie.sequence);
#endif /* ECORE_XCB_FIXES */
-}
-
+} /* ecore_x_region_fetch_prefetch */
/**
* Gets the reply of the XFixesFetchRegion request sent by ecore_xcb_region_fetch_prefetch().
reply = xcb_xfixes_fetch_region_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
#endif /* ECORE_XCB_FIXES */
-}
-
+} /* ecore_x_region_fetch_fetch */
/**
* Return the rectangles that compose a region.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI Ecore_X_Rectangle *
-ecore_x_region_fetch(Ecore_X_Region region __UNUSED__,
- int *num,
- Ecore_X_Rectangle *bounds)
+ecore_x_region_fetch(Ecore_X_Region region __UNUSED__,
+ int *num,
+ Ecore_X_Rectangle *bounds)
{
- Ecore_X_Rectangle extents = { 0, 0, 0, 0};
+ Ecore_X_Rectangle extents = { 0, 0, 0, 0};
Ecore_X_Rectangle *rects = NULL;
#ifdef ECORE_XCB_FIXES
- int n;
+ int n;
xcb_xfixes_fetch_region_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply)
{
- if (num) *num = 0;
- if (bounds) *bounds = extents;
- return NULL;
+ if (num)
+ *num = 0;
+
+ if (bounds)
+ *bounds = extents;
+
+ return NULL;
}
+
n = xcb_xfixes_fetch_region_rectangles_length(reply);
rects = (Ecore_X_Rectangle *)malloc(n * sizeof(Ecore_X_Rectangle));
if (!rects)
{
- if (num) *num = 0;
- if (bounds) *bounds = extents;
+ if (num)
+ *num = 0;
+
+ if (bounds)
+ *bounds = extents;
- return NULL;
+ return NULL;
}
- if (num) *num = n;
+ if (num)
+ *num = n;
+
if (bounds)
{
bounds->x = reply->extents.x;
bounds->width = reply->extents.width;
bounds->height = reply->extents.height;
}
+
memcpy(rects,
xcb_xfixes_fetch_region_rectangles(reply),
sizeof(Ecore_X_Rectangle) * n);
return rects;
-#else
- if (num) *num = 0;
- if (bounds) *bounds = extents;
+#else /* ifdef ECORE_XCB_FIXES */
+ if (num)
+ *num = 0;
+
+ if (bounds)
+ *bounds = extents;
+
return NULL;
#endif /* ECORE_XCB_FIXES */
-}
-
+} /* ecore_x_region_fetch */
/**
* Expand a region.
#ifdef ECORE_XCB_FIXES
xcb_xfixes_expand_region(_ecore_xcb_conn, source, dest, left, right, top, bottom);
#endif /* ECORE_XCB_FIXES */
-}
-
+} /* ecore_x_region_expand */
/**
* Change clip-mask in a graphic context to the specified region.
#ifdef ECORE_XCB_FIXES
xcb_xfixes_set_gc_clip_region(_ecore_xcb_conn, gc, region, x_origin, y_origin);
#endif /* ECORE_XCB_FIXES */
-}
-
+} /* ecore_x_region_gc_clip_set */
/**
* Change the shape extension of a window.
#ifdef ECORE_XCB_FIXES
xcb_xfixes_set_window_shape_region(_ecore_xcb_conn, dest, type, x_offset, y_offset, region);
#endif /* ECORE_XCB_FIXES */
-}
-
+} /* ecore_x_region_window_shape_set */
/**
* Change clip-mask in picture to the specified region.
#ifdef ECORE_XCB_FIXES
xcb_xfixes_set_picture_clip_region(_ecore_xcb_conn, picture, region, x_origin, y_origin);
#endif /* ECORE_XCB_FIXES */
-}
+} /* ecore_x_region_picture_clip_set */
+
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#include "ecore_xcb_private.h"
-
/**
* Creates a new default graphics context associated with the given
* drawable.
{
xcb_gcontext_t gc;
- if (!drawable) drawable = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+ if (!drawable)
+ drawable = ((xcb_screen_t *)_ecore_xcb_screen)->root;
gc = xcb_generate_id(_ecore_xcb_conn);
xcb_create_gc(_ecore_xcb_conn, gc, drawable, value_mask, value_list);
return gc;
-}
-
+} /* ecore_x_gc_new */
/**
* Deletes and frees the given graphics context.
ecore_x_gc_free(Ecore_X_GC gc)
{
xcb_free_gc(_ecore_xcb_conn, gc);
-}
+} /* ecore_x_gc_free */
+
/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
-/*
* Various ICCCM related functions.
*
* This is ALL the code involving anything ICCCM related, for both WM and
#include "ecore_xcb_private.h"
#include "Ecore_X_Atoms.h"
-
/**
* @defgroup Ecore_X_ICCCM_Group ICCCM related functions.
*
* Functions related to ICCCM.
*/
-
static int _ecore_x_icccm_size_hints_get (const void *reply,
Ecore_X_Atom property,
xcb_size_hints_t *hints)
{
uint32_t s;
- if (!hints) return 0;
+ if (!hints)
+ return 0;
+
+ if (!reply)
+ return 0;
- if (!reply) return 0;
if ((((xcb_get_property_reply_t *)reply)->type != ECORE_X_ATOM_WM_SIZE_HINTS) &&
- ((((xcb_get_property_reply_t *)reply)->format != 8) ||
+ ((((xcb_get_property_reply_t *)reply)->format != 8) ||
(((xcb_get_property_reply_t *)reply)->format != 16) ||
- (((xcb_get_property_reply_t *)reply)->format != 32)) &&
+ (((xcb_get_property_reply_t *)reply)->format != 32)) &&
(((xcb_get_property_reply_t *)reply)->value_len < 15)) /* OldNumPropSizeElements = 15 (pre-ICCCM) */
return 0;
xcb_get_property_value((xcb_get_property_reply_t *)reply),
((xcb_get_property_reply_t *)reply)->value_len);
- s = (XCB_SIZE_HINT_US_POSITION | XCB_SIZE_HINT_US_SIZE |
- XCB_SIZE_HINT_P_POSITION | XCB_SIZE_HINT_P_SIZE |
- XCB_SIZE_HINT_P_MIN_SIZE | XCB_SIZE_HINT_P_MAX_SIZE |
+ s = (XCB_SIZE_HINT_US_POSITION | XCB_SIZE_HINT_US_SIZE |
+ XCB_SIZE_HINT_P_POSITION | XCB_SIZE_HINT_P_SIZE |
+ XCB_SIZE_HINT_P_MIN_SIZE | XCB_SIZE_HINT_P_MAX_SIZE |
XCB_SIZE_HINT_P_RESIZE_INC | XCB_SIZE_HINT_P_ASPECT);
if (((xcb_get_property_reply_t *)reply)->value_len >= 18) /* NumPropSizeElements = 18 (ICCCM version 1) */
xcb_size_hints_set_base_size(hints, 0, 0);
xcb_size_hints_set_win_gravity(hints, 0);
}
+
/* FIXME: is it necessary ? */
/* hints->flags &= s; */ /* get rid of unwanted bits */
return 1;
-}
-
+} /* _ecore_x_icccm_size_hints_get */
/**
* Sets the state of a window.
c[0] = XCB_WM_STATE_NORMAL;
else if (state == ECORE_X_WINDOW_STATE_HINT_ICONIC)
c[0] = XCB_WM_STATE_ICONIC;
+
c[1] = 0;
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
ECORE_X_ATOM_WM_STATE, ECORE_X_ATOM_WM_STATE, 32,
2, c);
-}
+} /* ecore_x_icccm_state_set */
/*
* Sends the GetProperty request.
ECORE_X_ATOM_WM_STATE,
0L, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_icccm_state_get_prefetch */
/*
* Gets the reply of the GetProperty request sent by ecore_x_icccm_state_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_icccm_state_get_fetch */
/**
* Gets the state of a window.
EAPI Ecore_X_Window_State_Hint
ecore_x_icccm_state_get(Ecore_X_Window window __UNUSED__)
{
- xcb_get_property_reply_t *reply;
- uint8_t *prop;
+ xcb_get_property_reply_t *reply;
+ uint8_t *prop;
Ecore_X_Window_State_Hint hint = ECORE_X_WINDOW_STATE_HINT_NONE;
reply = _ecore_xcb_reply_get();
if (!reply)
- return hint;
+ return hint;
if ((reply->type == 0) ||
(reply->format != 8) ||
prop = (uint8_t *)xcb_get_property_value(reply);
switch (prop[0]) {
- case XCB_WM_STATE_WITHDRAWN:
- hint = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
- break;
- case XCB_WM_STATE_NORMAL:
- hint = ECORE_X_WINDOW_STATE_HINT_NORMAL;
- break;
- case XCB_WM_STATE_ICONIC:
- hint = ECORE_X_WINDOW_STATE_HINT_ICONIC;
- break;
- default:
- hint = ECORE_X_WINDOW_STATE_HINT_NONE;
- break;
- }
+ case XCB_WM_STATE_WITHDRAWN:
+ hint = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
+ break;
+
+ case XCB_WM_STATE_NORMAL:
+ hint = ECORE_X_WINDOW_STATE_HINT_NORMAL;
+ break;
+
+ case XCB_WM_STATE_ICONIC:
+ hint = ECORE_X_WINDOW_STATE_HINT_ICONIC;
+ break;
+
+ default:
+ hint = ECORE_X_WINDOW_STATE_HINT_NONE;
+ break;
+ } /* switch */
return hint;
-}
+} /* ecore_x_icccm_state_get */
/**
* Sends the ClientMessage event with the DeleteWindow property.
ECORE_X_EVENT_MASK_NONE,
ECORE_X_ATOM_WM_DELETE_WINDOW,
time, 0, 0, 0);
-}
+} /* ecore_x_icccm_delete_window_send */
/**
* Sends the ClientMessage event with the TakeFocus property.
ECORE_X_EVENT_MASK_NONE,
ECORE_X_ATOM_WM_TAKE_FOCUS,
time, 0, 0, 0);
-}
+} /* ecore_x_icccm_take_focus_send */
/**
* Sends the ClientMessage event with the SaveYourself property.
ECORE_X_EVENT_MASK_NONE,
ECORE_X_ATOM_WM_SAVE_YOURSELF,
time, 0, 0, 0);
-}
+} /* ecore_x_icccm_save_yourself_send */
/**
* Sends the ConfigureNotify event with the StructureNotify property.
ev.override_redirect = 0;
xcb_send_event(_ecore_xcb_conn, 0, window,
XCB_EVENT_MASK_STRUCTURE_NOTIFY, (const char *)&ev);
-}
+} /* ecore_x_icccm_move_resize_send */
/**
* Sets the hints of a window.
*/
EAPI void
ecore_x_icccm_hints_set(Ecore_X_Window window,
- int 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,
+ int 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,
int is_urgent)
{
xcb_wm_hints_t hints;
xcb_wm_hints_set_normal(&hints);
else if (initial_state == ECORE_X_WINDOW_STATE_HINT_ICONIC)
xcb_wm_hints_set_iconic(&hints);
+
if (icon_pixmap != 0)
- xcb_wm_hints_set_icon_pixmap(&hints, icon_pixmap);
+ xcb_wm_hints_set_icon_pixmap(&hints, icon_pixmap);
+
if (icon_mask != 0)
- xcb_wm_hints_set_icon_mask(&hints, icon_mask);
+ xcb_wm_hints_set_icon_mask(&hints, icon_mask);
+
if (icon_window != 0)
- xcb_wm_hints_set_icon_window(&hints, icon_window);
+ xcb_wm_hints_set_icon_window(&hints, icon_window);
+
if (window_group != 0)
- xcb_wm_hints_set_window_group(&hints, window_group);
+ xcb_wm_hints_set_window_group(&hints, window_group);
+
if (is_urgent)
- xcb_wm_hints_set_urgency(&hints);
+ xcb_wm_hints_set_urgency(&hints);
+
xcb_set_wm_hints(_ecore_xcb_conn, window, &hints);
-}
+} /* ecore_x_icccm_hints_set */
/*
* Sends the GetProperty request.
ECORE_X_ATOM_WM_HINTS,
0L, XCB_NUM_WM_HINTS_ELEMENTS);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_icccm_hints_get_prefetch */
/*
* Gets the reply of the GetProperty request sent by ecore_x_icccm_hints_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_icccm_hints_get_fetch */
/**
* Gets the hints of a window.
* @ingroup Ecore_X_ICCCM_Group
*/
EAPI int
-ecore_x_icccm_hints_get(Ecore_X_Window window __UNUSED__,
- int *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,
+ecore_x_icccm_hints_get(Ecore_X_Window window __UNUSED__,
+ int *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,
int *is_urgent)
{
- xcb_wm_hints_t hints;
+ xcb_wm_hints_t hints;
xcb_get_property_reply_t *reply;
- uint32_t flags;
+ int32_t hints_flags;
+ uint32_t hints_input;
+ int32_t hints_initial_state;
+ xcb_pixmap_t hints_icon_pixmap;
+ xcb_pixmap_t hints_icon_mask;
+ xcb_window_t hints_icon_window;
+ xcb_window_t hints_window_group;
if (accepts_focus)
*accepts_focus = 1;
+
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 = 0;
(reply->format != 32))
return 0;
- xcb_get_wm_hints_from_reply(&hints, reply);
+ memcpy(&hints, xcb_get_property_value(reply), reply->value_len);
+ hints_flags = hints.flags;
+ hints_input = hints.input;
+ hints_initial_state = hints.initial_state;
+ hints_icon_pixmap = hints.icon_pixmap;
+ hints_icon_mask = hints.icon_mask;
+ hints_icon_window = hints.icon_window;
+ hints_window_group = hints.window_group;
- flags = xcb_wm_hints_get_flags(&hints);
- if ((flags & XCB_WM_HINT_INPUT) && (accepts_focus))
+ if ((hints_flags & XCB_WM_HINT_INPUT) && (accepts_focus))
{
- if (xcb_wm_hints_get_input(hints))
+ if(hints_input)
*accepts_focus = 1;
else
*accepts_focus = 0;
}
- if ((flags & XCB_WM_HINT_STATE) && (initial_state))
+
+ if ((hints_flags & XCB_WM_HINT_STATE) && (initial_state))
{
- if (xcb_wm_hints_get_initial_state(hints) == XCB_WM_STATE_WITHDRAWN)
+ if (hints_initial_state == XCB_WM_STATE_WITHDRAWN)
*initial_state = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
- else if (xcb_wm_hints_get_initial_state(hints) == XCB_WM_STATE_NORMAL)
+ else if (hints_initial_state == XCB_WM_STATE_NORMAL)
*initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL;
- else if (xcb_wm_hints_get_initial_state(hints) == XCB_WM_STATE_ICONIC)
+ else if (hints_initial_state == XCB_WM_STATE_ICONIC)
*initial_state = ECORE_X_WINDOW_STATE_HINT_ICONIC;
}
- if ((flags & XCB_WM_HINT_ICON_PIXMAP) && (icon_pixmap))
+
+ if ((hints_flags & XCB_WM_HINT_ICON_PIXMAP) && (icon_pixmap))
{
- *icon_pixmap = xcb_wm_hints_get_icon_pixmap(hints);
+ *icon_pixmap = hints_icon_pixmap;
}
- if ((flags & XCB_WM_HINT_ICON_MASK) && (icon_mask))
+
+ if ((hints_flags & XCB_WM_HINT_ICON_MASK) && (icon_mask))
{
- *icon_mask = xcb_wm_hints_get_icon_mask(hints);
+ *icon_mask = hints_icon_mask;
}
- if ((flags & XCB_WM_HINT_ICON_WINDOW) && (icon_window))
+
+ if ((hints_flags & XCB_WM_HINT_ICON_WINDOW) && (icon_window))
{
- *icon_window = xcb_wm_hints_get_icon_window(hints);
+ *icon_window = hints_icon_window;
}
- if ((flags & XCB_WM_HINT_WINDOW_GROUP) && (window_group))
+
+ if ((hints_flags & XCB_WM_HINT_WINDOW_GROUP) && (window_group))
{
if (reply->value_len < XCB_NUM_WM_HINTS_ELEMENTS)
*window_group = 0;
else
- *window_group = xcb_wm_hints_get_window_group(hints);
+ *window_group = hints_window_group;
}
- if ((flags & XCB_WM_HINT_X_URGENCY) && (is_urgent))
+
+ if ((hints_flags & XCB_WM_HINT_X_URGENCY) && (is_urgent))
{
*is_urgent = 1;
}
return 1;
-}
+} /* ecore_x_icccm_hints_get */
/*
* Sends the GetProperty request.
ECORE_X_ATOM_WM_SIZE_HINTS,
0L, 18);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_icccm_size_pos_hints_get_prefetch */
/*
* Gets the reply of the GetProperty request sent by ecore_x_icccm_size_pos_hints_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_icccm_size_pos_hints_get_fetch */
/**
* Sets the hints of a window.
EAPI void
ecore_x_icccm_size_pos_hints_set(Ecore_X_Window window,
int request_pos,
- Ecore_X_Gravity gravity,
- int min_w,
+ Ecore_X_Gravity gravity,
+ int min_w,
int min_h,
- int max_w,
+ int max_w,
int max_h,
- int base_w,
+ int base_w,
int base_h,
- int step_x,
+ int step_x,
int step_y,
- double min_aspect,
+ double min_aspect,
double max_aspect)
{
- xcb_size_hints_t hint;
+ xcb_size_hints_t hint;
xcb_get_property_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply ||
+ if (!reply ||
(reply->type != ECORE_X_ATOM_WM_SIZE_HINTS) ||
- ((reply->format != 8) &&
- (reply->format != 16) &&
- (reply->format != 32)) ||
+ ((reply->format != 8) &&
+ (reply->format != 16) &&
+ (reply->format != 32)) ||
(reply->value_len < 15))
return;
- xcb_size_hints_set_flags(&hint, 0);
+ hint.flags = 0;
if (request_pos)
{
- xcb_size_hints_set_flags(&hint, XCB_SIZE_HINT_US_POSITION);
+ hint.flags = XCB_SIZE_HINT_US_POSITION;
}
+
if (gravity != ECORE_X_GRAVITY_NW)
{
- xcb_size_hints_set_win_gravity(&hint, (uint8_t)gravity);
+ hint.win_gravity = (uint8_t)gravity;
}
+
if ((min_w > 0) || (min_h > 0))
{
- xcb_size_hints_set_min_size(&hint, min_w, min_h);
+ hint.min_width = min_w;
+ hint.min_height = min_h;
}
+
if ((max_w > 0) || (max_h > 0))
{
- xcb_size_hints_set_max_size(&hint, max_w, max_h);
+ hint.max_width = max_w;
+ hint.max_height = max_h;
}
+
if ((base_w > 0) || (base_h > 0))
{
- xcb_size_hints_set_base_size(&hint, base_w, base_h);
+ hint.base_width = base_w;
+ hint.base_height = base_h;
}
+
if ((step_x > 1) || (step_y > 1))
{
- xcb_size_hints_set_resize_inc(&hint, step_x, step_y);
+ hint.width_inc = step_x;
+ hint.height_inc = step_y;
}
+
if ((min_aspect > 0.0) || (max_aspect > 0.0))
{
- xcb_size_hints_set_aspect(&hint,
+ xcb_size_hints_set_aspect(&hint,
(int32_t)(min_aspect * 10000),
10000,
(int32_t)(max_aspect * 10000),
10000);
}
+
xcb_set_wm_normal_hints(_ecore_xcb_conn, window, &hint);
-}
+} /* ecore_x_icccm_size_pos_hints_set */
/**
* Gets the hints of a window.
* @ingroup Ecore_X_ICCCM_Group
*/
EAPI int
-ecore_x_icccm_size_pos_hints_get(Ecore_X_Window window __UNUSED__,
- int *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)
+ecore_x_icccm_size_pos_hints_get(Ecore_X_Window window __UNUSED__,
+ int *request_pos,
+ Ecore_X_Gravity *gravity,
+ int *min_w,
+ int *min_h,
+ int *max_w,
+ int *max_h,
+ int *base_w,
+ int *base_h,
+ int *step_x,
+ int *step_y,
+ double *min_aspect,
+ double *max_aspect)
{
- xcb_size_hints_t hint;
+ xcb_size_hints_t hint;
xcb_get_property_reply_t *reply;
- uint32_t flags;
- int32_t minw = 0;
- int32_t minh = 0;
- int32_t maxw = 32767;
- int32_t maxh = 32767;
- int32_t basew = -1;
- int32_t baseh = -1;
- int32_t stepx = -1;
- int32_t stepy = -1;
- double mina = 0.0;
- double maxa = 0.0;
-
- if (request_pos) *request_pos = 0;
- if (gravity) *gravity = ECORE_X_GRAVITY_NW;
- if (min_w) *min_w = minw;
- if (min_h) *min_h = minh;
- if (max_w) *max_w = maxw;
- if (max_h) *max_h = maxh;
- if (base_w) *base_w = basew;
- if (base_h) *base_h = baseh;
- if (step_x) *step_x = stepx;
- if (step_y) *step_y = stepy;
- if (min_aspect) *min_aspect = mina;
- if (max_aspect) *max_aspect = maxa;
+ uint32_t flags;
+ int32_t minw = 0;
+ int32_t minh = 0;
+ int32_t maxw = 32767;
+ int32_t maxh = 32767;
+ int32_t basew = -1;
+ int32_t baseh = -1;
+ int32_t stepx = -1;
+ int32_t stepy = -1;
+ double mina = 0.0;
+ double maxa = 0.0;
+
+ if (request_pos)
+ *request_pos = 0;
+
+ if (gravity)
+ *gravity = ECORE_X_GRAVITY_NW;
+
+ if (min_w)
+ *min_w = minw;
+
+ if (min_h)
+ *min_h = minh;
+
+ if (max_w)
+ *max_w = maxw;
+
+ if (max_h)
+ *max_h = maxh;
+
+ if (base_w)
+ *base_w = basew;
+ if (base_h)
+ *base_h = baseh;
+
+ if (step_x)
+ *step_x = stepx;
+
+ if (step_y)
+ *step_y = stepy;
+
+ if (min_aspect)
+ *min_aspect = mina;
+
+ if (max_aspect)
+ *max_aspect = maxa;
reply = _ecore_xcb_reply_get();
if (!reply)
- return 0;
+ return 0;
if (!_ecore_x_icccm_size_hints_get(reply, ECORE_X_ATOM_WM_NORMAL_HINTS, &hint))
- return 0;
+ return 0;
- flags = xcb_size_hints_get_flags(hint);
- if ((flags & XCB_SIZE_HINT_US_POSITION) || (flags & XCB_SIZE_HINT_P_POSITION))
+ flags = hint.flags;
+ if ((flags & XCB_SIZE_HINT_US_POSITION) || (flags & XCB_SIZE_HINT_P_POSITION))
{
- if (request_pos)
- *request_pos = 1;
+ if (request_pos)
+ *request_pos = 1;
}
+
if (flags & XCB_SIZE_HINT_P_WIN_GRAVITY)
{
- if (gravity)
- *gravity = xcb_size_hints_get_win_gravity(&hint);
+ if (gravity)
+ *gravity = hint.win_gravity;
}
+
if (flags & XCB_SIZE_HINT_P_MIN_SIZE)
{
- xcb_size_hints_get_min_size(hint, &minw, &minh);
+ minw = hint.min_width;
+ minh = hint.min_height;
}
+
if (flags & XCB_SIZE_HINT_P_MAX_SIZE)
{
- xcb_size_hints_get_max_size(&hint, &maxw, &maxh);
- if (maxw < minw)
- maxw = minw;
- if (maxh < minh)
- maxh = minh;
+ maxw = hint.max_width;
+ maxh = hint.max_height;
+ if (maxw < minw)
+ maxw = minw;
+
+ if (maxh < minh)
+ maxh = minh;
}
+
if (flags & XCB_SIZE_HINT_BASE_SIZE)
{
- xcb_size_hints_get_base_size(&hint, &basew, &baseh);
- if (basew > minw)
- minw = basew;
- if (baseh > minh)
- minh = baseh;
+ basew = hint.base_width;
+ baseh = hint.base_height;
+ if (basew > minw)
+ minw = basew;
+
+ if (baseh > minh)
+ minh = baseh;
}
+
if (flags & XCB_SIZE_HINT_P_RESIZE_INC)
{
- xcb_size_hints_get_increase(&hint, &stepx, &stepy);
- if (stepx < 1)
- stepx = 1;
- if (stepy < 1)
- stepy = 1;
+ stepx = hint.width_inc;
+ stepy = hint.height_inc;
+ if (stepx < 1)
+ stepx = 1;
+
+ if (stepy < 1)
+ stepy = 1;
}
+
if (flags & XCB_SIZE_HINT_P_ASPECT)
{
- int32_t min_aspect_num;
- int32_t min_aspect_den;
- int32_t max_aspect_num;
- int32_t max_aspect_den;
-
- xcb_size_hints_get_min_aspect(hint, &min_aspect_num, &min_aspect_den);
- if (min_aspect_den > 0)
- mina = ((double)min_aspect_num) / ((double)min_aspect_den);
- xcb_size_hints_get_max_aspect(hint, &max_aspect_num, &max_aspect_den);
- if (max_aspect_den > 0)
- maxa = ((double)max_aspect_num) / ((double)max_aspect_den);
+ if (hint.min_aspect_den > 0)
+ mina = ((double)hint.min_aspect_num) / ((double)hint.min_aspect_den);
+
+ if (hint.max_aspect_den > 0)
+ maxa = ((double)hint.max_aspect_num) / ((double)hint.max_aspect_den);
}
if (min_w)
*min_w = minw;
+
if (min_h)
*min_h = minh;
+
if (max_w)
*max_w = maxw;
+
if (max_h)
*max_h = maxh;
+
if (base_w)
*base_w = basew;
+
if (base_h)
*base_h = baseh;
+
if (step_x)
*step_x = stepx;
+
if (step_y)
*step_y = stepy;
+
if (min_aspect)
*min_aspect = mina;
+
if (max_aspect)
*max_aspect = maxa;
return 1;
-}
+} /* ecore_x_icccm_size_pos_hints_get */
/**
* Set the title of a window
ecore_x_icccm_title_set(Ecore_X_Window window,
const char *title)
{
- if (!title) return;
+ if (!title)
+ return;
/* FIXME: to do: utf8 */
/* &xprop); */
/* #endif */
- xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
- ECORE_X_ATOM_WM_NAME, ECORE_X_ATOM_STRING, 8,
- strlen(title), title);
-}
+ xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
+ ECORE_X_ATOM_WM_NAME, ECORE_X_ATOM_STRING, 8,
+ strlen(title), title);
+} /* ecore_x_icccm_title_set */
/*
* Sends the GetProperty request.
XCB_GET_PROPERTY_TYPE_ANY,
0L, 128);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_icccm_title_get_prefetch */
/*
* Gets the reply of the GetProperty request sent by ecore_x_icccm_title_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_icccm_title_get_fetch */
/**
* Gets the title of a window.
EAPI char *
ecore_x_icccm_title_get(Ecore_X_Window window __UNUSED__)
{
- char *title = NULL;
+ char *title = NULL;
xcb_get_property_reply_t *reply;
reply = _ecore_xcb_reply_get();
/* not in UTF8, so we convert */
else
{
- /* convert to utf8 */
+ /* convert to utf8 */
- /* FIXME: to do... */
+ /* FIXME: to do... */
/* #ifdef X_HAVE_UTF8_STRING */
/* ret = Xutf8TextPropertyToTextList(_ecore_xcb_conn, &xprop, */
}
return title;
-}
+} /* ecore_x_icccm_title_get */
/*
* Sends the GetProperty request.
ECORE_X_ATOM_WM_PROTOCOLS,
ECORE_X_ATOM_ATOM, 0, 1000000L);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_icccm_protocol_get_prefetch */
/*
* Gets the reply of the GetProperty request sent by ecore_x_icccm_protocol_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_icccm_protocol_get_fetch */
/**
* Set or unset a wm protocol property.
*/
EAPI void
ecore_x_icccm_protocol_set(Ecore_X_Window window,
- Ecore_X_WM_Protocol protocol,
+ Ecore_X_WM_Protocol protocol,
int on)
{
xcb_get_property_reply_t *reply;
- Ecore_X_Atom *protos = NULL;
- Ecore_X_Atom proto;
- uint32_t protos_count = 0;
- uint8_t already_set = 0;
+ Ecore_X_Atom *protos = NULL;
+ Ecore_X_Atom proto;
+ uint32_t protos_count = 0;
+ uint8_t already_set = 0;
/* Check for invalid values */
if (protocol >= ECORE_X_WM_PROTOCOL_NUM)
proto = _ecore_xcb_atoms_wm_protocols[protocol];
reply = _ecore_xcb_reply_get();
- if (!reply) return;
+ if (!reply)
+ return;
if ((reply->type == ECORE_X_ATOM_ATOM) && (reply->format == 32))
{
if (on)
{
- Ecore_X_Atom *new_protos = NULL;
+ Ecore_X_Atom *new_protos = NULL;
+
+ if (already_set)
+ return;
+
+ new_protos = (Ecore_X_Atom *)malloc((protos_count + 1) * sizeof(Ecore_X_Atom));
+ if (!new_protos)
+ return;
- if (already_set)
- return;
- new_protos = (Ecore_X_Atom *)malloc((protos_count + 1) * sizeof(Ecore_X_Atom));
- if (!new_protos)
- return;
memcpy(new_protos, protos, reply->value_len);
- new_protos[protos_count] = proto;
- xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
+ new_protos[protos_count] = proto;
+ xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
ECORE_X_ATOM_WM_PROTOCOLS,
ECORE_X_ATOM_ATOM, 32,
protos_count + 1, new_protos);
- free(new_protos);
+ free(new_protos);
}
else
{
uint32_t i;
- if (!already_set)
- return;
- for (i = 0; i < protos_count; i++)
- {
- if (protos[i] == proto)
- {
- uint32_t j;
-
- for (j = i + 1; j < protos_count; j++)
- protos[j - 1] = protos[j];
- if (protos_count > 1)
+ if (!already_set)
+ return;
+
+ for (i = 0; i < protos_count; i++)
+ {
+ if (protos[i] == proto)
+ {
+ uint32_t j;
+
+ for (j = i + 1; j < protos_count; j++)
+ protos[j - 1] = protos[j];
+ if (protos_count > 1)
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
ECORE_X_ATOM_WM_PROTOCOLS,
ECORE_X_ATOM_ATOM, 32,
protos_count - 1, protos);
- else
- xcb_delete_property(_ecore_xcb_conn, window,
+ else
+ xcb_delete_property(_ecore_xcb_conn, window,
ECORE_X_ATOM_WM_PROTOCOLS);
- return;
- }
- }
+
+ return;
+ }
+ }
}
-}
+} /* ecore_x_icccm_protocol_set */
/**
* Determines whether a protocol is set for a window.
* @ingroup Ecore_X_ICCCM_Group
*/
EAPI int
-ecore_x_icccm_protocol_isset(Ecore_X_Window window __UNUSED__,
- Ecore_X_WM_Protocol protocol)
+ecore_x_icccm_protocol_isset(Ecore_X_Window window __UNUSED__,
+ Ecore_X_WM_Protocol protocol)
{
xcb_get_property_reply_t *reply;
- Ecore_X_Atom *protos = NULL;
- Ecore_X_Atom proto;
- uint32_t i;
- uint8_t ret = 0;
+ Ecore_X_Atom *protos = NULL;
+ Ecore_X_Atom proto;
+ uint32_t i;
+ uint8_t ret = 0;
/* check for invalid values */
if (protocol >= ECORE_X_WM_PROTOCOL_NUM)
protos = (Ecore_X_Atom *)xcb_get_property_value(reply);
for (i = 0; i < reply->value_len; i++)
if (protos[i] == proto)
- {
- ret = 1;
- break;
- }
+ {
+ ret = 1;
+ break;
+ }
return ret;
-}
+} /* ecore_x_icccm_protocol_isset */
/**
* Set a window name & class.
{
char *class_string;
char *s;
- int length_name;
- int length_class;
+ int length_name;
+ int length_class;
length_name = strlen(name);
length_class = strlen(class);
class_string = (char *)malloc(sizeof(char) * (length_name + length_class + 2));
if (!class_string)
- return;
+ return;
+
s = class_string;
if (length_name)
{
- strcpy(s, name);
- s += length_name + 1;
+ strcpy(s, name);
+ s += length_name + 1;
}
else
- *s++ = '\0';
+ *s++ = '\0';
+
if(length_class)
- strcpy(s, class);
+ strcpy(s, class);
else
- *s = '\0';
+ *s = '\0';
+
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
ECORE_X_ATOM_WM_CLASS, ECORE_X_ATOM_STRING, 8,
length_name + length_class + 2, (void *)class_string);
free(class_string);
-}
+} /* ecore_x_icccm_name_class_set */
/*
* Sends the GetProperty request.
ECORE_X_ATOM_STRING,
0, 2048L);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_icccm_name_class_get_prefetch */
/*
* Gets the reply of the GetProperty request sent by ecore_x_icccm_name_class_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_icccm_name_class_get_fetch */
/**
* Get a window name and class.
*/
EAPI void
ecore_x_icccm_name_class_get(Ecore_X_Window window __UNUSED__,
- char **name,
- char **class)
+ char **name,
+ char **class)
{
xcb_get_property_reply_t *reply;
- void *data;
- char *n = NULL;
- char *c = NULL;
- int length;
- int length_name;
- int length_class;
+ void *data;
+ char *n = NULL;
+ char *c = NULL;
+ int length;
+ int length_name;
+ int length_class;
+ if (name)
+ *name = NULL;
- if (name) *name = NULL;
- if (class) *class = NULL;
+ if (class)
+ *class = NULL;
reply = _ecore_xcb_reply_get();
if (!reply)
n = (char *)malloc(sizeof(char) * (length_name + 1));
if (!n)
return;
+
length_class = length - length_name - 1;
c = (char *)malloc(sizeof(char) * (length_class + 1));
if (!c)
if (name)
*name = n;
+
if (class)
*class = c;
-}
+} /* ecore_x_icccm_name_class_get */
/*
* Sends the GetProperty request.
XCB_GET_PROPERTY_TYPE_ANY,
0L, 1000000L);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_icccm_client_machine_get_prefetch */
/*
* Gets the reply of the GetProperty request sent by ecore_x_icccm_client_machine_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_icccm_client_machine_get_fetch */
/**
* Get a window client machine string.
name = ecore_x_window_prop_string_get(window, ECORE_X_ATOM_WM_CLIENT_MACHINE);
return name;
-}
+} /* ecore_x_icccm_client_machine_get */
/**
* Sets the WM_COMMAND property for @a win.
{
void *buf;
char *b;
- int nbytes;
- int i;
+ int nbytes;
+ int i;
for (i = 0, nbytes = 0; i < argc; i++)
{
}
buf = malloc(sizeof(char) * nbytes);
if (!buf)
- return;
+ return;
+
b = (char *)buf;
for (i = 0; i < argc; i++)
{
b += strlen(argv[i]) + 1;
}
else
- *b++ = '\0';
+ *b++ = '\0';
}
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
ECORE_X_ATOM_WM_COMMAND, ECORE_X_ATOM_STRING, 8,
nbytes, buf);
free(buf);
-}
+} /* ecore_x_icccm_command_set */
/*
* Sends the GetProperty request.
XCB_GET_PROPERTY_TYPE_ANY,
0L, 1000000L);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_icccm_command_get_prefetch */
/*
* Gets the reply of the GetProperty request sent by ecore_x_icccm_command_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_icccm_command_get_fetch */
/**
* Get the WM_COMMAND property for a window.
*/
EAPI void
ecore_x_icccm_command_get(Ecore_X_Window window __UNUSED__,
- int *argc,
- char ***argv)
+ int *argc,
+ char ***argv)
{
xcb_get_property_reply_t *reply;
- char **v;
- char *data;
- char *cp;
- char *start;
- uint32_t value_len;
- int c;
- int i;
- int j;
-
- if (argc) *argc = 0;
- if (argv) *argv = NULL;
+ char **v;
+ char *data;
+ char *cp;
+ char *start;
+ uint32_t value_len;
+ int c;
+ int i;
+ int j;
+
+ if (argc)
+ *argc = 0;
+
+ if (argv)
+ *argv = NULL;
reply = _ecore_xcb_reply_get();
if (!reply)
- return;
+ return;
if ((reply->type != ECORE_X_ATOM_STRING) ||
(reply->format != 8))
value_len = reply->value_len;
data = (char *)xcb_get_property_value(reply);
if (value_len && (data[value_len - 1] == '\0'))
- value_len--;
+ value_len--;
c = 1;
for (cp = (char *)data, i = value_len; i > 0; cp++, i--)
{
- if (*cp == '\0') c++;
+ if (*cp == '\0')
+ c++;
}
v = (char **)malloc((c + 1) * sizeof(char *));
if (!v)
start = (char *)malloc((value_len + 1) * sizeof(char));
if (!start)
{
- free(v);
- return;
+ free(v);
+ return;
}
- memcpy (start, (char *) data, value_len);
- start[value_len] = '\0';
- for (cp = start, i = value_len + 1, j = 0; i > 0; cp++, i--) {
- if (*cp == '\0') {
- v[j] = start;
- start = (cp + 1);
- j++;
- }
- }
+ memcpy (start, (char *)data, value_len);
+ start[value_len] = '\0';
+ for (cp = start, i = value_len + 1, j = 0; i > 0; cp++, i--) {
+ if (*cp == '\0')
+ {
+ v[j] = start;
+ start = (cp + 1);
+ j++;
+ }
+ }
if (c < 1)
{
- if (v)
- free(v);
- return;
+ free(v);
+ return;
}
- if (argc) *argc = c;
+ if (argc)
+ *argc = c;
+
if (argv)
{
- (*argv) = malloc(c * sizeof(char *));
- if (!*argv)
- {
- free(v);
- if (argc) *argc = 0;
- return;
- }
- for (i = 0; i < c; i++)
- {
- if (v[i])
- (*argv)[i] = strdup(v[i]);
- else
- (*argv)[i] = strdup("");
- }
+ (*argv) = malloc(c * sizeof(char *));
+ if (!*argv)
+ {
+ free(v);
+ if (argc)
+ *argc = 0;
+
+ return;
+ }
+
+ for (i = 0; i < c; i++)
+ {
+ if (v[i])
+ (*argv)[i] = strdup(v[i]);
+ else
+ (*argv)[i] = strdup("");
+ }
}
free(v);
-}
+} /* ecore_x_icccm_command_get */
/**
* Set a window icon name.
/* XStdICCTextStyle, &xprop); */
/* #endif */
- xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
- ECORE_X_ATOM_WM_ICON_NAME, ECORE_X_ATOM_WM_ICON_NAME,
- 8, strlen(title), title);
-}
+ xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
+ ECORE_X_ATOM_WM_ICON_NAME, ECORE_X_ATOM_WM_ICON_NAME,
+ 8, strlen(title), title);
+} /* ecore_x_icccm_icon_name_set */
/*
* Sends the GetProperty request.
XCB_GET_PROPERTY_TYPE_ANY,
0L, 128L);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_icccm_icon_name_get_prefetch */
/*
* Gets the reply of the GetProperty request sent by ecore_x_icccm_icon_name_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_icccm_icon_name_get_fetch */
/**
* Get a window icon name.
ecore_x_icccm_icon_name_get(Ecore_X_Window window __UNUSED__)
{
xcb_get_property_reply_t *reply;
- char *title = NULL;
+ char *title = NULL;
reply = _ecore_xcb_reply_get();
- if (!reply) return NULL;
+ if (!reply)
+ return NULL;
ERR("reply->bytes_afer (should be 0): %d", ((xcb_get_property_reply_t *)reply)->bytes_after);
{
/* FIXME: do the UTF8... */
- /* convert to utf8 */
+ /* convert to utf8 */
/* #ifdef X_HAVE_UTF8_STRING */
/* ret = Xutf8TextPropertyToTextList(_ecore_xcb_conn, &xprop, */
/* &list, &num); */
}
return title;
-}
+} /* ecore_x_icccm_icon_name_get */
/*
* Sends the GetProperty request.
ECORE_X_ATOM_WINDOW,
0L, LONG_MAX);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_icccm_colormap_window_get_prefetch */
/*
* Gets the reply of the GetProperty request sent by ecore_x_icccm_colormap_window_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_icccm_colormap_window_get_fetch */
/**
* Add a subwindow to the list of windows that need a different colormap installed.
ecore_x_icccm_colormap_window_set(Ecore_X_Window window,
Ecore_X_Window sub_window)
{
- void *data = NULL;
+ void *data = NULL;
xcb_get_property_reply_t *reply;
- uint32_t num;
+ uint32_t num;
if (window == 0)
- window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+ window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
reply = _ecore_xcb_reply_get();
if (!reply || (reply->format != 32) || (reply->value_len == 0))
data = calloc(1, sizeof(Ecore_X_Window));
if (!data)
{
- if (reply) free(reply);
+ if (reply)
+ free(reply);
+
return;
}
+
num = 1;
}
else
{
Ecore_X_Window *newset = NULL;
Ecore_X_Window *oldset = NULL;
- uint32_t i;
+ uint32_t i;
num = reply->value_len;
data = calloc(num + 1, sizeof(Ecore_X_Window));
if (!data)
- return;
+ return;
newset = (Ecore_X_Window *)data;
oldset = (Ecore_X_Window *)xcb_get_property_value(reply);
ECORE_X_ATOM_WINDOW,
32, num, data);
free(data);
-}
+} /* ecore_x_icccm_colormap_window_set */
/**
* Remove a window from the list of colormap windows.
ecore_x_icccm_colormap_window_unset(Ecore_X_Window window,
Ecore_X_Window sub_window)
{
- void *data = NULL;
- Ecore_X_Window *oldset = NULL;
- Ecore_X_Window *newset = NULL;
+ void *data = NULL;
+ Ecore_X_Window *oldset = NULL;
+ Ecore_X_Window *newset = NULL;
xcb_get_property_reply_t *reply;
- uint32_t num;
- uint32_t i;
- uint32_t j;
- uint32_t k = 0;
+ uint32_t num;
+ uint32_t i;
+ uint32_t j;
+ uint32_t k = 0;
- if (window == 0) window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+ if (window == 0)
+ window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
reply = _ecore_xcb_reply_get();
if (!reply || (reply->format != 32) || (reply->value_len == 0))
- return;
+ return;
num = reply->value_len;
oldset = (Ecore_X_Window *)xcb_get_property_value(reply);
for (i = 0; i < num; i++)
{
- if (oldset[i] == sub_window)
- {
- if (num == 1)
- {
- xcb_delete_property(_ecore_xcb_conn, window,
+ if (oldset[i] == sub_window)
+ {
+ if (num == 1)
+ {
+ xcb_delete_property(_ecore_xcb_conn, window,
ECORE_X_ATOM_WM_COLORMAP_WINDOWS);
- return;
- }
- else
- {
- data = calloc(num - 1, sizeof(Ecore_X_Window));
- newset = (Ecore_X_Window *)data;
- for (j = 0; j < num; ++j)
- if (oldset[j] != sub_window)
- newset[k++] = oldset[j];
+ return;
+ }
+ else
+ {
+ data = calloc(num - 1, sizeof(Ecore_X_Window));
+ newset = (Ecore_X_Window *)data;
+ for (j = 0; j < num; ++j)
+ if (oldset[j] != sub_window)
+ newset[k++] = oldset[j];
+
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
ECORE_X_ATOM_WINDOW,
32, k, data);
- free(newset);
- return;
- }
- }
+ free(newset);
+ return;
+ }
+ }
}
-}
+} /* ecore_x_icccm_colormap_window_unset */
/**
* Specify that a window is transient for another top-level window and should be handled accordingly.
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
ECORE_X_ATOM_WM_TRANSIENT_FOR, ECORE_X_ATOM_WINDOW, 32,
1, (void *)&forwindow);
-}
+} /* ecore_x_icccm_transient_for_set */
/**
* Remove the transient_for setting from a window.
ecore_x_icccm_transient_for_unset(Ecore_X_Window window)
{
xcb_delete_property(_ecore_xcb_conn, window, ECORE_X_ATOM_WM_TRANSIENT_FOR);
-}
+} /* ecore_x_icccm_transient_for_unset */
/*
* Sends the GetProperty request.
ECORE_X_ATOM_WINDOW,
0L, 1L);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_icccm_transient_for_get_prefetch */
/*
* Gets the reply of the GetProperty request sent by ecore_x_icccm_transient_for_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_icccm_transient_for_get_fetch */
/**
* Get the window this window is transient for, if any.
ecore_x_icccm_transient_for_get(Ecore_X_Window window __UNUSED__)
{
xcb_get_property_reply_t *reply;
- Ecore_X_Window forwin = 0;
+ Ecore_X_Window forwin = 0;
reply = _ecore_xcb_reply_get();
if (!reply)
- return forwin;
+ return forwin;
if ((reply->format != 32) ||
(reply->value_len == 0) ||
(reply->type != ECORE_X_ATOM_WINDOW))
return forwin;
-
+
forwin = *(Ecore_X_Window *)xcb_get_property_value(reply);
return forwin;
-}
+} /* ecore_x_icccm_transient_for_get */
/**
* Set the window role hint.
const char *role)
{
ecore_x_window_prop_string_set(window, ECORE_X_ATOM_WM_WINDOW_ROLE,
- (char *)role);
-}
+ (char *)role);
+} /* ecore_x_icccm_window_role_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_WM_WINDOW_ROLE, XCB_GET_PROPERTY_TYPE_ANY,
0L, 1000000L);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
-
+} /* ecore_x_icccm_window_role_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_icccm_window_role_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_icccm_window_role_get_fetch */
/**
* Get the window role.
ecore_x_icccm_window_role_get(Ecore_X_Window window)
{
return ecore_x_window_prop_string_get(window, ECORE_X_ATOM_WM_WINDOW_ROLE);
-}
+} /* ecore_x_icccm_window_role_get */
/**
* Set the window's client leader.
Ecore_X_Window leader)
{
ecore_x_window_prop_window_set(window, ECORE_X_ATOM_WM_CLIENT_LEADER,
- &leader, 1);
-}
+ &leader, 1);
+} /* ecore_x_icccm_client_leader_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_WINDOW,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
-
+} /* ecore_x_icccm_client_leader_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_icccm_client_leader_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_icccm_client_leader_get_fetch */
/**
* Get the window's client leader.
Ecore_X_Window leader;
if (ecore_x_window_prop_window_get(window, ECORE_X_ATOM_WM_CLIENT_LEADER,
- &leader, 1) > 0)
+ &leader, 1) > 0)
return leader;
return 0;
-}
+} /* ecore_x_icccm_client_leader_get */
/**
* Send the ClientMessage event with the ChangeState property.
{
xcb_client_message_event_t ev;
- if (!window) return;
- if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+ if (!window)
+ return;
+
+ if (!root)
+ root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
/* send_event is bit 7 (0x80) of response_type */
ev.response_type = XCB_CLIENT_MESSAGE | 0x80;
xcb_send_event(_ecore_xcb_conn, 0, root,
XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT,
(const char *)&ev);
-}
+} /* ecore_x_icccm_iconic_request_send */
/* FIXME: there are older E hints, gnome hints and mwm hints and new netwm */
/* hints. each should go in their own file/section so we know which */
/*
* Various MWM related functions.
- *
+ *
* This is ALL the code involving anything MWM related. for both WM and
* client.
*/
#include "ecore_xcb_private.h"
#include "Ecore_X_Atoms.h"
-
/**
* @defgroup Ecore_X_MWM_Group MWM related functions.
*
* Functions related to MWM.
*/
-#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)
+#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
{
}
MWMHints;
-
/**
* Sends the GetProperty request.
* @param window Window whose MWM hints are requested.
ECORE_X_ATOM_MOTIF_WM_HINTS,
0, LONG_MAX);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
-
+} /* ecore_x_mwm_hints_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_mwm_hints_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_mwm_hints_get_fetch */
/**
* To document.
* @ingroup Ecore_X_MWM_Group
*/
EAPI int
-ecore_x_mwm_hints_get(Ecore_X_Window window __UNUSED__,
- Ecore_X_MWM_Hint_Func *fhint,
- Ecore_X_MWM_Hint_Decor *dhint,
- Ecore_X_MWM_Hint_Input *ihint)
+ecore_x_mwm_hints_get(Ecore_X_Window window __UNUSED__,
+ Ecore_X_MWM_Hint_Func *fhint,
+ Ecore_X_MWM_Hint_Decor *dhint,
+ Ecore_X_MWM_Hint_Input *ihint)
{
- MWMHints *mwmhints = NULL;
- int ret = 0;
+ MWMHints *mwmhints = NULL;
+ int ret = 0;
xcb_get_property_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (dhint)
{
if (mwmhints->flags & ECORE_X_MWM_HINTS_DECORATIONS)
- *dhint = mwmhints->decorations;
+ *dhint = mwmhints->decorations;
else
- *dhint = ECORE_X_MWM_HINT_DECOR_ALL;
+ *dhint = ECORE_X_MWM_HINT_DECOR_ALL;
}
+
if (fhint)
{
if (mwmhints->flags & ECORE_X_MWM_HINTS_FUNCTIONS)
- *fhint = mwmhints->functions;
+ *fhint = mwmhints->functions;
else
- *fhint = ECORE_X_MWM_HINT_FUNC_ALL;
+ *fhint = ECORE_X_MWM_HINT_FUNC_ALL;
}
+
if (ihint)
{
if (mwmhints->flags & ECORE_X_MWM_HINTS_INPUT_MODE)
- *ihint = mwmhints->inputmode;
+ *ihint = mwmhints->inputmode;
else
- *ihint = ECORE_X_MWM_HINT_INPUT_MODELESS;
+ *ihint = ECORE_X_MWM_HINT_INPUT_MODELESS;
}
+
ret = 1;
}
return ret;
-}
+} /* ecore_x_mwm_hints_get */
/**
* Sets the borderless flag of a window using MWM.
data[0] = 2; /* just set the decorations hint! */
data[2] = !borderless;
-
- if (window == 0) window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+
+ if (window == 0)
+ window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
ECORE_X_ATOM_MOTIF_WM_HINTS, ECORE_X_ATOM_MOTIF_WM_HINTS,
32, 5, data);
-}
+} /* ecore_x_mwm_borderless_set */
/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
-/*
* _NET_WM... aka Extended Window Manager Hint (EWMH) functions.
*/
#include "ecore_xcb_private.h"
#include "Ecore_X_Atoms.h"
-
/**
* @defgroup Ecore_X_NetWM_Group Extended Window Manager Hint (EWMH) functions
*
* Functions related to the Extended Window Manager Hint (EWMH).
*/
-
-typedef struct _Ecore_X_Startup_Info Ecore_X_Startup_Info;
+typedef struct _Ecore_X_Startup_Info Ecore_X_Startup_Info;
struct _Ecore_X_Startup_Info
{
Ecore_X_Window win;
- int init;
+ int init;
- int buffer_size;
- char *buffer;
+ int buffer_size;
+ char *buffer;
- int length;
+ 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;
+ char *id;
+ char *name;
+ int screen;
+ char *bin;
+ char *icon;
+ int desktop;
+ int timestamp;
+ char *description;
+ char *wmclass;
+ int silent;
};
#if 0
-static void _ecore_x_window_prop_string_utf8_get_prefetch(Ecore_X_Window window, Ecore_X_Atom atom);
-static void _ecore_x_window_prop_string_utf8_get_fetch(void);
-#endif
-static void _ecore_x_window_prop_string_utf8_set(Ecore_X_Window window, Ecore_X_Atom atom, const char *str);
-static char *_ecore_x_window_prop_string_utf8_get(Ecore_X_Window window, Ecore_X_Atom atom);
+static void _ecore_x_window_prop_string_utf8_get_prefetch(Ecore_X_Window window, Ecore_X_Atom atom);
+static void _ecore_x_window_prop_string_utf8_get_fetch(void);
+#endif /* if 0 */
+static void _ecore_x_window_prop_string_utf8_set(Ecore_X_Window window, Ecore_X_Atom atom, const char *str);
+static char * _ecore_x_window_prop_string_utf8_get(Ecore_X_Window window, 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
-static void _ecore_x_netwm_startup_info_free(void *data);
+static int _ecore_x_netwm_startup_info_process(Ecore_X_Startup_Info *info);
+static int _ecore_x_netwm_startup_info_parse(Ecore_X_Startup_Info *info, char *data);
+#endif /* if 0 */
+static void _ecore_x_netwm_startup_info_free(void *data);
/*
* Local variables
ecore_x_netwm_init(void)
{
startup_info = eina_hash_string_superfast_new(_ecore_x_netwm_startup_info_free);
-}
+} /* ecore_x_netwm_init */
/**
* Shutdown the NetWM module
ecore_x_netwm_shutdown(void)
{
if (startup_info)
- eina_hash_free(startup_info);
+ eina_hash_free(startup_info);
+
startup_info = NULL;
-}
+} /* ecore_x_netwm_shutdown */
/**
* Set the _NET_SUPPORTING_WM_CHECK property.
EAPI void
ecore_x_netwm_wm_identify(Ecore_X_Window root,
Ecore_X_Window check,
- const char *wm_name)
+ const char *wm_name)
{
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);
-}
+} /* ecore_x_netwm_wm_identify */
/**
* Set the _NET_SUPPORTED property.
int num)
{
ecore_x_window_prop_atom_set(root, ECORE_X_ATOM_NET_SUPPORTED, supported, num);
-}
+} /* ecore_x_netwm_supported_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_SUPPORTED, ECORE_X_ATOM_ATOM,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_supported_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_netwm_supported_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_supported_get_fetch */
/**
* Get the hints supported by the Window Manager.
{
int num_ret;
- if (num) *num = 0UL;
- if (supported) *supported = NULL;
+ if (num)
+ *num = 0UL;
+
+ if (supported)
+ *supported = NULL;
num_ret = ecore_x_window_prop_xid_list_get(root,
ECORE_X_ATOM_NET_SUPPORTED,
if (num_ret <= 0)
return 0;
- if (num) *num = (uint32_t)num_ret;
+ if (num)
+ *num = (uint32_t)num_ret;
+
return 1;
-}
+} /* ecore_x_netwm_supported_get */
/**
* Set the _NET_NUMBER_OF_DESKTOPS property.
unsigned int n_desks)
{
ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS,
- &n_desks, 1);
-}
+ &n_desks, 1);
+} /* ecore_x_netwm_desk_count_set */
/**
* Set the _NET_VIRTUAL_ROOTS property.
*/
EAPI void
ecore_x_netwm_desk_roots_set(Ecore_X_Window root,
- Ecore_X_Window *vroots,
+ Ecore_X_Window *vroots,
unsigned int n_desks)
{
ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_VIRTUAL_ROOTS, vroots, n_desks);
-}
+} /* ecore_x_netwm_desk_roots_set */
/**
* Set the _NET_DESKTOP_NAMES property.
*/
EAPI void
ecore_x_netwm_desk_names_set(Ecore_X_Window root,
- const char **names,
+ const char **names,
unsigned int n_desks)
{
- char ss[32];
- char *buf;
+ char ss[32];
+ char *buf;
const char *s;
- uint32_t i;
- uint32_t len;
- uint32_t l;
+ uint32_t i;
+ uint32_t len;
+ uint32_t l;
buf = NULL;
len = 0;
for (i = 0; i < n_desks; i++)
{
- s = (names) ? names[i] : NULL;
- if (!s)
- {
- /* Default to "Desk-<number>" */
- sprintf(ss, "Desk-%d", i);
- s = ss;
- }
-
- l = strlen(s) + 1;
- buf = realloc(buf, len + l);
- memcpy(buf + len, s, l);
- len += l;
+ s = (names) ? names[i] : NULL;
+ if (!s)
+ {
+ /* Default to "Desk-<number>" */
+ sprintf(ss, "Desk-%d", i);
+ s = ss;
+ }
+
+ l = strlen(s) + 1;
+ buf = realloc(buf, len + l);
+ memcpy(buf + len, s, l);
+ len += l;
}
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, root,
ECORE_X_ATOM_UTF8_STRING,
8, len, (const void *)buf);
free(buf);
-}
+} /* ecore_x_netwm_desk_names_set */
/**
* Set the _NET_DESKTOP_GEOMETRY property.
ecore_x_window_prop_card32_set(root,
ECORE_X_ATOM_NET_DESKTOP_GEOMETRY,
size, 2);
-}
+} /* ecore_x_netwm_desk_size_set */
/**
* Set the _NET_DESKTOP_VIEWPORT property.
ecore_x_window_prop_card32_set(root,
ECORE_X_ATOM_NET_DESKTOP_VIEWPORT,
origins, 2 * n_desks);
-}
+} /* ecore_x_netwm_desk_viewports_set */
/**
* Set the _NET_DESKTOP_LAYOUT property.
layout[2] = rows;
layout[3] = starting_corner;
ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_DESKTOP_LAYOUT, layout, 4);
-}
+} /* ecore_x_netwm_desk_layout_set */
/**
* Set the _NET_WORKAREA property.
ecore_x_window_prop_card32_set(root,
ECORE_X_ATOM_NET_WORKAREA,
areas, 4 * n_desks);
-}
+} /* ecore_x_netwm_desk_workareas_set */
/**
* Set the _NET_CURRENT_DESKTOP property.
ecore_x_window_prop_card32_set(root,
ECORE_X_ATOM_NET_CURRENT_DESKTOP,
&desk, 1);
-}
+} /* ecore_x_netwm_desk_current_set */
/**
* Set the _NET_SHOWING_DESKTOP property.
ecore_x_window_prop_card32_set(root,
ECORE_X_ATOM_NET_SHOWING_DESKTOP,
&val, 1);
-}
+} /* ecore_x_netwm_showing_desktop_set */
/*
* Client status
ecore_x_window_prop_window_set(root,
ECORE_X_ATOM_NET_CLIENT_LIST,
p_clients, n_clients);
-}
+} /* ecore_x_netwm_client_list_set */
/**
* Set the _NET_CLIENT_LIST_STACKING property.
ecore_x_window_prop_window_set(root,
ECORE_X_ATOM_NET_CLIENT_LIST_STACKING,
p_clients, n_clients);
-}
+} /* ecore_x_netwm_client_list_stacking_set */
/**
* Set the _NET_ACTIVE_WINDOW property.
ecore_x_window_prop_window_set(root,
ECORE_X_ATOM_NET_ACTIVE_WINDOW,
&window, 1);
-}
+} /* ecore_x_netwm_client_active_set */
/**
* Set the _NET_WM_NAME property.
const char *name)
{
_ecore_x_window_prop_string_utf8_set(window, ECORE_X_ATOM_NET_WM_NAME, name);
-}
+} /* ecore_x_netwm_name_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_WM_NAME, ECORE_X_ATOM_UTF8_STRING,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_name_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_netwm_name_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_name_get_fetch */
/**
* Get the title of a window.
char **name)
{
if (name)
- *name = _ecore_x_window_prop_string_utf8_get(window, ECORE_X_ATOM_NET_WM_NAME);
+ *name = _ecore_x_window_prop_string_utf8_get(window, ECORE_X_ATOM_NET_WM_NAME);
+
return 1;
-}
+} /* ecore_x_netwm_name_get */
/**
* Set the _NET_STARTUP_ID property.
const char *id)
{
_ecore_x_window_prop_string_utf8_set(window, ECORE_X_ATOM_NET_STARTUP_ID, id);
-}
+} /* ecore_x_netwm_startup_id_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_STARTUP_ID, ECORE_X_ATOM_UTF8_STRING,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_startup_id_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_netwm_startup_id_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_startup_id_get_fetch */
/**
* Get the startup ID name of a window.
char **id)
{
if (id)
- *id = _ecore_x_window_prop_string_utf8_get(window, ECORE_X_ATOM_NET_STARTUP_ID);
+ *id = _ecore_x_window_prop_string_utf8_get(window, ECORE_X_ATOM_NET_STARTUP_ID);
+
return 1;
-}
+} /* ecore_x_netwm_startup_id_get */
/**
* Set the _NET_WM_VISIBLE_NAME property.
{
_ecore_x_window_prop_string_utf8_set(window, ECORE_X_ATOM_NET_WM_VISIBLE_NAME,
name);
-}
+} /* ecore_x_netwm_visible_name_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_WM_VISIBLE_NAME, ECORE_X_ATOM_UTF8_STRING,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_visible_name_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_netwm_visible_name_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_visible_name_get_fetch */
/**
* Get the visible title of a window.
char **name)
{
if (name)
- *name = _ecore_x_window_prop_string_utf8_get(window,
- ECORE_X_ATOM_NET_WM_VISIBLE_NAME);
+ *name = _ecore_x_window_prop_string_utf8_get(window,
+ ECORE_X_ATOM_NET_WM_VISIBLE_NAME);
+
return 1;
-}
+} /* ecore_x_netwm_visible_name_get */
/**
* Set the _NET_WM_ICON_NAME property.
{
_ecore_x_window_prop_string_utf8_set(window, ECORE_X_ATOM_NET_WM_ICON_NAME,
name);
-}
+} /* ecore_x_netwm_icon_name_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_WM_ICON_NAME, ECORE_X_ATOM_UTF8_STRING,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_icon_name_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_netwm_icon_name_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_icon_name_get_fetch */
/**
* Get the icon name of a window.
char **name)
{
if (name)
- *name = _ecore_x_window_prop_string_utf8_get(window,
- ECORE_X_ATOM_NET_WM_ICON_NAME);
+ *name = _ecore_x_window_prop_string_utf8_get(window,
+ ECORE_X_ATOM_NET_WM_ICON_NAME);
+
return 1;
-}
+} /* ecore_x_netwm_icon_name_get */
/**
* Set the _NET_WM_VISIBLE_ICON_NAME property.
_ecore_x_window_prop_string_utf8_set(window,
ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME,
name);
-}
+} /* ecore_x_netwm_visible_icon_name_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME, ECORE_X_ATOM_UTF8_STRING,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_visible_icon_name_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_netwm_visible_icon_name_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_visible_icon_name_get_fetch */
/**
* Get the visible icon name of a window.
char **name)
{
if (name)
- *name = _ecore_x_window_prop_string_utf8_get(window,
- ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME);
+ *name = _ecore_x_window_prop_string_utf8_get(window,
+ ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME);
+
return 1;
-}
+} /* ecore_x_netwm_visible_icon_name_get */
/**
* Set the _NET_WM_DESKTOP property.
unsigned int desk)
{
ecore_x_window_prop_card32_set(window, ECORE_X_ATOM_NET_WM_DESKTOP, &desk, 1);
-}
+} /* ecore_x_netwm_desktop_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_WM_DESKTOP, ECORE_X_ATOM_CARDINAL,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_desktop_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_netwm_desktop_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_desktop_get_fetch */
/**
* Get the visible icon name of a window.
*/
EAPI int
ecore_x_netwm_desktop_get(Ecore_X_Window window,
- unsigned int *desk)
+ unsigned int *desk)
{
- int ret;
+ int ret;
uint32_t tmp;
ret = ecore_x_window_prop_card32_get(window, ECORE_X_ATOM_NET_WM_DESKTOP,
- &tmp, 1);
+ &tmp, 1);
+
+ if (desk)
+ *desk = tmp;
- if (desk) *desk = tmp;
return (ret == 1) ? 1 : 0;
-}
+} /* ecore_x_netwm_desktop_get */
/**
* Set the _NET_WM_STRUT property.
strut[2] = top;
strut[3] = bottom;
ecore_x_window_prop_card32_set(window, ECORE_X_ATOM_NET_WM_STRUT, strut, 4);
-}
+} /* ecore_x_netwm_strut_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_WM_STRUT, ECORE_X_ATOM_CARDINAL,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_strut_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_strut_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_strut_get_fetch */
/*
* _NET_WM_STRUT is deprecated
int *bottom)
{
uint32_t strut[4];
- int ret = 0;
+ int ret = 0;
ret = ecore_x_window_prop_card32_get(window, ECORE_X_ATOM_NET_WM_STRUT, strut, 4);
if (ret != 4)
- return 0;
+ return 0;
+
+ if (left)
+ *left = strut[0];
+
+ if (right)
+ *right = strut[1];
- if (left) *left = strut[0];
- if (right) *right = strut[1];
- if (top) *top = strut[2];
- if (bottom) *bottom = strut[3];
+ if (top)
+ *top = strut[2];
+
+ if (bottom)
+ *bottom = strut[3];
return 1;
-}
+} /* ecore_x_netwm_strut_get */
/**
* Set the _NET_WM_STRUT_PARTIAL property.
strut[10] = bottom_start_x;
strut[11] = bottom_end_x;
ecore_x_window_prop_card32_set(window, ECORE_X_ATOM_NET_WM_STRUT_PARTIAL, strut, 12);
-}
+} /* ecore_x_netwm_strut_partial_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_WM_STRUT_PARTIAL, ECORE_X_ATOM_CARDINAL,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_strut_partial_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_strut_partial_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_strut_partial_get_fetch */
/**
* Get the space at the edje of the screen of a window.
int *bottom_end_x)
{
uint32_t strut[12];
- int ret = 0;
+ int ret = 0;
ret = ecore_x_window_prop_card32_get(window, ECORE_X_ATOM_NET_WM_STRUT_PARTIAL, strut, 12);
if (ret != 12)
- return 0;
-
- 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 0;
+
+ 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 1;
-}
+} /* ecore_x_netwm_strut_partial_get */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_WM_ICON, ECORE_X_ATOM_CARDINAL,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_icons_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_icons_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_icons_get_fetch */
/**
* Retrieve hte possible icons of a window.
uint32_t *data;
uint32_t *p;
uint32_t *src;
- uint32_t icons;
- uint32_t len;
- uint32_t i;
- int num_ret;
+ uint32_t icons;
+ uint32_t len;
+ uint32_t i;
+ int num_ret;
- if (num) *num = 0UL;
- if (icon) *icon = NULL;
+ if (num)
+ *num = 0UL;
+
+ if (icon)
+ *icon = NULL;
num_ret = ecore_x_window_prop_card32_list_get(window,
ECORE_X_ATOM_NET_WM_ICON,
&data);
if ((num_ret <= 0) || !data)
- return 0;
+ return 0;
if (num_ret < 2)
{
- free(data);
- return 0;
+ free(data);
+ return 0;
}
/* Check how many icons there are */
p = data;
while (p)
{
- len = p[0] * p[1];
- p += (len + 2);
- if ((p - data) > num_ret)
- {
- free(data);
- return 0;
- }
- icons++;
-
- if ((p - data) == num_ret)
- p = NULL;
+ len = p[0] * p[1];
+ p += (len + 2);
+ if ((p - data) > num_ret)
+ {
+ free(data);
+ return 0;
+ }
+
+ icons++;
+
+ if ((p - data) == num_ret)
+ p = NULL;
}
- if (num) *num = icons;
+ if (num)
+ *num = icons;
/* If the user doesn't want the icons, return */
if (!icon)
{
- free(data);
- return 1;
+ free(data);
+ return 1;
}
/* Allocate memory */
*icon = malloc(icons * sizeof(Ecore_X_Icon));
if (!(*icon))
{
- free(data);
- return 0;
+ free(data);
+ return 0;
}
/* Fetch the icons */
p = data;
for (i = 0; i < icons; i++)
{
- uint32_t *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(uint32_t));
- if (!((*icon)[i]).data)
- {
- while (i)
- free(((*icon)[--i]).data);
- free(*icon);
- free(data);
- return 0;
- }
-
- pd = ((*icon)[i]).data;
- ps = src;
- pe = ps + len;
- for (; ps < pe; ps++)
- {
- uint32_t 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);
+ uint32_t *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(uint32_t));
+ if (!((*icon)[i]).data)
+ {
+ while (i)
+ free(((*icon)[--i]).data);
+ free(*icon);
+ free(data);
+ return 0;
+ }
+
+ pd = ((*icon)[i]).data;
+ ps = src;
+ pe = ps + len;
+ for (; ps < pe; ps++)
+ {
+ uint32_t 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 1;
-}
+} /* ecore_x_netwm_icons_get */
/**
* Set the _NET_WM_ICON_GEOMETRY property.
geometry[2] = (uint32_t)width;
geometry[3] = (uint32_t)height;
ecore_x_window_prop_card32_set(window, ECORE_X_ATOM_NET_WM_ICON_GEOMETRY, geometry, 4);
-}
+} /* ecore_x_netwm_icon_geometry_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_WM_ICON_GEOMETRY, ECORE_X_ATOM_CARDINAL,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_icon_geometry_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_icon_geometry_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_icon_geometry_get_fetch */
/**
* Get the geometry of an icon.
int *height)
{
uint32_t geometry[4];
- int ret;
+ int ret;
ret = ecore_x_window_prop_card32_get(window, ECORE_X_ATOM_NET_WM_ICON_GEOMETRY, geometry, 4);
if (ret != 4)
- return 0;
+ return 0;
+
+ if (x)
+ *x = geometry[0];
+
+ if (y)
+ *y = geometry[1];
+
+ if (width)
+ *width = geometry[2];
- if (x) *x = geometry[0];
- if (y) *y = geometry[1];
- if (width) *width = geometry[2];
- if (height) *height = geometry[3];
+ if (height)
+ *height = geometry[3];
return 1;
-}
+} /* ecore_x_netwm_icon_geometry_get */
/**
* Set the _NET_WM_PID property.
tmp = pid;
ecore_x_window_prop_card32_set(window, ECORE_X_ATOM_NET_WM_PID,
- &tmp, 1);
-}
+ &tmp, 1);
+} /* ecore_x_netwm_pid_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_WM_PID, ECORE_X_ATOM_CARDINAL,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_pid_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_pid_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_pid_get_fetch */
/**
* Get the process ID of a client window.
uint32_t tmp;
ret = ecore_x_window_prop_card32_get(window, ECORE_X_ATOM_NET_WM_PID,
- &tmp, 1);
- if (pid) *pid = tmp;
+ &tmp, 1);
+ if (pid)
+ *pid = tmp;
return (ret == 1) ? 1 : 0;
-}
+} /* ecore_x_netwm_pid_get */
/**
* Set the _NET_WM_HANDLED_ICONS property.
ecore_x_netwm_handled_icons_set(Ecore_X_Window window)
{
ecore_x_window_prop_card32_set(window, ECORE_X_ATOM_NET_WM_HANDLED_ICONS,
- NULL, 0);
-}
+ NULL, 0);
+} /* ecore_x_netwm_handled_icons_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_WM_HANDLED_ICONS, ECORE_X_ATOM_CARDINAL,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_handled_icons_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_handled_icons_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_handled_icons_get_fetch */
/**
* Return wheter the Client handles icons or not.
{
int ret = 0;
ret = ecore_x_window_prop_card32_get(window, ECORE_X_ATOM_NET_WM_HANDLED_ICONS,
- NULL, 0);
+ NULL, 0);
return (ret == 0) ? 1 : 0;
-}
+} /* ecore_x_netwm_handled_icons_get */
/**
* Set the _NET_WM_USER_TIME property.
unsigned int time)
{
ecore_x_window_prop_card32_set(window, ECORE_X_ATOM_NET_WM_USER_TIME,
- &time, 1);
-}
+ &time, 1);
+} /* ecore_x_netwm_user_time_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_WM_USER_TIME, ECORE_X_ATOM_CARDINAL,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_user_time_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_netwm_user_time_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_user_time_get_fetch */
/**
* Get the last user activity time in the window.
uint32_t tmp;
ret = ecore_x_window_prop_card32_get(window, ECORE_X_ATOM_NET_WM_USER_TIME,
- &tmp, 1);
- if (time) *time = tmp;
+ &tmp, 1);
+ if (time)
+ *time = tmp;
+
return (ret == 1) ? 1 : 0;
-}
+} /* ecore_x_netwm_user_time_get */
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;
+ return ECORE_X_WINDOW_STATE_MODAL;
else if (a == ECORE_X_ATOM_NET_WM_STATE_STICKY)
- return ECORE_X_WINDOW_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;
+ 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;
+ return ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ;
else if (a == ECORE_X_ATOM_NET_WM_STATE_SHADED)
- return ECORE_X_WINDOW_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;
+ 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;
+ return ECORE_X_WINDOW_STATE_SKIP_PAGER;
else if (a == ECORE_X_ATOM_NET_WM_STATE_HIDDEN)
- return ECORE_X_WINDOW_STATE_HIDDEN;
+ return ECORE_X_WINDOW_STATE_HIDDEN;
else if (a == ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN)
- return ECORE_X_WINDOW_STATE_FULLSCREEN;
+ return ECORE_X_WINDOW_STATE_FULLSCREEN;
else if (a == ECORE_X_ATOM_NET_WM_STATE_ABOVE)
- return ECORE_X_WINDOW_STATE_ABOVE;
+ return ECORE_X_WINDOW_STATE_ABOVE;
else if (a == ECORE_X_ATOM_NET_WM_STATE_BELOW)
- return ECORE_X_WINDOW_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;
+ return ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION;
else
- return ECORE_X_WINDOW_STATE_UNKNOWN;
-}
+ return ECORE_X_WINDOW_STATE_UNKNOWN;
+} /* _ecore_x_netwm_state_get */
static Ecore_X_Atom
_ecore_x_netwm_state_atom_get(Ecore_X_Window_State s)
switch(s)
{
case ECORE_X_WINDOW_STATE_MODAL:
- return ECORE_X_ATOM_NET_WM_STATE_MODAL;
+ return ECORE_X_ATOM_NET_WM_STATE_MODAL;
+
case ECORE_X_WINDOW_STATE_STICKY:
- return ECORE_X_ATOM_NET_WM_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;
+ 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;
+ return ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ;
+
case ECORE_X_WINDOW_STATE_SHADED:
- return ECORE_X_ATOM_NET_WM_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;
+ 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;
+ return ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER;
+
case ECORE_X_WINDOW_STATE_HIDDEN:
- return ECORE_X_ATOM_NET_WM_STATE_HIDDEN;
+ return ECORE_X_ATOM_NET_WM_STATE_HIDDEN;
+
case ECORE_X_WINDOW_STATE_FULLSCREEN:
- return ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN;
+ return ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN;
+
case ECORE_X_WINDOW_STATE_ABOVE:
- return ECORE_X_ATOM_NET_WM_STATE_ABOVE;
+ return ECORE_X_ATOM_NET_WM_STATE_ABOVE;
+
case ECORE_X_WINDOW_STATE_BELOW:
- return ECORE_X_ATOM_NET_WM_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;
+ return ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION;
+
default:
- return 0;
- }
-}
+ return 0;
+ } /* switch */
+} /* _ecore_x_netwm_state_atom_get */
/**
* Set the _NET_WM_STATE property.
Ecore_X_Window_State *state,
unsigned int num)
{
- Ecore_X_Atom *set;
- uint32_t i;
+ Ecore_X_Atom *set;
+ uint32_t i;
if (!num)
{
- ecore_x_window_prop_property_del(window, ECORE_X_ATOM_NET_WM_STATE);
- return;
+ ecore_x_window_prop_property_del(window, ECORE_X_ATOM_NET_WM_STATE);
+ return;
}
set = malloc(num * sizeof(Ecore_X_Atom));
- if (!set) return;
+ if (!set)
+ return;
for (i = 0; i < num; i++)
- set[i] = _ecore_x_netwm_state_atom_get(state[i]);
+ set[i] = _ecore_x_netwm_state_atom_get(state[i]);
ecore_x_window_prop_atom_set(window, ECORE_X_ATOM_NET_WM_STATE, set, num);
free(set);
-}
+} /* ecore_x_netwm_window_state_set */
/**
* Sends the GetProperty request.
cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, window,
ECORE_X_ATOM_NET_WM_STATE, ECORE_X_ATOM_ATOM,
- 0, 0x7fffffff);;
+ 0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_window_state_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_window_state_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_window_state_get_fetch */
/**
* Get the hints describing the window state.
unsigned int *num)
{
Ecore_X_Atom *atoms;
- int num_ret;
- int i;
+ int num_ret;
+ int i;
- if (num) *num = 0;
- if (state) *state = NULL;
+ if (num)
+ *num = 0;
+
+ if (state)
+ *state = NULL;
num_ret = ecore_x_window_prop_atom_list_get(window, ECORE_X_ATOM_NET_WM_STATE,
- &atoms);
+ &atoms);
if (num_ret <= 0)
return 0;
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]);
+ *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;
+ if (num)
+ *num = num_ret;
}
free(atoms);
return 1;
-}
+} /* ecore_x_netwm_window_state_get */
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;
+ return ECORE_X_WINDOW_TYPE_DESKTOP;
else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK)
- return ECORE_X_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;
+ return ECORE_X_WINDOW_TYPE_TOOLBAR;
else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU)
- return ECORE_X_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;
+ return ECORE_X_WINDOW_TYPE_UTILITY;
else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH)
- return ECORE_X_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;
+ return ECORE_X_WINDOW_TYPE_DIALOG;
else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL)
- return ECORE_X_WINDOW_TYPE_NORMAL;
+ return ECORE_X_WINDOW_TYPE_NORMAL;
else
- return ECORE_X_WINDOW_TYPE_UNKNOWN;
-}
+ return ECORE_X_WINDOW_TYPE_UNKNOWN;
+} /* _ecore_x_netwm_window_type_type_get */
static Ecore_X_Atom
_ecore_x_netwm_window_type_atom_get(Ecore_X_Window_Type type)
switch (type)
{
case ECORE_X_WINDOW_TYPE_DESKTOP:
- return ECORE_X_ATOM_NET_WM_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;
+ return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK;
+
case ECORE_X_WINDOW_TYPE_TOOLBAR:
- return ECORE_X_ATOM_NET_WM_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;
+ return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU;
+
case ECORE_X_WINDOW_TYPE_UTILITY:
- return ECORE_X_ATOM_NET_WM_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;
+ return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH;
+
case ECORE_X_WINDOW_TYPE_DIALOG:
- return ECORE_X_ATOM_NET_WM_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;
+ return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL;
+
default:
- return 0;
- }
-}
+ return 0;
+ } /* switch */
+} /* _ecore_x_netwm_window_type_atom_get */
/*
* FIXME: We should set WM_TRANSIENT_FOR if type is ECORE_X_WINDOW_TYPE_TOOLBAR
atom = _ecore_x_netwm_window_type_atom_get(type);
ecore_x_window_prop_atom_set(window, ECORE_X_ATOM_NET_WM_WINDOW_TYPE,
- &atom, 1);
-}
+ &atom, 1);
+} /* ecore_x_netwm_window_type_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_WM_WINDOW_TYPE, ECORE_X_ATOM_ATOM,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_window_type_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_window_type_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_window_type_get_fetch */
/* FIXME: Maybe return 0 on some conditions? */
Ecore_X_Window_Type *type)
{
Ecore_X_Atom *atoms;
- int num;
- int i;
+ int num;
+ int i;
- if (type) *type = ECORE_X_WINDOW_TYPE_NORMAL;
+ if (type)
+ *type = ECORE_X_WINDOW_TYPE_NORMAL;
num = ecore_x_window_prop_atom_list_get(window, ECORE_X_ATOM_NET_WM_WINDOW_TYPE,
- &atoms);
+ &atoms);
if (num < 0)
{
- /* IMO this is not the place to mix netwm and icccm /kwo */
- /* Check if WM_TRANSIENT_FOR is set */
+ /* IMO this is not the place to mix netwm and icccm /kwo */
+ /* Check if WM_TRANSIENT_FOR is set */
/* Disable it for xcb */
if (type)
{
- for (i = 0; i < num; ++i)
- {
- *type = _ecore_x_netwm_window_type_type_get(atoms[i]);
- if (*type != ECORE_X_WINDOW_TYPE_UNKNOWN)
- break;
- }
+ for (i = 0; i < num; ++i)
+ {
+ *type = _ecore_x_netwm_window_type_type_get(atoms[i]);
+ if (*type != ECORE_X_WINDOW_TYPE_UNKNOWN)
+ break;
+ }
}
free(atoms);
return 1;
-}
+} /* ecore_x_netwm_window_type_get */
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;
+ return ECORE_X_ATOM_NET_WM_ACTION_MOVE;
+
case ECORE_X_ACTION_RESIZE:
- return ECORE_X_ATOM_NET_WM_ACTION_RESIZE;
+ return ECORE_X_ATOM_NET_WM_ACTION_RESIZE;
+
case ECORE_X_ACTION_MINIMIZE:
- return ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE;
+ return ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE;
+
case ECORE_X_ACTION_SHADE:
- return ECORE_X_ATOM_NET_WM_ACTION_SHADE;
+ return ECORE_X_ATOM_NET_WM_ACTION_SHADE;
+
case ECORE_X_ACTION_STICK:
- return ECORE_X_ATOM_NET_WM_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;
+ return ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ;
+
case ECORE_X_ACTION_MAXIMIZE_VERT:
- return ECORE_X_ATOM_NET_WM_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;
+ return ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN;
+
case ECORE_X_ACTION_CHANGE_DESKTOP:
- return ECORE_X_ATOM_NET_WM_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;
+ return ECORE_X_ATOM_NET_WM_ACTION_CLOSE;
+
case ECORE_X_ACTION_ABOVE:
- return ECORE_X_ATOM_NET_WM_ACTION_ABOVE;
+ return ECORE_X_ATOM_NET_WM_ACTION_ABOVE;
+
case ECORE_X_ACTION_BELOW:
- return ECORE_X_ATOM_NET_WM_ACTION_BELOW;
+ return ECORE_X_ATOM_NET_WM_ACTION_BELOW;
+
default:
- return 0;
- }
-}
+ return 0;
+ } /* switch */
+} /* _ecore_x_netwm_action_atom_get */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS, ECORE_X_ATOM_ATOM,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_allowed_action_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_allowed_action_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_allowed_action_get_fetch */
/* FIXME: Get complete list */
Ecore_X_Action action)
{
Ecore_X_Atom *atoms;
- Ecore_X_Atom atom;
- int num;
- int ret = 0;
- int i;
+ Ecore_X_Atom atom;
+ int num;
+ int ret = 0;
+ int i;
num = ecore_x_window_prop_atom_list_get(window, ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS,
- &atoms);
+ &atoms);
if (num <= 0)
- return ret;
+ return ret;
atom = _ecore_x_netwm_action_atom_get(action);
for (i = 0; i < num; ++i)
{
- if (atom == atoms[i])
- {
- ret = 1;
- break;
- }
+ if (atom == atoms[i])
+ {
+ ret = 1;
+ break;
+ }
}
free(atoms);
return ret;
-}
+} /* ecore_x_netwm_allowed_action_isset */
/* FIXME: Set complete list */
/**
Ecore_X_Action *action,
unsigned int num)
{
- Ecore_X_Atom *set;
- unsigned int i;
+ Ecore_X_Atom *set;
+ unsigned int i;
if (!num)
{
- ecore_x_window_prop_property_del(window, ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS);
- return;
+ ecore_x_window_prop_property_del(window, ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS);
+ return;
}
set = malloc(num * sizeof(Ecore_X_Atom));
- if (!set) return;
+ if (!set)
+ return;
for (i = 0; i < num; i++)
- set[i] = _ecore_x_netwm_action_atom_get(action[i]);
+ set[i] = _ecore_x_netwm_action_atom_get(action[i]);
ecore_x_window_prop_atom_set(window, ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS, set, num);
free(set);
-}
+} /* ecore_x_netwm_allowed_action_set */
/**
* Get the allowed actions supported by a window.
unsigned int *num)
{
Ecore_X_Atom *atoms;
- int num_ret;
- int i;
+ int num_ret;
+ int i;
- if (num) *num = 0;
- if (action) *action = NULL;
+ if (num)
+ *num = 0;
+
+ if (action)
+ *action = NULL;
num_ret = ecore_x_window_prop_atom_list_get(window, ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS,
- &atoms);
+ &atoms);
if (num_ret <= 0)
return 0;
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]);
+ *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;
+ if (num)
+ *num = num_ret;
}
free(atoms);
return 1;
-}
+} /* ecore_x_netwm_allowed_action_get */
/**
* Set the _NET_WM_WINDOW_OPACITY property.
{
uint32_t op = opacity;
ecore_x_window_prop_card32_set(window, ECORE_X_ATOM_NET_WM_WINDOW_OPACITY,
- &op, 1);
-}
+ &op, 1);
+} /* ecore_x_netwm_opacity_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_WM_WINDOW_OPACITY, ECORE_X_ATOM_CARDINAL,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_opacity_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_netwm_opacity_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_opacity_get_fetch */
/**
* Get the opacity value of a window.
unsigned int tmp;
ret = ecore_x_window_prop_card32_get(window, ECORE_X_ATOM_NET_WM_WINDOW_OPACITY,
- &tmp, 1);
- if (opacity) *opacity = tmp;
+ &tmp, 1);
+ if (opacity)
+ *opacity = tmp;
+
return ret == 1 ? 1 : 0;
-}
+} /* ecore_x_netwm_opacity_get */
/**
* Set the _NET_FRAME_EXTENTS property.
frames[2] = ft;
frames[3] = fb;
ecore_x_window_prop_card32_set(window, ECORE_X_ATOM_NET_FRAME_EXTENTS, frames, 4);
-}
+} /* ecore_x_netwm_frame_size_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_FRAME_EXTENTS, ECORE_X_ATOM_CARDINAL,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_frame_size_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_netwm_frame_size_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_frame_size_get_fetch */
/**
* Get the frame extent of a window.
int *fb)
{
uint32_t frames[4];
- int ret = 0;
+ int ret = 0;
ret = ecore_x_window_prop_card32_get(window, ECORE_X_ATOM_NET_FRAME_EXTENTS, frames, 4);
if (ret != 4)
- return 0;
+ return 0;
+
+ if (fl)
+ *fl = frames[0];
+
+ if (fr)
+ *fr = frames[1];
+
+ if (ft)
+ *ft = frames[2];
+
+ if (fb)
+ *fb = frames[3];
- if (fl) *fl = frames[0];
- if (fr) *fr = frames[1];
- if (ft) *ft = frames[2];
- if (fb) *fb = frames[3];
return 1;
-}
+} /* ecore_x_netwm_frame_size_get */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER, ECORE_X_ATOM_CARDINAL,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_sync_counter_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_netwm_sync_counter_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_sync_counter_get_fetch */
/**
* Get the X ID of a X Sync counter.
ecore_x_netwm_sync_counter_get(Ecore_X_Window window,
Ecore_X_Sync_Counter *counter)
{
- int ret;
+ int ret;
unsigned int tmp;
ret = ecore_x_window_prop_card32_get(window, ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER,
- &tmp, 1);
+ &tmp, 1);
+
+ if (counter)
+ *counter = tmp;
- if (counter) *counter = tmp;
return (ret == 1) ? 1 : 0;
-}
+} /* ecore_x_netwm_sync_counter_get */
/**
* Send a _NET_WM_PING property event.
{
xcb_client_message_event_t ev;
- if (!window) return;
+ if (!window)
+ return;
ev.response_type = XCB_CLIENT_MESSAGE | 0x80;
ev.format = 32;
ev.data.data32[5] = 0;
xcb_send_event(_ecore_xcb_conn, 0, window, XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
-}
+} /* ecore_x_netwm_ping_send */
/**
* Send a _NET_WM_SYNC_REQUEST property event.
{
xcb_client_message_event_t ev;
- if (!window) return;
+ if (!window)
+ return;
ev.response_type = XCB_CLIENT_MESSAGE | 0x80;
ev.format = 32;
ev.data.data32[4] = 0;
xcb_send_event(_ecore_xcb_conn, 0, window, 0, (const char *)&ev);
-}
+} /* ecore_x_netwm_sync_request_send */
/**
* Send a _NET_WM_STATE property event.
{
xcb_client_message_event_t ev;
- if (!window) return;
- if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+ if (!window)
+ return;
+
+ if (!root)
+ root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
ev.response_type = XCB_CLIENT_MESSAGE | 0x80;
ev.format = 32;
xcb_send_event(_ecore_xcb_conn, 0, root,
XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT,
(const char *)&ev);
-}
+} /* ecore_x_netwm_state_request_send */
/**
* Send a _NET_WM_DESKTOP property event.
{
xcb_client_message_event_t ev;
- if (!window) return;
- if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+ if (!window)
+ return;
+
+ if (!root)
+ root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
ev.response_type = XCB_CLIENT_MESSAGE | 0x80;
ev.format = 32;
xcb_send_event(_ecore_xcb_conn, 0, root,
XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT,
(const char *)&ev);
-}
+} /* ecore_x_netwm_desktop_request_send */
int
_ecore_x_netwm_startup_info_begin(Ecore_X_Window window,
{
#if 0
Ecore_X_Startup_Info *info;
- unsigned char exists = 0;
+ unsigned char exists = 0;
+
+ if (!startup_info)
+ return 0;
- if (!startup_info) return 0;
info = eina_hash_find(startup_info, (void *)window);
if (info)
{
exists = 1;
- INF("Already got info for win: 0x%x", window);
- _ecore_x_netwm_startup_info_free(info);
+ INF("Already got info for win: 0x%x", window);
+ _ecore_x_netwm_startup_info_free(info);
}
+
info = calloc(1, sizeof(Ecore_X_Startup_Info));
- if (!info) return 0;
+ 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;
+ _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);
+ eina_hash_modify(startup_info, (void *)info->win, info);
else
- eina_hash_add(startup_info, (void *)info->win, info);
+ 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);
+ /* We have a '\0' in there, the message is done */
+ _ecore_x_netwm_startup_info_process(info);
}
-#else
+
+#else /* if 0 */
window = XCB_NONE;
data = NULL;
-#endif
+#endif /* if 0 */
return 1;
-}
+} /* _ecore_x_netwm_startup_info_begin */
int
_ecore_x_netwm_startup_info(Ecore_X_Window window,
Ecore_X_Startup_Info *info;
char *p;
- if (!startup_info) return 0;
+ if (!startup_info)
+ return 0;
+
info = eina_hash_find(startup_info, (void *)window);
- if (!info) return 0;
+ 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;
- }
+ 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);
+ /* We have a '\0' in there, the message is done */
+ _ecore_x_netwm_startup_info_process(info);
}
-#else
+
+#else /* if 0 */
window = XCB_NONE;
data = NULL;
-#endif
+#endif /* if 0 */
return 1;
-}
+} /* _ecore_x_netwm_startup_info */
/*
* Set UTF-8 string property
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
atom, ECORE_X_ATOM_UTF8_STRING,
8, strlen(str), str);
-}
+} /* _ecore_x_window_prop_string_utf8_set */
static void
_ecore_x_window_prop_string_utf8_get_prefetch(Ecore_X_Window window,
- Ecore_X_Atom atom)
+ Ecore_X_Atom atom)
{
xcb_get_property_cookie_t cookie;
atom, ECORE_X_ATOM_UTF8_STRING,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* _ecore_x_window_prop_string_utf8_get_prefetch */
+
+static void
+_ecore_x_window_prop_string_utf8_get_fetch(void)
+{
+ xcb_get_property_cookie_t cookie;
+ xcb_get_property_reply_t *reply;
+
+ cookie.sequence = _ecore_xcb_cookie_get();
+ reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
+ _ecore_xcb_reply_cache(reply);
+} /* _ecore_x_window_prop_string_utf8_get_fetch */
/*
* Get UTF-8 string property
*/
static char *
_ecore_x_window_prop_string_utf8_get(Ecore_X_Window window __UNUSED__,
- Ecore_X_Atom atom __UNUSED__)
+ Ecore_X_Atom atom __UNUSED__)
{
xcb_get_property_reply_t *reply;
- char *str;
- int length;
+ char *str;
+ int length;
- reply = _ecore_xcb_reply_get((Ecore_Xcb_Reply_Cb)xcb_get_property_reply);
- if (!reply) return NULL;
+ reply = _ecore_xcb_reply_get();
+ if (!reply)
+ return NULL;
if ((reply->format != 8) ||
(reply->value_len <= 0))
- {
- free(reply);
- return NULL;
- }
+ return NULL;
length = reply->value_len;
str = (char *)malloc (sizeof (char) * (length + 1));
if (!str)
{
- free(reply);
return NULL;
}
+
memcpy(str, xcb_get_property_value(reply), length);
str[length] = '\0';
- free(reply);
return str;
-}
+} /* _ecore_x_window_prop_string_utf8_get */
#if 0 /* Unused */
/*
_ecore_x_netwm_startup_info_process(Ecore_X_Startup_Info *info)
{
Ecore_X_Event_Startup_Sequence *e;
- int event;
- char *p;
+ 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;
+ 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;
+ 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;
+ event = ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE;
}
else if (!strcmp(info->buffer, "remove"))
- event = ECORE_X_EVENT_STARTUP_SEQUENCE_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;
+ 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;
+ 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);
+ 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);
+ _ecore_x_netwm_startup_info_free(info);
}
else
{
- /* Discard buffer */
- info->length = 0;
- info->buffer[0] = 0;
+ /* Discard buffer */
+ info->length = 0;
+ info->buffer[0] = 0;
}
+
return 1;
-}
+} /* _ecore_x_netwm_startup_info_process */
/*
* Parse startup info
_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
- {
- WRN("Ecore X Sequence, Unknown: %s=%s", key, value);
- }
+ 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
+ {
+ WRN("Ecore X Sequence, Unknown: %s=%s", key, value);
+ }
}
- if (!info->id) return 0;
+ if (!info->id)
+ return 0;
+
return 1;
-}
-#endif
+} /* _ecore_x_netwm_startup_info_parse */
+
+#endif /* if 0 */
/*
* Free startup info struct
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);
+ 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);
-}
+} /* _ecore_x_netwm_startup_info_free */
/*
* Is screen composited?
EAPI int
ecore_x_screen_is_composited(int screen)
{
- char buf[32];
- xcb_intern_atom_cookie_t cookie_atom;
+ char buf[32];
+ xcb_intern_atom_cookie_t cookie_atom;
xcb_get_selection_owner_cookie_t cookie_owner;
- xcb_intern_atom_reply_t *reply_atom;
+ xcb_intern_atom_reply_t *reply_atom;
xcb_get_selection_owner_reply_t *reply_owner;
- Ecore_X_Window window;
- Ecore_X_Atom atom;
+ Ecore_X_Window window;
+ Ecore_X_Atom atom;
snprintf(buf, sizeof(buf), "_NET_WM_CM_S%d", screen);
cookie_atom = xcb_intern_atom_unchecked(_ecore_xcb_conn, 1,
strlen(buf), buf);
reply_atom = xcb_intern_atom_reply(_ecore_xcb_conn, cookie_atom, NULL);
- if (!reply_atom) return 0;
+ if (!reply_atom)
+ return 0;
+
atom = reply_atom->atom;
free(reply_atom);
cookie_owner = xcb_get_selection_owner_unchecked(_ecore_xcb_conn, atom);
reply_owner = xcb_get_selection_owner_reply(_ecore_xcb_conn, cookie_owner, NULL);
- if (!reply_owner) return 0;
+ if (!reply_owner)
+ return 0;
window = reply_owner->owner;
free(reply_owner);
return window != XCB_NONE;
-}
+} /* ecore_x_screen_is_composited */
+
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#include "ecore_xcb_private.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
{
Ecore_X_Pixmap pmap;
- if (win == 0) win = ((xcb_screen_t *)_ecore_xcb_screen)->root;
- if (dep == 0) dep = ((xcb_screen_t *)_ecore_xcb_screen)->root_depth;
+ if (win == 0)
+ win = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+
+ if (dep == 0)
+ dep = ((xcb_screen_t *)_ecore_xcb_screen)->root_depth;
pmap = xcb_generate_id(_ecore_xcb_conn);
xcb_create_pixmap(_ecore_xcb_conn, dep, pmap, win, w, h);
return pmap;
-}
-
+} /* ecore_x_pixmap_new */
/**
* Deletes the reference to the given pixmap.
ecore_x_pixmap_free(Ecore_X_Pixmap pmap)
{
xcb_free_pixmap(_ecore_xcb_conn, pmap);
-}
-
+} /* ecore_x_pixmap_free */
/**
* Pastes a rectangular area of the given pixmap onto the given drawable.
EAPI void
ecore_x_pixmap_paste(Ecore_X_Pixmap pmap,
Ecore_X_Drawable dest,
- Ecore_X_GC gc,
+ Ecore_X_GC gc,
int sx,
int sy,
- int w,
+ int w,
int h,
int dx,
int dy)
{
xcb_copy_area(_ecore_xcb_conn, pmap, dest, gc, sx, sy, dx, dy, w, h);
-}
-
+} /* ecore_x_pixmap_paste */
/**
* Retrieves the size of the given pixmap.
{
if (pmap)
ecore_x_drawable_geometry_get(pmap, x, y, w, h);
-}
-
+} /* ecore_x_pixmap_geometry_get */
/**
* Retrieves the depth of the given pixmap.
ecore_x_pixmap_depth_get(Ecore_X_Pixmap pmap)
{
return ecore_x_drawable_depth_get(pmap);
-}
+} /* ecore_x_pixmap_depth_get */
+
#ifndef MAXHOSTNAMELEN
# define MAXHOSTNAMELEN 256
-#endif
+#endif /* ifndef MAXHOSTNAMELEN */
#ifndef XK_MISCELLANY
-# define XK_MISCELLANY 1
+# define XK_MISCELLANY 1
#endif /* XK_MISCELLANY */
#include <xcb/xcb.h>
#include "ecore_private.h"
#include "Ecore_X.h"
-extern int _ecore_x11xcb_log_dom ;
+extern int _ecore_x11xcb_log_dom;
#ifdef ECORE_XLIB_XCB_DEFAULT_LOG_COLOR
# undef ECORE_XLIB_XCB_DEFAULT_LOG_COLOR
-#endif
+#endif /* ifdef ECORE_XLIB_XCB_DEFAULT_LOG_COLOR */
#define ECORE_XLIB_XCB_DEFAULT_LOG_COLOR EINA_COLOR_BLUE
#ifdef ERR
# undef ERR
-#endif
+#endif /* ifdef ERR */
#define ERR(...) EINA_LOG_DOM_ERR(_ecore_x11xcb_log_dom, __VA_ARGS__)
#ifdef DBG
# undef DBG
-#endif
+#endif /* ifdef DBG */
#define DBG(...) EINA_LOG_DOM_DBG(_ecore_x11xcb_log_dom, __VA_ARGS__)
#ifdef INF
# undef INF
-#endif
+#endif /* ifdef INF */
#define INF(...) EINA_LOG_DOM_INFO(_ecore_x11xcb_log_dom, __VA_ARGS__)
#ifdef WRN
# undef WRN
-#endif
+#endif /* ifdef WRN */
#define WRN(...) EINA_LOG_DOM_WARN(_ecore_x11xcb_log_dom, __VA_ARGS__)
#ifdef CRIT
# undef CRIT
-#endif
+#endif /* ifdef CRIT */
#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_x11xcb_log_dom, __VA_ARGS__)
-typedef struct _Ecore_X_Selection_Intern Ecore_X_Selection_Intern;
+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;
- Ecore_X_Time time;
+ Ecore_X_Window win;
+ Ecore_X_Atom selection;
+ unsigned char *data;
+ int length;
+ Ecore_X_Time time;
};
-typedef struct _Ecore_X_Selection_Converter Ecore_X_Selection_Converter;
+typedef struct _Ecore_X_Selection_Converter Ecore_X_Selection_Converter;
struct _Ecore_X_Selection_Converter
{
- Ecore_X_Atom target;
- int (*convert)(char *target, void *data, int size,
- void **data_ret, int *size_ret);
+ Ecore_X_Atom target;
+ int (*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;
+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);
+ 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;
+ int version;
Ecore_X_Window win, dest;
enum {
ECORE_X_DND_SOURCE_CONVERTING
} state;
- struct {
- short x, y;
+ struct
+ {
+ short x, y;
unsigned short width, height;
} rectangle;
- struct {
+ struct
+ {
Ecore_X_Window window;
- int x, y;
+ int x, y;
} prev;
-
+
Ecore_X_Time time;
Ecore_X_Atom action, accepted_action;
- int will_accept;
- int suppress;
+ int will_accept;
+ int suppress;
- int await_status;
+ int await_status;
} Ecore_X_DND_Source;
typedef struct _Ecore_X_DND_Target
{
- int version;
+ int version;
Ecore_X_Window win, source;
enum {
ECORE_X_DND_TARGET_ENTERED
} state;
- struct {
+ struct
+ {
int x, y;
} pos;
Ecore_X_Atom action, accepted_action;
- int will_accept;
+ 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_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 Ecore_X_Connection *_ecore_xcb_conn;
-extern Ecore_X_Screen *_ecore_xcb_screen;
-extern double _ecore_xcb_double_click_time;
-extern Ecore_X_Time _ecore_xcb_event_last_time;
-extern Ecore_X_Window _ecore_xcb_event_last_window;
-extern int16_t _ecore_xcb_event_last_root_x;
-extern int16_t _ecore_xcb_event_last_root_y;
-extern int _ecore_xcb_xcursor;
-
-extern Ecore_X_Atom _ecore_xcb_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_NUM];
-
-extern int _ecore_window_grabs_num;
-extern Ecore_X_Window *_ecore_window_grabs;
-extern int (*_ecore_window_grab_replay_func) (void *data, int event_type, void *event);
-extern void *_ecore_window_grab_replay_data;
-
-extern Ecore_X_Window _ecore_xcb_private_window;
-
-
-void _ecore_x_error_handler_init(void);
-
-void _ecore_x_event_handle_any_event (xcb_generic_event_t *event);
-void _ecore_x_event_handle_key_press (xcb_generic_event_t *event);
-void _ecore_x_event_handle_key_release (xcb_generic_event_t *event);
-void _ecore_x_event_handle_button_press (xcb_generic_event_t *event);
-void _ecore_x_event_handle_button_release (xcb_generic_event_t *event);
-void _ecore_x_event_handle_motion_notify (xcb_generic_event_t *event);
-void _ecore_x_event_handle_enter_notify (xcb_generic_event_t *event);
-void _ecore_x_event_handle_leave_notify (xcb_generic_event_t *event);
-void _ecore_x_event_handle_focus_in (xcb_generic_event_t *event);
-void _ecore_x_event_handle_focus_out (xcb_generic_event_t *event);
-void _ecore_x_event_handle_keymap_notify (xcb_generic_event_t *event);
-void _ecore_x_event_handle_expose (xcb_generic_event_t *event);
-void _ecore_x_event_handle_graphics_expose (xcb_generic_event_t *event);
-void _ecore_x_event_handle_visibility_notify (xcb_generic_event_t *event);
-void _ecore_x_event_handle_create_notify (xcb_generic_event_t *event);
-void _ecore_x_event_handle_destroy_notify (xcb_generic_event_t *event);
-void _ecore_x_event_handle_unmap_notify (xcb_generic_event_t *event);
-void _ecore_x_event_handle_map_notify (xcb_generic_event_t *event);
-void _ecore_x_event_handle_map_request (xcb_generic_event_t *event);
-void _ecore_x_event_handle_reparent_notify (xcb_generic_event_t *event);
-void _ecore_x_event_handle_configure_notify (xcb_generic_event_t *event);
-void _ecore_x_event_handle_configure_request (xcb_generic_event_t *event);
-void _ecore_x_event_handle_gravity_notify (xcb_generic_event_t *event);
-void _ecore_x_event_handle_resize_request (xcb_generic_event_t *event);
-void _ecore_x_event_handle_circulate_notify (xcb_generic_event_t *event);
-void _ecore_x_event_handle_circulate_request (xcb_generic_event_t *event);
-void _ecore_x_event_handle_property_notify (xcb_generic_event_t *event);
-void _ecore_x_event_handle_selection_clear (xcb_generic_event_t *event);
-void _ecore_x_event_handle_selection_request (xcb_generic_event_t *event);
-void _ecore_x_event_handle_selection_notify (xcb_generic_event_t *event);
-void _ecore_x_event_handle_colormap_notify (xcb_generic_event_t *event);
-void _ecore_x_event_handle_client_message (xcb_generic_event_t *event);
-void _ecore_x_event_handle_mapping_notify (xcb_generic_event_t *event);
+extern Ecore_X_Screen *_ecore_xcb_screen;
+extern double _ecore_xcb_double_click_time;
+extern Ecore_X_Time _ecore_xcb_event_last_time;
+extern Ecore_X_Window _ecore_xcb_event_last_window;
+extern int16_t _ecore_xcb_event_last_root_x;
+extern int16_t _ecore_xcb_event_last_root_y;
+extern int _ecore_xcb_xcursor;
+
+extern Ecore_X_Atom _ecore_xcb_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_NUM];
+
+extern int _ecore_window_grabs_num;
+extern Ecore_X_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_xcb_private_window;
+
+void _ecore_x_error_handler_init(void);
+
+void _ecore_x_event_handle_any_event (xcb_generic_event_t *event);
+void _ecore_x_event_handle_key_press (xcb_generic_event_t *event);
+void _ecore_x_event_handle_key_release (xcb_generic_event_t *event);
+void _ecore_x_event_handle_button_press (xcb_generic_event_t *event);
+void _ecore_x_event_handle_button_release (xcb_generic_event_t *event);
+void _ecore_x_event_handle_motion_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_enter_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_leave_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_focus_in (xcb_generic_event_t *event);
+void _ecore_x_event_handle_focus_out (xcb_generic_event_t *event);
+void _ecore_x_event_handle_keymap_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_expose (xcb_generic_event_t *event);
+void _ecore_x_event_handle_graphics_expose (xcb_generic_event_t *event);
+void _ecore_x_event_handle_visibility_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_create_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_destroy_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_unmap_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_map_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_map_request (xcb_generic_event_t *event);
+void _ecore_x_event_handle_reparent_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_configure_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_configure_request (xcb_generic_event_t *event);
+void _ecore_x_event_handle_gravity_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_resize_request (xcb_generic_event_t *event);
+void _ecore_x_event_handle_circulate_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_circulate_request (xcb_generic_event_t *event);
+void _ecore_x_event_handle_property_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_selection_clear (xcb_generic_event_t *event);
+void _ecore_x_event_handle_selection_request (xcb_generic_event_t *event);
+void _ecore_x_event_handle_selection_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_colormap_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_client_message (xcb_generic_event_t *event);
+void _ecore_x_event_handle_mapping_notify (xcb_generic_event_t *event);
#ifdef ECORE_XCB_DAMAGE
-void _ecore_x_event_handle_damage_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_damage_notify (xcb_generic_event_t *event);
#endif /* ECORE_XCB_DAMAGE */
#ifdef ECORE_XCB_RANDR
-void _ecore_x_event_handle_randr_change (xcb_generic_event_t *event);
+void _ecore_x_event_handle_randr_change (xcb_generic_event_t *event);
#endif /* ECORE_XCB_RANDR */
#ifdef ECORE_XCB_SCREENSAVER
-void _ecore_x_event_handle_screensaver_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_screensaver_notify (xcb_generic_event_t *event);
#endif /* ECORE_XCB_SCREENSAVER */
#ifdef ECORE_XCB_SHAPE
-void _ecore_x_event_handle_shape_change (xcb_generic_event_t *event);
+void _ecore_x_event_handle_shape_change (xcb_generic_event_t *event);
#endif /* ECORE_XCB_SHAPE */
#ifdef ECORE_XCB_SYNC
-void _ecore_x_event_handle_sync_counter (xcb_generic_event_t *event);
-void _ecore_x_event_handle_sync_alarm (xcb_generic_event_t *event);
+void _ecore_x_event_handle_sync_counter (xcb_generic_event_t *event);
+void _ecore_x_event_handle_sync_alarm (xcb_generic_event_t *event);
#endif /* ECORE_XCB_SYNC */
#ifdef ECORE_XCB_FIXES
-void _ecore_x_event_handle_fixes_selection_notify(xcb_generic_event_t *event);
+void _ecore_x_event_handle_fixes_selection_notify(xcb_generic_event_t *event);
#endif /* ECORE_XCB_FIXES */
-
/* requests / replies */
-int _ecore_x_reply_init ();
-void _ecore_x_reply_shutdown ();
-void _ecore_xcb_cookie_cache (unsigned int cookie);
-unsigned int _ecore_xcb_cookie_get (void);
-void _ecore_xcb_reply_cache (void *reply);
-void *_ecore_xcb_reply_get (void);
-
+int _ecore_x_reply_init ();
+void _ecore_x_reply_shutdown ();
+void _ecore_xcb_cookie_cache (unsigned int cookie);
+unsigned int _ecore_xcb_cookie_get (void);
+void _ecore_xcb_reply_cache (void *reply);
+void * _ecore_xcb_reply_get (void);
/* atoms */
extern Ecore_X_Atom ECORE_X_ATOM_ATOM;
#define ECORE_X_ATOMS_COUNT 117
-void _ecore_x_atom_init (xcb_intern_atom_cookie_t *);
-void _ecore_x_atom_init_finalize (xcb_intern_atom_cookie_t *);
-
+void _ecore_x_atom_init (xcb_intern_atom_cookie_t *);
+void _ecore_x_atom_init_finalize (xcb_intern_atom_cookie_t *);
/* damage */
-void _ecore_x_damage_init (const xcb_query_extension_reply_t *reply);
-void _ecore_x_damage_init_finalize (void);
+void _ecore_x_damage_init (const xcb_query_extension_reply_t *reply);
+void _ecore_x_damage_init_finalize (void);
/* composite */
-void _ecore_x_composite_init (const xcb_query_extension_reply_t *reply);
-void _ecore_x_composite_init_finalize (void);
+void _ecore_x_composite_init (const xcb_query_extension_reply_t *reply);
+void _ecore_x_composite_init_finalize (void);
/* from dnd */
-void _ecore_x_dnd_init (void);
-void _ecore_x_dnd_shutdown (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_init (void);
+void _ecore_x_dnd_shutdown (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);
/* dpms */
-void _ecore_x_dpms_init (const xcb_query_extension_reply_t *reply);
-void _ecore_x_dpms_init_finalize (void);
-
+void _ecore_x_dpms_init (const xcb_query_extension_reply_t *reply);
+void _ecore_x_dpms_init_finalize (void);
/* 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);
-
+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);
/* randr */
-void _ecore_x_randr_init (const xcb_query_extension_reply_t *reply);
-void _ecore_x_randr_init_finalize (void);
-
+void _ecore_x_randr_init (const xcb_query_extension_reply_t *reply);
+void _ecore_x_randr_init_finalize (void);
/* selection */
-void _ecore_x_selection_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);
-int _ecore_x_selection_set(Ecore_X_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);
-void *_ecore_x_selection_parse(const char *target, void *data, int size, int format);
-
+void _ecore_x_selection_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);
+int _ecore_x_selection_set(Ecore_X_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);
+void * _ecore_x_selection_parse(const char *target, void *data, int size, int format);
/* screensaver */
-void _ecore_x_screensaver_init (const xcb_query_extension_reply_t *reply);
-void _ecore_x_screensaver_init_finalize (void);
-
+void _ecore_x_screensaver_init (const xcb_query_extension_reply_t *reply);
+void _ecore_x_screensaver_init_finalize (void);
/* shape */
-void _ecore_x_shape_init (const xcb_query_extension_reply_t *reply);
-void _ecore_x_shape_init_finalize (void);
-
+void _ecore_x_shape_init (const xcb_query_extension_reply_t *reply);
+void _ecore_x_shape_init_finalize (void);
/* sync */
-void _ecore_x_sync_init (const xcb_query_extension_reply_t *reply);
-void _ecore_x_sync_init_finalize (void);
-
+void _ecore_x_sync_init (const xcb_query_extension_reply_t *reply);
+void _ecore_x_sync_init_finalize (void);
/* xfixes */
-void _ecore_x_xfixes_init (const xcb_query_extension_reply_t *reply);
-void _ecore_x_xfixes_init_finalize (void);
-
+void _ecore_x_xfixes_init (const xcb_query_extension_reply_t *reply);
+void _ecore_x_xfixes_init_finalize (void);
/* xinerama */
-void _ecore_x_xinerama_init (const xcb_query_extension_reply_t *reply);
-void _ecore_x_xinerama_init_finalize (void);
-
+void _ecore_x_xinerama_init (const xcb_query_extension_reply_t *reply);
+void _ecore_x_xinerama_init_finalize (void);
/* xprint */
-void _ecore_x_xprint_init (const xcb_query_extension_reply_t *reply);
-void _ecore_x_xprint_init_finalize (void);
+void _ecore_x_xprint_init (const xcb_query_extension_reply_t *reply);
+void _ecore_x_xprint_init_finalize (void);
/* to categorize */
-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);
-
+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);
#endif /* __ECORE_XCB_PRIVATE_H__*/
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#include "ecore_xcb_private.h"
-
/**
* @defgroup Ecore_X_RandR_Group X RandR Extension Functions
*
* Functions related to the X RandR extension.
*/
-
#ifdef ECORE_XCB_RANDR
static int _randr_available = 0;
static xcb_randr_query_version_cookie_t _ecore_xcb_randr_init_cookie;
#endif /* ECORE_XCB_RANDR */
-
/* To avoid round trips, the initialization is separated in 2
functions: _ecore_xcb_randr_init and
_ecore_xcb_randr_init_finalize. The first one gets the cookies and
#ifdef ECORE_XCB_RANDR
if (reply && (reply->present))
_ecore_xcb_randr_init_cookie = xcb_randr_query_version_unchecked(_ecore_xcb_conn, 1, 2);
+
#endif /* ECORE_XCB_RANDR */
-}
+} /* _ecore_x_randr_init */
void
_ecore_x_randr_init_finalize(void)
{
if ((reply->major_version >= 1) &&
(reply->minor_version >= 1))
- _randr_available = 1;
+ _randr_available = 1;
+
free(reply);
}
+
#endif /* ECORE_XCB_RANDR */
-}
+} /* _ecore_x_randr_init_finalize */
/**
* Return whether the X server supports the RandR Extension.
{
#ifdef ECORE_XCB_RANDR
return _randr_available;
-#else
+#else /* ifdef ECORE_XCB_RANDR */
return 0;
#endif /* ECORE_XCB_RANDR */
-}
-
+} /* ecore_x_randr_query */
static Ecore_X_Window
_xcb_randr_root_to_screen(Ecore_X_Window root)
for (; iter.rem; xcb_screen_next(&iter))
{
if (iter.data->root == root)
- return iter.data->root;
+ return iter.data->root;
}
return XCB_NONE;
-}
+} /* _xcb_randr_root_to_screen */
/**
* Select if the ScreenChangeNotify events will be sent.
int on)
{
#ifdef ECORE_XCB_RANDR
- xcb_randr_select_input(_ecore_xcb_conn, window,
- on ? XCB_RANDR_SCREEN_CHANGE_NOTIFY : 0);
- return 1;
-#else
+ xcb_randr_select_input(_ecore_xcb_conn, window,
+ on ? XCB_RANDR_SCREEN_CHANGE_NOTIFY : 0);
+ return 1;
+#else /* ifdef ECORE_XCB_RANDR */
return 0;
#endif /* ECORE_XCB_RANDR */
-}
+} /* ecore_x_randr_events_select */
/**
* Sends the GetScreenInfo request.
_xcb_randr_root_to_screen(window));
_ecore_xcb_cookie_cache(cookie.sequence);
#endif /* ECORE_XCB_RANDR */
-}
-
+} /* ecore_x_randr_get_screen_info_prefetch */
/**
* Gets the reply of the GetScreenInfo request sent by ecore_x_randr_get_screen_info_prefetch().
xcb_randr_get_screen_info_reply_t *reply;
cookie.sequence = _ecore_xcb_cookie_get();
- reply =xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL);
+ reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
#endif /* ECORE_XCB_RANDR */
-}
+} /* ecore_x_randr_get_screen_info_fetch */
/**
* Get the set of rotations and reflections.
reply = _ecore_xcb_reply_get();
if (!reply)
- return 0;
+ return 0;
return reply->rotations;
-#else
+#else /* ifdef ECORE_XCB_RANDR */
return 0;
#endif /* ECORE_XCB_RANDR */
-}
+} /* ecore_x_randr_screen_rotations_get */
/**
* Get the rotation.
reply = _ecore_xcb_reply_get();
if (!reply)
- return 0;
+ return 0;
return reply->rotation;
-#else
+#else /* ifdef ECORE_XCB_RANDR */
return 0;
#endif /* ECORE_XCB_RANDR */
-}
+} /* ecore_x_randr_screen_rotation_get */
/**
* Get the frame buffer sizes.
*/
EAPI Ecore_X_Screen_Size *
ecore_x_randr_screen_sizes_get(Ecore_X_Window root __UNUSED__,
- int *num)
+ int *num)
{
#ifdef ECORE_XCB_RANDR
xcb_randr_get_screen_info_reply_t *reply;
- xcb_randr_screen_size_t *sizes;
- Ecore_X_Screen_Size *ret;
- int n;
- int i;
+ xcb_randr_screen_size_t *sizes;
+ Ecore_X_Screen_Size *ret;
+ int n;
+ int i;
- if (num) *num = 0;
+ if (num)
+ *num = 0;
reply = _ecore_xcb_reply_get();
if (!reply)
- return NULL;
+ return NULL;
n = xcb_randr_get_screen_info_sizes_length(reply);
ret = calloc(n, sizeof(Ecore_X_Screen_Size));
- if (!ret) return NULL;
+ if (!ret)
+ return NULL;
+
+ if (num)
+ *num = n;
- if (num) *num = n;
sizes = xcb_randr_get_screen_info_sizes(reply);
for (i = 0; i < n; i++)
{
}
return ret;
-#else
- if (num) *num = 0;
+#else /* ifdef ECORE_XCB_RANDR */
+ if (num)
+ *num = 0;
+
return NULL;
#endif /* ECORE_XCB_RANDR */
-}
+} /* ecore_x_randr_screen_sizes_get */
/**
* Get the current frame buffer size.
Ecore_X_Screen_Size ret = { -1, -1 };
#ifdef ECORE_XCB_RANDR
xcb_randr_get_screen_info_reply_t *reply;
- xcb_randr_screen_size_t *sizes;
- uint16_t size_index;
+ xcb_randr_screen_size_t *sizes;
+ uint16_t size_index;
reply = _ecore_xcb_reply_get();
if (!reply)
- return ret;
+ return ret;
size_index = reply->sizeID;
sizes = xcb_randr_get_screen_info_sizes(reply);
ret.width = sizes[size_index].mwidth;
ret.height = sizes[size_index].mheight;
}
+
#endif /* ECORE_XCB_RANDR */
return ret;
-}
+} /* ecore_x_randr_current_screen_size_get */
/**
* Get the current refresh rate.
EAPI Ecore_X_Screen_Refresh_Rate
ecore_x_randr_current_screen_refresh_rate_get(Ecore_X_Window root __UNUSED__)
{
- Ecore_X_Screen_Refresh_Rate ret = { -1 };
+ Ecore_X_Screen_Refresh_Rate ret = { -1 };
#ifdef ECORE_XCB_RANDR
xcb_randr_get_screen_info_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply)
- return ret;
+ return ret;
ret.rate = reply->rate;
#endif /* ECORE_XCB_RANDR */
return ret;
-}
+} /* ecore_x_randr_current_screen_refresh_rate_get */
/**
* Get the refresh rates.
*/
EAPI Ecore_X_Screen_Refresh_Rate *
ecore_x_randr_screen_refresh_rates_get(Ecore_X_Window root __UNUSED__,
- int size_id __UNUSED__,
- int *num)
+ int size_id __UNUSED__,
+ int *num)
{
#ifdef ECORE_XCB_RANDR
xcb_randr_get_screen_info_reply_t *reply;
- Ecore_X_Screen_Refresh_Rate *ret;
- Ecore_X_Screen_Refresh_Rate *tmp;
+ Ecore_X_Screen_Refresh_Rate *ret;
+ Ecore_X_Screen_Refresh_Rate *tmp;
xcb_randr_refresh_rates_iterator_t iter;
- uint16_t n;
+ uint16_t n;
- if (num) *num = 0;
+ if (num)
+ *num = 0;
reply = _ecore_xcb_reply_get();
if (!reply)
- return NULL;
+ return NULL;
n = reply->nSizes;
ret = calloc(n, sizeof(Ecore_X_Screen_Refresh_Rate));
if (!ret)
- return NULL;
+ return NULL;
- if (num) *num = n;
+ if (num)
+ *num = n;
/* FIXME: maybe there's a missing function in xcb randr implementation */
iter = xcb_randr_get_screen_info_rates_iterator(reply);
tmp = ret;
for (; iter.rem; xcb_randr_refresh_rates_next(&iter), tmp++)
{
- tmp->rate = iter.data->nRates;;
+ tmp->rate = iter.data->nRates;
}
return ret;
-#else
- if (num) *num = 0;
+#else /* ifdef ECORE_XCB_RANDR */
+ if (num)
+ *num = 0;
+
return NULL;
#endif /* ECORE_XCB_RANDR */
-}
+} /* ecore_x_randr_screen_refresh_rates_get */
/* FIXME: round trip. Should we remove it ? */
#ifdef ECORE_XCB_RANDR
xcb_randr_set_screen_config_cookie_t cookie;
xcb_randr_set_screen_config_reply_t *reply_config;
- xcb_randr_get_screen_info_reply_t *reply;
+ xcb_randr_get_screen_info_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply)
- return;
+ return;
cookie = xcb_randr_set_screen_config_unchecked(_ecore_xcb_conn, root,
XCB_CURRENT_TIME,
0);
reply_config = xcb_randr_set_screen_config_reply(_ecore_xcb_conn, cookie, NULL);
if (reply_config)
- free(reply_config);
+ free(reply_config);
+
#endif /* ECORE_XCB_RANDR */
-}
+} /* ecore_x_randr_screen_rotation_set */
/* FIXME: round trip. Should we remove it ? */
#ifdef ECORE_XCB_RANDR
xcb_randr_set_screen_config_cookie_t cookie;
xcb_randr_set_screen_config_reply_t *reply_config;
- xcb_randr_get_screen_info_reply_t *reply;
- xcb_randr_screen_size_iterator_t iter;
- int size_index = -1;
- int i;
+ xcb_randr_get_screen_info_reply_t *reply;
+ xcb_randr_screen_size_iterator_t iter;
+ int size_index = -1;
+ int i;
reply = _ecore_xcb_reply_get();
if (!reply)
- return 0;
+ return 0;
iter = xcb_randr_get_screen_info_sizes_iterator(reply);
for (i = 0; iter.rem; xcb_randr_screen_size_next(&iter), i++)
(iter.data->mwidth = size.width) &&
(iter.data->mheight = size.height))
{
- size_index = i;
- break;
+ size_index = i;
+ break;
}
}
- if (size_index == -1) return 0;
+ if (size_index == -1)
+ return 0;
cookie = xcb_randr_set_screen_config_unchecked(_ecore_xcb_conn, root,
XCB_CURRENT_TIME,
0);
reply_config = xcb_randr_set_screen_config_reply(_ecore_xcb_conn, cookie, NULL);
if (!reply_config)
- return 0;
+ return 0;
free(reply_config);
return 1;
-#else
+#else /* ifdef ECORE_XCB_RANDR */
return 0;
#endif /* ECORE_XCB_RANDR */
-}
+} /* ecore_x_randr_screen_size_set */
/* FIXME: round trip. Should we remove it ? */
#ifdef ECORE_XCB_RANDR
xcb_randr_set_screen_config_cookie_t cookie;
xcb_randr_set_screen_config_reply_t *reply_config;
- xcb_randr_get_screen_info_reply_t *reply;
- xcb_randr_screen_size_iterator_t iter;
- int size_index = -1;
- int i;
+ xcb_randr_get_screen_info_reply_t *reply;
+ xcb_randr_screen_size_iterator_t iter;
+ int size_index = -1;
+ int i;
reply = _ecore_xcb_reply_get();
if (!reply)
- return 0;
+ return 0;
iter = xcb_randr_get_screen_info_sizes_iterator(reply);
for (i = 0; iter.rem; xcb_randr_screen_size_next(&iter), i++)
(iter.data->mwidth = size.width) &&
(iter.data->mheight = size.height))
{
- size_index = i;
- break;
+ size_index = i;
+ break;
}
}
- if (size_index == -1) return 0;
+ if (size_index == -1)
+ return 0;
cookie = xcb_randr_set_screen_config_unchecked(_ecore_xcb_conn, root,
XCB_CURRENT_TIME,
rate.rate);
reply_config = xcb_randr_set_screen_config_reply(_ecore_xcb_conn, cookie, NULL);
if (!reply_config)
- return 0;
+ return 0;
free(reply_config);
return 1;
-#else
+#else /* ifdef ECORE_XCB_RANDR */
return 0;
#endif /* ECORE_XCB_RANDR */
-}
+} /* ecore_x_randr_screen_refresh_rate_set */
+
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
-#include "ecore_x_private.h"
+#include <pixman.h>
+#include "ecore_xcb_private.h"
/*
* [x] XCreateRegion
{
pixman_region16_t *region;
- region = (pixman_region16_t *)malloc (sizeof (pixman_region16_t));
+ region = (pixman_region16_t *)malloc (sizeof (pixman_region16_t));
if (!region)
- return NULL;
+ return NULL;
pixman_region_init(region);
return (Ecore_X_XRegion *)region;
-}
+} /* ecore_x_xregion_new */
EAPI void
ecore_x_xregion_free(Ecore_X_XRegion *region)
{
if (!region)
- return;
+ return;
pixman_region_fini(region);
free(region);
-}
+} /* ecore_x_xregion_free */
EAPI int
ecore_x_xregion_set(Ecore_X_XRegion *region, Ecore_X_GC gc)
{
xcb_rectangle_t *rects;
- pixman_box16_t *boxes;
- int num;
+ pixman_box16_t *boxes;
+ int num;
+ int i;
if (!region)
- return 0;
+ return 0;
boxes = pixman_region_rectangles ((pixman_region16_t *)region, &num);
if (!boxes || (num == 0))
- return 0;
+ return 0;
rects = (xcb_rectangle_t *)malloc(sizeof(xcb_rectangle_t) * num);
if (!rects)
- return 0;
+ return 0;
for (i = 0; i < num; i++)
{
rects[i].height = boxes[i].y2 - boxes[i].y1 + 1;
}
- xcb_set_clip_rectangles(_ecore_x_connection,
+ xcb_set_clip_rectangles(_ecore_xcb_conn,
XCB_CLIP_ORDERING_YX_BANDED,
gc,
0, 0,
num,
rects);
return 1;
-}
+} /* ecore_x_xregion_set */
EAPI void
ecore_x_xregion_translate(Ecore_X_XRegion *region, int x, int y)
{
if (!region)
- return;
+ return;
pixman_region_translate((pixman_region16_t *)region, x, y);
-}
+} /* ecore_x_xregion_translate */
EAPI int
ecore_x_xregion_intersect(Ecore_X_XRegion *dst, Ecore_X_XRegion *r1, Ecore_X_XRegion *r2)
{
return pixman_region_intersect((pixman_region16_t *)dst, (pixman_region16_t *)r1, (pixman_region16_t *)r2);
-}
+} /* ecore_x_xregion_intersect */
EAPI int
ecore_x_xregion_union(Ecore_X_XRegion *dst, Ecore_X_XRegion *r1, Ecore_X_XRegion *r2)
{
return pixman_region_union((pixman_region16_t *)dst, (pixman_region16_t *)r1, (pixman_region16_t *)r2);
-}
+} /* ecore_x_xregion_union */
EAPI int
ecore_x_xregion_union_rect(Ecore_X_XRegion *dst, Ecore_X_XRegion *src, Ecore_X_Rectangle *rect)
{
return pixman_region_union_rect((pixman_region16_t *)dst, (pixman_region16_t *)src,
rect->x, rect->y, rect->width, rect->height);
-}
+} /* ecore_x_xregion_union_rect */
EAPI int
-ecore_x_xregion_subtract(Ecore_X_XRegion *dst, Ecore_X_XRegion *r1, Ecore_X_XRegion *r2)
+ecore_x_xregion_subtract(Ecore_X_XRegion *dst, Ecore_X_XRegion *rm, Ecore_X_XRegion *rs)
{
return pixman_region_subtract((pixman_region16_t *)dst, (pixman_region16_t *)rm, (pixman_region16_t *)rs);
-}
+} /* ecore_x_xregion_subtract */
EAPI int
ecore_x_xregion_is_empty(Ecore_X_XRegion *region)
{
if (!region)
- return 1;
+ return 1;
return !pixman_region_not_empty((pixman_region16_t *)region);
-}
+} /* ecore_x_xregion_is_empty */
EAPI int
ecore_x_xregion_is_equal(Ecore_X_XRegion *r1, Ecore_X_XRegion *r2)
{
if (!r1 || !r2)
- return 0;
+ return 0;
return pixman_region_equal((pixman_region16_t *)r1, (pixman_region16_t *)r2);
-}
+} /* ecore_x_xregion_is_equal */
EAPI int
ecore_x_xregion_point_contain(Ecore_X_XRegion *region, int x, int y)
{
if (!region)
- return 0;
+ return 0;
- return pixman_region_contains_point((pixman_region16_t *)region, x, y);
-}
+ return pixman_region_contains_point((pixman_region16_t *)region, x, y, NULL);
+} /* ecore_x_xregion_point_contain */
EAPI int
ecore_x_xregion_rect_contain(Ecore_X_XRegion *region, Ecore_X_Rectangle *rect)
pixman_box16_t box;
if (!region || !rect)
- return 0;
+ return 0;
box.x1 = rect->x;
box.y1 = rect->y;
box.y2 = rect->y + rect->height - 1;
return pixman_region_contains_rectangle((pixman_region16_t *)region, &box);
-}
+} /* ecore_x_xregion_rect_contain */
+
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#include <stdlib.h>
+#include <Eina.h>
-/*
+/*
* FIXME:
* - in ecore_xcb_cookie_cache, should provide better error management
* when memory allocation fails
* but its code is commented.
*/
-static Eina_List *_ecore_xcb_cookies = NULL;
-static void *_ecore_xcb_reply = NULL;
+static Eina_List *_ecore_xcb_cookies = NULL;
+static void *_ecore_xcb_reply = NULL;
-typedef struct _Ecore_Xcb_Data Ecore_Xcb_Data;
+typedef struct _Ecore_Xcb_Data Ecore_Xcb_Data;
struct _Ecore_Xcb_Data
{
- unsigned int cookie;
+ unsigned int cookie;
};
-
int
_ecore_x_reply_init ()
{
return 1;
-}
+} /* _ecore_x_reply_init */
void
_ecore_x_reply_shutdown ()
{
- Ecore_Xcb_Data *data;
+ Ecore_Xcb_Data *data;
- if (_ecore_xcb_reply)
- free(_ecore_xcb_reply);
+ if (_ecore_xcb_reply)
+ free(_ecore_xcb_reply);
if (!_ecore_xcb_cookies)
- return;
+ return;
EINA_LIST_FREE(_ecore_xcb_cookies, data)
- free(data);
-}
+ free(data);
+} /* _ecore_x_reply_shutdown */
void
_ecore_xcb_cookie_cache (unsigned int cookie)
Ecore_Xcb_Data *data;
if (!_ecore_xcb_cookies)
- return;
+ return;
data = (Ecore_Xcb_Data *)malloc(sizeof(Ecore_Xcb_Data));
if (!data)
- return;
+ return;
data->cookie = cookie;
free(data);
return;
}
-}
+} /* _ecore_xcb_cookie_cache */
unsigned int
_ecore_xcb_cookie_get (void)
{
Ecore_Xcb_Data *data;
- unsigned int cookie;
+ unsigned int cookie;
if (!_ecore_xcb_cookies)
- return 0;
+ return 0;
data = eina_list_data_get(_ecore_xcb_cookies);
- if (!data) return 0;
+ if (!data)
+ return 0;
_ecore_xcb_cookies = eina_list_remove_list(_ecore_xcb_cookies, _ecore_xcb_cookies);
- cookie = data->cookie;
- free(data);
+ cookie = data->cookie;
+ free(data);
- return cookie;
-}
+ return cookie;
+} /* _ecore_xcb_cookie_get */
void
_ecore_xcb_reply_cache (void *reply)
{
if (_ecore_xcb_reply)
- free(_ecore_xcb_reply);
+ free(_ecore_xcb_reply);
+
_ecore_xcb_reply = reply;
-}
+} /* _ecore_xcb_reply_cache */
void *
_ecore_xcb_reply_get (void)
{
return _ecore_xcb_reply;
-}
+} /* _ecore_xcb_reply_get */
EAPI void
ecore_xcb_reply_free()
/* free(_ecore_xcb_reply); */
/* _ecore_xcb_reply = NULL; */
/* } */
-}
+} /* ecore_xcb_reply_free */
+
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#include "ecore_xcb_private.h"
-
/**
* @defgroup Ecore_X_ScreenSaver_Group X ScreenSaver extension
*
* These functions use the ScreenSaver extension of the X server
- */
-
+ */
#ifdef ECORE_XCB_SCREENSAVER
static int _screensaver_available = 0;
static xcb_screensaver_query_version_cookie_t _ecore_xcb_screensaver_init_cookie;
#endif /* ECORE_XCB_SCREENSAVER */
-
/* To avoid round trips, the initialization is separated in 2
functions: _ecore_xcb_screensaver_init and
_ecore_xcb_screensaver_init_finalize. The first one gets the cookies and
#ifdef ECORE_XCB_SCREENSAVER
if (reply && (reply->present))
_ecore_xcb_screensaver_init_cookie = xcb_screensaver_query_version_unchecked(_ecore_xcb_conn, 1, 1);
+
#endif /* ECORE_XCB_SCREENSAVER */
-}
+} /* _ecore_x_screensaver_init */
void
_ecore_x_screensaver_init_finalize(void)
{
if ((reply->server_major_version >= 1) &&
(reply->server_minor_version >= 1))
- _screensaver_available = 1;
+ _screensaver_available = 1;
+
free(reply);
}
-#endif /* ECORE_XCB_SCREENSAVER */
-}
+#endif /* ECORE_XCB_SCREENSAVER */
+} /* _ecore_x_screensaver_init_finalize */
/**
* Return whether the X server supports the ScreenSaver Extension.
ecore_x_screensaver_event_available_get(void)
{
return 1;
-}
-
+} /* ecore_x_screensaver_event_available_get */
/**
* Sends the QueryInfo request.
cookie = xcb_screensaver_query_info_unchecked(_ecore_xcb_conn, ((xcb_screen_t *)_ecore_xcb_screen)->root);
_ecore_xcb_cookie_cache(cookie.sequence);
#endif /* ECORE_XCB_SCREENSAVER */
-}
-
+} /* ecore_x_screensaver_idle_time_prefetch */
/**
* Gets the reply of the QueryInfo request sent by ecore_x_get_screensaver_prefetch().
reply = xcb_screensaver_query_info_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
#endif /* ECORE_XCB_SCREENSAVER */
-}
-
+} /* ecore_x_screensaver_idle_time_fetch */
/**
* Get the number of seconds since the last input was received.
EAPI int
ecore_x_screensaver_idle_time_get(void)
{
- int idle = 0;
+ int idle = 0;
#ifdef ECORE_XCB_SCREENSAVER
xcb_screensaver_query_info_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return 0;
+ if (!reply)
+ return 0;
/* FIXME: check if it is ms_since_user_input or ms_until_server */
idle = reply->ms_since_user_input / 1000;
#endif /* ECORE_XCB_SCREENSAVER */
return idle;
-}
-
+} /* ecore_x_screensaver_idle_time_get */
/**
* Set the parameters of the screen saver.
(int16_t)interval,
(uint8_t)blank,
(uint8_t)expose);
-}
-
+} /* ecore_x_screensaver_set */
/**
* Sends the GetScreenSaver request.
cookie = xcb_get_screen_saver_unchecked(_ecore_xcb_conn);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
-
+} /* ecore_x_get_screensaver_prefetch */
/**
* Gets the reply of the GetScreenSaver request sent by ecore_x_get_screensaver_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_screen_saver_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
-
+} /* ecore_x_get_screensaver_fetch */
/**
* Set the timeout of the screen saver.
xcb_get_screen_saver_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return;
+ if (!reply)
+ return;
xcb_set_screen_saver(_ecore_xcb_conn,
(int16_t)timeout,
reply->interval,
reply->prefer_blanking,
reply->allow_exposures);
-}
-
+} /* ecore_x_screensaver_timeout_set */
/**
* Get the timeout of the screen saver.
xcb_get_screen_saver_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return 0.0;
+ if (!reply)
+ return 0.0;
return (int)reply->timeout;
-}
-
+} /* ecore_x_screensaver_timeout_get */
/**
* Set the interval of the screen saver.
xcb_get_screen_saver_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return;
+ if (!reply)
+ return;
xcb_set_screen_saver(_ecore_xcb_conn,
reply->timeout,
(int16_t)interval,
reply->prefer_blanking,
reply->allow_exposures);
-}
-
+} /* ecore_x_screensaver_interval_set */
/**
* Get the interval of the screen saver.
xcb_get_screen_saver_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return 0.0;
+ if (!reply)
+ return 0.0;
return (int)reply->interval;
-}
-
+} /* ecore_x_screensaver_interval_get */
/**
* Set the screen blanking.
xcb_get_screen_saver_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return;
+ if (!reply)
+ return;
xcb_set_screen_saver(_ecore_xcb_conn,
reply->timeout,
reply->interval,
(uint8_t)blank,
reply->allow_exposures);
-}
-
+} /* ecore_x_screensaver_blank_set */
/**
* Get the screen blanking.
xcb_get_screen_saver_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return 0.0;
+ if (!reply)
+ return 0.0;
return (int)reply->prefer_blanking;
-}
-
+} /* ecore_x_screensaver_blank_get */
/**
* Set the screen save control values.
xcb_get_screen_saver_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return;
+ if (!reply)
+ return;
xcb_set_screen_saver(_ecore_xcb_conn,
reply->timeout,
reply->interval,
reply->prefer_blanking,
(uint8_t)expose);
-}
-
+} /* ecore_x_screensaver_expose_set */
/**
* Get the screen save control values.
xcb_get_screen_saver_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return 0.0;
+ if (!reply)
+ return 0.0;
return (int)reply->allow_exposures;
-}
-
+} /* ecore_x_screensaver_expose_get */
/**
* Specifies if the Screen Saver NotifyMask event should be generated.
((xcb_screen_t *)_ecore_xcb_screen)->root,
on ? XCB_SCREENSAVER_EVENT_NOTIFY_MASK : 0);
#endif /* ECORE_XCB_SCREENSAVER */
-}
+} /* ecore_x_screensaver_event_listen_set */
+
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#include <string.h>
#include "ecore_xcb_private.h"
#include "Ecore_X_Atoms.h"
-static Ecore_X_Selection_Intern selections[4];
+static Ecore_X_Selection_Intern selections[4];
static Ecore_X_Selection_Converter *converters = NULL;
-static Ecore_X_Selection_Parser *parsers = NULL;
+static Ecore_X_Selection_Parser *parsers = NULL;
-static int _ecore_x_selection_converter_text(char *target, void *data, int size, void **data_ret, int *size_ret);
-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);
+static int _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))
/* Initialize converters */
ecore_x_selection_converter_atom_add(ECORE_X_ATOM_TEXT,
- _ecore_x_selection_converter_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
+ _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_text);
ecore_x_selection_converter_atom_add(ECORE_X_ATOM_STRING,
- _ecore_x_selection_converter_text);
+ _ecore_x_selection_converter_text);
/* Initialize parsers */
ecore_x_selection_parser_add("text/plain",
- _ecore_x_selection_parser_text);
+ _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_text);
ecore_x_selection_parser_add("text/uri-list",
- _ecore_x_selection_parser_files);
+ _ecore_x_selection_parser_files);
ecore_x_selection_parser_add("_NETSCAPE_URL",
- _ecore_x_selection_parser_files);
+ _ecore_x_selection_parser_files);
ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_TARGETS,
- _ecore_x_selection_parser_targets);
-}
+ _ecore_x_selection_parser_targets);
+} /* _ecore_x_selection_init */
void
_ecore_x_selection_shutdown(void)
cnv = converters;
while (cnv)
{
- Ecore_X_Selection_Converter *tmp;
+ Ecore_X_Selection_Converter *tmp;
- tmp = cnv->next;
- free(cnv);
- cnv = tmp;
+ tmp = cnv->next;
+ free(cnv);
+ cnv = tmp;
}
converters = NULL;
prs = parsers;
while (prs)
{
- Ecore_X_Selection_Parser *tmp;
+ Ecore_X_Selection_Parser *tmp;
- tmp = prs;
- prs = prs->next;
- free(tmp->target);
- free(tmp);
+ tmp = prs;
+ prs = prs->next;
+ free(tmp->target);
+ free(tmp);
}
parsers = NULL;
-}
+} /* _ecore_x_selection_shutdown */
Ecore_X_Selection_Intern *
_ecore_x_selection_get(Ecore_X_Atom selection)
{
if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
- return &selections[0];
+ return &selections[0];
else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
- return &selections[1];
+ return &selections[1];
else if (selection == ECORE_X_ATOM_SELECTION_XDND)
- return &selections[2];
+ return &selections[2];
else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
- return &selections[3];
+ return &selections[3];
else
- return NULL;
-}
-
+ return NULL;
+} /* _ecore_x_selection_get */
/*
* Sends the GetSelectionOwner request.
cookie = xcb_get_selection_owner_unchecked(_ecore_xcb_conn, selection);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* _ecore_xcb_get_selection_owner_prefetch */
/*
* Gets the reply of the GetSelectionOwner request sent by _ecore_xcb_get_selection_owner_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_selection_owner_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* _ecore_xcb_get_selection_owner_fetch */
/*
* To use this function, you must call before, and in order,
Ecore_X_Atom selection)
{
xcb_get_selection_owner_reply_t *reply;
- unsigned char *buf = NULL;
- int in;
+ unsigned char *buf = NULL;
+ int in;
xcb_set_selection_owner(_ecore_xcb_conn, window, selection, _ecore_xcb_event_last_time);
reply = _ecore_xcb_reply_get();
- if (!reply || (reply->owner != window)) return 0;
+ if (!reply || (reply->owner != window))
+ return 0;
if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
- in = 0;
+ in = 0;
else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
- in = 1;
+ in = 1;
else if (selection == ECORE_X_ATOM_SELECTION_XDND)
- in = 2;
+ in = 2;
else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
- in = 3;
+ in = 3;
else
- return 0;
+ return 0;
if (data)
{
- selections[in].win = window;
- selections[in].selection = selection;
- selections[in].length = size;
- selections[in].time = _ecore_xcb_event_last_time;
-
- buf = malloc(size);
- memcpy(buf, data, size);
- selections[in].data = buf;
+ selections[in].win = window;
+ selections[in].selection = selection;
+ selections[in].length = size;
+ selections[in].time = _ecore_xcb_event_last_time;
+
+ buf = malloc(size);
+ 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));
- }
+ if (selections[in].data)
+ {
+ free(selections[in].data);
+ memset(&selections[in], 0, sizeof(Ecore_X_Selection_Data));
+ }
}
return 1;
-}
-
+} /* _ecore_x_selection_set */
/**
* Sends the GetSelectionOwner request.
cookie = xcb_get_selection_owner_unchecked(_ecore_xcb_conn, ECORE_X_ATOM_SELECTION_PRIMARY);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_selection_primary_prefetch */
/**
* Gets the reply of the GetSelectionOwner request sent by ecore_x_selection_primary_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_selection_owner_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_selection_primary_fetch */
/**
* Claim ownership of the PRIMARY selection and set its data.
int size)
{
return _ecore_x_selection_set(window, data, size, ECORE_X_ATOM_SELECTION_PRIMARY);
-}
+} /* ecore_x_selection_primary_set */
/**
* Release ownership of the primary selection
ecore_x_selection_primary_clear(void)
{
return _ecore_x_selection_set(XCB_NONE, NULL, 0, ECORE_X_ATOM_SELECTION_PRIMARY);
-}
-
+} /* ecore_x_selection_primary_clear */
/**
* Sends the GetSelectionOwner request.
cookie = xcb_get_selection_owner_unchecked(_ecore_xcb_conn, ECORE_X_ATOM_SELECTION_SECONDARY);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_selection_secondary_prefetch */
/**
* Gets the reply of the GetSelectionOwner request sent by ecore_x_selection_secondary_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_selection_owner_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
-
+} /* ecore_x_selection_secondary_fetch */
/**
* Claim ownership of the SECONDARY selection and set its data.
int size)
{
return _ecore_x_selection_set(window, data, size, ECORE_X_ATOM_SELECTION_SECONDARY);
-}
+} /* ecore_x_selection_secondary_set */
/**
* Release ownership of the secondary selection
ecore_x_selection_secondary_clear(void)
{
return _ecore_x_selection_set(XCB_NONE, NULL, 0, ECORE_X_ATOM_SELECTION_SECONDARY);
-}
-
+} /* ecore_x_selection_secondary_clear */
/**
* Sends the GetSelectionOwner request.
cookie = xcb_get_selection_owner_unchecked(_ecore_xcb_conn, ECORE_X_ATOM_SELECTION_XDND);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_selection_xdnd_prefetch */
/**
* Gets the reply of the GetSelectionOwner request sent by ecore_x_selection_xdnd_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_selection_owner_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_selection_xdnd_fetch */
/**
* Claim ownership of the XDND selection and set its data.
int size)
{
return _ecore_x_selection_set(window, data, size, ECORE_X_ATOM_SELECTION_XDND);
-}
+} /* ecore_x_selection_xdnd_set */
/**
* Release ownership of the XDND selection
ecore_x_selection_xdnd_clear(void)
{
return _ecore_x_selection_set(XCB_NONE, NULL, 0, ECORE_X_ATOM_SELECTION_XDND);
-}
-
+} /* ecore_x_selection_xdnd_clear */
/**
* Sends the GetSelectionOwner request.
cookie = xcb_get_selection_owner_unchecked(_ecore_xcb_conn, ECORE_X_ATOM_SELECTION_CLIPBOARD);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_selection_clipboard_prefetch */
/**
* Gets the reply of the GetSelectionOwner request sent by ecore_x_selection_clipboard_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_selection_owner_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_selection_clipboard_fetch */
/**
* Claim ownership of the CLIPBOARD selection and set its data.
int size)
{
return _ecore_x_selection_set(window, data, size, ECORE_X_ATOM_SELECTION_CLIPBOARD);
-}
+} /* ecore_x_selection_clipboard_set */
/**
* Release ownership of the clipboard selection
ecore_x_selection_clipboard_clear(void)
{
return _ecore_x_selection_set(XCB_NONE, NULL, 0, ECORE_X_ATOM_SELECTION_CLIPBOARD);
-}
-
+} /* ecore_x_selection_clipboard_clear */
/* FIXME: roundtrip if target is not handled in the tests */
Ecore_X_Atom
Ecore_X_Atom x_target = XCB_NONE;
if (!strcmp(target, ECORE_X_SELECTION_TARGET_TEXT))
- x_target = ECORE_X_ATOM_TEXT;
+ x_target = ECORE_X_ATOM_TEXT;
else if (!strcmp(target, ECORE_X_SELECTION_TARGET_COMPOUND_TEXT))
- x_target = ECORE_X_ATOM_COMPOUND_TEXT;
+ x_target = ECORE_X_ATOM_COMPOUND_TEXT;
else if (!strcmp(target, ECORE_X_SELECTION_TARGET_STRING))
- x_target = ECORE_X_ATOM_STRING;
+ x_target = ECORE_X_ATOM_STRING;
else if (!strcmp(target, ECORE_X_SELECTION_TARGET_UTF8_STRING))
- x_target = ECORE_X_ATOM_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;
+ x_target = ECORE_X_ATOM_FILE_NAME;
else
{
xcb_intern_atom_cookie_t cookie;
strlen(target), target);
reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookie, NULL);
if (!reply)
- return XCB_NONE;
- x_target = reply->atom;
+ return XCB_NONE;
+
+ x_target = reply->atom;
free(reply);
}
return x_target;
-}
-
+} /* _ecore_x_selection_target_atom_get */
/* FIXME: roundtrip if target is not handled in the tests */
char *
_ecore_x_selection_target_get(Ecore_X_Atom target)
{
if (target == ECORE_X_ATOM_FILE_NAME)
- return strdup(ECORE_X_SELECTION_TARGET_FILENAME);
+ return strdup(ECORE_X_SELECTION_TARGET_FILENAME);
else if (target == ECORE_X_ATOM_STRING)
- return strdup(ECORE_X_SELECTION_TARGET_STRING);
+ return strdup(ECORE_X_SELECTION_TARGET_STRING);
else if (target == ECORE_X_ATOM_UTF8_STRING)
- return strdup(ECORE_X_SELECTION_TARGET_UTF8_STRING);
+ return strdup(ECORE_X_SELECTION_TARGET_UTF8_STRING);
else if (target == ECORE_X_ATOM_TEXT)
- return strdup(ECORE_X_SELECTION_TARGET_TEXT);
+ return strdup(ECORE_X_SELECTION_TARGET_TEXT);
else
{
xcb_get_atom_name_cookie_t cookie;
xcb_get_atom_name_reply_t *reply;
- char *name;
+ char *name;
cookie = xcb_get_atom_name_unchecked(_ecore_xcb_conn, target);
reply = xcb_get_atom_name_reply(_ecore_xcb_conn, cookie, NULL);
if (!reply)
- return NULL;
+ return NULL;
+
name = (char *)malloc(sizeof(char) * (reply->length + 1));
if (!name)
{
free(reply);
return NULL;
}
+
memcpy(name, xcb_get_atom_name_name(reply), reply->length);
name[reply->length] = '\0';
free(reply);
return name;
}
-}
+} /* _ecore_x_selection_target_get */
static void
_ecore_x_selection_request(Ecore_X_Window window,
target = _ecore_x_selection_target_atom_get(target_str);
if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
- prop = ECORE_X_ATOM_SELECTION_PROP_PRIMARY;
+ prop = ECORE_X_ATOM_SELECTION_PROP_PRIMARY;
else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
- prop = ECORE_X_ATOM_SELECTION_PROP_SECONDARY;
+ prop = ECORE_X_ATOM_SELECTION_PROP_SECONDARY;
else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
- prop = ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD;
+ prop = ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD;
else
- return;
+ return;
xcb_convert_selection(_ecore_xcb_conn, window,
selection, target, prop,
XCB_CURRENT_TIME);
-}
+} /* _ecore_x_selection_request */
EAPI void
ecore_x_selection_primary_request(Ecore_X_Window window,
const char *target)
{
_ecore_x_selection_request(window, ECORE_X_ATOM_SELECTION_PRIMARY, target);
-}
+} /* ecore_x_selection_primary_request */
EAPI void
ecore_x_selection_secondary_request(Ecore_X_Window window,
const char *target)
{
_ecore_x_selection_request(window, ECORE_X_ATOM_SELECTION_SECONDARY, target);
-}
+} /* ecore_x_selection_secondary_request */
EAPI void
ecore_x_selection_xdnd_request(Ecore_X_Window window,
const char *target)
{
- Ecore_X_Atom atom;
+ Ecore_X_Atom atom;
Ecore_X_DND_Target *_target;
_target = _ecore_x_dnd_target_get();
ECORE_X_ATOM_SELECTION_XDND, atom,
ECORE_X_ATOM_SELECTION_PROP_XDND,
_target->time);
-}
+} /* ecore_x_selection_xdnd_request */
EAPI void
ecore_x_selection_clipboard_request(Ecore_X_Window window, const char *target)
{
_ecore_x_selection_request(window, ECORE_X_ATOM_SELECTION_CLIPBOARD, target);
-}
+} /* ecore_x_selection_clipboard_request */
EAPI void
-ecore_x_selection_converter_atom_add(Ecore_X_Atom target,
- int (*func)(char *target,
- void *data,
- int size,
- void **data_ret,
- int *size_ret))
+ecore_x_selection_converter_atom_add(Ecore_X_Atom target,
+ int (*func)(char *target,
+ void *data,
+ int size,
+ void **data_ret,
+ int *size_ret,
+ Ecore_X_Atom *ttype,
+ int *tsize))
{
Ecore_X_Selection_Converter *cnv;
cnv = 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));
- cnv = cnv->next;
+ 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));
+ cnv = cnv->next;
}
else
{
- converters = calloc(1, sizeof(Ecore_X_Selection_Converter));
- cnv = converters;
+ converters = calloc(1, sizeof(Ecore_X_Selection_Converter));
+ cnv = converters;
}
+
cnv->target = target;
cnv->convert = func;
-}
+} /* ecore_x_selection_converter_atom_add */
EAPI void
-ecore_x_selection_converter_add(char *target,
- int (*func)(char *target,
- void *data,
- int size,
- void **data_ret,
- int *size_ret))
+ecore_x_selection_converter_add(char *target,
+ int (*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;
+ return;
x_target = _ecore_x_selection_target_atom_get(target);
ecore_x_selection_converter_atom_add(x_target, func);
-}
+} /* ecore_x_selection_converter_add */
EAPI void
ecore_x_selection_converter_atom_del(Ecore_X_Atom target)
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;
+ 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;
}
-}
+} /* ecore_x_selection_converter_atom_del */
EAPI void
ecore_x_selection_converter_del(char *target)
Ecore_X_Atom x_target;
if (!target)
- return;
+ return;
x_target = _ecore_x_selection_target_atom_get(target);
ecore_x_selection_converter_atom_del(x_target);
-}
+} /* ecore_x_selection_converter_del */
EAPI int
ecore_x_selection_notify_send(Ecore_X_Window requestor,
xcb_send_event(_ecore_xcb_conn, 0,
requestor, 0, (const char *)&ev);
return 1;
-}
+} /* ecore_x_selection_notify_send */
/* Locate and run conversion callback for specified selection target */
EAPI int
-ecore_x_selection_convert(Ecore_X_Atom selection,
- Ecore_X_Atom target,
- void **data_ret)
+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_Intern *sel;
Ecore_X_Selection_Converter *cnv;
- void *data;
- char *tgt_str;
- int size;
+ void *data;
+ char *tgt_str;
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);
- free(tgt_str);
- if (r)
- {
- *data_ret = data;
- return r;
- }
- else
- return 0;
- }
+ 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 0;
+ }
}
/* Default, just return the data */
memcpy(*data_ret, sel->data, sel->length);
free(tgt_str);
return 1;
-}
+} /* ecore_x_selection_convert */
/* TODO: We need to work out a mechanism for automatic conversion to any requested
* locale using Ecore_Txt functions */
/* Converter for standard non-utf8 text targets */
static int
-_ecore_x_selection_converter_text(char *target, void *data, int size, void **data_ret, int *size_ret)
+_ecore_x_selection_converter_text(char *target, void *data, int size, void **data_ret, int *size_ret, Ecore_X_Atom *targprop, int *s)
{
-
- /* FIXME: to do... */
+ /* FIXME: to do... */
/* XTextProperty text_prop; */
/* char *mystr; */
/* #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); */
-/* memcpy(*data_ret, text_prop.value, bufsize); */
-/* *size_ret = bufsize; */
-/* XFree(text_prop.value); */
-/* free(mystr); */
-/* return 1; */
+/* int bufsize = strlen((char *)text_prop.value) + 1; */
+/* *data_ret = malloc(bufsize); */
+/* memcpy(*data_ret, text_prop.value, bufsize); */
+/* *size_ret = bufsize; */
+/* XFree(text_prop.value); */
+/* free(mystr); */
+/* return 1; */
/* } */
/* #else */
/* if (XmbTextListToTextProperty(_ecore_x_disp, &mystr, 1, style, &text_prop) == Success) */
/* { */
-/* int bufsize = strlen(text_prop.value) + 1; */
-/* *data_ret = malloc(bufsize); */
-/* memcpy(*data_ret, text_prop.value, bufsize); */
-/* *size_ret = bufsize; */
-/* XFree(text_prop.value); */
-/* free(mystr); */
-/* return 1; */
+/* int bufsize = strlen(text_prop.value) + 1; */
+/* *data_ret = malloc(bufsize); */
+/* memcpy(*data_ret, text_prop.value, bufsize); */
+/* *size_ret = bufsize; */
+/* XFree(text_prop.value); */
+/* free(mystr); */
+/* return 1; */
/* } */
/* #endif */
/* else */
/* { */
-/* free(mystr); */
-/* return 0; */
+/* free(mystr); */
+/* return 0; */
/* } */
- return 0;
-}
+ return 0;
+} /* _ecore_x_selection_converter_text */
EAPI void
ecore_x_selection_parser_add(const char *target,
- void *(*func)(const char *target,
- void *data,
- int size,
- int format))
+ void *(*func)(const char *target,
+ void *data,
+ int size,
+ int format))
{
Ecore_X_Selection_Parser *prs;
if (!target)
- return;
+ return;
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));
- prs = prs->next;
+ while (prs->next)
+ {
+ if (!strcmp(prs->target, target))
+ {
+ prs->parse = func;
+ return;
+ }
+
+ prs = prs->next;
+ }
+
+ prs->next = calloc(1, sizeof(Ecore_X_Selection_Parser));
+ prs = prs->next;
}
else
{
- parsers = calloc(1, sizeof(Ecore_X_Selection_Parser));
- prs = parsers;
+ parsers = calloc(1, sizeof(Ecore_X_Selection_Parser));
+ prs = parsers;
}
+
prs->target = strdup(target);
prs->parse = func;
-}
+} /* ecore_x_selection_parser_add */
EAPI void
ecore_x_selection_parser_del(const char *target)
Ecore_X_Selection_Parser *prs, *prev_prs;
if (!target)
- return;
+ return;
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;
+ 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;
}
-}
+} /* ecore_x_selection_parser_del */
/* Locate and run conversion callback for specified selection target */
void *
for (prs = parsers; prs; prs = prs->next)
{
- if (!strcmp(prs->target, target))
- {
- sel = prs->parse(target, data, size, format);
- return sel;
- }
+ if (!strcmp(prs->target, target))
+ {
+ sel = prs->parse(target, data, size, format);
+ return sel;
+ }
}
/* Default, just return the data */
sel->format = format;
sel->data = data;
return sel;
-}
+} /* _ecore_x_selection_parse */
static int
_ecore_x_selection_data_default_free(void *data)
free(sel->data);
free(sel);
return 1;
-}
+} /* _ecore_x_selection_data_default_free */
static void *
_ecore_x_selection_parser_files(const char *target, void *_data, int size, int format __UNUSED__)
if (strcmp(target, "text/uri-list") &&
strcmp(target, "_NETSCAPE_URL"))
- return NULL;
+ return NULL;
sel = calloc(1, sizeof(Ecore_X_Selection_Data_Files));
ECORE_X_SELECTION_DATA(sel)->free = _ecore_x_selection_data_files_free;
if (data[size - 1])
{
- /* Isn't nul terminated */
- size++;
- data = realloc(data, size);
- data[size - 1] = 0;
+ /* Isn't nul terminated */
+ size++;
+ data = realloc(data, size);
+ data[size - 1] = 0;
}
tmp = malloc(size);
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++;
- sel->files = realloc(sel->files, sel->num_files * sizeof(char *));
- sel->files[sel->num_files - 1] = strdup(tmp);
- tmp[0] = 0;
- i = 0;
- }
- }
+ 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++;
+ sel->files = realloc(sel->files, sel->num_files * sizeof(char *));
+ sel->files[sel->num_files - 1] = strdup(tmp);
+ tmp[0] = 0;
+ i = 0;
+ }
+ }
}
if (i > 0)
{
- tmp[i] = 0;
- sel->num_files++;
- sel->files = realloc(sel->files, sel->num_files * sizeof(char *));
- sel->files[sel->num_files - 1] = strdup(tmp);
+ tmp[i] = 0;
+ sel->num_files++;
+ sel->files = realloc(sel->files, sel->num_files * sizeof(char *));
+ sel->files[sel->num_files - 1] = strdup(tmp);
}
+
free(tmp);
free(data);
ECORE_X_SELECTION_DATA(sel)->length = sel->num_files;
return ECORE_X_SELECTION_DATA(sel);
-}
+} /* _ecore_x_selection_parser_files */
static int
_ecore_x_selection_data_files_free(void *data)
sel = data;
if (sel->files)
{
- for (i = 0; i < sel->num_files; i++)
- free(sel->files[i]);
- free(sel->files);
+ for (i = 0; i < sel->num_files; i++)
+ free(sel->files[i]);
+ free(sel->files);
}
+
free(sel);
return 0;
-}
+} /* _ecore_x_selection_data_files_free */
static void *
_ecore_x_selection_parser_text(const char *target __UNUSED__,
- void *_data,
- int size,
- int format __UNUSED__)
+ void *_data,
+ int size,
+ int format __UNUSED__)
{
Ecore_X_Selection_Data_Text *sel;
- char *data = _data;
+ char *data = _data;
sel = calloc(1, sizeof(Ecore_X_Selection_Data_Text));
if (data[size - 1])
{
- /* Isn't nul terminated */
- size++;
- data = realloc(data, size);
- data[size - 1] = 0;
+ /* Isn't nul terminated */
+ size++;
+ data = realloc(data, size);
+ data[size - 1] = 0;
}
sel->text = (char *)data;
ECORE_X_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_TEXT;
ECORE_X_SELECTION_DATA(sel)->free = _ecore_x_selection_data_text_free;
return sel;
-}
+} /* _ecore_x_selection_parser_text */
static int
_ecore_x_selection_data_text_free(void *data)
free(sel->text);
free(sel);
return 1;
-}
+} /* _ecore_x_selection_data_text_free */
static void *
_ecore_x_selection_parser_targets(const char *target __UNUSED__,
- void *data,
- int size,
- int format __UNUSED__)
+ void *data,
+ int size,
+ int format __UNUSED__)
{
Ecore_X_Selection_Data_Targets *sel;
- uint32_t *targets;
- xcb_get_atom_name_cookie_t *cookies;
- int i;
+ uint32_t *targets;
+ xcb_get_atom_name_cookie_t *cookies;
+ int i;
sel = calloc(1, sizeof(Ecore_X_Selection_Data_Targets));
targets = (uint32_t *)data;
sel->targets = malloc((size - 2) * sizeof(char *));
cookies = (xcb_get_atom_name_cookie_t *)malloc ((size - 2) * sizeof (xcb_get_atom_name_cookie_t));
for (i = 0; i < size - 2; i++)
- cookies[i] = xcb_get_atom_name_unchecked(_ecore_xcb_conn, targets[i + 2]);
+ cookies[i] = xcb_get_atom_name_unchecked(_ecore_xcb_conn, targets[i + 2]);
/* FIXME: do we let the declaration of reply inside the loop ? */
for (i = 0; i < size - 2; i++)
{
- xcb_get_atom_name_reply_t *reply;
- char *name;
- int length;
-
- reply =xcb_get_atom_name_reply(_ecore_xcb_conn, cookies[i], NULL);
- length = xcb_get_atom_name_name_length(reply);
- name = (char *)malloc (length + 1);
- memcpy(name, xcb_get_atom_name_name(reply), length);
- name[length] = '\0';
- sel->targets[i - 2] = name;
+ xcb_get_atom_name_reply_t *reply;
+ char *name;
+ int length;
+
+ reply = xcb_get_atom_name_reply(_ecore_xcb_conn, cookies[i], NULL);
+ length = xcb_get_atom_name_name_length(reply);
+ name = (char *)malloc (length + 1);
+ memcpy(name, xcb_get_atom_name_name(reply), length);
+ name[length] = '\0';
+ sel->targets[i - 2] = name;
}
free(cookies);
free(data);
ECORE_X_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_TARGETS;
ECORE_X_SELECTION_DATA(sel)->length = size;
return sel;
-}
+} /* _ecore_x_selection_parser_targets */
static int
_ecore_x_selection_data_targets_free(void *data)
if (sel->targets)
{
- for (i = 0; i < sel->num_targets; i++)
- free(sel->targets[i]);
- free(sel->targets);
+ for (i = 0; i < sel->num_targets; i++)
+ free(sel->targets[i]);
+ free(sel->targets);
}
+
free(sel);
return 1;
-}
+} /* _ecore_x_selection_data_targets_free */
+
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#include "ecore_xcb_private.h"
-
/**
* @defgroup Ecore_X_Shape_Group X Shape extension
*
* Functions that use the shape extension of the X server to change shape of given windows.
*/
-
#ifdef ECORE_XCB_SHAPE
static int _shape_available = 0;
static xcb_shape_query_version_cookie_t _ecore_xcb_shape_init_cookie;
#endif /* ECORE_XCB_SHAPE */
-
/* To avoid round trips, the initialization is separated in 2
functions: _ecore_xcb_shape_init and
_ecore_xcb_shape_init_finalize. The first one gets the cookies and
#ifdef ECORE_XCB_SHAPE
if (reply && (reply->present))
_ecore_xcb_shape_init_cookie = xcb_shape_query_version_unchecked(_ecore_xcb_conn);
+
#endif /* ECORE_XCB_SHAPE */
-}
+} /* _ecore_x_shape_init */
void
_ecore_x_shape_init_finalize(void)
_shape_available = 1;
free(reply);
}
-#endif /* ECORE_XCB_SHAPE */
-}
+#endif /* ECORE_XCB_SHAPE */
+} /* _ecore_x_shape_init_finalize */
/**
* Sets the shape of the given window to the given pixmap.
#ifdef ECORE_XCB_SHAPE
xcb_shape_mask(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, dest_win, 0, 0, source_mask);
#endif /* ECORE_XCB_SHAPE */
-}
+} /* ecore_x_window_shape_mask_set */
EAPI void
ecore_x_window_shape_window_set(Ecore_X_Window dest_win,
#ifdef ECORE_XCB_SHAPE
xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, XCB_SHAPE_SK_BOUNDING, dest_win, 0, 0, shape_win);
#endif /* ECORE_XCB_SHAPE */
-}
+} /* ecore_x_window_shape_window_set */
EAPI void
ecore_x_window_shape_window_set_xy(Ecore_X_Window dest_win,
#ifdef ECORE_XCB_SHAPE
xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, XCB_SHAPE_SK_BOUNDING, dest_win, x, y, shape_win);
#endif /* ECORE_XCB_SHAPE */
-}
-
+} /* ecore_x_window_shape_window_set_xy */
/**
* Sets the shape of the given window to a rectangle.
rect.height = height;
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, 0, dest_win, 0, 0, 1, &rect);
#endif /* ECORE_XCB_SHAPE */
-}
+} /* ecore_x_window_shape_rectangle_set */
EAPI void
ecore_x_window_shape_rectangles_set(Ecore_X_Window dest_win,
{
#ifdef ECORE_XCB_SHAPE
if (num > 0)
- xcb_shape_rectangles(_ecore_xcb_conn,
- XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING,
- 0, dest_win, 0, 0, num, (xcb_rectangle_t *)rects);
+ xcb_shape_rectangles(_ecore_xcb_conn,
+ XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING,
+ 0, dest_win, 0, 0, num, (xcb_rectangle_t *)rects);
else
- xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, 0, dest_win, 0, 0, 0, NULL);
+ xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, 0, dest_win, 0, 0, 0, NULL);
+
#endif /* ECORE_XCB_SHAPE */
-}
+} /* ecore_x_window_shape_rectangles_set */
EAPI void
ecore_x_window_shape_window_add(Ecore_X_Window dest_win,
#ifdef ECORE_XCB_SHAPE
xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, XCB_SHAPE_SK_BOUNDING, XCB_SHAPE_SK_BOUNDING, dest_win, 0, 0, shape_win);
#endif /* ECORE_XCB_SHAPE */
-}
+} /* ecore_x_window_shape_window_add */
EAPI void
ecore_x_window_shape_window_add_xy(Ecore_X_Window dest_win,
#ifdef ECORE_XCB_SHAPE
xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, XCB_SHAPE_SK_BOUNDING, XCB_SHAPE_SK_BOUNDING, dest_win, x, y, shape_win);
#endif /* ECORE_XCB_SHAPE */
-}
+} /* ecore_x_window_shape_window_add_xy */
EAPI void
ecore_x_window_shape_rectangle_add(Ecore_X_Window dest_win,
rect.height = height;
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, XCB_SHAPE_SK_BOUNDING, 0, dest_win, 0, 0, 1, &rect);
#endif /* ECORE_XCB_SHAPE */
-}
+} /* ecore_x_window_shape_rectangle_add */
EAPI void
ecore_x_window_shape_rectangle_clip(Ecore_X_Window dest_win,
{
#ifdef ECORE_XCB_SHAPE
xcb_rectangle_t rect;
-
+
rect.x = x;
rect.y = y;
rect.width = width;
XCB_SHAPE_SO_INTERSECT, XCB_SHAPE_SK_BOUNDING,
0, dest_win, 0, 0, 1, &rect);
#endif /* ECORE_XCB_SHAPE */
-}
+} /* ecore_x_window_shape_rectangle_clip */
EAPI void
ecore_x_window_shape_rectangles_add(Ecore_X_Window dest_win,
{
#ifdef ECORE_XCB_SHAPE
if (num > 0)
- xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, XCB_SHAPE_SK_BOUNDING, 0, dest_win, 0, 0, num, (const xcb_rectangle_t *)rects);
+ xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, XCB_SHAPE_SK_BOUNDING, 0, dest_win, 0, 0, num, (const xcb_rectangle_t *)rects);
else
- xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, XCB_SHAPE_SK_BOUNDING, 0, dest_win, 0, 0, 0, NULL);
-#endif /* ECORE_XCB_SHAPE */
-}
+ xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, XCB_SHAPE_SK_BOUNDING, 0, dest_win, 0, 0, 0, NULL);
+#endif /* ECORE_XCB_SHAPE */
+} /* ecore_x_window_shape_rectangles_add */
/**
* Sends the ShapeGetRectangles request.
cookie = xcb_shape_get_rectangles_unchecked(_ecore_xcb_conn, window, XCB_SHAPE_SK_BOUNDING);
_ecore_xcb_cookie_cache(cookie.sequence);
#endif /* ECORE_XCB_SHAPE */
-}
-
+} /* ecore_x_window_shape_rectangles_get_prefetch */
/**
* Gets the reply of the ShapeGetRectangles request sent by ecore_x_window_shape_rectangles_get_prefetch().
reply = xcb_shape_get_rectangles_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
#endif /* ECORE_XCB_SHAPE */
-}
-
+} /* ecore_x_window_shape_rectangles_get_fetch */
/**
* To document.
*/
EAPI Ecore_X_Rectangle *
ecore_x_window_shape_rectangles_get(Ecore_X_Window window __UNUSED__,
- int *num_ret)
+ int *num_ret)
{
Ecore_X_Rectangle *rects = NULL;
- uint32_t num = 0;
+ uint32_t num = 0;
#ifdef ECORE_XCB_SHAPE
xcb_shape_get_rectangles_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply)
{
- if (num_ret) *num_ret = 0;
- return NULL;
+ if (num_ret)
+ *num_ret = 0;
+
+ return NULL;
}
num = reply->rectangles_len;
rects = malloc(sizeof(Ecore_X_Rectangle) * num);
if (rects)
- memcpy (rects,
- xcb_shape_get_rectangles_rectangles(reply),
- num * sizeof (Ecore_X_Rectangle));
+ memcpy (rects,
+ xcb_shape_get_rectangles_rectangles(reply),
+ num * sizeof (Ecore_X_Rectangle));
else
- num = 0;
+ num = 0;
+
#endif /* ECORE_XCB_SHAPE */
- if (num_ret) *num_ret = num;
+ if (num_ret)
+ *num_ret = num;
return rects;
-}
+} /* ecore_x_window_shape_rectangles_get */
EAPI void
ecore_x_window_shape_events_select(Ecore_X_Window dest_win,
int on)
{
#ifdef ECORE_XCB_SHAPE
- xcb_shape_select_input(_ecore_xcb_conn, dest_win, on ? 1 : 0);
+ xcb_shape_select_input(_ecore_xcb_conn, dest_win, on ? 1 : 0);
#endif /* ECORE_XCB_SHAPE */
-}
+} /* ecore_x_window_shape_events_select */
+
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#include "ecore_xcb_private.h"
-
/**
* @defgroup Ecore_X_Sync_Group X Sync Extension Functions
*
* Functions related to the X Sync extension.
*/
-
#ifdef ECORE_XCB_SYNC
static int _sync_available = 0;
static xcb_sync_initialize_cookie_t _ecore_xcb_sync_init_cookie;
#endif /* ECORE_XCB_SYNC */
-
/* To avoid round trips, the initialization is separated in 2
functions: _ecore_xcb_sync_init and
_ecore_xcb_sync_init_finalize. The first one gets the cookies and
{
#ifdef ECORE_XCB_SYNC
if (reply && (reply->present))
- _ecore_xcb_sync_init_cookie = xcb_sync_initialize_unchecked(_ecore_xcb_conn,
- XCB_SYNC_MAJOR_VERSION,
- XCB_SYNC_MINOR_VERSION);
+ _ecore_xcb_sync_init_cookie = xcb_sync_initialize_unchecked(_ecore_xcb_conn,
+ XCB_SYNC_MAJOR_VERSION,
+ XCB_SYNC_MINOR_VERSION);
+
#endif /* ECORE_XCB_SYNC */
-}
+} /* _ecore_x_sync_init */
void
_ecore_x_sync_init_finalize(void)
if (reply)
{
- if (reply->major_version >= 3)
- _sync_available = 1;
+ if (reply->major_version >= 3)
+ _sync_available = 1;
+
free(reply);
}
-#endif /* ECORE_XCB_SYNC */
-}
+#endif /* ECORE_XCB_SYNC */
+} /* _ecore_x_sync_init_finalize */
/**
* Return whether the X server supports the Sync Extension.
{
#ifdef ECORE_XCB_SYNC
return _sync_available;
-#else
+#else /* ifdef ECORE_XCB_SYNC */
return 0;
#endif /* ECORE_XCB_SYNC */
-}
-
+} /* ecore_x_sync_query */
/**
* Create a new alarm.
ecore_x_sync_alarm_new(Ecore_X_Sync_Counter counter)
{
#ifdef ECORE_XCB_SYNC
- uint32_t value_list[6];
- xcb_sync_int64_t init;
+ uint32_t value_list[6];
+ xcb_sync_int64_t init;
Ecore_X_Sync_Alarm alarm;
- uint32_t value_mask;
+ uint32_t value_mask;
init.lo = 0;
init.hi = 0;
xcb_sync_set_counter(_ecore_xcb_conn, counter, init);
value_mask =
- XCB_SYNC_CA_COUNTER | XCB_SYNC_CA_VALUE_TYPE |
- XCB_SYNC_CA_VALUE | XCB_SYNC_CA_TEST_TYPE |
- XCB_SYNC_CA_DELTA | XCB_SYNC_CA_EVENTS;
+ XCB_SYNC_CA_COUNTER | XCB_SYNC_CA_VALUE_TYPE |
+ XCB_SYNC_CA_VALUE | XCB_SYNC_CA_TEST_TYPE |
+ XCB_SYNC_CA_DELTA | XCB_SYNC_CA_EVENTS;
value_list[0] = counter;
value_list[1] = XCB_SYNC_VALUETYPE_ABSOLUTE;
value_list[2] = 1;
ecore_x_sync();
return alarm;
-#else
+#else /* ifdef ECORE_XCB_SYNC */
return 0;
#endif /* ECORE_XCB_SYNC */
-}
-
+} /* ecore_x_sync_alarm_new */
/**
* Delete an alarm.
#ifdef ECORE_XCB_SYNC
xcb_sync_destroy_alarm(_ecore_xcb_conn, alarm);
return 1;
-#else
+#else /* ifdef ECORE_XCB_SYNC */
return 0;
#endif /* ECORE_XCB_SYNC */
-}
+} /* ecore_x_sync_alarm_free */
/* FIXME: round trip */
ecore_x_sync_counter_query(Ecore_X_Sync_Counter counter, unsigned int *val)
{
#ifdef ECORE_XCB_SYNC
- xcb_sync_query_counter_cookie_t cookie;
- xcb_sync_query_counter_reply_t *reply;
-
- cookie = xcb_sync_query_counter_unchecked(_ecore_xcb_conn, counter);
- reply = xcb_sync_query_counter_reply(_ecore_xcb_conn, cookie, NULL);
- if (reply)
- {
- *val = (unsigned int)reply->counter_value.lo;
- free(reply);
- return 1;
- }
+ xcb_sync_query_counter_cookie_t cookie;
+ xcb_sync_query_counter_reply_t *reply;
+
+ cookie = xcb_sync_query_counter_unchecked(_ecore_xcb_conn, counter);
+ reply = xcb_sync_query_counter_reply(_ecore_xcb_conn, cookie, NULL);
+ if (reply)
+ {
+ *val = (unsigned int)reply->counter_value.lo;
+ free(reply);
+ return 1;
+ }
+
+#endif /* ECORE_XCB_SYNC */
+
+ return 0;
+} /* ecore_x_sync_counter_query */
+
+EAPI Ecore_X_Sync_Counter
+ecore_x_sync_counter_new(int val)
+{
+#ifdef ECORE_XCB_SYNC
+ xcb_sync_counter_t counter;
+ xcb_sync_int64_t v;
+
+ counter = xcb_generate_id(_ecore_xcb_conn);
+ v.hi = (val < 0) ? ~0 : 0;
+ v.lo = val;
+ xcb_sync_create_counter(_ecore_xcb_conn, counter, v);
+ return counter;
+#else /* ! ECORE_XCB_SYNC */
+ return 0;
+#endif /* ! ECORE_XCB_SYNC */
+} /* ecore_x_sync_counter_new */
+
+EAPI void
+ecore_x_sync_counter_free(Ecore_X_Sync_Counter counter)
+{
+#ifdef ECORE_XCB_SYNC
+ xcb_sync_destroy_counter(_ecore_xcb_conn, counter);
+#endif /* ECORE_XCB_SYNC */
+} /* ecore_x_sync_counter_free */
+
+EAPI void
+ecore_x_sync_counter_inc(Ecore_X_Sync_Counter counter, int by)
+{
+#ifdef ECORE_XCB_SYNC
+ xcb_sync_int64_t v;
+
+ v.hi = (by < 0) ? ~0 : 0;
+ v.lo = by;
+ xcb_sync_change_counter(_ecore_xcb_conn, counter, v);
+#endif /* ECORE_XCB_SYNC */
+} /* ecore_x_sync_counter_inc */
+
+EAPI void
+ecore_x_sync_counter_val_wait(Ecore_X_Sync_Counter counter, int val)
+{
+#ifdef ECORE_XCB_SYNC
+ xcb_sync_query_counter_cookie_t cookie;
+ xcb_sync_query_counter_reply_t *reply;
+ xcb_sync_int64_t v1;
+ xcb_sync_int64_t v2;
+ xcb_sync_waitcondition_t cond;
+
+ /* what's the purpose of that call ?? as the value is erased... */
+ cookie = xcb_sync_query_counter_unchecked(_ecore_xcb_conn, counter);
+ reply = xcb_sync_query_counter_reply(_ecore_xcb_conn, cookie, NULL);
+ v1 = reply->counter_value;
+ free(reply);
+
+ v1.hi = (val < 0) ? ~0 : 0;
+ v1.lo = val;
+ v2.hi = ((val + 1) < 0) ? ~0 : 0;
+ v2.lo = val + 1;
+ cond.trigger.counter = counter;
+ cond.trigger.wait_type = XCB_SYNC_VALUETYPE_ABSOLUTE;
+ cond.trigger.wait_value = v1;
+ cond.trigger.test_type = XCB_SYNC_TESTTYPE_POSITIVE_COMPARISON;
+ cond.event_threshold = v2;
+
+ xcb_sync_await(_ecore_xcb_conn, 1, (const xcb_sync_waitcondition_t *)&cond);
#endif /* ECORE_XCB_SYNC */
+} /* ecore_x_sync_counter_val_wait */
- return 0;
-}
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#include <string.h>
#include <Ecore.h>
#include "ecore_xcb_private.h"
#include "Ecore_X_Atoms.h"
-
-static int ignore_num = 0;
+static int ignore_num = 0;
static Ecore_X_Window *ignore_list = NULL;
-static Ecore_X_Window _ecore_x_window_at_xy_get(Ecore_X_Window base,
- int16_t base_x,
- int16_t base_y,
- int16_t x,
- int16_t y,
- Ecore_X_Window *skip,
- int skip_num);
+static Ecore_X_Window _ecore_x_window_at_xy_get(Ecore_X_Window base,
+ int16_t base_x,
+ int16_t base_y,
+ int16_t x,
+ int16_t y,
+ Ecore_X_Window *skip,
+ int skip_num);
#ifdef ECORE_XCB_RENDER
-static Ecore_X_Window _ecore_x_window_argb_internal_new(Ecore_X_Window parent,
- int16_t x,
- int16_t y,
- uint16_t w,
- uint16_t h,
- uint8_t override_redirect,
- uint8_t save_under);
+static Ecore_X_Window _ecore_x_window_argb_internal_new(Ecore_X_Window parent,
+ int16_t x,
+ int16_t y,
+ uint16_t w,
+ uint16_t h,
+ uint8_t override_redirect,
+ uint8_t save_under);
#endif /* ECORE_XCB_RENDER */
-
/**
* @defgroup Ecore_X_Window_Create_Group X Window Creation Functions
*
int width,
int height)
{
- uint32_t value_list[9];
+ uint32_t value_list[9];
Ecore_X_Window window;
xcb_visualid_t vis = { XCB_WINDOW_CLASS_COPY_FROM_PARENT };
- uint32_t value_mask;
+ uint32_t value_mask;
- if (parent == 0) parent = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+ if (parent == 0)
+ parent = ((xcb_screen_t *)_ecore_xcb_screen)->root;
value_mask =
- XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL | XCB_CW_BIT_GRAVITY |
- XCB_CW_WIN_GRAVITY | XCB_CW_BACKING_STORE | XCB_CW_OVERRIDE_REDIRECT |
- XCB_CW_SAVE_UNDER | XCB_CW_EVENT_MASK | XCB_CW_DONT_PROPAGATE;
-
- value_list[0] = XCB_NONE;
- value_list[1] = 0;
- value_list[2] = XCB_GRAVITY_NORTH_WEST;
- value_list[3] = XCB_GRAVITY_NORTH_WEST;
- value_list[4] = XCB_BACKING_STORE_NOT_USEFUL;
- value_list[5] = 0;
- value_list[6] = 0;
- value_list[7] =
- XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE |
- XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE |
- XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW |
- XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_EXPOSURE |
- XCB_EVENT_MASK_VISIBILITY_CHANGE | XCB_EVENT_MASK_STRUCTURE_NOTIFY |
- XCB_EVENT_MASK_FOCUS_CHANGE | XCB_EVENT_MASK_PROPERTY_CHANGE |
- XCB_EVENT_MASK_COLOR_MAP_CHANGE;
- value_list[8] = XCB_EVENT_MASK_NO_EVENT;
+ XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL | XCB_CW_BIT_GRAVITY |
+ XCB_CW_WIN_GRAVITY | XCB_CW_BACKING_STORE | XCB_CW_OVERRIDE_REDIRECT |
+ XCB_CW_SAVE_UNDER | XCB_CW_EVENT_MASK | XCB_CW_DONT_PROPAGATE;
+
+ value_list[0] = XCB_NONE;
+ value_list[1] = 0;
+ value_list[2] = XCB_GRAVITY_NORTH_WEST;
+ value_list[3] = XCB_GRAVITY_NORTH_WEST;
+ value_list[4] = XCB_BACKING_STORE_NOT_USEFUL;
+ value_list[5] = 0;
+ value_list[6] = 0;
+ value_list[7] =
+ XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE |
+ XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE |
+ XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW |
+ XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_EXPOSURE |
+ XCB_EVENT_MASK_VISIBILITY_CHANGE | XCB_EVENT_MASK_STRUCTURE_NOTIFY |
+ XCB_EVENT_MASK_FOCUS_CHANGE | XCB_EVENT_MASK_PROPERTY_CHANGE |
+ XCB_EVENT_MASK_COLOR_MAP_CHANGE;
+ value_list[8] = XCB_EVENT_MASK_NO_EVENT;
window = xcb_generate_id(_ecore_xcb_conn);
xcb_create_window(_ecore_xcb_conn,
- XCB_WINDOW_CLASS_COPY_FROM_PARENT,
- window, parent, x, y, width, height, 0,
- XCB_WINDOW_CLASS_INPUT_OUTPUT,
- vis,
- value_mask,
- value_list);
-
- if (parent == ((xcb_screen_t *)_ecore_xcb_screen)->root) ecore_x_window_defaults_set(window);
+ XCB_WINDOW_CLASS_COPY_FROM_PARENT,
+ window, parent, x, y, width, height, 0,
+ XCB_WINDOW_CLASS_INPUT_OUTPUT,
+ vis,
+ value_mask,
+ value_list);
+
+ if (parent == ((xcb_screen_t *)_ecore_xcb_screen)->root)
+ ecore_x_window_defaults_set(window);
+
return window;
-}
+} /* ecore_x_window_new */
/**
* Creates a window with the override redirect attribute set to @c True.
int width,
int height)
{
- uint32_t value_list[9];
+ uint32_t value_list[9];
Ecore_X_Window window;
- xcb_visualid_t vis = { XCB_WINDOW_CLASS_COPY_FROM_PARENT };
- uint32_t value_mask;
+ xcb_visualid_t vis = { XCB_WINDOW_CLASS_COPY_FROM_PARENT };
+ uint32_t value_mask;
- if (parent == 0) parent = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+ if (parent == 0)
+ parent = ((xcb_screen_t *)_ecore_xcb_screen)->root;
value_mask =
- XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL | XCB_CW_BIT_GRAVITY |
- XCB_CW_WIN_GRAVITY | XCB_CW_BACKING_STORE | XCB_CW_OVERRIDE_REDIRECT |
- XCB_CW_SAVE_UNDER | XCB_CW_EVENT_MASK | XCB_CW_DONT_PROPAGATE;
-
- value_list[0] = XCB_NONE;
- value_list[1] = 0;
- value_list[2] = XCB_GRAVITY_NORTH_WEST;
- value_list[3] = XCB_GRAVITY_NORTH_WEST;
- value_list[4] = XCB_BACKING_STORE_NOT_USEFUL;
- value_list[5] = 1;
- value_list[6] = 0;
- value_list[7] =
- XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE |
- XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE |
- XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW |
- XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_EXPOSURE |
- XCB_EVENT_MASK_VISIBILITY_CHANGE | XCB_EVENT_MASK_STRUCTURE_NOTIFY |
- XCB_EVENT_MASK_FOCUS_CHANGE | XCB_EVENT_MASK_PROPERTY_CHANGE |
- XCB_EVENT_MASK_COLOR_MAP_CHANGE;
- value_list[8] = XCB_EVENT_MASK_NO_EVENT;
+ XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL | XCB_CW_BIT_GRAVITY |
+ XCB_CW_WIN_GRAVITY | XCB_CW_BACKING_STORE | XCB_CW_OVERRIDE_REDIRECT |
+ XCB_CW_SAVE_UNDER | XCB_CW_EVENT_MASK | XCB_CW_DONT_PROPAGATE;
+
+ value_list[0] = XCB_NONE;
+ value_list[1] = 0;
+ value_list[2] = XCB_GRAVITY_NORTH_WEST;
+ value_list[3] = XCB_GRAVITY_NORTH_WEST;
+ value_list[4] = XCB_BACKING_STORE_NOT_USEFUL;
+ value_list[5] = 1;
+ value_list[6] = 0;
+ value_list[7] =
+ XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE |
+ XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE |
+ XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW |
+ XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_EXPOSURE |
+ XCB_EVENT_MASK_VISIBILITY_CHANGE | XCB_EVENT_MASK_STRUCTURE_NOTIFY |
+ XCB_EVENT_MASK_FOCUS_CHANGE | XCB_EVENT_MASK_PROPERTY_CHANGE |
+ XCB_EVENT_MASK_COLOR_MAP_CHANGE;
+ value_list[8] = XCB_EVENT_MASK_NO_EVENT;
window = xcb_generate_id(_ecore_xcb_conn);
xcb_create_window(_ecore_xcb_conn,
- XCB_WINDOW_CLASS_COPY_FROM_PARENT,
- window, parent, x, y, width, height, 0,
- XCB_WINDOW_CLASS_INPUT_OUTPUT,
- vis,
- value_mask,
- value_list);
+ XCB_WINDOW_CLASS_COPY_FROM_PARENT,
+ window, parent, x, y, width, height, 0,
+ XCB_WINDOW_CLASS_INPUT_OUTPUT,
+ vis,
+ value_mask,
+ value_list);
return window;
-}
+} /* ecore_x_window_override_new */
/**
* Creates a new input window.
int width,
int height)
{
- uint32_t value_list[3];
+ uint32_t value_list[3];
Ecore_X_Window window;
- xcb_visualid_t vis = { XCB_WINDOW_CLASS_COPY_FROM_PARENT };
- uint32_t value_mask;
+ xcb_visualid_t vis = { XCB_WINDOW_CLASS_COPY_FROM_PARENT };
+ uint32_t value_mask;
- if (parent == 0) parent = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+ if (parent == 0)
+ parent = ((xcb_screen_t *)_ecore_xcb_screen)->root;
value_mask = XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK | XCB_CW_DONT_PROPAGATE;
- value_list[0] = 1;
- value_list[1] =
- XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE |
- XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE |
- XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW |
- XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_EXPOSURE |
- XCB_EVENT_MASK_VISIBILITY_CHANGE | XCB_EVENT_MASK_STRUCTURE_NOTIFY |
- XCB_EVENT_MASK_FOCUS_CHANGE | XCB_EVENT_MASK_PROPERTY_CHANGE |
- XCB_EVENT_MASK_COLOR_MAP_CHANGE;
- value_list[2] = XCB_EVENT_MASK_NO_EVENT;
+ value_list[0] = 1;
+ value_list[1] =
+ XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE |
+ XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE |
+ XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW |
+ XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_EXPOSURE |
+ XCB_EVENT_MASK_VISIBILITY_CHANGE | XCB_EVENT_MASK_STRUCTURE_NOTIFY |
+ XCB_EVENT_MASK_FOCUS_CHANGE | XCB_EVENT_MASK_PROPERTY_CHANGE |
+ XCB_EVENT_MASK_COLOR_MAP_CHANGE;
+ value_list[2] = XCB_EVENT_MASK_NO_EVENT;
window = xcb_generate_id(_ecore_xcb_conn);
xcb_create_window(_ecore_xcb_conn,
- XCB_WINDOW_CLASS_COPY_FROM_PARENT,
- window, parent, x, y, width, height, 0,
- XCB_WINDOW_CLASS_INPUT_OUTPUT,
- vis,
- value_mask,
- value_list);
+ XCB_WINDOW_CLASS_COPY_FROM_PARENT,
+ window, parent, x, y, width, height, 0,
+ XCB_WINDOW_CLASS_INPUT_OUTPUT,
+ vis,
+ value_mask,
+ value_list);
if (parent == ((xcb_screen_t *)_ecore_xcb_screen)->root)
{
}
return window;
-}
+} /* ecore_x_window_input_new */
/**
* Creates a new window.
#endif /* ECORE_XCB_RENDER */
return window;
-}
+} /* ecore_x_window_manager_argb_new */
/**
* Creates a new window.
#endif /* ECORE_XCB_RENDER */
return window;
-}
+} /* ecore_x_window_argb_new */
/**
* Creates a window with the override redirect attribute set to @c True.
#endif /* ECORE_XCB_RENDER */
return window;
-}
+} /* ecore_x_window_override_argb_new */
/**
* @defgroup Ecore_X_Window_Destroy_Group X Window Destroy Functions
*/
if (window)
xcb_destroy_window(_ecore_xcb_conn, window);
-}
+} /* ecore_x_window_free */
/**
* Sends a delete request to the given window.
xcb_send_event(_ecore_xcb_conn, 0, window,
XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
-}
+} /* ecore_x_window_delete_request_send */
/**
* @defgroup Ecore_X_Window_Configure_Group X Window Configure Functions
* Functions to configure X windows.
*/
-
/**
* Configures the given window with the given mask.
* @param window The given window.
int stack_mode)
{
uint32_t *value_list;
- uint32_t value_mask;
- int length = 0;
+ uint32_t value_mask;
+ int length = 0;
if (!window)
return;
value_mask = mask;
- for ( ; value_mask; value_mask >>= 1)
- if (value_mask & 1)
- length++;
+ for (; value_mask; value_mask >>= 1)
+ if (value_mask & 1)
+ length++;
+
value_list = (uint32_t *)malloc(sizeof(uint32_t) * length);
if (!value_list)
return;
value_mask = mask;
- for ( ; value_mask; value_mask >>= 1, value_list++)
+ for (; value_mask; value_mask >>= 1, value_list++)
if (value_mask & 1)
{
- switch (value_mask) {
- case XCB_CONFIG_WINDOW_X:
- *value_list = x;
- break;
- case XCB_CONFIG_WINDOW_Y:
- *value_list = y;
- break;
- case XCB_CONFIG_WINDOW_WIDTH:
- *value_list = width;
- break;
- case XCB_CONFIG_WINDOW_HEIGHT:
- *value_list = height;
- break;
- case XCB_CONFIG_WINDOW_BORDER_WIDTH:
- *value_list = border_width;
- break;
- case XCB_CONFIG_WINDOW_SIBLING:
- *value_list = sibling;
- break;
- case XCB_CONFIG_WINDOW_STACK_MODE:
- *value_list = stack_mode;
- break;
- }
+ switch (value_mask) {
+ case XCB_CONFIG_WINDOW_X:
+ *value_list = x;
+ break;
+
+ case XCB_CONFIG_WINDOW_Y:
+ *value_list = y;
+ break;
+
+ case XCB_CONFIG_WINDOW_WIDTH:
+ *value_list = width;
+ break;
+
+ case XCB_CONFIG_WINDOW_HEIGHT:
+ *value_list = height;
+ break;
+
+ case XCB_CONFIG_WINDOW_BORDER_WIDTH:
+ *value_list = border_width;
+ break;
+
+ case XCB_CONFIG_WINDOW_SIBLING:
+ *value_list = sibling;
+ break;
+
+ case XCB_CONFIG_WINDOW_STACK_MODE:
+ *value_list = stack_mode;
+ break;
+ } /* switch */
}
xcb_configure_window(_ecore_xcb_conn, window, mask, value_list);
free(value_list);
-}
+} /* ecore_x_window_configure */
/**
* Moves a window to the position @p x, @p y.
value_list[1] = y;
xcb_configure_window(_ecore_xcb_conn, window, value_mask, value_list);
-}
+} /* ecore_x_window_move */
/**
* Resizes a window.
if (!window)
return;
- if (width < 1) width = 1;
- if (height < 1) height = 1;
+ if (width < 1)
+ width = 1;
+
+ if (height < 1)
+ height = 1;
value_mask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
value_list[1] = height;
xcb_configure_window(_ecore_xcb_conn, window, value_mask, value_list);
-}
+} /* ecore_x_window_resize */
/**
* Moves and resizes a window.
if (!window)
return;
- if (width < 1) width = 1;
- if (height < 1) height = 1;
+ if (width < 1)
+ width = 1;
+
+ if (height < 1)
+ height = 1;
value_mask =
- XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y |
- XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
+ XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y |
+ XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
value_list[0] = x;
value_list[1] = y;
value_list[3] = height;
xcb_configure_window(_ecore_xcb_conn, window, value_mask, value_list);
-}
+} /* ecore_x_window_move_resize */
/**
* Sets the width of the border of the given window.
value_list = border_width;
xcb_configure_window(_ecore_xcb_conn, window, XCB_CONFIG_WINDOW_BORDER_WIDTH, &value_list);
-}
+} /* ecore_x_window_border_width_set */
/**
* Raises the given window.
value_list = XCB_STACK_MODE_ABOVE;
xcb_configure_window(_ecore_xcb_conn, window, XCB_CONFIG_WINDOW_STACK_MODE, &value_list);
-}
+} /* ecore_x_window_raise */
/**
* Lowers the given window.
value_list = XCB_STACK_MODE_BELOW;
xcb_configure_window(_ecore_xcb_conn, window, XCB_CONFIG_WINDOW_STACK_MODE, &value_list);
-}
+} /* ecore_x_window_lower */
/**
* @defgroup Ecore_X_Window_Change_Properties_Group X Window Change Property Functions
EAPI void
ecore_x_window_defaults_set(Ecore_X_Window window)
{
- char buf[MAXHOSTNAMELEN];
- pid_t pid;
- int argc;
+ char buf[MAXHOSTNAMELEN];
+ pid_t pid;
+ int argc;
char **argv;
/*
/* The ecore function uses UTF8 which Xlib may not like (especially
* with older clients) */
/* ecore_xcb_window_prop_string_set(win, ECORE_X_ATOM_WM_CLIENT_MACHINE,
- (char *)buf); */
+ (char *)buf); */
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
ECORE_X_ATOM_WM_CLIENT_MACHINE,
ECORE_X_ATOM_STRING,
ecore_app_args_get(&argc, &argv);
ecore_x_icccm_command_set(window, argc, argv);
-}
+} /* ecore_x_window_defaults_set */
/**
* @defgroup Ecore_X_Window_Visibility_Group X Window Visibility Functions
ecore_x_window_show(Ecore_X_Window window)
{
xcb_map_window(_ecore_xcb_conn, window);
-}
+} /* ecore_x_window_show */
/**
* Hides a window.
ecore_x_window_hide(Ecore_X_Window window)
{
xcb_unmap_notify_event_t ev;
- Ecore_X_Window root;
+ Ecore_X_Window root;
/* ICCCM: SEND unmap event... */
root = window;
/* FIXME: is it correct ? */
if (xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn)).rem == 1)
- root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+ root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
else
{
- xcb_get_geometry_cookie_t cookie;
- xcb_get_geometry_reply_t *rep;
- Ecore_X_Drawable draw;
+ xcb_get_geometry_cookie_t cookie;
+ xcb_get_geometry_reply_t *rep;
+ Ecore_X_Drawable draw;
/* FIXME: can we avoid round trips, here ? */
draw = window;
rep = xcb_get_geometry_reply(_ecore_xcb_conn, cookie, NULL);
if (!rep)
return;
+
root = rep->root;
free(rep);
}
+
ev.response_type = XCB_UNMAP_NOTIFY;
ev.pad0 = 0;
ev.sequence = 0;
XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT,
(const char *)&ev);
xcb_unmap_window(_ecore_xcb_conn, window);
-}
+} /* ecore_x_window_hide */
/**
* @defgroup Ecore_X_Window_Input_Focus_Group X Window Input Focus Functions
{
Ecore_X_Time time = XCB_CURRENT_TIME;
- if (window == 0) window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+ if (window == 0)
+ window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
/* xcb_set_input_focus(_ecore_xcb_conn, XCB_INPUT_FOCUS_NONE, win, time); */
xcb_set_input_focus(_ecore_xcb_conn,
XCB_INPUT_FOCUS_POINTER_ROOT, window, time);
-}
+} /* ecore_x_window_focus */
/**
* Sets the focus to the given window at a specific time.
ecore_x_window_focus_at_time(Ecore_X_Window window,
Ecore_X_Time time)
{
- if (window == 0) window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+ if (window == 0)
+ window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
/* xcb_set_input_focus(_ecore_xcb_conn, XCB_INPUT_FOCUS_NONE, win, time); */
xcb_set_input_focus(_ecore_xcb_conn,
XCB_INPUT_FOCUS_POINTER_ROOT, window, time);
-}
+} /* ecore_x_window_focus_at_time */
/**
* @defgroup Ecore_X_Window_Reparent_Group X Window Reparent Functions
int x,
int y)
{
- if (new_parent == 0) new_parent = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+ if (new_parent == 0)
+ new_parent = ((xcb_screen_t *)_ecore_xcb_screen)->root;
xcb_reparent_window(_ecore_xcb_conn, window, new_parent, x, y);
-}
-
+} /* ecore_x_window_reparent */
/**
* @defgroup Ecore_X_Window_Change_Attributes_Group X Window Change Attributes Functions
value_list = pixmap;
xcb_change_window_attributes(_ecore_xcb_conn, window,
XCB_CW_BACK_PIXMAP, &value_list);
-}
+} /* ecore_x_window_pixmap_set */
/**
* Sets the background color of the given window.
{
xcb_alloc_color_cookie_t cookie;
xcb_alloc_color_reply_t *rep;
- uint32_t value_list;
+ uint32_t value_list;
/* FIXME: should I provide a reply, and not the color components, here ? */
/* (because of roundtrips) */
red, green, blue);
rep = xcb_alloc_color_reply(_ecore_xcb_conn, cookie, NULL);
if (!rep)
- return;
+ return;
value_list = rep->pixel;
xcb_change_window_attributes(_ecore_xcb_conn, window,
XCB_CW_BACK_PIXEL, &value_list);
free(rep);
-}
+} /* ecore_x_window_background_color_set */
/**
* Sets the bit gravity of the given window.
value_list = gravity;
xcb_change_window_attributes(_ecore_xcb_conn, window,
XCB_CW_BIT_GRAVITY, &value_list);
-}
+} /* ecore_x_window_pixel_gravity_set */
/**
* Sets the gravity of the given window.
value_list = gravity;
xcb_change_window_attributes(_ecore_xcb_conn, window,
XCB_CW_WIN_GRAVITY, &value_list);
-}
+} /* ecore_x_window_gravity_set */
/**
* Sets the override attribute of the given window.
value_list = override_redirect;
xcb_change_window_attributes(_ecore_xcb_conn, window,
XCB_CW_OVERRIDE_REDIRECT, &value_list);
-}
+} /* ecore_x_window_override_set */
/**
* Shows the cursor of the given window.
ecore_x_window_cursor_show(Ecore_X_Window window,
int show)
{
- if (window == 0) window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+ if (window == 0)
+ window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
if (!show)
{
- Ecore_X_Cursor cursor;
+ Ecore_X_Cursor cursor;
Ecore_X_Drawable draw;
- Ecore_X_Pixmap pixmap;
- Ecore_X_Pixmap mask;
- Ecore_X_GC gc;
- xcb_point_t point;
- uint32_t value_list;
+ Ecore_X_Pixmap pixmap;
+ Ecore_X_Pixmap mask;
+ Ecore_X_GC gc;
+ xcb_point_t point;
+ uint32_t value_list;
draw = window;
pixmap = xcb_generate_id(_ecore_xcb_conn);
xcb_change_window_attributes(_ecore_xcb_conn, window,
XCB_CW_CURSOR, &value_list);
}
-}
+} /* ecore_x_window_cursor_show */
/**
* Sets the cursor of the given window.
value_list = cursor;
xcb_change_window_attributes(_ecore_xcb_conn, window,
XCB_CW_CURSOR, &value_list);
-}
+} /* ecore_x_window_cursor_set */
/**
* Todo
uint32_t value_list;
value_list =
- XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY |
- XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT;
+ XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY |
+ XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT;
xcb_change_window_attributes(_ecore_xcb_conn, window,
XCB_CW_EVENT_MASK, &value_list);
-
-}
+} /* ecore_x_window_container_manage */
/**
* Todo
uint32_t value_list;
value_list =
- XCB_EVENT_MASK_VISIBILITY_CHANGE |
+ XCB_EVENT_MASK_VISIBILITY_CHANGE |
/* XCB_EVENT_MASK_RESIZE_REDIRECT | */
- XCB_EVENT_MASK_STRUCTURE_NOTIFY |
- XCB_EVENT_MASK_FOCUS_CHANGE |
- XCB_EVENT_MASK_PROPERTY_CHANGE |
- XCB_EVENT_MASK_COLOR_MAP_CHANGE;
+ XCB_EVENT_MASK_STRUCTURE_NOTIFY |
+ XCB_EVENT_MASK_FOCUS_CHANGE |
+ XCB_EVENT_MASK_PROPERTY_CHANGE |
+ XCB_EVENT_MASK_COLOR_MAP_CHANGE;
xcb_change_window_attributes(_ecore_xcb_conn, window,
XCB_CW_EVENT_MASK, &value_list);
#ifdef ECORE_XCB_SHAPE
xcb_shape_select_input(_ecore_xcb_conn, window, 1);
#endif /* ECORE_XCB_SHAPE */
-}
+} /* ecore_x_window_client_manage */
/**
* Todo
uint32_t value_list;
value_list =
- XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY |
- XCB_EVENT_MASK_PROPERTY_CHANGE;
+ XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY |
+ XCB_EVENT_MASK_PROPERTY_CHANGE;
xcb_change_window_attributes(_ecore_xcb_conn, window,
XCB_CW_EVENT_MASK, &value_list);
-}
+} /* ecore_x_window_sniff */
/**
* Todo
uint32_t value_list;
value_list =
- XCB_EVENT_MASK_VISIBILITY_CHANGE |
- XCB_EVENT_MASK_STRUCTURE_NOTIFY |
- XCB_EVENT_MASK_FOCUS_CHANGE |
- XCB_EVENT_MASK_PROPERTY_CHANGE |
- XCB_EVENT_MASK_COLOR_MAP_CHANGE;
+ XCB_EVENT_MASK_VISIBILITY_CHANGE |
+ XCB_EVENT_MASK_STRUCTURE_NOTIFY |
+ XCB_EVENT_MASK_FOCUS_CHANGE |
+ XCB_EVENT_MASK_PROPERTY_CHANGE |
+ XCB_EVENT_MASK_COLOR_MAP_CHANGE;
xcb_change_window_attributes(_ecore_xcb_conn, window,
XCB_CW_EVENT_MASK, &value_list);
#ifdef ECORE_XCB_SHAPE
xcb_shape_select_input(_ecore_xcb_conn, window, 1);
#endif /* ECORE_XCB_SHAPE */
-}
+} /* ecore_x_window_client_sniff */
/**
* Clears an area of the given window.
int height)
{
xcb_clear_area(_ecore_xcb_conn, 0, window, x, y, width, height);
-}
+} /* ecore_x_window_area_clear */
/**
* Exposes an area of the given window.
int height)
{
xcb_clear_area(_ecore_xcb_conn, 1, window, x, y, width, height);
-}
-
+} /* ecore_x_window_area_expose */
/**
* @defgroup Ecore_X_Window_Save_Set_Group X Window Change Save Set Functions
ecore_x_window_save_set_add(Ecore_X_Window window)
{
xcb_change_save_set(_ecore_xcb_conn, XCB_SET_MODE_INSERT, window);
-}
+} /* ecore_x_window_save_set_add */
/**
* Deletes the window from the client's save-set.
ecore_x_window_save_set_del(Ecore_X_Window window)
{
xcb_change_save_set(_ecore_xcb_conn, XCB_SET_MODE_DELETE, window);
-}
+} /* ecore_x_window_save_set_del */
/******************************
- *
- * Request that have a reply
- *
- ******************************/
-
+*
+* Request that have a reply
+*
+******************************/
/**
* Sends the GetInputFocus request.
cookie = xcb_get_input_focus_unchecked(_ecore_xcb_conn);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_get_input_focus_prefetch */
/**
* Gets the reply of the GetInputFocus request sent by ecore_x_get_input_focus_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_input_focus_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_get_input_focus_fetch */
/**
* Gets the window that has focus.
ecore_x_window_focus_get(void)
{
xcb_get_input_focus_reply_t *reply;
- Ecore_X_Window window = 0;
+ Ecore_X_Window window = 0;
reply = _ecore_xcb_reply_get();
- if (!reply) return window;
+ if (!reply)
+ return window;
return reply->focus;
-}
-
+} /* ecore_x_window_focus_get */
/**
* @defgroup Ecore_X_Window_Get_Attributes_Group X Window Get Attributes Functions
* Functions that get the attributes of a window.
*/
-
/**
* Sends the GetWindowAttributes request.
* @ingroup Ecore_X_Window_Get_Attributes_Group
cookie = xcb_get_window_attributes_unchecked(_ecore_xcb_conn, window);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_get_window_attributes_prefetch */
/**
* Gets the reply of the GetWindowAttributes request sent by ecore_x_get_window_attributes_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_window_attributes_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_get_window_attributes_fetch */
/**
* Retrieves the attributes of a window.
* @ingroup Ecore_X_Window_Get_Attributes_Group
*/
EAPI int
-ecore_x_window_attributes_get(Ecore_X_Window window __UNUSED__,
+ecore_x_window_attributes_get(Ecore_X_Window window __UNUSED__,
Ecore_X_Window_Attributes *att_ret)
{
xcb_get_window_attributes_reply_t *reply;
- if (!att_ret) return 0;
+ if (!att_ret)
+ return 0;
reply = _ecore_xcb_reply_get();
- if (!reply) return 0;
+ if (!reply)
+ return 0;
memset(att_ret, 0, sizeof(Ecore_X_Window_Attributes));
- if (reply->map_state != XCB_MAP_STATE_UNMAPPED) att_ret->visible = 1;
- if (reply->map_state == XCB_MAP_STATE_VIEWABLE) att_ret->viewable = 1;
- if (reply->override_redirect) att_ret->override = 1;
- if (reply->_class == XCB_WINDOW_CLASS_INPUT_ONLY) att_ret->input_only = 1;
- if (reply->save_under) att_ret->save_under = 1;
+ if (reply->map_state != XCB_MAP_STATE_UNMAPPED)
+ att_ret->visible = 1;
+
+ if (reply->map_state == XCB_MAP_STATE_VIEWABLE)
+ att_ret->viewable = 1;
+
+ if (reply->override_redirect)
+ att_ret->override = 1;
+
+ if (reply->_class == XCB_WINDOW_CLASS_INPUT_ONLY)
+ att_ret->input_only = 1;
- att_ret->event_mask.mine = reply->your_event_mask;
- att_ret->event_mask.all = reply->all_event_masks;
+ if (reply->save_under)
+ att_ret->save_under = 1;
+
+ att_ret->event_mask.mine = reply->your_event_mask;
+ att_ret->event_mask.all = reply->all_event_masks;
att_ret->event_mask.no_propagate = reply->do_not_propagate_mask;
- att_ret->window_gravity = reply->win_gravity;
- att_ret->pixel_gravity = reply->bit_gravity;
- att_ret->colormap = reply->colormap;
- att_ret->visual = reply->visual;
+ att_ret->window_gravity = reply->win_gravity;
+ att_ret->pixel_gravity = reply->bit_gravity;
+ att_ret->colormap = reply->colormap;
+ att_ret->visual = reply->visual;
return 1;
-}
+} /* ecore_x_window_attributes_get */
/**
* Finds out whether the given window is currently visible.
xcb_get_window_attributes_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return 0;
+ if (!reply)
+ return 0;
return (reply->map_state == XCB_MAP_STATE_VIEWABLE) ? 1 : 0;
-}
-
+} /* ecore_x_window_visible_get */
/**
* Sends the QueryPointer request.
cookie = xcb_query_pointer_unchecked(_ecore_xcb_conn, window);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_pointer_xy_get_prefetch */
/**
* Gets the reply of the QueryPointer request sent by ecore_x_query_pointer_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_query_pointer_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_pointer_xy_get_fetch */
/**
* Retrieves the coordinates of the pointer.
*/
EAPI void
ecore_x_pointer_xy_get(Ecore_X_Window window __UNUSED__,
- int *x,
- int *y)
+ int *x,
+ int *y)
{
xcb_query_pointer_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply)
{
- if (x) *x = 0;
- if (y) *y = 0;
+ if (x)
+ *x = 0;
- return;
+ if (y)
+ *y = 0;
+
+ return;
}
- if (x) *x = reply->win_x;
- if (y) *y = reply->win_y;
-}
+ if (x)
+ *x = reply->win_x;
+ if (y)
+ *y = reply->win_y;
+} /* ecore_x_pointer_xy_get */
/**
* Sends the QueryTree request.
cookie = xcb_query_tree_unchecked(_ecore_xcb_conn, window);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_query_tree_prefetch */
/**
* Gets the reply of the QueryTree request sent by ecore_x_query_tree_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_query_tree_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_query_tree_fetch */
/**
* Retrieves the parent window of the given window.
xcb_query_tree_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return 0;
+ if (!reply)
+ return 0;
return reply->parent;
-}
-
+} /* ecore_x_window_parent_get */
/**
* Retrieves the children windows of the given window.
*/
EAPI Ecore_X_Window *
ecore_x_window_children_get(Ecore_X_Window window __UNUSED__,
- int *num)
+ int *num)
{
xcb_query_tree_reply_t *reply;
- Ecore_X_Window *windows = NULL;
+ Ecore_X_Window *windows = NULL;
+
+ if (num)
+ *num = 0;
- if (num) *num = 0;
reply = _ecore_xcb_reply_get();
- if (!reply) return NULL;
+ if (!reply)
+ return NULL;
windows = malloc(sizeof(Ecore_X_Window) * reply->children_len);
if (!windows)
- return NULL;
+ return NULL;
+
+ if (num)
+ *num = reply->children_len;
- if (num) *num = reply->children_len;
memcpy(windows,
xcb_query_tree_children(reply),
sizeof(Ecore_X_Window) * reply->children_len);
return windows;
-}
+} /* ecore_x_window_children_get */
/* FIXME: I've tried to remove the round trips. 3 cookies are */
/* created at the beginning of the function. Because of */
Ecore_X_Window *skip,
int skip_num)
{
- xcb_window_iterator_t iter_children;
xcb_get_window_attributes_cookie_t cookie_get_window_attributes;
- xcb_get_geometry_cookie_t cookie_get_geometry;
- xcb_query_tree_cookie_t cookie_query_tree;
+ xcb_get_geometry_cookie_t cookie_get_geometry;
+ xcb_query_tree_cookie_t cookie_query_tree;
xcb_get_window_attributes_reply_t *reply_get_window_attributes;
- xcb_get_geometry_reply_t *reply_get_geometry;
- xcb_query_tree_reply_t *reply_query_tree;
- Ecore_X_Window window = 0;
- Ecore_X_Window child = 0;
- int16_t win_x;
- int16_t win_y;
- uint16_t win_width;
- uint16_t win_height;
+ xcb_get_geometry_reply_t *reply_get_geometry;
+ xcb_query_tree_reply_t *reply_query_tree;
+ Ecore_X_Window window = 0;
+ Ecore_X_Window child = 0;
+ int16_t win_x;
+ int16_t win_y;
+ uint16_t win_width;
+ uint16_t win_height;
+ xcb_window_t *wins = NULL;
+ int tree_c_len;
+ int i;
cookie_get_window_attributes = xcb_get_window_attributes_unchecked(_ecore_xcb_conn, base);
cookie_get_geometry = xcb_get_geometry_unchecked(_ecore_xcb_conn, base);
reply_get_window_attributes = xcb_get_window_attributes_reply(_ecore_xcb_conn, cookie_get_window_attributes, NULL);
if (!reply_get_window_attributes)
{
- reply_get_geometry = xcb_get_geometry_reply(_ecore_xcb_conn, cookie_get_geometry, NULL);
- if (reply_get_geometry) free(reply_get_geometry);
- reply_query_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_query_tree, NULL);
- if (reply_query_tree) free(reply_query_tree);
- return window;
+ reply_get_geometry = xcb_get_geometry_reply(_ecore_xcb_conn, cookie_get_geometry, NULL);
+ if (reply_get_geometry)
+ free(reply_get_geometry);
+
+ reply_query_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_query_tree, NULL);
+ if (reply_query_tree)
+ free(reply_query_tree);
+
+ return window;
}
if (reply_get_window_attributes->map_state != XCB_MAP_STATE_VIEWABLE)
{
- free(reply_get_window_attributes);
- reply_get_geometry = xcb_get_geometry_reply(_ecore_xcb_conn, cookie_get_geometry, NULL);
- if (reply_get_geometry) free(reply_get_geometry);
- reply_query_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_query_tree, NULL);
- if (reply_query_tree) free(reply_query_tree);
- return window;
+ free(reply_get_window_attributes);
+ reply_get_geometry = xcb_get_geometry_reply(_ecore_xcb_conn, cookie_get_geometry, NULL);
+ if (reply_get_geometry)
+ free(reply_get_geometry);
+
+ reply_query_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_query_tree, NULL);
+ if (reply_query_tree)
+ free(reply_query_tree);
+
+ return window;
}
free(reply_get_window_attributes);
reply_get_geometry = xcb_get_geometry_reply(_ecore_xcb_conn, cookie_get_geometry, NULL);
if (!reply_get_geometry)
{
- reply_query_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_query_tree, NULL);
- if (reply_query_tree) free(reply_query_tree);
- return window;
+ reply_query_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_query_tree, NULL);
+ if (reply_query_tree)
+ free(reply_query_tree);
+
+ return window;
}
win_x = reply_get_geometry->x;
(x < (int16_t)(win_x + win_width)) &&
(y < (int16_t)(win_y + win_height))))
{
- reply_query_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_query_tree, NULL);
- if (reply_query_tree) free(reply_query_tree);
- return window;
+ reply_query_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_query_tree, NULL);
+ if (reply_query_tree)
+ free(reply_query_tree);
+
+ return window;
}
reply_query_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_query_tree, NULL);
if (!reply_query_tree)
{
if (skip)
- {
+ {
int i;
- for (i = 0; i < skip_num; i++)
- if (base == skip[i])
- return window;
- }
- return base;
+ for (i = 0; i < skip_num; i++)
+ if (base == skip[i])
+ return window;
+
+ }
+
+ return base;
}
- iter_children = xcb_query_tree_children_iterator(reply_query_tree);
- for (; iter_children.rem; xcb_window_next(&iter_children))
+ wins = xcb_query_tree_children(reply_query_tree);
+ tree_c_len = xcb_query_tree_children_length(reply_query_tree);
+ for(i = 0; i < tree_c_len; i++)
{
if (skip)
{
int j;
for (j = 0; j < skip_num; j++)
- if (*iter_children.data == skip[j])
- continue;
+ if (wins[i] == skip[j])
+ continue;
+
}
- child = _ecore_x_window_at_xy_get(*iter_children.data, win_x, win_y, x, y, skip, skip_num);
+
+ child = _ecore_x_window_at_xy_get(wins[i], win_x, win_y, x, y, skip, skip_num);
if (child)
{
free(reply_query_tree);
{
int i;
- for (i = 0; i < skip_num; i++)
- if (base == skip[i])
- {
- /* We return 0. child has an xid equal to 0 */
- free(reply_query_tree);
- return child;
- }
+ for (i = 0; i < skip_num; i++)
+ if (base == skip[i])
+ {
+ /* We return 0. child has an xid equal to 0 */
+ free(reply_query_tree);
+ return child;
+ }
+
}
free(reply_query_tree);
return base;
-}
+} /* _ecore_x_window_at_xy_get */
/**
* @defgroup Ecore_X_Window_Geometry_Group X Window Geometry Functions
*/
EAPI Ecore_X_Window
ecore_x_window_at_xy_get(int x,
- int y)
+ int y)
{
Ecore_X_Window window;
Ecore_X_Window root;
ecore_x_ungrab();
return window ? window : root;
-}
+} /* ecore_x_window_at_xy_get */
/**
* Retrieves the top, visible window at the given location,
*/
EAPI Ecore_X_Window
ecore_x_window_at_xy_with_skip_get(int x,
- int y,
- Ecore_X_Window *skip,
- int skip_num)
+ int y,
+ Ecore_X_Window *skip,
+ int skip_num)
{
Ecore_X_Window window;
Ecore_X_Window root;
ecore_x_ungrab();
return window ? window : root;
-}
+} /* ecore_x_window_at_xy_with_skip_get */
/**
* Retrieves the top, visible window at the given location,
ecore_x_ungrab();
return window ? window : begin;
-}
-
-
+} /* ecore_x_window_at_xy_begin_get */
/* FIXME: Should I provide the replies (or the cookies), instead of
creating them in the function ? */
uint8_t override_redirect,
uint8_t save_under)
{
- uint32_t value_list[10];
- xcb_depth_iterator_t iter_depth;
- xcb_visualtype_iterator_t iter_visualtype;
+ uint32_t value_list[10];
+ xcb_depth_iterator_t iter_depth;
+ xcb_visualtype_iterator_t iter_visualtype;
xcb_render_query_pict_formats_cookie_t cookie_pict_format;
xcb_render_query_pict_formats_reply_t *rep_pict_format;
- Ecore_X_Screen *screen = NULL;
- Ecore_X_Window win = { 0 };
- xcb_visualid_t vis = { 0 };
- Ecore_X_Colormap colormap;
- uint32_t value_mask;
+ Ecore_X_Screen *screen = NULL;
+ Ecore_X_Window win = { 0 };
+ xcb_visualid_t vis = { 0 };
+ Ecore_X_Colormap colormap;
+ uint32_t value_mask;
cookie_pict_format = xcb_render_query_pict_formats_unchecked(_ecore_xcb_conn);
if (parent == 0)
{
parent = ((xcb_screen_t *)_ecore_xcb_screen)->root;
- screen = ((xcb_screen_t *)_ecore_xcb_screen);
+ screen = ((xcb_screen_t *)_ecore_xcb_screen);
}
else
{
- xcb_screen_iterator_t iter_screen;
+ xcb_screen_iterator_t iter_screen;
xcb_get_geometry_reply_t *rep;
- Ecore_X_Drawable draw;
- Ecore_X_Window root;
+ Ecore_X_Drawable draw;
+ Ecore_X_Window root;
draw = parent;
rep = xcb_get_geometry_reply(_ecore_xcb_conn,
draw),
NULL);
if (!rep)
- return win;
+ return win;
root = rep->root;
{
if (iter_screen.data->root == root)
{
- screen = iter_screen.data;
+ screen = iter_screen.data;
}
}
}
+
if (!screen)
- return win;
+ return win;
/* we get the X visual types */
iter_depth = xcb_screen_allowed_depths_iterator(screen);
for (; iter_depth.rem; xcb_depth_next(&iter_depth)) {
- if (iter_depth.data->depth == 32) {
- iter_visualtype = xcb_depth_visuals_iterator(iter_depth.data);
- break;
- }
- }
+ if (iter_depth.data->depth == 32)
+ {
+ iter_visualtype = xcb_depth_visuals_iterator(iter_depth.data);
+ break;
+ }
+ }
/* we get the X render visual id */
rep_pict_format = xcb_render_query_pict_formats_reply(_ecore_xcb_conn,
cookie_pict_format,
NULL);
if (!rep_pict_format)
- return win;
+ return win;
for (; iter_visualtype.rem; xcb_visualtype_next(&iter_visualtype)) {
- if (iter_visualtype.data->_class == XCB_VISUAL_CLASS_TRUE_COLOR) {
- xcb_render_pictforminfo_iterator_t iter_forminfo;
- xcb_render_pictscreen_iterator_t iter_pictscreen;
- xcb_render_pictformat_t pict_format = { 0 };
-
- iter_forminfo = xcb_render_query_pict_formats_formats_iterator(rep_pict_format);
- for (; iter_forminfo.rem; xcb_render_pictforminfo_next(&iter_forminfo)) {
- if (iter_forminfo.data->type == XCB_RENDER_PICT_TYPE_DIRECT &&
- iter_forminfo.data->direct.alpha_mask && iter_forminfo.data->depth == 32) {
- pict_format = iter_forminfo.data->id;
- break;
- }
- }
- if (pict_format == 0) {
- free(rep_pict_format);
- return win;
- }
- iter_pictscreen = xcb_render_query_pict_formats_screens_iterator(rep_pict_format);
- for (; iter_pictscreen.rem; xcb_render_pictscreen_next(&iter_pictscreen)) {
- xcb_render_pictdepth_iterator_t iter_depth;
-
- iter_depth = xcb_render_pictscreen_depths_iterator(iter_pictscreen.data);
- for (; iter_depth.rem; xcb_render_pictdepth_next(&iter_depth)) {
- xcb_render_pictvisual_iterator_t iter_visual;
-
- iter_visual = xcb_render_pictdepth_visuals_iterator(iter_depth.data);
- for (; iter_visual.rem; xcb_render_pictvisual_next(&iter_visual)) {
- if ((iter_visual.data->visual == iter_visualtype.data->visual_id) &&
- (pict_format == iter_visual.data->format)) {
- vis = iter_visual.data->visual;
- break;
- }
+ if (iter_visualtype.data->_class == XCB_VISUAL_CLASS_TRUE_COLOR)
+ {
+ xcb_render_pictforminfo_iterator_t iter_forminfo;
+ xcb_render_pictscreen_iterator_t iter_pictscreen;
+ xcb_render_pictformat_t pict_format = { 0 };
+
+ iter_forminfo = xcb_render_query_pict_formats_formats_iterator(rep_pict_format);
+ for (; iter_forminfo.rem; xcb_render_pictforminfo_next(&iter_forminfo)) {
+ if (iter_forminfo.data->type == XCB_RENDER_PICT_TYPE_DIRECT &&
+ iter_forminfo.data->direct.alpha_mask && iter_forminfo.data->depth == 32)
+ {
+ pict_format = iter_forminfo.data->id;
+ break;
+ }
+ }
+ if (pict_format == 0)
+ {
+ free(rep_pict_format);
+ return win;
}
- }
- }
- }
- }
+
+ iter_pictscreen = xcb_render_query_pict_formats_screens_iterator(rep_pict_format);
+ for (; iter_pictscreen.rem; xcb_render_pictscreen_next(&iter_pictscreen)) {
+ xcb_render_pictdepth_iterator_t iter_depth;
+
+ iter_depth = xcb_render_pictscreen_depths_iterator(iter_pictscreen.data);
+ for (; iter_depth.rem; xcb_render_pictdepth_next(&iter_depth)) {
+ xcb_render_pictvisual_iterator_t iter_visual;
+
+ iter_visual = xcb_render_pictdepth_visuals_iterator(iter_depth.data);
+ for (; iter_visual.rem; xcb_render_pictvisual_next(&iter_visual)) {
+ if ((iter_visual.data->visual == iter_visualtype.data->visual_id) &&
+ (pict_format == iter_visual.data->format))
+ {
+ vis = iter_visual.data->visual;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
free(rep_pict_format);
if (vis == 0)
- return win;
+ return win;
colormap = xcb_generate_id(_ecore_xcb_conn);
xcb_create_colormap(_ecore_xcb_conn, XCB_COLORMAP_ALLOC_NONE, colormap, parent, vis);
value_mask =
- XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL | XCB_CW_BIT_GRAVITY |
- XCB_CW_WIN_GRAVITY | XCB_CW_BACKING_STORE | XCB_CW_OVERRIDE_REDIRECT |
- XCB_CW_SAVE_UNDER | XCB_CW_EVENT_MASK | XCB_CW_DONT_PROPAGATE |
- XCB_CW_COLORMAP;
-
- value_list[0] = XCB_NONE;
- value_list[1] = 0;
- value_list[2] = XCB_GRAVITY_NORTH_WEST;
- value_list[3] = XCB_GRAVITY_NORTH_WEST;
- value_list[4] = XCB_BACKING_STORE_NOT_USEFUL;
- value_list[5] = override_redirect;
- value_list[6] = save_under;
- value_list[7] =
- XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE |
- XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE |
- XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW |
- XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_EXPOSURE |
- XCB_EVENT_MASK_VISIBILITY_CHANGE | XCB_EVENT_MASK_STRUCTURE_NOTIFY |
- XCB_EVENT_MASK_FOCUS_CHANGE | XCB_EVENT_MASK_PROPERTY_CHANGE |
- XCB_EVENT_MASK_COLOR_MAP_CHANGE;
- value_list[8] = XCB_EVENT_MASK_NO_EVENT;
- value_list[9] = colormap;
+ XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL | XCB_CW_BIT_GRAVITY |
+ XCB_CW_WIN_GRAVITY | XCB_CW_BACKING_STORE | XCB_CW_OVERRIDE_REDIRECT |
+ XCB_CW_SAVE_UNDER | XCB_CW_EVENT_MASK | XCB_CW_DONT_PROPAGATE |
+ XCB_CW_COLORMAP;
+
+ value_list[0] = XCB_NONE;
+ value_list[1] = 0;
+ value_list[2] = XCB_GRAVITY_NORTH_WEST;
+ value_list[3] = XCB_GRAVITY_NORTH_WEST;
+ value_list[4] = XCB_BACKING_STORE_NOT_USEFUL;
+ value_list[5] = override_redirect;
+ value_list[6] = save_under;
+ value_list[7] =
+ XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE |
+ XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE |
+ XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW |
+ XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_EXPOSURE |
+ XCB_EVENT_MASK_VISIBILITY_CHANGE | XCB_EVENT_MASK_STRUCTURE_NOTIFY |
+ XCB_EVENT_MASK_FOCUS_CHANGE | XCB_EVENT_MASK_PROPERTY_CHANGE |
+ XCB_EVENT_MASK_COLOR_MAP_CHANGE;
+ value_list[8] = XCB_EVENT_MASK_NO_EVENT;
+ value_list[9] = colormap;
win = xcb_generate_id(_ecore_xcb_conn);
xcb_create_window(_ecore_xcb_conn,
xcb_free_colormap(_ecore_xcb_conn, colormap);
if (parent == ((xcb_screen_t *)_ecore_xcb_screen)->root)
- ecore_x_window_defaults_set(win);
+ ecore_x_window_defaults_set(win);
return win;
-}
-#endif /* ECORE_XCB_RENDER */
-
+} /* _ecore_x_window_argb_internal_new */
+#endif /* ECORE_XCB_RENDER */
/* FIXME: round trip */
EAPI int
ecore_x_window_argb_get(Ecore_X_Window win)
{
- uint8_t ret = 0;
+ uint8_t ret = 0;
#ifdef ECORE_XCB_RENDER
- xcb_render_pictforminfo_iterator_t iter_forminfo;
- xcb_render_pictscreen_iterator_t iter_pictscreen;
- xcb_render_pictformat_t pict_format = { 0 };
+ xcb_render_pictforminfo_iterator_t iter_forminfo;
+ xcb_render_pictscreen_iterator_t iter_pictscreen;
+ xcb_render_pictformat_t pict_format = { 0 };
xcb_render_query_pict_formats_reply_t *rep_pictformat;
- xcb_get_window_attributes_reply_t *rep;
- xcb_visualid_t visual;
+ xcb_get_window_attributes_reply_t *rep;
+ xcb_visualid_t visual;
rep = xcb_get_window_attributes_reply(_ecore_xcb_conn,
xcb_get_window_attributes_unchecked(_ecore_xcb_conn,
win),
NULL);
if (!rep)
- return ret;
+ return ret;
visual = rep->visual;
xcb_render_query_pict_formats_unchecked(_ecore_xcb_conn),
NULL);
if (!rep_pictformat)
- return ret;
+ return ret;
iter_forminfo = xcb_render_query_pict_formats_formats_iterator(rep_pictformat);
for (; iter_forminfo.rem; xcb_render_pictforminfo_next(&iter_forminfo))
#endif /* ECORE_XCB_RENDER */
return ret;
-}
-
-
-
+} /* ecore_x_window_argb_get */
/**
* Set if a window should be ignored.
if (ignore)
{
- if (ignore_list)
- {
- for (i = 0; i < ignore_num; i++)
- {
- if (window == ignore_list[i])
- return;
- }
- ignore_list = realloc(ignore_list, (ignore_num + 1) * sizeof(Ecore_X_Window));
- if (!ignore_list) return;
- ignore_list[ignore_num++] = window;
- }
- else
- {
- ignore_num = 0;
- ignore_list = malloc(sizeof(Ecore_X_Window));
- ignore_list[ignore_num++] = window;
- }
+ if (ignore_list)
+ {
+ for (i = 0; i < ignore_num; i++)
+ {
+ if (window == ignore_list[i])
+ return;
+ }
+ ignore_list = realloc(ignore_list, (ignore_num + 1) * sizeof(Ecore_X_Window));
+ if (!ignore_list)
+ return;
+
+ ignore_list[ignore_num++] = window;
+ }
+ else
+ {
+ ignore_num = 0;
+ ignore_list = malloc(sizeof(Ecore_X_Window));
+ ignore_list[ignore_num++] = window;
+ }
}
else
{
- if (!ignore_list) return;
- for (i = 0, j = 0; i < ignore_num; i++)
- {
- if (window != ignore_list[i])
- ignore_list[i] = ignore_list[j++];
- else
- ignore_num--;
- }
- ignore_list = realloc(ignore_list, ignore_num * sizeof(Ecore_X_Window));
+ if (!ignore_list)
+ return;
+
+ for (i = 0, j = 0; i < ignore_num; i++)
+ {
+ if (window != ignore_list[i])
+ ignore_list[i] = ignore_list[j++];
+ else
+ ignore_num--;
+ }
+ ignore_list = realloc(ignore_list, ignore_num * sizeof(Ecore_X_Window));
}
-}
+} /* ecore_x_window_ignore_set */
/**
* Get the ignore list
EAPI Ecore_X_Window *
ecore_x_window_ignore_list(int *num)
{
- if (num) *num = ignore_num;
+ if (num)
+ *num = ignore_num;
+
return ignore_list;
-}
+} /* ecore_x_window_ignore_list */
/**
* Retrieves the size of the given window.
window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
ecore_x_drawable_geometry_get(window, NULL, NULL, width, height);
-}
+} /* ecore_x_window_size_get */
/**
* Retrieves the geometry of the given window.
window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
ecore_x_drawable_geometry_get(window, x, y, width, height);
-}
+} /* ecore_x_window_geometry_get */
/**
* Retrieves the width of the border of the given window.
return 0;
return ecore_x_drawable_border_width_get(win);
-}
+} /* ecore_x_window_border_width_get */
/**
* Retrieves the depth of the given window.
ecore_x_window_depth_get(Ecore_X_Window win)
{
return ecore_x_drawable_depth_get(win);
-}
+} /* ecore_x_window_depth_get */
+
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#include <stdlib.h>
#include <string.h>
#include "ecore_xcb_private.h"
#include "Ecore_X_Atoms.h"
-
/*
* 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 *val,
unsigned int num)
{
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win,
atom, ECORE_X_ATOM_CARDINAL, 32, num, (const void *)val);
-}
+} /* ecore_x_window_prop_card32_set */
/**
* Sends the GetProperty request.
*/
EAPI void
ecore_x_window_prop_card32_get_prefetch(Ecore_X_Window window,
- Ecore_X_Atom atom)
+ Ecore_X_Atom atom)
{
xcb_get_property_cookie_t cookie;
ECORE_X_ATOM_CARDINAL,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
-
+} /* ecore_x_window_prop_card32_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_window_prop_card32_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_window_prop_card32_get_fetch */
/*
* Get CARD32 (array) property
*/
EAPI int
ecore_x_window_prop_card32_get(Ecore_X_Window win __UNUSED__,
- Ecore_X_Atom atom __UNUSED__,
- unsigned int *val,
- unsigned int len)
+ Ecore_X_Atom atom __UNUSED__,
+ unsigned int *val,
+ unsigned int len)
{
xcb_get_property_reply_t *reply;
return -1;
if (reply->value_len < len)
- len = xcb_get_property_value_length(reply);
+ len = xcb_get_property_value_length(reply);
if (val)
memcpy(val, xcb_get_property_value(reply), len);
return (int)len;
-}
+} /* ecore_x_window_prop_card32_get */
/*
* Get CARD32 (array) property of any length
*/
EAPI int
ecore_x_window_prop_card32_list_get(Ecore_X_Window win __UNUSED__,
- Ecore_X_Atom atom __UNUSED__,
- unsigned int **plist)
+ Ecore_X_Atom atom __UNUSED__,
+ unsigned int **plist)
{
xcb_get_property_reply_t *reply;
- int num = -1;
+ int num = -1;
if (plist)
*plist = NULL;
else if ((reply->type == ECORE_X_ATOM_CARDINAL) &&
(reply->format == 32))
{
- uint32_t *val;
-
- num = xcb_get_property_value_length(reply);
- if (plist)
- {
- val = (uint32_t *)malloc (num);
- if (!val)
- goto error;
-
- memcpy(val, xcb_get_property_value(reply), num);
- *plist = val;
- }
+ uint32_t *val;
+
+ num = xcb_get_property_value_length(reply);
+ if (plist)
+ {
+ val = (uint32_t *)malloc (num);
+ if (!val)
+ goto error;
+
+ memcpy(val, xcb_get_property_value(reply), num);
+ *plist = val;
+ }
}
- error:
+error:
return num;
-}
+} /* ecore_x_window_prop_card32_list_get */
/*
* Set X ID (array) property
EAPI void
ecore_x_window_prop_xid_set(Ecore_X_Window win,
Ecore_X_Atom atom,
- Ecore_X_Atom type,
+ Ecore_X_Atom type,
Ecore_X_ID *xids,
- unsigned int num)
+ unsigned int num)
{
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win,
atom, type, 32, num, xids);
-}
+} /* ecore_x_window_prop_xid_set */
/**
* Sends the GetProperty request.
type,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
-
+} /* ecore_x_window_prop_xid_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_window_prop_xid_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_window_prop_xid_get_fetch */
/*
* Get X ID (array) property
*/
EAPI int
ecore_x_window_prop_xid_get(Ecore_X_Window win __UNUSED__,
- Ecore_X_Atom atom __UNUSED__,
- Ecore_X_Atom type __UNUSED__,
- Ecore_X_ID *xids,
- unsigned int len)
+ Ecore_X_Atom atom __UNUSED__,
+ Ecore_X_Atom type __UNUSED__,
+ Ecore_X_ID *xids,
+ unsigned int len)
{
xcb_get_property_reply_t *reply;
- int num = len;
+ int num = len;
reply = _ecore_xcb_reply_get();
if (!reply)
else if (reply->format == 32)
{
if (reply->value_len < len)
- num = xcb_get_property_value_length(reply);
+ num = xcb_get_property_value_length(reply);
if (xids)
memcpy(xids, xcb_get_property_value(reply), num);
}
return num;
-}
+} /* ecore_x_window_prop_xid_get */
/*
* Get X ID (array) property
*/
EAPI int
ecore_x_window_prop_xid_list_get(Ecore_X_Window win __UNUSED__,
- Ecore_X_Atom atom __UNUSED__,
- Ecore_X_Atom type __UNUSED__,
- Ecore_X_ID **pxids)
+ Ecore_X_Atom atom __UNUSED__,
+ Ecore_X_Atom type __UNUSED__,
+ Ecore_X_ID **pxids)
{
xcb_get_property_reply_t *reply;
- int num = -1;
+ int num = -1;
if (pxids)
*pxids = NULL;
else if ((reply->type == ECORE_X_ATOM_CARDINAL) &&
(reply->format == 32))
{
- uint32_t *val;
-
- num = xcb_get_property_value_length(reply);
- if (pxids)
- {
- val = (uint32_t *)malloc (num);
- if (!val)
- return -1;
-
- memcpy(val, xcb_get_property_value(reply), num);
- *pxids = val;
- }
+ uint32_t *val;
+
+ num = xcb_get_property_value_length(reply);
+ if (pxids)
+ {
+ val = (uint32_t *)malloc (num);
+ if (!val)
+ return -1;
+
+ memcpy(val, xcb_get_property_value(reply), num);
+ *pxids = val;
+ }
}
return num;
-}
+} /* ecore_x_window_prop_xid_list_get */
/*
* Remove/add/toggle X ID list item.
int op)
{
Ecore_X_ID *lst;
- int i;
- int num;
+ int i;
+ int num;
num = ecore_x_window_prop_xid_list_get(win, atom, type, &lst);
if (num < 0)
- return; /* Error - assuming invalid window */
+ return; /* Error - assuming invalid window */
/* Is it there? */
for (i = 0; i < num; i++)
{
- if (lst[i] == item)
- break;
+ 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];
+ /* 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;
+ /* 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:
+done:
if (lst)
free(lst);
-}
+} /* ecore_x_window_prop_xid_list_change */
/*
* Set Atom (array) property
unsigned int num)
{
ecore_x_window_prop_xid_set(win, atom, ECORE_X_ATOM_ATOM, list, num);
-}
+} /* ecore_x_window_prop_atom_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_ATOM,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
-
+} /* ecore_x_window_prop_atom_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_window_prop_atom_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_window_prop_atom_get_fetch */
/*
* Get Atom (array) property
ecore_x_window_prop_atom_get(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Atom *list,
- unsigned int len)
+ unsigned int len)
{
return ecore_x_window_prop_xid_get(win, atom, ECORE_X_ATOM_ATOM, list, len);
-}
+} /* ecore_x_window_prop_atom_get */
/*
* Get Atom (array) property
Ecore_X_Atom **plist)
{
return ecore_x_window_prop_xid_list_get(win, atom, ECORE_X_ATOM_ATOM, plist);
-}
+} /* ecore_x_window_prop_atom_list_get */
/*
* Remove/add/toggle atom list item.
int op)
{
ecore_x_window_prop_xid_list_change(win, atom, ECORE_X_ATOM_ATOM, item, op);
-}
+} /* ecore_x_window_prop_atom_list_change */
/*
* Set Window (array) property
unsigned int num)
{
ecore_x_window_prop_xid_set(win, atom, ECORE_X_ATOM_WINDOW, list, num);
-}
+} /* ecore_x_window_prop_window_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_WINDOW,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
-
+} /* ecore_x_window_prop_window_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_window_prop_window_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_window_prop_window_get_fetch */
/*
* Get Window (array) property
unsigned int len)
{
return ecore_x_window_prop_xid_get(win, atom, ECORE_X_ATOM_WINDOW, list, len);
-}
+} /* ecore_x_window_prop_window_get */
/*
* Get Window (array) property
Ecore_X_Window **plist)
{
return ecore_x_window_prop_xid_list_get(win, atom, ECORE_X_ATOM_WINDOW, plist);
-}
+} /* ecore_x_window_prop_window_list_get */
/**
* To be documented.
ecore_x_window_prop_any_type(void)
{
return XCB_GET_PROPERTY_TYPE_ANY;
-}
+} /* ecore_x_window_prop_any_type */
/**
* To be documented.
void *data,
int number)
{
- if (window == 0) window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+ if (window == 0)
+ window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
property, type,
size, number, data);
-}
+} /* ecore_x_window_prop_property_set */
/**
* Sends the GetProperty request.
window ? window : ((xcb_screen_t *)_ecore_xcb_screen)->root,
property, type, 0, LONG_MAX);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
-
+} /* ecore_x_window_prop_property_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_window_prop_property_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_window_prop_property_get_fetch */
/**
* To be documented.
* FIXME: To be fixed.
*/
EAPI int
-ecore_x_window_prop_property_get(Ecore_X_Window window __UNUSED__,
- Ecore_X_Atom property __UNUSED__,
- Ecore_X_Atom type __UNUSED__,
- int size __UNUSED__,
- unsigned char **data,
- int *num)
+ecore_x_window_prop_property_get(Ecore_X_Window window __UNUSED__,
+ Ecore_X_Atom property __UNUSED__,
+ Ecore_X_Atom type __UNUSED__,
+ int size __UNUSED__,
+ unsigned char **data,
+ int *num)
{
xcb_get_property_reply_t *reply;
/* make sure these are initialized */
- if (num) *num = 0L;
+ if (num)
+ *num = 0L;
if (data)
- *data = NULL;
+ *data = NULL;
else /* we can't store the retrieved data, so just return */
- return 0;
+ return 0;
reply = _ecore_xcb_reply_get();
if (!reply)
- return 0;
+ return 0;
if ((reply->format != size) ||
(reply->value_len == 0))
if (!*data)
return 0;
- memcpy(*data, xcb_get_property_value(reply),
+ memcpy(*data, xcb_get_property_value(reply),
xcb_get_property_value_length(reply));
if (num)
*num = reply->value_len;
return reply->format;
-}
+} /* ecore_x_window_prop_property_get */
EAPI void
ecore_x_window_prop_property_del(Ecore_X_Window window,
Ecore_X_Atom property)
{
xcb_delete_property(_ecore_xcb_conn, window, property);
-}
+} /* ecore_x_window_prop_property_del */
/**
* Sends the ListProperties request.
cookie = xcb_list_properties_unchecked(_ecore_xcb_conn, window);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
-
+} /* ecore_x_window_prop_list_prefetch */
/**
* Gets the reply of the ListProperties request sent by ecore_x_window_prop_list_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_list_properties_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
-
+} /* ecore_x_window_prop_list_fetch */
/**
* To be documented.
*/
EAPI Ecore_X_Atom *
ecore_x_window_prop_list(Ecore_X_Window window __UNUSED__,
- int *num_ret)
+ int *num_ret)
{
xcb_list_properties_reply_t *reply;
- Ecore_X_Atom *atoms;
+ Ecore_X_Atom *atoms;
- if (num_ret) *num_ret = 0;
+ if (num_ret)
+ *num_ret = 0;
reply = _ecore_xcb_reply_get();
if (!reply)
atoms = (Ecore_X_Atom *)malloc(reply->atoms_len * sizeof(Ecore_X_Atom));
if (!atoms)
return NULL;
+
memcpy(atoms,
xcb_list_properties_atoms(reply),
reply->atoms_len * sizeof(Ecore_X_Atom));
if(num_ret)
- *num_ret = reply->atoms_len;
+ *num_ret = reply->atoms_len;
return atoms;
-}
+} /* ecore_x_window_prop_list */
/**
* Set a window string property.
Ecore_X_Atom type,
const char *str)
{
- if (win == 0) win = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+ if (win == 0)
+ win = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win,
- type, ECORE_X_ATOM_UTF8_STRING,
- 8, strlen(str), str);
-}
+ type, ECORE_X_ATOM_UTF8_STRING,
+ 8, strlen(str), str);
+} /* ecore_x_window_prop_string_set */
/**
* Sends the GetProperty request.
window ? window : ((xcb_screen_t *)_ecore_xcb_screen)->root,
type, XCB_GET_PROPERTY_TYPE_ANY, 0L, 1000000L);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
-
+} /* ecore_x_window_prop_string_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_window_prop_string_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_window_prop_string_get_fetch */
/**
* Get a window string property.
*/
EAPI char *
ecore_x_window_prop_string_get(Ecore_X_Window window __UNUSED__,
- Ecore_X_Atom type __UNUSED__)
+ Ecore_X_Atom type __UNUSED__)
{
xcb_get_property_reply_t *reply;
- char *str = NULL;
+ char *str = NULL;
reply = _ecore_xcb_reply_get();
if (!reply)
- return NULL;
+ return NULL;
if (reply->type == ECORE_X_ATOM_UTF8_STRING)
{
}
else
{
- /* FIXME: to be done... */
+ /* FIXME: to be done... */
/* #ifdef X_HAVE_UTF8_STRING */
/* s = Xutf8TextPropertyToTextList(_ecore_xcb_conn, &xtp, */
}
return str;
-}
+} /* ecore_x_window_prop_string_get */
/* FIXME : round trips because of GetWMProtocols */
/* should we rewrite its code ? */
ecore_x_window_prop_protocol_isset(Ecore_X_Window window,
Ecore_X_WM_Protocol protocol)
{
- xcb_get_property_cookie_t cookie;
+ xcb_get_property_cookie_t cookie;
xcb_get_wm_protocols_reply_t protocols;
- Ecore_X_Atom proto;
- uint32_t i;
- uint8_t ret = 0;
+ Ecore_X_Atom proto;
+ uint32_t i;
+ uint8_t ret = 0;
/* check for invalid values */
if (protocol >= ECORE_X_WM_PROTOCOL_NUM)
- return ret;
+ return ret;
proto = _ecore_xcb_atoms_wm_protocols[protocol];
cookie = xcb_get_wm_protocols(_ecore_xcb_conn, window, ECORE_X_ATOM_WM_PROTOCOLS);
if (!xcb_get_wm_protocols_reply(_ecore_xcb_conn, cookie, &protocols, NULL))
- return ret;
+ return ret;
for (i = 0; i < protocols.atoms_len; i++)
- if (protocols.atoms[i] == proto)
- {
- ret = 1;
- break;
- }
+ if (protocols.atoms[i] == proto)
+ {
+ ret = 1;
+ break;
+ }
xcb_get_wm_protocols_reply_wipe(&protocols);
return ret;
-}
+} /* ecore_x_window_prop_protocol_isset */
/**
* To be documented.
ecore_x_window_prop_protocol_list_get(Ecore_X_Window window,
int *num_ret)
{
- xcb_get_property_cookie_t cookie;
+ xcb_get_property_cookie_t cookie;
xcb_get_wm_protocols_reply_t protocols;
- Ecore_X_WM_Protocol *prot_ret = NULL;
- uint32_t protos_count;
- uint32_t i;
+ Ecore_X_WM_Protocol *prot_ret = NULL;
+ uint32_t protos_count;
+ uint32_t i;
cookie = xcb_get_wm_protocols(_ecore_xcb_conn, window, ECORE_X_ATOM_WM_PROTOCOLS);
if (!xcb_get_wm_protocols_reply(_ecore_xcb_conn, cookie, &protocols, NULL))
return NULL;
- if ((protocols.atoms_len <= 0)) return NULL;
+ if ((protocols.atoms_len <= 0))
+ return NULL;
prot_ret = calloc(1, protocols.atoms_len * sizeof(Ecore_X_WM_Protocol));
if (!prot_ret)
{
- xcb_get_wm_protocols_reply_wipe(&protocols);
- return NULL;
+ xcb_get_wm_protocols_reply_wipe(&protocols);
+ return NULL;
}
+
for (i = 0; i < protocols.atoms_len; i++)
{
- Ecore_X_WM_Protocol j;
-
- prot_ret[i] = -1;
- for (j = 0; j < ECORE_X_WM_PROTOCOL_NUM; j++)
- {
- if (_ecore_xcb_atoms_wm_protocols[j] == protocols.atoms[i])
- prot_ret[i] = j;
- }
+ Ecore_X_WM_Protocol j;
+
+ prot_ret[i] = -1;
+ for (j = 0; j < ECORE_X_WM_PROTOCOL_NUM; j++)
+ {
+ if (_ecore_xcb_atoms_wm_protocols[j] == protocols.atoms[i])
+ prot_ret[i] = j;
+ }
}
xcb_get_wm_protocols_reply_wipe(&protocols);
*num_ret = protos_count;
return prot_ret;
-}
+} /* ecore_x_window_prop_protocol_list_get */
+
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
/* #include "Ecore.h" */
#include "ecore_xcb_private.h"
#include "Ecore_X.h"
-
-typedef struct _Shadow Shadow;
+typedef struct _Shadow Shadow;
struct _Shadow
{
- Shadow *parent;
- Shadow **children;
- Ecore_X_Window win;
- int children_num;
- short x, y;
- unsigned short w, h;
+ Shadow *parent;
+ Shadow **children;
+ Ecore_X_Window win;
+ int children_num;
+ short x, y;
+ unsigned short w, h;
};
static int shadow_count = 0;
static Shadow **shadow_base = NULL;
static int shadow_num = 0;
-
/* FIXME: round trips */
static Shadow *
_ecore_x_window_tree_walk(Ecore_X_Window window)
{
- Shadow *s;
- Shadow **sl;
+ Shadow *s;
+ Shadow **sl;
xcb_get_window_attributes_reply_t *reply_attr;
- xcb_get_geometry_reply_t *reply_geom;
- xcb_query_tree_reply_t *reply_tree;
+ xcb_get_geometry_reply_t *reply_geom;
+ xcb_query_tree_reply_t *reply_tree;
xcb_get_window_attributes_cookie_t cookie_attr;
- xcb_get_geometry_cookie_t cookie_geom;
- xcb_query_tree_cookie_t cookie_tree;
- int i;
- int j;
+ xcb_get_geometry_cookie_t cookie_geom;
+ xcb_query_tree_cookie_t cookie_tree;
+ int i;
+ int j;
cookie_attr = xcb_get_window_attributes_unchecked(_ecore_xcb_conn, window);
cookie_geom = xcb_get_geometry_unchecked(_ecore_xcb_conn, window);
if (!reply_attr)
{
reply_geom = xcb_get_geometry_reply(_ecore_xcb_conn, cookie_geom, NULL);
- if (reply_geom) free(reply_geom);
+ if (reply_geom)
+ free(reply_geom);
+
reply_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_tree, NULL);
- if (reply_tree) free(reply_tree);
+ if (reply_tree)
+ free(reply_tree);
+
return NULL;
}
if (reply_attr->map_state != XCB_MAP_STATE_VIEWABLE)
{
reply_geom = xcb_get_geometry_reply(_ecore_xcb_conn, cookie_geom, NULL);
- if (reply_geom) free(reply_geom);
+ if (reply_geom)
+ free(reply_geom);
+
reply_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_tree, NULL);
- if (reply_tree) free(reply_tree);
+ if (reply_tree)
+ free(reply_tree);
+
return NULL;
}
free(reply_attr);
s = calloc(1, sizeof(Shadow));
- if (!s) return NULL;
+ if (!s)
+ return NULL;
reply_geom = xcb_get_geometry_reply(_ecore_xcb_conn, cookie_geom, NULL);
if (!reply_geom)
{
reply_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_tree, NULL);
- if (reply_tree) free(reply_tree);
+ if (reply_tree)
+ free(reply_tree);
+
return NULL;
}
reply_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_tree, NULL);
if (reply_tree)
-/* if (XQueryTree(_ecore_xcb_conn, s->win, &root_win, &parent_win, */
-/* &list, &num)) */
{
+/* if (XQueryTree(_ecore_xcb_conn, s->win, &root_win, &parent_win, */
+/* &list, &num)) */
xcb_window_t *list;
- int num;
+ int num;
num = xcb_query_tree_children_length(reply_tree);
list = xcb_query_tree_children(reply_tree);
- s->children = calloc(1, sizeof(Shadow *) * num);
- if (s->children)
- {
- s->children_num = num;
- for (i = 0; i < num; i++)
- {
- s->children[i] = _ecore_x_window_tree_walk(list[i]);
- if (s->children[i]) s->children[i]->parent = s;
- }
- /* compress list down */
- j = 0;
- for (i = 0; i < num; i++)
- {
- if (s->children[i])
- {
- s->children[j] = s->children[i];
- j++;
- }
- }
- if (j == 0)
- {
- free(s->children);
- s->children = NULL;
- s->children_num = 0;
- }
- else
- {
- s->children_num = j;
- sl = realloc(s->children, sizeof(Shadow *) * j);
- if (sl) s->children = sl;
- }
- }
+ s->children = calloc(1, sizeof(Shadow *) * num);
+ if (s->children)
+ {
+ s->children_num = num;
+ for (i = 0; i < num; i++)
+ {
+ s->children[i] = _ecore_x_window_tree_walk(list[i]);
+ if (s->children[i])
+ s->children[i]->parent = s;
+ }
+ /* compress list down */
+ j = 0;
+ for (i = 0; i < num; i++)
+ {
+ if (s->children[i])
+ {
+ s->children[j] = s->children[i];
+ j++;
+ }
+ }
+ if (j == 0)
+ {
+ free(s->children);
+ s->children = NULL;
+ s->children_num = 0;
+ }
+ else
+ {
+ s->children_num = j;
+ sl = realloc(s->children, sizeof(Shadow *) * j);
+ if (sl)
+ s->children = sl;
+ }
+ }
+
free(reply_tree);
}
+
return s;
-}
+} /* _ecore_x_window_tree_walk */
static void
_ecore_x_window_tree_shadow_free1(Shadow *s)
{
int i;
- if (!s) return;
+ 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);
+ 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);
-}
+} /* _ecore_x_window_tree_shadow_free1 */
static void
_ecore_x_window_tree_shadow_free(void)
{
int i;
- if (!shadow_base) return;
+ 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]);
+ if (!shadow_base[i])
+ continue;
+
+ _ecore_x_window_tree_shadow_free1(shadow_base[i]);
}
free(shadow_base);
shadow_base = NULL;
shadow_num = 0;
-}
+} /* _ecore_x_window_tree_shadow_free */
static void
_ecore_x_window_tree_shadow_populate(void)
{
- Ecore_X_Window *roots;
- int i, num;
+ 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);
+ 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);
}
-}
+} /* _ecore_x_window_tree_shadow_populate */
static void
_ecore_x_window_tree_shadow_start(void)
{
shadow_count++;
- if (shadow_count > 1) return;
+ if (shadow_count > 1)
+ return;
+
_ecore_x_window_tree_shadow_populate();
-}
+} /* _ecore_x_window_tree_shadow_start */
static void
_ecore_x_window_tree_shadow_stop(void)
{
shadow_count--;
- if (shadow_count != 0) return;
+ if (shadow_count != 0)
+ return;
+
_ecore_x_window_tree_shadow_free();
-}
+} /* _ecore_x_window_tree_shadow_stop */
Shadow *
_ecore_x_window_shadow_tree_find_shadow(Shadow *s, Ecore_X_Window win)
Shadow *ss;
int i;
- if (s->win == win) return s;
+ 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;
- }
+ 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;
-}
+} /* _ecore_x_window_shadow_tree_find_shadow */
Shadow *
_ecore_x_window_shadow_tree_find(Ecore_X_Window base)
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;
+ if (!shadow_base[i])
+ continue;
+
+ if ((s = _ecore_x_window_shadow_tree_find_shadow(shadow_base[i], base)))
+ return s;
}
return NULL;
-}
+} /* _ecore_x_window_shadow_tree_find */
static Ecore_X_Window
_ecore_x_window_shadow_tree_at_xy_get_shadow(Shadow *s, int bx, int by, int x, int y,
- Ecore_X_Window *skip, int skip_num)
+ Ecore_X_Window *skip, int skip_num)
{
Ecore_X_Window child;
int i, j;
wx = s->x + bx;
wy = s->y + by;
if (!((x >= wx) && (y >= wy) && (x < (wx + s->w)) && (y < (wy + s->h))))
- return 0;
+ 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;
- }
- }
- }
+ 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;
-}
+} /* _ecore_x_window_shadow_tree_at_xy_get_shadow */
static Ecore_X_Window
_ecore_x_window_shadow_tree_at_xy_get(Ecore_X_Window base, int bx, int by, int x, int y,
- Ecore_X_Window *skip, int skip_num)
+ Ecore_X_Window *skip, int skip_num)
{
Shadow *s;
if (!shadow_base)
{
- _ecore_x_window_tree_shadow_populate();
- if (!shadow_base) return 0;
+ _ecore_x_window_tree_shadow_populate();
+ if (!shadow_base)
+ return 0;
}
+
s = _ecore_x_window_shadow_tree_find(base);
- if (!s) return 0;
+ if (!s)
+ return 0;
+
return _ecore_x_window_shadow_tree_at_xy_get_shadow(s, bx, by, x, y, skip, skip_num);
-}
+} /* _ecore_x_window_shadow_tree_at_xy_get */
/**
* Retrieves the top, visible window at the given location,
ecore_x_window_shadow_tree_at_xy_with_skip_get(Ecore_X_Window base, int x, int y, Ecore_X_Window *skip, int skip_num)
{
return _ecore_x_window_shadow_tree_at_xy_get(base, 0, 0, x, y, skip, skip_num);
-}
+} /* ecore_x_window_shadow_tree_at_xy_with_skip_get */
/**
* Retrieves the parent window a given window has. This uses the shadow window
ecore_x_window_shadow_parent_get(Ecore_X_Window root, Ecore_X_Window win)
{
Shadow *s;
- int i;
+ int i;
if (!shadow_base)
{
- _ecore_x_window_tree_shadow_populate();
- if (!shadow_base) return 0;
+ _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;
- }
+ 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;
-}
+} /* ecore_x_window_shadow_parent_get */
/**
* Flushes the window shadow tree so nothing is stored.
ecore_x_window_shadow_tree_flush(void)
{
_ecore_x_window_tree_shadow_free();
-}
+} /* ecore_x_window_shadow_tree_flush */
+
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#include "ecore_xcb_private.h"
-
/**
* @defgroup Ecore_X_Xinerama_Group X Xinerama Extension Functions
*
* Functions related to the X Xinerama extension.
*/
-
#ifdef ECORE_XCB_XINERAMA
static int _xinerama_available = 0;
static xcb_xinerama_query_version_cookie_t _ecore_xcb_xinerama_init_cookie;
#endif /* ECORE_XCB_XINERAMA */
-
/* To avoid round trips, the initialization is separated in 2
functions: _ecore_xcb_xinerama_init and
_ecore_xcb_xinerama_init_finalize. The first one gets the cookies and
#ifdef ECORE_XCB_XINERAMA
if (reply && (reply->present))
_ecore_xcb_xinerama_init_cookie = xcb_xinerama_query_version_unchecked(_ecore_xcb_conn, 1, 2);
+
#endif /* ECORE_XCB_XINERAMA */
-}
+} /* _ecore_x_xinerama_init */
void
_ecore_x_xinerama_init_finalize(void)
xcb_xinerama_query_version_reply_t *reply;
reply = xcb_xinerama_query_version_reply(_ecore_xcb_conn,
- _ecore_xcb_xinerama_init_cookie, NULL);
+ _ecore_xcb_xinerama_init_cookie, NULL);
if (reply)
{
if ((reply->major >= 1) &&
(reply->minor >= 1))
- _xinerama_available = 1;
+ _xinerama_available = 1;
+
free(reply);
}
-#endif /* ECORE_XCB_XINERAMA */
-}
+#endif /* ECORE_XCB_XINERAMA */
+} /* _ecore_x_xinerama_init_finalize */
/**
* Return whether the X server supports the Xinerama Extension.
{
#ifdef ECORE_XCB_XINERAMA
return _xinerama_available;
-#else
+#else /* ifdef ECORE_XCB_XINERAMA */
return 0;
#endif /* ECORE_XCB_XINERAMA */
-}
-
+} /* ecore_x_xinerama_query */
/**
* Sends the XineramaQueryScreens request.
cookie = xcb_xinerama_query_screens_unchecked(_ecore_xcb_conn);
_ecore_xcb_cookie_cache(cookie.sequence);
#endif /* ECORE_XCB_XINERAMA */
-}
-
+} /* ecore_x_xinerama_query_screens_prefetch */
/**
* Gets the reply of the XineramaQueryScreens request sent by ecore_x_xinerama_query_screens_prefetch().
reply = xcb_xinerama_query_screens_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
#endif /* ECORE_XCB_XINERAMA */
-}
-
+} /* ecore_x_xinerama_query_screens_fetch */
/**
* Return the number of screens.
EAPI int
ecore_x_xinerama_screen_count_get(void)
{
- int screen_count = 0;
+ int screen_count = 0;
#ifdef ECORE_XCB_XINERAMA
xcb_xinerama_screen_info_iterator_t iter;
xcb_xinerama_query_screens_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return 0;
+ if (!reply)
+ return 0;
iter = xcb_xinerama_query_screens_screen_info_iterator(reply);
screen_count = iter.rem;
#endif /* ECORE_XCB_XINERAMA */
return screen_count;
-}
-
+} /* ecore_x_xinerama_screen_count_get */
/**
* Get the geometry of the screen.
reply = _ecore_xcb_reply_get();
if (!reply)
{
- if (x) *x = 0;
- if (y) *y = 0;
- if (width) *width = ((xcb_screen_t *)_ecore_xcb_screen)->width_in_pixels;
- if (height) *height = ((xcb_screen_t *)_ecore_xcb_screen)->height_in_pixels;
+ if (x)
+ *x = 0;
+
+ if (y)
+ *y = 0;
+
+ if (width)
+ *width = ((xcb_screen_t *)_ecore_xcb_screen)->width_in_pixels;
+
+ if (height)
+ *height = ((xcb_screen_t *)_ecore_xcb_screen)->height_in_pixels;
return 0;
}
{
if (screen == 0)
{
- if (x) *x = iter.data->x_org;
- if (y) *y = iter.data->y_org;
- if (width) *width = iter.data->width;
- if (height) *height = iter.data->height;
+ if (x)
+ *x = iter.data->x_org;
+
+ if (y)
+ *y = iter.data->y_org;
+
+ if (width)
+ *width = iter.data->width;
+
+ if (height)
+ *height = iter.data->height;
+
return 1;
}
}
#endif /* ECORE_XCB_XINERAMA */
- if (x) *x = 0;
- if (y) *y = 0;
- if (width) *width = ((xcb_screen_t *)_ecore_xcb_screen)->width_in_pixels;
- if (height) *height = ((xcb_screen_t *)_ecore_xcb_screen)->height_in_pixels;
+ if (x)
+ *x = 0;
+
+ if (y)
+ *y = 0;
+
+ if (width)
+ *width = ((xcb_screen_t *)_ecore_xcb_screen)->width_in_pixels;
+
+ if (height)
+ *height = ((xcb_screen_t *)_ecore_xcb_screen)->height_in_pixels;
return 0;
-}
+} /* ecore_x_xinerama_screen_geometry_get */
+
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_13.c \
ecore_x_fixes.c \
ecore_x_damage.c \
ecore_x_composite.c \
ecore_x_atoms.c \
ecore_x_region.c \
ecore_x_image.c \
-ecore_x_xi2.c
+ecore_x_xi2.c \
+ecore_x_randr.h
libecore_x_xlib_la_LIBADD = \
@Xcursor_libs@ \
$(top_builddir)/src/lib/ecore_input/libecore_input.la \
@EINA_LIBS@
-libecore_x_xlib_la_LDFLAGS = -version-info @version_info@
-
endif
EXTRA_DIST = ecore_x_private.h
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#include <stdlib.h>
#include <string.h>
#ifdef LOGRT
#include <dlfcn.h>
-#endif
+#endif /* ifdef LOGRT */
#include "Ecore.h"
#include "ecore_private.h"
#include "Ecore_X_Atoms.h"
#include "Ecore_Input.h"
-static int _ecore_x_fd_handler(void *data, Ecore_Fd_Handler *fd_handler);
-static int _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 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
- */
+ * 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;
#ifdef ECORE_XRANDR
static int _ecore_x_event_randr_id = 0;
-#endif
+#endif /* ifdef ECORE_XRANDR */
#ifdef ECORE_XFIXES
static int _ecore_x_event_fixes_selection_id = 0;
-#endif
+#endif /* ifdef ECORE_XFIXES */
#ifdef ECORE_XDAMAGE
static int _ecore_x_event_damage_id = 0;
-#endif
+#endif /* ifdef ECORE_XDAMAGE */
static int _ecore_x_event_handlers_num = 0;
static void (**_ecore_x_event_handlers) (XEvent * event) = NULL;
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;
-int _ecore_x_xcursor = 0;
-XIC _ecore_x_ic = NULL; /* Input context for composed characters */
-XIM _ecore_x_im = 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;
+int _ecore_x_xcursor = 0;
+XIC _ecore_x_ic = NULL; /* Input context for composed characters */
+XIM _ecore_x_im = NULL;
Ecore_X_Window _ecore_x_private_win = 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_PROP_TITLE_CHANGE = 0;
-EAPI int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE = 0;
-EAPI int ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE = 0;
-EAPI int ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE = 0;
-EAPI int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE = 0;
-EAPI int ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE = 0;
-EAPI int ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE = 0;
-EAPI int ECORE_X_EVENT_WINDOW_PROP_DESKTOP_CHANGE = 0;
-*/
+ EAPI int ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE = 0;
+ EAPI int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE = 0;
+ EAPI int ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE = 0;
+ EAPI int ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE = 0;
+ EAPI int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE = 0;
+ EAPI int ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE = 0;
+ EAPI int ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE = 0;
+ EAPI int ECORE_X_EVENT_WINDOW_PROP_DESKTOP_CHANGE = 0;
+ */
EAPI int ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST = 0;
EAPI int ECORE_X_EVENT_WINDOW_STATE_REQUEST = 0;
#ifdef LOGRT
static double t0 = 0.0;
-static Status (*_logrt_real_reply) (Display *disp, void *rep, int extra, Bool discard) = NULL;
+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);
+ 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();
-}
+} /* _logrt_init */
+
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)
{
printf("%s", tsym);
}
else
- printf("???");
+ printf("???");
}
else
- printf("???");
- if (i > 1) printf(" > ");
+ printf("???");
+
+ if (i > 1)
+ printf(" > ");
}
printf("\n");
}
}
+
// fixme: logme
return _logrt_real_reply(disp, rep, extra, discard);
-}
-#endif
+} /* _XReply */
+
+#endif /* ifdef LOGRT */
/**
* @defgroup Ecore_X_Init_Group X Library Init and Shutdown Functions
#ifdef ECORE_XSS
int screensaver_base = 0;
int screensaver_err_base = 0;
-#endif
+#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
+#endif /* ifdef ECORE_XRANDR */
#ifdef ECORE_XFIXES
int fixes_base = 0;
int fixes_err_base = 0;
-#endif
+#endif /* ifdef ECORE_XFIXES */
#ifdef ECORE_XDAMAGE
int damage_base = 0;
int damage_err_base = 0;
-#endif
-
- if (++_ecore_x_init_count != 1)
- return _ecore_x_init_count;
+#endif /* ifdef ECORE_XDAMAGE */
+
+ if (++_ecore_x_init_count != 1)
+ return _ecore_x_init_count;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
#ifdef LOGRT
_logrt_init();
-#endif
-
- _ecore_xlib_log_dom = eina_log_domain_register("EcoreX11", ECORE_XLIB_DEFAULT_LOG_COLOR);
+#endif /* ifdef LOGRT */
+
+ eina_init();
+ _ecore_xlib_log_dom = eina_log_domain_register("EcoreX11",
+ 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;
+ 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())
- {
- eina_log_domain_unregister(_ecore_xlib_log_dom);
- _ecore_xlib_log_dom = -1;
- return --_ecore_x_init_count;
- }
+ goto shutdown_ecore;
+
#ifdef EVAS_FRAME_QUEUING
XInitThreads();
-#endif
+#endif /* ifdef EVAS_FRAME_QUEUING */
_ecore_x_disp = XOpenDisplay((char *)name);
if (!_ecore_x_disp)
- goto shutdown_ecore_event;
+ 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)
+#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_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;
+ 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
+#endif /* ifdef ECORE_XSS */
if (XSyncQueryExtension(_ecore_x_disp, &sync_base, &sync_err_base))
{
- int major, minor;
+ 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_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_randr_id = randr_base;
+
ECORE_X_EVENT_HANDLERS_GROW(randr_base, RRNumberEvents);
-#endif
+#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_fixes_selection_id = fixes_base;
+
ECORE_X_EVENT_HANDLERS_GROW(fixes_base, XFixesNumberEvents);
-#endif
+#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_damage_id = damage_base;
+
ECORE_X_EVENT_HANDLERS_GROW(damage_base, XDamageNumberEvents);
-#endif
+#endif /* ifdef ECORE_XDAMAGE */
_ecore_x_event_handlers = calloc(_ecore_x_event_handlers_num, sizeof(void *));
if (!_ecore_x_event_handlers)
- goto close_display;
+ goto close_display;
-#ifdef ECORE_XCURSOR
+#ifdef ECORE_XCURSOR
_ecore_x_xcursor = XcursorSupportsARGB(_ecore_x_disp);
-#endif
- _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;
+#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
-
+ _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;
+ _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;
+ _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;
+ _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;
+ _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
+
+#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
+ _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
+ _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
XkbSetDetectableAutoRepeat(_ecore_x_disp, 1, &works);
}
while (0);
-#endif
-
+#endif /* ifdef ECORE_XKB */
+
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_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_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_WINDOW_PROP_TITLE_CHANGE = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_PROP_DESKTOP_CHANGE = 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_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_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_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_WINDOW_PROP_TITLE_CHANGE = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_PROP_DESKTOP_CHANGE = 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();
}
-
+
/* everything has these... unless its like a pda... :) */
ECORE_X_MODIFIER_SHIFT = _ecore_x_key_mask_get(XK_Shift_L);
- ECORE_X_MODIFIER_CTRL = _ecore_x_key_mask_get(XK_Control_L);
-
+ ECORE_X_MODIFIER_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);
-
+ 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);
-
+ 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;
+ 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_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);
+ 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_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;
+ goto free_event_handlers;
_ecore_x_atoms_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_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_dpms_init();
_ecore_x_randr_init();
_ecore_x_input_init();
-
+
_ecore_x_private_win = ecore_x_window_override_new(0, -77, -777, 123, 456);
#ifdef ENABLE_XIM
/* Setup XIM */
if (!_ecore_x_ic && XSupportsLocale())
{
- XIM im;
- XIC ic;
- XIMStyles *supported_styles;
- XIMStyle chosen_style = 0;
- Ecore_X_Window client_window = ecore_x_window_root_get(_ecore_x_private_win);
- char *ret;
- int i;
-
- XSetLocaleModifiers("@im=none");
- if ((im = XOpenIM(_ecore_x_disp, NULL, NULL, NULL)) == NULL)
- goto _im_create_end;
- ret = XGetIMValues(im, XNQueryInputStyle, &supported_styles, NULL);
- if (ret || !supported_styles)
- goto _im_create_error;
- for (i = 0; i < supported_styles->count_styles; i++)
+ XIM im;
+ XIC ic;
+ XIMStyles *supported_styles;
+ XIMStyle chosen_style = 0;
+ Ecore_X_Window client_window = ecore_x_window_root_get(
+ _ecore_x_private_win);
+ char *ret;
+ int i;
+
+ XSetLocaleModifiers("@im=none");
+ if ((im = XOpenIM(_ecore_x_disp, NULL, NULL, NULL)) == NULL)
+ goto _im_create_end;
+
+ ret = XGetIMValues(im, XNQueryInputStyle, &supported_styles, NULL);
+ if (ret || !supported_styles)
+ goto _im_create_error;
+
+ for (i = 0; i < supported_styles->count_styles; i++)
{
- if (supported_styles->supported_styles[i] ==
+ if (supported_styles->supported_styles[i] ==
(XIMPreeditNothing | XIMStatusNothing))
- chosen_style = supported_styles->supported_styles[i];
+ chosen_style = supported_styles->supported_styles[i];
}
- XFree(supported_styles);
- if (!chosen_style)
- goto _im_create_error;
- ic = XCreateIC(im, XNInputStyle, chosen_style, XNClientWindow, client_window, NULL);
- if (ic)
- {
- _ecore_x_ic = ic;
+ XFree(supported_styles);
+ if (!chosen_style)
+ goto _im_create_error;
+
+ ic = XCreateIC(im,
+ XNInputStyle,
+ chosen_style,
+ XNClientWindow,
+ client_window,
+ NULL);
+ if (ic)
+ {
+ _ecore_x_ic = ic;
_ecore_x_im = im;
- goto _im_create_end;
- }
+ goto _im_create_end;
+ }
+
_im_create_error:
- XCloseIM(im);
+ XCloseIM(im);
}
+
_im_create_end:
-#endif
+#endif /* ifdef ENABLE_XIM */
return _ecore_x_init_count;
free_event_handlers:
_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;
-}
+} /* ecore_x_init */
static int
_ecore_x_shutdown(int close_display)
{
if (--_ecore_x_init_count != 0)
- return _ecore_x_init_count;
+ return _ecore_x_init_count;
+
+ if (!_ecore_x_disp)
+ return _ecore_x_init_count;
- if (!_ecore_x_disp) return _ecore_x_init_count;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
#ifdef ENABLE_XIM
if (_ecore_x_ic)
{
- XDestroyIC(_ecore_x_ic);
- _ecore_x_ic = NULL;
+ XDestroyIC(_ecore_x_ic);
+ _ecore_x_ic = NULL;
}
+
if (_ecore_x_im)
{
- XCloseIM(_ecore_x_im);
+ XCloseIM(_ecore_x_im);
_ecore_x_im = NULL;
}
-#endif
+
+#endif /* ifdef ENABLE_XIM */
+ ecore_main_fd_handler_del(_ecore_x_fd_handler_handle);
if (close_display)
XCloseDisplay(_ecore_x_disp);
else
close(ConnectionNumber(_ecore_x_disp));
+
free(_ecore_x_event_handlers);
- ecore_main_fd_handler_del(_ecore_x_fd_handler_handle);
_ecore_x_fd_handler_handle = NULL;
_ecore_x_disp = NULL;
_ecore_x_event_handlers = NULL;
_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;
-}
+} /* _ecore_x_shutdown */
/**
* Shuts down the Ecore X library.
ecore_x_shutdown(void)
{
return _ecore_x_shutdown(1);
-}
+} /* ecore_x_shutdown */
/**
* Shuts down the Ecore X library.
ecore_x_disconnect(void)
{
return _ecore_x_shutdown(0);
-}
+} /* ecore_x_disconnect */
/**
* @defgroup Ecore_X_Display_Attr_Group X Display Attributes
ecore_x_display_get(void)
{
return (Ecore_X_Display *)_ecore_x_disp;
-}
+} /* ecore_x_display_get */
/**
* Retrieves the X display file descriptor.
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return ConnectionNumber(_ecore_x_disp);
-}
+} /* ecore_x_fd_get */
/**
* Retrieves the Ecore_X_Screen handle used for the current X connection.
* @return The current default screen.
* @ingroup Ecore_Xcb_Display_Attr_Group
*/
-EAPI Ecore_X_Screen*
+EAPI Ecore_X_Screen *
ecore_x_default_screen_get(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- return (Ecore_X_Screen*) DefaultScreenOfDisplay(_ecore_x_disp);
-}
+ return (Ecore_X_Screen *)DefaultScreenOfDisplay(_ecore_x_disp);
+} /* ecore_x_default_screen_get */
/**
* 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.
EAPI void
ecore_x_double_click_time_set(double t)
{
- if (t < 0.0) t = 0.0;
+ if (t < 0.0)
+ t = 0.0;
+
_ecore_x_double_click_time = t;
-}
+} /* ecore_x_double_click_time_set */
/**
* Retrieves the double and triple click flag timeout.
ecore_x_double_click_time_get(void)
{
return _ecore_x_double_click_time;
-}
+} /* ecore_x_double_click_time_get */
/**
* @defgroup Ecore_X_Flush_Group X Synchronization Functions
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XFlush(_ecore_x_disp);
-}
+} /* ecore_x_flush */
/**
* Flushes the command buffer and waits until all requests have been
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XSync(_ecore_x_disp, False);
-}
+} /* ecore_x_sync */
/**
* Kill all clients with subwindows under a given window.
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))
+ &children_r, &num_children) && (num_children > 0))
{
- for (j = 0; j < num_children; ++j)
- {
- XKillClient(_ecore_x_disp, children_r[j]);
- }
-
- XFree(children_r);
+ 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);
-}
+} /* ecore_x_killall */
/**
* Kill a specific client
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XKillClient(_ecore_x_disp, win);
-}
+} /* ecore_x_kill */
/**
* Return the last event time
ecore_x_current_time_get(void)
{
return _ecore_x_event_last_time;
-}
+} /* ecore_x_current_time_get */
/**
* Return the screen DPI
ecore_x_dpi_get(void)
{
Screen *s;
-
+
LOGFN(__FILE__, __LINE__, __FUNCTION__);
s = DefaultScreenOfDisplay(_ecore_x_disp);
- if (s->mwidth <= 0) return 75;
+ if (s->mwidth <= 0)
+ return 75;
+
return (((s->width * 254) / s->mwidth) + 5) / 10;
-}
+} /* ecore_x_dpi_get */
-static int
+/**
+ * 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;
+} /* ecore_x_bell */
+
+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);
+ XEvent ev;
+
+ XNextEvent(d, &ev);
#ifdef ENABLE_XIM
- /* Filter event for XIM */
- if (XFilterEvent(&ev, ev.xkey.window)) continue;
-#endif
-
- 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);
- }
+ /* 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 1;
-}
+ return ECORE_CALLBACK_RENEW;
+} /* _ecore_x_fd_handler */
-static int
+static Eina_Bool
_ecore_x_fd_handler_buf(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
{
Display *d;
d = data;
- if (XPending(d)) return 1;
- return 0;
-}
+ if (XPending(d))
+ return ECORE_CALLBACK_RENEW;
+
+ return ECORE_CALLBACK_CANCEL;
+} /* _ecore_x_fd_handler_buf */
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
- };
-
+ 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;
- }
- }
- }
+ 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;
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ if (mod->modifiermap)
+ XFree(mod->modifiermap);
+ XFree(mod);
+ }
+ return 0;
+} /* _ecore_x_key_mask_get */
/*****************************************************************************/
/*****************************************************************************/
Ecore_X_Window *roots;
#ifdef ECORE_XPRINT
int xp_base, xp_err_base;
-#endif
-
- if (!num_ret) return NULL;
+#endif /* ifdef ECORE_XPRINT */
+
+ if (!num_ret)
+ return NULL;
+
*num_ret = 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
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((num - overlap) * sizeof(Window));
- 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);
- }
+ 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((num - overlap) * sizeof(Window));
+ 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);
+ 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
+
+#else /* ifdef ECORE_XPRINT */
num = ScreenCount(_ecore_x_disp);
roots = malloc(num * sizeof(Window));
- if (!roots) return NULL;
+ if (!roots)
+ return NULL;
+
*num_ret = num;
for (i = 0; i < num; i++)
- roots[i] = RootWindow(_ecore_x_disp, i);
-#endif
+ roots[i] = RootWindow(_ecore_x_disp, i);
+#endif /* ifdef ECORE_XPRINT */
return roots;
-}
+} /* ecore_x_window_root_list */
EAPI Ecore_X_Window
ecore_x_window_root_first_get(void)
{
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;
*/
-}
-
+} /* ecore_x_window_root_first_get */
-static void _ecore_x_window_manage_error(void *data);
+static void _ecore_x_window_manage_error(void *data);
static int _ecore_x_window_manage_failed = 0;
static void
{
if ((ecore_x_error_request_get() == X_ChangeWindowAttributes) &&
(ecore_x_error_code_get() == BadAccess))
- _ecore_x_window_manage_failed = 1;
-}
+ _ecore_x_window_manage_failed = 1;
+} /* _ecore_x_window_manage_error */
EAPI int
ecore_x_window_manage(Ecore_X_Window win)
{
- XWindowAttributes att;
-
+ XWindowAttributes att;
+
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (XGetWindowAttributes(_ecore_x_disp, win, &att) != True) return 0;
+ if (XGetWindowAttributes(_ecore_x_disp, win, &att) != True)
+ return 0;
+
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);
+ 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 0;
+ _ecore_x_window_manage_failed = 0;
+ return 0;
}
+
return 1;
-}
+} /* ecore_x_window_manage */
EAPI void
ecore_x_window_container_manage(Ecore_X_Window win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- XSelectInput(_ecore_x_disp, win,
- SubstructureRedirectMask |
- SubstructureNotifyMask);
-}
+ XSelectInput(_ecore_x_disp, win,
+ SubstructureRedirectMask |
+ SubstructureNotifyMask);
+} /* ecore_x_window_container_manage */
EAPI void
ecore_x_window_client_manage(Ecore_X_Window win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- XSelectInput(_ecore_x_disp, win,
- PropertyChangeMask |
+ XSelectInput(_ecore_x_disp, win,
+ PropertyChangeMask |
// ResizeRedirectMask |
- FocusChangeMask |
- ColormapChangeMask |
- VisibilityChangeMask |
- StructureNotifyMask |
+ FocusChangeMask |
+ ColormapChangeMask |
+ VisibilityChangeMask |
+ StructureNotifyMask |
SubstructureNotifyMask
- );
+ );
XShapeSelectInput(_ecore_x_disp, win, ShapeNotifyMask);
-}
+} /* ecore_x_window_client_manage */
EAPI void
ecore_x_window_sniff(Ecore_X_Window win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XSelectInput(_ecore_x_disp, win,
- PropertyChangeMask |
- SubstructureNotifyMask);
-}
+ PropertyChangeMask |
+ SubstructureNotifyMask);
+} /* ecore_x_window_sniff */
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 |
+ PropertyChangeMask |
+ FocusChangeMask |
+ ColormapChangeMask |
+ VisibilityChangeMask |
+ StructureNotifyMask |
SubstructureNotifyMask);
XShapeSelectInput(_ecore_x_disp, win, ShapeNotifyMask);
-}
-
-
-
-
-
+} /* ecore_x_window_client_sniff */
EAPI int
-ecore_x_window_attributes_get(Ecore_X_Window win, Ecore_X_Window_Attributes *att_ret)
+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 0;
+ if (!XGetWindowAttributes(_ecore_x_disp, win, &att))
+ return 0;
+
memset(att_ret, 0, sizeof(Ecore_X_Window_Attributes));
att_ret->root = att.root;
att_ret->x = att.x;
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;
+ 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->colormap = att.colormap;
att_ret->visual = att.visual;
return 1;
-}
+} /* ecore_x_window_attributes_get */
EAPI void
ecore_x_window_save_set_add(Ecore_X_Window win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XAddToSaveSet(_ecore_x_disp, win);
-}
+} /* ecore_x_window_save_set_add */
EAPI void
ecore_x_window_save_set_del(Ecore_X_Window win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XRemoveFromSaveSet(_ecore_x_disp, win);
-}
+} /* ecore_x_window_save_set_del */
EAPI Ecore_X_Window *
ecore_x_window_children_get(Ecore_X_Window win, int *num)
{
- Ecore_X_Window *windows = NULL;
- Window root_ret = 0, parent_ret = 0, *children_ret = NULL;
- unsigned int children_ret_num = 0;
-
+ 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;
- }
+ &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);
+ 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;
-}
+} /* ecore_x_window_children_get */
EAPI int
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);
-}
+ return XChangePointerControl(_ecore_x_disp, 1, 1,
+ accel_num, accel_denom, threshold);
+} /* ecore_x_pointer_control_set */
EAPI int
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);
-}
+ return XGetPointerControl(_ecore_x_disp,
+ accel_num, accel_denom, threshold);
+} /* ecore_x_pointer_control_get */
EAPI int
ecore_x_pointer_mapping_set(unsigned char *map, int nmap)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return XSetPointerMapping(_ecore_x_disp, map, nmap);
-}
+} /* ecore_x_pointer_mapping_set */
EAPI int
ecore_x_pointer_mapping_get(unsigned char *map, int nmap)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return XGetPointerMapping(_ecore_x_disp, map, nmap);
-}
+} /* ecore_x_pointer_mapping_get */
EAPI int
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 1;
+ ButtonPressMask | ButtonReleaseMask |
+ EnterWindowMask | LeaveWindowMask | PointerMotionMask,
+ GrabModeAsync, GrabModeAsync,
+ None, None, CurrentTime) == GrabSuccess)
+ return 1;
+
return 0;
-}
+} /* ecore_x_pointer_grab */
EAPI int
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 1;
+ ButtonPressMask | ButtonReleaseMask |
+ EnterWindowMask | LeaveWindowMask | PointerMotionMask,
+ GrabModeAsync, GrabModeAsync,
+ win, None, CurrentTime) == GrabSuccess)
+ return 1;
+
return 0;
-}
+} /* ecore_x_pointer_confine_grab */
EAPI void
ecore_x_pointer_ungrab(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XUngrabPointer(_ecore_x_disp, CurrentTime);
-}
+} /* ecore_x_pointer_ungrab */
EAPI int
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);
-}
+} /* ecore_x_pointer_warp */
EAPI int
ecore_x_keyboard_grab(Ecore_X_Window win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (XGrabKeyboard(_ecore_x_disp, win, False,
- GrabModeAsync, GrabModeAsync,
- CurrentTime) == GrabSuccess) return 1;
+ GrabModeAsync, GrabModeAsync,
+ CurrentTime) == GrabSuccess)
+ return 1;
+
return 0;
-}
+} /* ecore_x_keyboard_grab */
EAPI void
ecore_x_keyboard_ungrab(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- XUngrabKeyboard(_ecore_x_disp, CurrentTime);
-}
+ XUngrabKeyboard(_ecore_x_disp, CurrentTime);
+} /* ecore_x_keyboard_ungrab */
EAPI void
ecore_x_grab(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
_ecore_x_grab_count++;
- if (_ecore_x_grab_count == 1) XGrabServer(_ecore_x_disp);
-}
+ if (_ecore_x_grab_count == 1)
+ XGrabServer(_ecore_x_disp);
+} /* ecore_x_grab */
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);
-}
+ if (_ecore_x_grab_count < 0)
+ _ecore_x_grab_count = 0;
+
+ if (_ecore_x_grab_count == 0)
+ XUngrabServer(_ecore_x_disp);
+} /* ecore_x_ungrab */
-int _ecore_window_grabs_num = 0;
-Window *_ecore_window_grabs = NULL;
-int (*_ecore_window_grab_replay_func) (void *data, int event_type, void *event);
-void *_ecore_window_grab_replay_data;
+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(int (*func) (void *data, int event_type, void *event), void *data)
+ecore_x_passive_grab_replay_func_set(Eina_Bool (*func)(void *data,
+ int event_type,
+ void *event), void *data)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
_ecore_window_grab_replay_func = func;
_ecore_window_grab_replay_data = data;
-}
+} /* ecore_x_passive_grab_replay_func_set */
EAPI void
-ecore_x_window_button_grab(Ecore_X_Window win, int button,
- Ecore_X_Event_Mask event_mask,
- int mod, int any_mod)
+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;
-
+ unsigned int b;
+ unsigned int m;
+ unsigned int locks[8];
+ int i, ev;
+
LOGFN(__FILE__, __LINE__, __FUNCTION__);
b = button;
- if (b == 0) b = AnyButton;
+ if (b == 0)
+ b = AnyButton;
+
m = _ecore_x_event_modifier(mod);
- if (any_mod) m = AnyModifier;
+ 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;
+ 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);
+ XGrabButton(_ecore_x_disp, b, m | locks[i],
+ win, False, ev, GrabModeSync, GrabModeAsync, None, None);
_ecore_window_grabs_num++;
- _ecore_window_grabs = realloc(_ecore_window_grabs,
- _ecore_window_grabs_num * sizeof(Window));
+ _ecore_window_grabs = realloc(_ecore_window_grabs,
+ _ecore_window_grabs_num * sizeof(Window));
_ecore_window_grabs[_ecore_window_grabs_num - 1] = win;
-}
+} /* ecore_x_window_button_grab */
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.data.l[1] = 0x10000000 + val;
xev.xclient.data.l[2] = swin;
XSendEvent(_ecore_x_disp, _ecore_x_private_win, False, NoEventMask, &xev);
-}
+} /* _ecore_x_sync_magic_send */
void
_ecore_x_window_grab_remove(Ecore_X_Window win)
{
int i, shuffle = 0;
-
+
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--;
- _ecore_window_grabs = realloc(_ecore_window_grabs,
- _ecore_window_grabs_num * sizeof(Window));
- }
+ 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--;
+ _ecore_window_grabs = realloc(_ecore_window_grabs,
+ _ecore_window_grabs_num *
+ sizeof(Window));
+ }
}
-}
+} /* _ecore_x_window_grab_remove */
EAPI void
-ecore_x_window_button_ungrab(Ecore_X_Window win, int button,
- int mod, int any_mod)
+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;
-
+ unsigned int b;
+ unsigned int m;
+ unsigned int locks[8];
+ int i;
+
LOGFN(__FILE__, __LINE__, __FUNCTION__);
b = button;
- if (b == 0) b = AnyButton;
+ if (b == 0)
+ b = AnyButton;
+
m = _ecore_x_event_modifier(mod);
- if (any_mod) m = AnyModifier;
+ 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;
+ 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);
+ XUngrabButton(_ecore_x_disp, b, m | locks[i], win);
_ecore_x_sync_magic_send(1, win);
-}
+} /* ecore_x_window_button_ungrab */
-int _ecore_key_grabs_num = 0;
-Window *_ecore_key_grabs = NULL;
+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)
+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;
-
+ 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);
+ keycode = atoi(key + 8);
else
{
- keysym = XStringToKeysym(key);
- if (keysym == NoSymbol) return;
- keycode = XKeysymToKeycode(_ecore_x_disp, XStringToKeysym(key));
+ keysym = XStringToKeysym(key);
+ if (keysym == NoSymbol)
+ return;
+
+ keycode = XKeysymToKeycode(_ecore_x_disp, XStringToKeysym(key));
}
- if (keycode == 0) return;
-
+
+ if (keycode == 0)
+ return;
+
m = _ecore_x_event_modifier(mod);
- if (any_mod) m = AnyModifier;
+ 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;
+ 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);
+ XGrabKey(_ecore_x_disp, keycode, m | locks[i],
+ win, False, GrabModeSync, GrabModeAsync);
_ecore_key_grabs_num++;
_ecore_key_grabs = realloc(_ecore_key_grabs,
- _ecore_key_grabs_num * sizeof(Window));
+ _ecore_key_grabs_num * sizeof(Window));
_ecore_key_grabs[_ecore_key_grabs_num - 1] = win;
-}
+} /* ecore_x_window_key_grab */
void
_ecore_x_key_grab_remove(Ecore_X_Window win)
{
int i, shuffle = 0;
-
+
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--;
- _ecore_key_grabs = realloc(_ecore_key_grabs,
- _ecore_key_grabs_num * sizeof(Window));
- }
+ 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--;
+ _ecore_key_grabs = realloc(_ecore_key_grabs,
+ _ecore_key_grabs_num * sizeof(Window));
+ }
}
-}
+} /* _ecore_x_key_grab_remove */
EAPI void
ecore_x_window_key_ungrab(Ecore_X_Window win, const char *key,
- int mod, int any_mod)
+ int mod, int any_mod)
{
- KeyCode keycode = 0;
- KeySym keysym;
- unsigned int m;
- unsigned int locks[8];
- int i;
+ 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);
+ keycode = atoi(key + 8);
else
{
- keysym = XStringToKeysym(key);
- if (keysym == NoSymbol) return;
- keycode = XKeysymToKeycode(_ecore_x_disp, XStringToKeysym(key));
+ keysym = XStringToKeysym(key);
+ if (keysym == NoSymbol)
+ return;
+
+ keycode = XKeysymToKeycode(_ecore_x_disp, XStringToKeysym(key));
}
- if (keycode == 0) return;
-
+
+ if (keycode == 0)
+ return;
+
m = _ecore_x_event_modifier(mod);
- if (any_mod) m = AnyModifier;
+ 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;
+ 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);
+ XUngrabKey(_ecore_x_disp, keycode, m | locks[i], win);
_ecore_x_sync_magic_send(2, win);
-}
+} /* ecore_x_window_key_ungrab */
/**
* Send client message with given type and format 32.
*/
EAPI int
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)
+ Ecore_X_Event_Mask mask,
+ long d0, long d1, long d2, long d3, long d4)
{
XEvent xev;
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);
-}
+} /* ecore_x_client_message32_send */
/**
* Send client message with given type and format 8.
*/
EAPI int
ecore_x_client_message8_send(Ecore_X_Window win, Ecore_X_Atom type,
- const void *data, int len)
+ 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;
+ 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);
-}
+} /* ecore_x_client_message8_send */
EAPI int
ecore_x_mouse_move_send(Ecore_X_Window win, int x, int y)
xev.xmotion.is_hint = 0;
xev.xmotion.same_screen = 1;
return XSendEvent(_ecore_x_disp, win, True, PointerMotionMask, &xev);
-}
+} /* ecore_x_mouse_move_send */
EAPI int
ecore_x_mouse_down_send(Ecore_X_Window win, int x, int y, int b)
xev.xbutton.button = b;
xev.xbutton.same_screen = 1;
return XSendEvent(_ecore_x_disp, win, True, ButtonPressMask, &xev);
-}
+} /* ecore_x_mouse_down_send */
EAPI int
ecore_x_mouse_up_send(Ecore_X_Window win, int x, int y, int b)
xev.xbutton.button = b;
xev.xbutton.same_screen = 1;
return XSendEvent(_ecore_x_disp, win, True, ButtonReleaseMask, &xev);
-}
+} /* ecore_x_mouse_up_send */
EAPI void
ecore_x_focus_reset(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XSetInputFocus(_ecore_x_disp, PointerRoot, RevertToPointerRoot, CurrentTime);
-}
+} /* ecore_x_focus_reset */
EAPI void
ecore_x_events_allow_all(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XAllowEvents(_ecore_x_disp, AsyncBoth, CurrentTime);
-}
+} /* ecore_x_events_allow_all */
EAPI void
ecore_x_pointer_last_xy_get(int *x, int *y)
{
- if (x) *x = _ecore_x_event_last_root_x;
- if (y) *y = _ecore_x_event_last_root_y;
-}
+ if (x)
+ *x = _ecore_x_event_last_root_x;
+
+ if (y)
+ *y = _ecore_x_event_last_root_y;
+} /* ecore_x_pointer_last_xy_get */
EAPI void
ecore_x_pointer_xy_get(Ecore_X_Window win, int *x, int *y)
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;
-}
+ 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;
+} /* ecore_x_pointer_xy_get */
+
/*****************************************************************************/
/*****************************************************************************/
/*****************************************************************************/
{
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_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;
return xmodifiers;
-}
+} /* _ecore_x_event_modifier */
+
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#ifdef HAVE_ALLOCA_H
# include <alloca.h>
#elif defined _MSC_VER
# include <malloc.h>
# define alloca _alloca
-#else
+#else /* ifdef HAVE_ALLOCA_H */
# include <stddef.h>
# ifdef __cplusplus
extern "C"
-# endif
-void *alloca (size_t);
-#endif
+# endif /* ifdef __cplusplus */
+void * alloca (size_t);
+#endif /* ifdef HAVE_ALLOCA_H */
#include <string.h>
_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 },
-
- { "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_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 }
- };
+ {
+ { "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_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 }
+ };
Atom *atoms;
char **names;
int i, num;
for (i = 0; i < num; i++) names[i] = (char *)items[i].name;
XInternAtoms(_ecore_x_disp, names, num, False, atoms);
for (i = 0; i < num; i++) *(items[i].atom) = atoms[i];
-}
+} /* _ecore_x_atoms_init */
/**
* Retrieves the atom value associated with the given name.
EAPI Ecore_X_Atom
ecore_x_atom_get(const char *name)
{
- if (!_ecore_x_disp) return 0;
+ if (!_ecore_x_disp)
+ return 0;
+
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return XInternAtom(_ecore_x_disp, name, False);
-}
+} /* ecore_x_atom_get */
EAPI void
ecore_x_atoms_get(const char **names, int num, Ecore_X_Atom *atoms)
Atom *atoms_int;
int i;
- if (!_ecore_x_disp) return;
+ 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];
-}
+ atoms[i] = atoms_int[i];
+} /* ecore_x_atoms_get */
EAPI char *
ecore_x_atom_name_get(Ecore_X_Atom atom)
char *name;
char *xname;
- if (!_ecore_x_disp) return NULL;
+ if (!_ecore_x_disp)
+ return NULL;
+
LOGFN(__FILE__, __LINE__, __FUNCTION__);
xname = XGetAtomName(_ecore_x_disp, atom);
- if (!xname) return NULL;
+ if (!xname)
+ return NULL;
name = strdup(xname);
XFree(xname);
return name;
-}
+} /* ecore_x_atom_name_get */
+
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
-
+#endif /* ifdef HAVE_CONFIG_H */
#include "ecore_x_private.h"
#include "Ecore_X.h"
int major, minor;
if (XCompositeQueryVersion(_ecore_x_disp, &major, &minor))
- _composite_available = 1;
-#endif
-}
+ _composite_available = 1;
+
+#endif /* ifdef ECORE_XCOMPOSITE */
+} /* _ecore_x_composite_init */
EAPI int
ecore_x_composite_query(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return _composite_available;
-}
+} /* ecore_x_composite_query */
EAPI void
-ecore_x_composite_redirect_window(Ecore_X_Window win, Ecore_X_Composite_Update_Type type)
+ecore_x_composite_redirect_window(Ecore_X_Window win,
+ Ecore_X_Composite_Update_Type type)
{
#ifdef ECORE_XCOMPOSITE
int update = CompositeRedirectAutomatic;
switch(type)
{
case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC:
- update = CompositeRedirectAutomatic;
- break;
+ update = CompositeRedirectAutomatic;
+ break;
+
case ECORE_X_COMPOSITE_UPDATE_MANUAL:
- update = CompositeRedirectManual;
- break;
- }
+ update = CompositeRedirectManual;
+ break;
+ } /* switch */
XCompositeRedirectWindow(_ecore_x_disp, win, update);
-#endif
-}
+#endif /* ifdef ECORE_XCOMPOSITE */
+} /* ecore_x_composite_redirect_window */
EAPI void
-ecore_x_composite_redirect_subwindows(Ecore_X_Window win, Ecore_X_Composite_Update_Type type)
+ecore_x_composite_redirect_subwindows(Ecore_X_Window win,
+ Ecore_X_Composite_Update_Type type)
{
#ifdef ECORE_XCOMPOSITE
int update = CompositeRedirectAutomatic;
switch(type)
{
case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC:
- update = CompositeRedirectAutomatic;
- break;
+ update = CompositeRedirectAutomatic;
+ break;
+
case ECORE_X_COMPOSITE_UPDATE_MANUAL:
- update = CompositeRedirectManual;
- break;
- }
+ update = CompositeRedirectManual;
+ break;
+ } /* switch */
XCompositeRedirectSubwindows(_ecore_x_disp, win, update);
-#endif
-}
+#endif /* ifdef ECORE_XCOMPOSITE */
+} /* ecore_x_composite_redirect_subwindows */
EAPI void
-ecore_x_composite_unredirect_window(Ecore_X_Window win, Ecore_X_Composite_Update_Type type)
+ecore_x_composite_unredirect_window(Ecore_X_Window win,
+ Ecore_X_Composite_Update_Type type)
{
#ifdef ECORE_XCOMPOSITE
int update = CompositeRedirectAutomatic;
switch(type)
{
case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC:
- update = CompositeRedirectAutomatic;
- break;
+ update = CompositeRedirectAutomatic;
+ break;
+
case ECORE_X_COMPOSITE_UPDATE_MANUAL:
- update = CompositeRedirectManual;
- break;
- }
+ update = CompositeRedirectManual;
+ break;
+ } /* switch */
XCompositeUnredirectWindow(_ecore_x_disp, win, update);
-#endif
-}
+#endif /* ifdef ECORE_XCOMPOSITE */
+} /* ecore_x_composite_unredirect_window */
EAPI void
-ecore_x_composite_unredirect_subwindows(Ecore_X_Window win, Ecore_X_Composite_Update_Type type)
+ecore_x_composite_unredirect_subwindows(Ecore_X_Window win,
+ Ecore_X_Composite_Update_Type type)
{
#ifdef ECORE_XCOMPOSITE
int update = CompositeRedirectAutomatic;
switch(type)
{
case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC:
- update = CompositeRedirectAutomatic;
- break;
+ update = CompositeRedirectAutomatic;
+ break;
+
case ECORE_X_COMPOSITE_UPDATE_MANUAL:
- update = CompositeRedirectManual;
- break;
- }
+ update = CompositeRedirectManual;
+ break;
+ } /* switch */
XCompositeUnredirectSubwindows(_ecore_x_disp, win, update);
-#endif
-}
+#endif /* ifdef ECORE_XCOMPOSITE */
+} /* ecore_x_composite_unredirect_subwindows */
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
+#endif /* ifdef ECORE_XCOMPOSITE */
return pixmap;
+} /* ecore_x_composite_name_window_pixmap_get */
+
+EAPI void
+ecore_x_composite_window_events_disable(Ecore_X_Window win)
+{
+#ifdef ECORE_XCOMPOSITE
+ XRectangle rect;
+ rect.x = -1;
+ rect.y = -1;
+ rect.width = 1;
+ rect.height = 1;
+ XShapeCombineRectangles(_ecore_x_disp, win, ShapeInput, 0, 0, &rect, 1,
+ ShapeSet, Unsorted);
+#endif /* ifdef ECORE_XCOMPOSITE */
+}
+
+EAPI void
+ecore_x_composite_window_events_enable(Ecore_X_Window win)
+{
+#ifdef ECORE_XCOMPOSITE
+ XRectangle rect;
+ rect.x = 0;
+ rect.y = 0;
+ rect.width = 65535;
+ rect.height = 65535;
+ XShapeCombineRectangles(_ecore_x_disp, win, ShapeInput, 0, 0, &rect, 1,
+ ShapeSet, Unsorted);
+#endif /* ifdef ECORE_XCOMPOSITE */
}
EAPI Ecore_X_Window
Ecore_X_Window win = 0;
#ifdef ECORE_XCOMPOSITE
XRectangle rect;
-
+
LOGFN(__FILE__, __LINE__, __FUNCTION__);
win = XCompositeGetOverlayWindow(_ecore_x_disp, root);
rect.x = -1;
rect.y = -1;
rect.width = 1;
rect.height = 1;
- XShapeCombineRectangles(_ecore_x_disp, win, ShapeInput, 0, 0, &rect, 1,
+ XShapeCombineRectangles(_ecore_x_disp, win, ShapeInput, 0, 0, &rect, 1,
ShapeSet, Unsorted);
-#endif
+#endif /* ifdef ECORE_XCOMPOSITE */
return win;
-}
+} /* ecore_x_composite_render_window_enable */
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
-}
+#endif /* ifdef ECORE_XCOMPOSITE */
+} /* ecore_x_composite_render_window_disable */
+
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#include <stdlib.h>
#include "ecore_x_private.h"
-
EAPI int
ecore_x_cursor_color_supported_get(void)
{
return _ecore_x_xcursor;
-}
+} /* ecore_x_cursor_color_supported_get */
EAPI Ecore_X_Cursor
-ecore_x_cursor_new(Ecore_X_Window win, int *pixels, int w, int h, int hot_x, int hot_y)
+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++)
- {
+ 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];
+ xci->pixels[i] = pixels[i];
// (a << 24) | (r << 16) | (g << 8) | (b);
- }
- c = XcursorImageLoadCursor(_ecore_x_disp, xci);
- XcursorImageDestroy(xci);
- return c;
- }
+ }
+ c = XcursorImageLoadCursor(_ecore_x_disp, xci);
+ XcursorImageDestroy(xci);
+ return c;
+ }
}
else
-#endif
- {
- 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;
- }
+#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;
-}
+} /* ecore_x_cursor_new */
EAPI void
ecore_x_cursor_free(Ecore_X_Cursor c)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XFreeCursor(_ecore_x_disp, c);
-}
+} /* ecore_x_cursor_free */
/*
* Returns the cursor for the given shape.
LOGFN(__FILE__, __LINE__, __FUNCTION__);
/* Shapes are defined in Ecore_X_Cursor.h */
return XCreateFontCursor(_ecore_x_disp, shape);
-}
+} /* ecore_x_cursor_shape_get */
EAPI void
ecore_x_cursor_size_set(int size)
#ifdef ECORE_XCURSOR
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XcursorSetDefaultSize(_ecore_x_disp, size);
-#else
+#else /* ifdef ECORE_XCURSOR */
size = 0;
-#endif
-}
+#endif /* ifdef ECORE_XCURSOR */
+} /* ecore_x_cursor_size_set */
EAPI int
ecore_x_cursor_size_get(void)
#ifdef ECORE_XCURSOR
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return XcursorGetDefaultSize(_ecore_x_disp);
-#else
+#else /* ifdef ECORE_XCURSOR */
return 0;
-#endif
-}
+#endif /* ifdef ECORE_XCURSOR */
+} /* ecore_x_cursor_size_get */
+
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
-
+#endif /* ifdef HAVE_CONFIG_H */
#include "ecore_x_private.h"
#include "Ecore_X.h"
static int _damage_available;
#ifdef ECORE_XDAMAGE
static int _damage_major, _damage_minor;
-#endif
+#endif /* ifdef ECORE_XDAMAGE */
void
_ecore_x_damage_init(void)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (XDamageQueryVersion(_ecore_x_disp, &_damage_major, &_damage_minor))
- _damage_available = 1;
+ _damage_available = 1;
else
- _damage_available = 0;
-#else
+ _damage_available = 0;
+
+#else /* ifdef ECORE_XDAMAGE */
_damage_available = 0;
-#endif
-}
+#endif /* ifdef ECORE_XDAMAGE */
+} /* _ecore_x_damage_init */
EAPI int
ecore_x_damage_query(void)
{
return _damage_available;
-}
+} /* ecore_x_damage_query */
EAPI Ecore_X_Damage
ecore_x_damage_new(Ecore_X_Drawable d, Ecore_X_Damage_Report_Level level)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
damage = XDamageCreate(_ecore_x_disp, d, level);
return damage;
-#else
+#else /* ifdef ECORE_XDAMAGE */
return 0;
-#endif
-}
+#endif /* ifdef ECORE_XDAMAGE */
+} /* ecore_x_damage_new */
EAPI void
ecore_x_damage_free(Ecore_X_Damage damage)
#ifdef ECORE_XDAMAGE
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XDamageDestroy(_ecore_x_disp, damage);
-#endif
-}
+#endif /* ifdef ECORE_XDAMAGE */
+} /* ecore_x_damage_free */
EAPI void
-ecore_x_damage_subtract(Ecore_X_Damage damage, Ecore_X_Region repair, Ecore_X_Region parts)
+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
-}
+#endif /* ifdef ECORE_XDAMAGE */
+} /* ecore_x_damage_subtract */
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#include <stdlib.h>
#include <string.h>
typedef struct _Version_Cache_Item
{
Ecore_X_Window win;
- int ver;
+ int ver;
} Version_Cache_Item;
static Version_Cache_Item *_version_cache = NULL;
static int _version_cache_num = 0, _version_cache_alloc = 0;
{
if (!_ecore_x_dnd_init_count)
{
- _source = calloc(1, sizeof(Ecore_X_DND_Source));
- _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));
- _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();
+ _source = calloc(1, sizeof(Ecore_X_DND_Source));
+ _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));
+ _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++;
-}
+} /* _ecore_x_dnd_init */
void
_ecore_x_dnd_shutdown(void)
{
_ecore_x_dnd_init_count--;
if (_ecore_x_dnd_init_count > 0)
- return;
+ return;
if (_source)
- free(_source);
+ free(_source);
+
_source = NULL;
if (_target)
- free(_target);
+ free(_target);
+
_target = NULL;
_ecore_x_dnd_init_count = 0;
-}
+} /* _ecore_x_dnd_shutdown */
static int
-_ecore_x_dnd_converter_copy(char *target __UNUSED__, void *data, int size, void **data_ret, int *size_ret)
+_ecore_x_dnd_converter_copy(char *target __UNUSED__,
+ void *data,
+ int size,
+ void **data_ret,
+ int *size_ret,
+ Ecore_X_Atom *tprop __UNUSED__,
+ int *count __UNUSED__)
{
XTextProperty text_prop;
char *mystr;
XICCEncodingStyle style = XTextStyle;
if (!data || !size)
- return 0;
+ return 0;
mystr = calloc(1, size + 1);
- if (!mystr) return 0;
+ if (!mystr)
+ return 0;
+
memcpy(mystr, data, size);
- if (XmbTextListToTextProperty(_ecore_x_disp, &mystr, 1, style, &text_prop) == Success)
+ if (XmbTextListToTextProperty(_ecore_x_disp, &mystr, 1, style,
+ &text_prop) == Success)
{
- int bufsize = strlen((char *)text_prop.value) + 1;
- *data_ret = malloc(bufsize);
- memcpy(*data_ret, text_prop.value, bufsize);
- *size_ret = bufsize;
- XFree(text_prop.value);
- free(mystr);
- return 1;
+ int bufsize = strlen((char *)text_prop.value) + 1;
+ *data_ret = malloc(bufsize);
+ memcpy(*data_ret, text_prop.value, bufsize);
+ *size_ret = bufsize;
+ XFree(text_prop.value);
+ free(mystr);
+ return 1;
}
else
{
- free(mystr);
- return 0;
+ free(mystr);
+ return 0;
}
-}
+} /* _ecore_x_dnd_converter_copy */
EAPI void
ecore_x_dnd_aware_set(Ecore_X_Window win, int on)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (on)
- ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_AWARE,
- XA_ATOM, 32, &prop_data, 1);
+ 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);
-}
+ ecore_x_window_prop_property_del(win, ECORE_X_ATOM_XDND_AWARE);
+} /* ecore_x_dnd_aware_set */
EAPI int
ecore_x_dnd_version_get(Ecore_X_Window win)
// 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 (_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;
- _version_cache = realloc(_version_cache, _version_cache_alloc * sizeof(Version_Cache_Item));
- _version_cache[_version_cache_num - 1].win = win;
- _version_cache[_version_cache_num - 1].ver = version;
- }
- return version;
+ 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;
+
+ _version_cache = realloc(_version_cache,
+ _version_cache_alloc *
+ sizeof(Version_Cache_Item));
+ _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;
- _version_cache = realloc(_version_cache, _version_cache_alloc * sizeof(Version_Cache_Item));
- _version_cache[_version_cache_num - 1].win = win;
- _version_cache[_version_cache_num - 1].ver = 0;
+ _version_cache_num++;
+ if (_version_cache_num > _version_cache_alloc)
+ _version_cache_alloc += 16;
+
+ _version_cache =
+ realloc(_version_cache, _version_cache_alloc *
+ sizeof(Version_Cache_Item));
+ _version_cache[_version_cache_num - 1].win = win;
+ _version_cache[_version_cache_num - 1].ver = 0;
}
+
return 0;
-}
+} /* ecore_x_dnd_version_get */
EAPI int
ecore_x_dnd_type_isset(Ecore_X_Window win, const char *type)
{
- int num, i, ret = 0;
- unsigned char *data;
- Ecore_X_Atom *atoms, atom;
+ int num, i, ret = 0;
+ 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;
+ 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 = 1;
- break;
- }
+ if (atom == atoms[i])
+ {
+ ret = 1;
+ break;
+ }
}
XFree(data);
return ret;
-}
+} /* ecore_x_dnd_type_isset */
EAPI void
ecore_x_dnd_type_set(Ecore_X_Window win, const char *type, int 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;
+ 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);
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);
+ 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);
+ 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);
-}
+} /* ecore_x_dnd_type_set */
EAPI void
-ecore_x_dnd_types_set(Ecore_X_Window win, const char **types, unsigned int num_types)
+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;
+ 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);
- }
+ 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);
+ 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);
}
-}
+} /* ecore_x_dnd_types_set */
EAPI void
-ecore_x_dnd_actions_set(Ecore_X_Window win, Ecore_X_Atom *actions, unsigned int num_actions)
+ecore_x_dnd_actions_set(Ecore_X_Window win,
+ Ecore_X_Atom *actions,
+ unsigned int num_actions)
{
- unsigned int i;
- unsigned char *data = NULL;
+ 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);
- }
+ 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);
+ 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);
}
-}
+} /* ecore_x_dnd_actions_set */
Ecore_X_DND_Source *
_ecore_x_dnd_source_get(void)
{
return _source;
-}
+} /* _ecore_x_dnd_source_get */
Ecore_X_DND_Target *
_ecore_x_dnd_target_get(void)
{
return _target;
-}
+} /* _ecore_x_dnd_target_get */
EAPI int
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 0;
+ return 0;
/* Take ownership of XdndSelection */
if (!ecore_x_selection_xdnd_set(source, data, size))
- return 0;
+ return 0;
if (_version_cache)
{
- free(_version_cache);
- _version_cache = NULL;
- _version_cache_num = 0;
- _version_cache_alloc = 0;
+ 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->dest = None;
return 1;
-}
+} /* ecore_x_dnd_begin */
EAPI int
ecore_x_dnd_drop(void)
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 = 1;
- }
- 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;
- }
+ 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 = 1;
+ }
+ 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;
+ /* 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;
-}
+} /* ecore_x_dnd_drop */
EAPI void
-ecore_x_dnd_send_status(int will_accept, int suppress, Ecore_X_Rectangle rectangle, Ecore_X_Atom action)
+ecore_x_dnd_send_status(int will_accept,
+ int suppress,
+ Ecore_X_Rectangle rectangle,
+ Ecore_X_Atom action)
{
XEvent xev;
if (_target->state == ECORE_X_DND_TARGET_IDLE)
- return;
+ return;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
memset(&xev, 0, sizeof(XEvent));
xev.xclient.data.l[0] = _target->win;
xev.xclient.data.l[1] = 0;
if (will_accept)
- xev.xclient.data.l[1] |= 0x1UL;
+ xev.xclient.data.l[1] |= 0x1UL;
+
if (!suppress)
- xev.xclient.data.l[1] |= 0x2UL;
+ xev.xclient.data.l[1] |= 0x2UL;
/* Set rectangle information */
xev.xclient.data.l[2] = rectangle.x;
if (will_accept)
{
- xev.xclient.data.l[4] = action;
- _target->accepted_action = action;
+ xev.xclient.data.l[4] = action;
+ _target->accepted_action = action;
}
else
{
- xev.xclient.data.l[4] = None;
- _target->accepted_action = action;
+ xev.xclient.data.l[4] = None;
+ _target->accepted_action = action;
}
XSendEvent(_ecore_x_disp, _target->source, False, 0, &xev);
-}
+} /* ecore_x_dnd_send_status */
EAPI void
ecore_x_dnd_send_finished(void)
{
- XEvent xev;
+ XEvent xev;
if (_target->state == ECORE_X_DND_TARGET_IDLE)
- return;
+ return;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
xev.xany.type = ClientMessage;
xev.xclient.data.l[2] = 0;
if (_target->will_accept)
{
- xev.xclient.data.l[1] |= 0x1UL;
- xev.xclient.data.l[2] = _target->accepted_action;
+ 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;
-}
+} /* ecore_x_dnd_send_finished */
void
ecore_x_dnd_source_action_set(Ecore_X_Atom action)
{
_source->action = action;
if (_source->prev.window)
- _ecore_x_dnd_drag(_source->prev.window, _source->prev.x, _source->prev.y);
-}
+ _ecore_x_dnd_drag(_source->prev.window, _source->prev.x, _source->prev.y);
+} /* ecore_x_dnd_source_action_set */
Ecore_X_Atom
ecore_x_dnd_source_action_get(void)
{
return _source->action;
-}
+} /* ecore_x_dnd_source_action_get */
void
_ecore_x_dnd_drag(Ecore_X_Window root, int x, int y)
{
- XEvent xev;
- Ecore_X_Window win;
+ XEvent xev;
+ Ecore_X_Window win;
Ecore_X_Window *skip;
- int num;
+ int num;
if (_source->state != ECORE_X_DND_SOURCE_DRAGGING)
- return;
+ return;
/* Preinitialize XEvent struct */
memset(&xev, 0, sizeof(XEvent));
// 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);
+ 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;
+ 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;
+ 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;
- }
+ 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;
+ }
}
_source->prev.x = x;
_source->prev.y = y;
_source->prev.window = root;
_source->dest = win;
-}
+} /* _ecore_x_dnd_drag */
+
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#include "ecore_x_private.h"
_dpms_minor = 0;
if (DPMSGetVersion(_ecore_x_disp, &_dpms_major, &_dpms_minor))
- _dpms_available = 1;
+ _dpms_available = 1;
else
- _dpms_available = 0;
-#else
+ _dpms_available = 0;
+
+#else /* ifdef ECORE_XDPMS */
_dpms_available = 0;
-#endif
-}
+#endif /* ifdef ECORE_XDPMS */
+} /* _ecore_x_dpms_init */
/**
* @defgroup Ecore_X_DPMS_Group X DPMS Extension Functions
ecore_x_dpms_query(void)
{
return _dpms_available;
-}
+} /* ecore_x_dpms_query */
/**
* Checks if the X server is capable of DPMS.
#ifdef ECORE_XDPMS
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return DPMSCapable(_ecore_x_disp);
-#else
+#else /* ifdef ECORE_XDPMS */
return 0;
-#endif
-}
+#endif /* ifdef ECORE_XDPMS */
+} /* ecore_x_dpms_capable_get */
/**
* Checks the DPMS state of the display.
LOGFN(__FILE__, __LINE__, __FUNCTION__);
DPMSInfo(_ecore_x_disp, &power_lvl, &state);
return state;
-#else
+#else /* ifdef ECORE_XDPMS */
return 0;
-#endif
-}
+#endif /* ifdef ECORE_XDPMS */
+} /* ecore_x_dpms_enabled_get */
/**
* Sets the DPMS state of the display.
#ifdef ECORE_XDPMS
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (enabled)
- DPMSEnable(_ecore_x_disp);
+ DPMSEnable(_ecore_x_disp);
else
- DPMSDisable(_ecore_x_disp);
-#endif
-}
+ DPMSDisable(_ecore_x_disp);
+
+#endif /* ifdef ECORE_XDPMS */
+} /* ecore_x_dpms_enabled_set */
/**
* Gets the timeouts. The values are in unit of seconds.
* @ingroup Ecore_X_DPMS_Group
*/
EAPI void
-ecore_x_dpms_timeouts_get(unsigned int *standby, unsigned int *suspend, unsigned int *off)
+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
-}
+ DPMSGetTimeouts(_ecore_x_disp, (unsigned short *)standby,
+ (unsigned short *)suspend, (unsigned short *)off);
+#endif /* ifdef ECORE_XDPMS */
+} /* ecore_x_dpms_timeouts_get */
/**
* Sets the timeouts. The values are in unit of seconds.
* @ingroup Ecore_X_DPMS_Group
*/
EAPI int
-ecore_x_dpms_timeouts_set(unsigned int standby, unsigned int suspend, unsigned int off)
+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);
-#else
+#else /* ifdef ECORE_XDPMS */
return 0;
-#endif
-}
+#endif /* ifdef ECORE_XDPMS */
+} /* ecore_x_dpms_timeouts_set */
/**
* Returns the amount of time of inactivity before standby mode is invoked.
LOGFN(__FILE__, __LINE__, __FUNCTION__);
DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
return standby;
-#else
+#else /* ifdef ECORE_XDPMS */
return 0;
-#endif
-}
+#endif /* ifdef ECORE_XDPMS */
+} /* ecore_x_dpms_timeout_standby_get */
/**
* Returns the amount of time of inactivity before the second level of
LOGFN(__FILE__, __LINE__, __FUNCTION__);
DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
return suspend;
-#else
+#else /* ifdef ECORE_XDPMS */
return 0;
-#endif
-}
+#endif /* ifdef ECORE_XDPMS */
+} /* ecore_x_dpms_timeout_suspend_get */
/**
* Returns the amount of time of inactivity before the third and final
LOGFN(__FILE__, __LINE__, __FUNCTION__);
DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
return off;
-#else
+#else /* ifdef ECORE_XDPMS */
return 0;
-#endif
-}
+#endif /* ifdef ECORE_XDPMS */
+} /* ecore_x_dpms_timeout_off_get */
/**
* Sets the standby timeout (in unit of seconds).
LOGFN(__FILE__, __LINE__, __FUNCTION__);
DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
DPMSSetTimeouts(_ecore_x_disp, new_timeout, suspend, off);
-#endif
-}
+#endif /* ifdef ECORE_XDPMS */
+} /* ecore_x_dpms_timeout_standby_set */
/**
* Sets the suspend timeout (in unit of seconds).
LOGFN(__FILE__, __LINE__, __FUNCTION__);
DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
DPMSSetTimeouts(_ecore_x_disp, standby, new_timeout, off);
-#endif
-}
+#endif /* ifdef ECORE_XDPMS */
+} /* ecore_x_dpms_timeout_suspend_set */
/**
* Sets the off timeout (in unit of seconds).
LOGFN(__FILE__, __LINE__, __FUNCTION__);
DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
DPMSSetTimeouts(_ecore_x_disp, standby, suspend, new_timeout);
-#endif
-}
+#endif /* ifdef ECORE_XDPMS */
+} /* ecore_x_dpms_timeout_off_set */
+
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#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.
* @ingroup Ecore_X_Drawable_Group
*/
EAPI void
-ecore_x_drawable_geometry_get(Ecore_X_Drawable d, int *x, int *y, int *w, int *h)
+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;
+ 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;
-}
+ {
+ 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;
+} /* ecore_x_drawable_geometry_get */
/**
* Retrieves the width of the border of the given drawable.
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;
+ 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;
-}
+ return (int)border_ret;
+} /* ecore_x_drawable_border_width_get */
/**
* Retrieves the depth of the given drawable.
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;
+ 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;
-}
+ return (int)depth_ret;
+} /* ecore_x_drawable_depth_get */
/**
* Fill the specified rectangle on a drawable.
* @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)
+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);
-}
+} /* ecore_x_drawable_rectangle_fill */
+
/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
-/*
* OLD E hints
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#include "Ecore.h"
#include "ecore_x_private.h"
EAPI void
ecore_x_e_init(void)
{
-}
+} /* ecore_x_e_init */
EAPI void
ecore_x_e_frame_size_set(Ecore_X_Window win, int fl, int fr, int ft, int fb)
frames[2] = ft;
frames[3] = fb;
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_FRAME_SIZE, frames, 4);
-}
+} /* ecore_x_e_frame_size_set */
EAPI void
ecore_x_e_virtual_keyboard_set(Ecore_X_Window win, unsigned int is_keyboard)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD,
- &is_keyboard, 1);
-}
+ &is_keyboard, 1);
+} /* ecore_x_e_virtual_keyboard_set */
EAPI int
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 0;
+ if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD,
+ &val, 1))
+ return 0;
+
return val;
-}
+} /* ecore_x_e_virtual_keyboard_get */
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;
+ 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;
-}
+} /* _ecore_x_e_vkbd_state_get */
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;
+ 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: return 0;
- }
+ } /* switch */
return 0;
-}
+} /* _ecore_x_e_vkbd_atom_get */
EAPI void
-ecore_x_e_virtual_keyboard_state_set(Ecore_X_Window win, Ecore_X_Virtual_Keyboard_State state)
+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);
-}
+ &atom, 1);
+} /* ecore_x_e_virtual_keyboard_state_set */
EAPI Ecore_X_Virtual_Keyboard_State
ecore_x_e_virtual_keyboard_state_get(Ecore_X_Window win)
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;
+ &atom, 1))
+ return ECORE_X_VIRTUAL_KEYBOARD_STATE_UNKNOWN;
+
return _ecore_x_e_vkbd_state_get(atom);
-}
+} /* ecore_x_e_virtual_keyboard_state_get */
EAPI void
-ecore_x_e_virtual_keyboard_state_send(Ecore_X_Window win, Ecore_X_Virtual_Keyboard_State state)
+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);
-}
+ ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
+ _ecore_x_e_vkbd_atom_get(state),
+ 0, 0, 0, 0);
+} /* ecore_x_e_virtual_keyboard_state_send */
-static Ecore_X_Atom
-_ecore_x_e_illume_atom_get(Ecore_X_Illume_Mode mode)
+static Ecore_X_Atom
+_ecore_x_e_illume_atom_get(Ecore_X_Illume_Mode mode)
{
- switch (mode)
+ switch (mode)
{
case ECORE_X_ILLUME_MODE_SINGLE:
- return ECORE_X_ATOM_E_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;
+ 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;
+ return ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT;
+
default:
- return ECORE_X_ILLUME_MODE_UNKNOWN;;
- }
+ return ECORE_X_ILLUME_MODE_UNKNOWN;
+ } /* switch */
return ECORE_X_ILLUME_MODE_UNKNOWN;
-}
+} /* _ecore_x_e_illume_atom_get */
-static Ecore_X_Illume_Mode
-_ecore_x_e_illume_mode_get(Ecore_X_Atom atom)
+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;
+ return ECORE_X_ILLUME_MODE_SINGLE;
+
if (atom == ECORE_X_ATOM_E_ILLUME_MODE_DUAL_TOP)
- return ECORE_X_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_DUAL_LEFT;
+
return ECORE_X_ILLUME_MODE_UNKNOWN;
-}
+} /* _ecore_x_e_illume_mode_get */
-EAPI void
-ecore_x_e_illume_zone_set(Ecore_X_Window win, Ecore_X_Window zone)
+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,
+ ecore_x_window_prop_window_set(win, ECORE_X_ATOM_E_ILLUME_ZONE,
&zone, 1);
-}
+} /* ecore_x_e_illume_zone_set */
-EAPI Ecore_X_Window
-ecore_x_e_illume_zone_get(Ecore_X_Window win)
+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;
+ if (!ecore_x_window_prop_window_get(win, ECORE_X_ATOM_E_ILLUME_ZONE,
+ &zone, 1))
+ return 0;
+
return zone;
-}
+} /* ecore_x_e_illume_zone_get */
-EAPI void
-ecore_x_e_illume_zone_list_set(Ecore_X_Window win, Ecore_X_Window *zones, unsigned int n_zones)
+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,
+ ecore_x_window_prop_window_set(win, ECORE_X_ATOM_E_ILLUME_ZONE_LIST,
zones, n_zones);
-}
+} /* ecore_x_e_illume_zone_list_set */
-EAPI void
-ecore_x_e_illume_conformant_set(Ecore_X_Window win, unsigned int is_conformant)
+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);
-}
+ &is_conformant, 1);
+} /* ecore_x_e_illume_conformant_set */
-EAPI int
-ecore_x_e_illume_conformant_get(Ecore_X_Window win)
+EAPI int
+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,
+ if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_E_ILLUME_CONFORMANT,
&val, 1))
- return 0;
+ return 0;
+
return val;
-}
+} /* ecore_x_e_illume_conformant_get */
-EAPI void
-ecore_x_e_illume_mode_set(Ecore_X_Window win, Ecore_X_Illume_Mode mode)
+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);
-}
+ &atom, 1);
+} /* ecore_x_e_illume_mode_set */
-EAPI Ecore_X_Illume_Mode
-ecore_x_e_illume_mode_get(Ecore_X_Window win)
+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_ILLUME_MODE_UNKNOWN;
+
return _ecore_x_e_illume_mode_get(atom);
-}
+} /* ecore_x_e_illume_mode_get */
-EAPI void
-ecore_x_e_illume_mode_send(Ecore_X_Window win, Ecore_X_Illume_Mode mode)
+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);
-}
+ ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
+ _ecore_x_e_illume_atom_get(mode),
+ 0, 0, 0, 0);
+} /* ecore_x_e_illume_mode_send */
-EAPI void
-ecore_x_e_illume_focus_back_send(Ecore_X_Window win)
+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);
-}
+ ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
+ 1, 0, 0, 0, 0);
+} /* ecore_x_e_illume_focus_back_send */
-EAPI void
-ecore_x_e_illume_focus_forward_send(Ecore_X_Window win)
+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);
-}
+ ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
+ 1, 0, 0, 0, 0);
+} /* ecore_x_e_illume_focus_forward_send */
-EAPI void
-ecore_x_e_illume_focus_home_send(Ecore_X_Window win)
+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);
-}
+ ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
+ 1, 0, 0, 0, 0);
+} /* ecore_x_e_illume_focus_home_send */
-EAPI void
-ecore_x_e_illume_close_send(Ecore_X_Window win)
+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);
-}
+ ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
+ 1, 0, 0, 0, 0);
+} /* ecore_x_e_illume_close_send */
-EAPI void
-ecore_x_e_illume_home_new_send(Ecore_X_Window win)
+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);
-}
+ ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
+ 1, 0, 0, 0, 0);
+} /* ecore_x_e_illume_home_new_send */
-EAPI void
-ecore_x_e_illume_home_del_send(Ecore_X_Window win)
+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);
-}
+ ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
+ 1, 0, 0, 0, 0);
+} /* ecore_x_e_illume_home_del_send */
-EAPI void
-ecore_x_e_illume_drag_set(Ecore_X_Window win, unsigned int drag)
+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);
-}
+} /* ecore_x_e_illume_drag_set */
-EAPI int
-ecore_x_e_illume_drag_get(Ecore_X_Window win)
+EAPI int
+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 0;
+ return 0;
+
return val;
-}
+} /* ecore_x_e_illume_drag_get */
-EAPI void
-ecore_x_e_illume_drag_locked_set(Ecore_X_Window win, unsigned int is_locked)
+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,
+ ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED,
&is_locked, 1);
-}
+} /* ecore_x_e_illume_drag_locked_set */
-EAPI int
-ecore_x_e_illume_drag_locked_get(Ecore_X_Window win)
+EAPI int
+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,
+ if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED,
&val, 1))
- return 0;
+ return 0;
+
return val;
-}
+} /* ecore_x_e_illume_drag_locked_get */
-EAPI void
-ecore_x_e_illume_drag_start_send(Ecore_X_Window win)
+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);
-}
+ ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
+ 1, 0, 0, 0, 0);
+} /* ecore_x_e_illume_drag_start_send */
-EAPI void
-ecore_x_e_illume_drag_end_send(Ecore_X_Window win)
+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);
-}
+ ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
+ 1, 0, 0, 0, 0);
+} /* ecore_x_e_illume_drag_end_send */
-EAPI void
-ecore_x_e_illume_indicator_geometry_set(Ecore_X_Window win, int x, int y, int w, int h)
+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];
geom[1] = y;
geom[2] = w;
geom[3] = h;
- ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY,
+ ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY,
geom, 4);
-}
+} /* ecore_x_e_illume_indicator_geometry_set */
-EAPI int
-ecore_x_e_illume_indicator_geometry_get(Ecore_X_Window win, int *x, int *y, int *w, int *h)
+EAPI int
+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 0;
- if (x) *x = geom[0];
- if (y) *y = geom[1];
- if (w) *w = geom[2];
- if (h) *h = geom[3];
+ ret =
+ ecore_x_window_prop_card32_get(win,
+ ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY,
+ geom, 4);
+ if (ret != 4)
+ return 0;
+
+ if (x)
+ *x = geom[0];
+
+ if (y)
+ *y = geom[1];
+
+ if (w)
+ *w = geom[2];
+
+ if (h)
+ *h = geom[3];
+
return 1;
-}
+} /* ecore_x_e_illume_indicator_geometry_get */
-EAPI void
-ecore_x_e_illume_softkey_geometry_set(Ecore_X_Window win, int x, int y, int w, int h)
+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];
geom[1] = y;
geom[2] = w;
geom[3] = h;
- ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY,
+ ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY,
geom, 4);
-}
+} /* ecore_x_e_illume_softkey_geometry_set */
-EAPI int
-ecore_x_e_illume_softkey_geometry_get(Ecore_X_Window win, int *x, int *y, int *w, int *h)
+EAPI int
+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 0;
- if (x) *x = geom[0];
- if (y) *y = geom[1];
- if (w) *w = geom[2];
- if (h) *h = geom[3];
+ ret =
+ ecore_x_window_prop_card32_get(win,
+ ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY,
+ geom, 4);
+ if (ret != 4)
+ return 0;
+
+ if (x)
+ *x = geom[0];
+
+ if (y)
+ *y = geom[1];
+
+ if (w)
+ *w = geom[2];
+
+ if (h)
+ *h = geom[3];
+
return 1;
-}
+} /* ecore_x_e_illume_softkey_geometry_get */
-EAPI void
-ecore_x_e_illume_keyboard_geometry_set(Ecore_X_Window win, int x, int y, int w, int h)
+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];
geom[1] = y;
geom[2] = w;
geom[3] = h;
- ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY,
+ ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY,
geom, 4);
-}
+} /* ecore_x_e_illume_keyboard_geometry_set */
-EAPI int
-ecore_x_e_illume_keyboard_geometry_get(Ecore_X_Window win, int *x, int *y, int *w, int *h)
+EAPI int
+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 0;
- if (x) *x = geom[0];
- if (y) *y = geom[1];
- if (w) *w = geom[2];
- if (h) *h = geom[3];
+ ret =
+ ecore_x_window_prop_card32_get(win,
+ ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY,
+ geom, 4);
+ if (ret != 4)
+ return 0;
+
+ if (x)
+ *x = geom[0];
+
+ if (y)
+ *y = geom[1];
+
+ if (w)
+ *w = geom[2];
+
+ if (h)
+ *h = geom[3];
+
return 1;
-}
+} /* ecore_x_e_illume_keyboard_geometry_get */
static Ecore_X_Atom
_ecore_x_e_quickpanel_atom_get(Ecore_X_Illume_Quickpanel_State state)
{
- switch (state)
+ switch (state)
{
case ECORE_X_ILLUME_QUICKPANEL_STATE_ON:
- return ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON;
+ return ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON;
+
case ECORE_X_ILLUME_QUICKPANEL_STATE_OFF:
- return ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF;
+ return ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF;
+
default:
- return 0;
- }
+ return 0;
+ } /* switch */
return 0;
-}
+} /* _ecore_x_e_quickpanel_atom_get */
static Ecore_X_Illume_Quickpanel_State
_ecore_x_e_quickpanel_state_get(Ecore_X_Atom atom)
{
- if (atom == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON)
- return ECORE_X_ILLUME_QUICKPANEL_STATE_ON;
+ 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_OFF;
+
return ECORE_X_ILLUME_QUICKPANEL_STATE_UNKNOWN;
-}
+} /* _ecore_x_e_quickpanel_state_get */
-EAPI void
-ecore_x_e_illume_quickpanel_set(Ecore_X_Window win, unsigned int is_quickpanel)
+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);
-}
+ &is_quickpanel, 1);
+} /* ecore_x_e_illume_quickpanel_set */
-EAPI int
-ecore_x_e_illume_quickpanel_get(Ecore_X_Window win)
+EAPI int
+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,
+ if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_E_ILLUME_QUICKPANEL,
&val, 1))
- return 0;
+ return 0;
+
return val;
-}
+} /* ecore_x_e_illume_quickpanel_get */
-EAPI void
-ecore_x_e_illume_quickpanel_state_set(Ecore_X_Window win, Ecore_X_Illume_Quickpanel_State state)
+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);
-}
+ &atom, 1);
+} /* ecore_x_e_illume_quickpanel_state_set */
-EAPI Ecore_X_Illume_Quickpanel_State
-ecore_x_e_illume_quickpanel_state_get(Ecore_X_Window win)
+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;
+ 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);
-}
+} /* ecore_x_e_illume_quickpanel_state_get */
-EAPI void
-ecore_x_e_illume_quickpanel_state_send(Ecore_X_Window win, Ecore_X_Illume_Quickpanel_State state)
+EAPI void
+ecore_x_e_illume_quickpanel_state_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);
-}
+ ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
+ _ecore_x_e_quickpanel_atom_get(state),
+ 0, 0, 0, 0);
+} /* ecore_x_e_illume_quickpanel_state_send */
-EAPI void
-ecore_x_e_illume_quickpanel_state_toggle(Ecore_X_Window win)
+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_client_message32_send(win,
ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE_TOGGLE,
- ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
- 0, 0, 0, 0, 0);
-}
+ ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
+ 0, 0, 0, 0, 0);
+} /* ecore_x_e_illume_quickpanel_state_toggle */
-EAPI void
-ecore_x_e_illume_quickpanel_priority_major_set(Ecore_X_Window win, unsigned int priority)
+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);
-}
+ ecore_x_window_prop_card32_set(
+ win,
+ ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR,
+ &priority,
+ 1);
+} /* ecore_x_e_illume_quickpanel_priority_major_set */
-EAPI int
-ecore_x_e_illume_quickpanel_priority_major_get(Ecore_X_Window win)
+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,
+ if (!ecore_x_window_prop_card32_get(win,
+ ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR,
&val, 1))
- return 0;
+ return 0;
+
return val;
-}
+} /* ecore_x_e_illume_quickpanel_priority_major_get */
-EAPI void
-ecore_x_e_illume_quickpanel_priority_minor_set(Ecore_X_Window win, unsigned int priority)
+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);
-}
+ ecore_x_window_prop_card32_set(
+ win,
+ ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR,
+ &priority,
+ 1);
+} /* ecore_x_e_illume_quickpanel_priority_minor_set */
-EAPI int
-ecore_x_e_illume_quickpanel_priority_minor_get(Ecore_X_Window win)
+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,
+ if (!ecore_x_window_prop_card32_get(win,
+ ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR,
&val, 1))
- return 0;
+ return 0;
+
return val;
-}
+} /* ecore_x_e_illume_quickpanel_priority_minor_get */
-EAPI void
-ecore_x_e_illume_quickpanel_zone_set(Ecore_X_Window win, unsigned int zone)
+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,
+ ecore_x_window_prop_card32_set(win,
+ ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE,
&zone, 1);
-}
+} /* ecore_x_e_illume_quickpanel_zone_set */
-EAPI int
-ecore_x_e_illume_quickpanel_zone_get(Ecore_X_Window win)
+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,
+ if (!ecore_x_window_prop_card32_get(win,
+ ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE,
&val, 1))
- return 0;
+ return 0;
+
return val;
-}
+} /* ecore_x_e_illume_quickpanel_zone_get */
-EAPI void
-ecore_x_e_illume_quickpanel_position_update_send(Ecore_X_Window win)
+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);
-}
+ 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);
+} /* ecore_x_e_illume_quickpanel_position_update_send */
-EAPI void
-ecore_x_e_comp_sync_counter_set(Ecore_X_Window win, Ecore_X_Sync_Counter counter)
+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_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);
-}
+ ecore_x_window_prop_property_del(win, ECORE_X_ATOM_E_COMP_SYNC_COUNTER);
+} /* ecore_x_e_comp_sync_counter_set */
EAPI Ecore_X_Sync_Counter
ecore_x_e_comp_sync_counter_get(Ecore_X_Window win)
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;
+ 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;
-}
+} /* ecore_x_e_comp_sync_counter_get */
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);
+ if (!root)
+ root = DefaultRootWindow(_ecore_x_disp);
+
xev.xclient.type = ClientMessage;
xev.xclient.display = _ecore_x_disp;
xev.xclient.window = win;
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,
+ SubstructureRedirectMask | SubstructureNotifyMask,
&xev);
-}
+} /* ecore_x_e_comp_sync_draw_done_send */
EAPI void
ecore_x_e_comp_sync_supported_set(Ecore_X_Window root, Eina_Bool enabled)
{
Ecore_X_Window win;
- if (!root) root = DefaultRootWindow(_ecore_x_disp);
+ 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(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);
+ 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);
+
+ 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_prop_property_del(
+ root,
+ ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED);
ecore_x_window_free(win);
}
}
-}
+} /* ecore_x_e_comp_sync_supported_set */
EAPI Eina_Bool
ecore_x_e_comp_sync_supported_get(Ecore_X_Window root)
{
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);
+
+ 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);
+ 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 1;
- }
+ return 1;
}
+
return 0;
-}
+} /* ecore_x_e_comp_sync_supported_get */
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.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,
+ NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask,
&xev);
-}
+} /* ecore_x_e_comp_sync_begin_send */
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.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,
+ NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask,
&xev);
-}
+} /* ecore_x_e_comp_sync_end_send */
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.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,
+ NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask,
&xev);
-}
+} /* ecore_x_e_comp_sync_cancel_send */
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.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,
+ NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask,
&xev);
-}
+} /* ecore_x_e_comp_flush_send */
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.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,
+ NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask,
&xev);
-}
+} /* ecore_x_e_comp_dump_send */
+
+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_DUMP,
+ ECORE_X_ATOM_PIXMAP, &pixmap, 1);
+ else
+ ecore_x_window_prop_property_del(win, pixmap);
+} /* ecore_x_e_comp_pixmap_set */
+
+EAPI Ecore_X_Pixmap
+ecore_x_e_comp_pixmap_get(Ecore_X_Window win)
+{
+ 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_DUMP,
+ ECORE_X_ATOM_PIXMAP,
+ &pixmap, 1);
+ if (ret != 1)
+ return 0;
+
+ return pixmap;
+} /* ecore_x_e_comp_pixmap_get */
+
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#include <stdlib.h>
#include "ecore_x_private.h"
#include "Ecore_X.h"
-static void _ecore_x_error_handle(Display * d, XErrorEvent * ev);
-static int _ecore_x_io_error_handle(Display *d);
+static void _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_func)(void *data) = NULL;
static void *_error_data = NULL;
-static void (*_io_error_func) (void *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 int _error_request_code = 0;
+static int _error_code = 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)
+ecore_x_error_handler_set(void (*func)(void *data), const void *data)
{
_error_func = func;
_error_data = (void *)data;
-}
+} /* ecore_x_error_handler_set */
/**
* Set the I/O error handler.
* @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)
+ecore_x_io_error_handler_set(void (*func)(void *data), const void *data)
{
_io_error_func = func;
_io_error_data = (void *)data;
-}
+} /* ecore_x_io_error_handler_set */
/**
* Get the request code that caused the error.
* @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;
-}
+} /* ecore_x_error_request_get */
/**
* 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;
-}
+} /* ecore_x_error_code_get */
void
_ecore_x_error_handler_init(void)
{
XSetErrorHandler((XErrorHandler)_ecore_x_error_handle);
- XSetIOErrorHandler((XIOErrorHandler)_ecore_x_io_error_handle);
-}
+ XSetIOErrorHandler((XIOErrorHandler)_ecore_x_io_error_handle);
+} /* _ecore_x_error_handler_init */
static void
_ecore_x_error_handle(Display *d, XErrorEvent *ev)
{
- if (d == _ecore_x_disp)
+ if (d == _ecore_x_disp)
{
- _error_request_code = ev->request_code;
- _error_code = ev->error_code;
- if (_error_func) _error_func(_error_data);
+ _error_request_code = ev->request_code;
+ _error_code = ev->error_code;
+ if (_error_func)
+ _error_func(_error_data);
}
-}
+} /* _ecore_x_error_handle */
static int
_ecore_x_io_error_handle(Display *d)
{
- if (d == _ecore_x_disp)
+ if (d == _ecore_x_disp)
{
- if (_io_error_func) _io_error_func(_io_error_data);
- else exit(-1);
+ if (_io_error_func)
+ _io_error_func(_io_error_data);
+ else
+ exit(-1);
}
+
return 0;
-}
+} /* _ecore_x_io_error_handle */
+
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#include <stdlib.h>
#include <stdio.h>
#ifndef CODESET
#define CODESET "INVALID"
-#endif
+#endif /* ifndef CODESET */
#if 0
-static void _ecore_x_event_free_window_prop_name_class_change(void *data, void *ev);
-static void _ecore_x_event_free_window_prop_title_change(void *data, void *ev);
-static void _ecore_x_event_free_window_prop_visible_title_change(void *data, void *ev);
-static void _ecore_x_event_free_window_prop_icon_name_change(void *data, void *ev);
-static void _ecore_x_event_free_window_prop_visible_icon_name_change(void *data, void *ev);
-static void _ecore_x_event_free_window_prop_client_machine_change(void *data, void *ev);
-#endif
+static void _ecore_x_event_free_window_prop_name_class_change(void *data,
+ void *ev);
+static void _ecore_x_event_free_window_prop_title_change(void *data, void *ev);
+static void _ecore_x_event_free_window_prop_visible_title_change(void *data,
+ void *ev);
+static void _ecore_x_event_free_window_prop_icon_name_change(void *data,
+ void *ev);
+static void _ecore_x_event_free_window_prop_visible_icon_name_change(void *data,
+ void *ev);
+static void _ecore_x_event_free_window_prop_client_machine_change(void *data,
+ void *ev);
+#endif /* if 0 */
static Window _ecore_x_mouse_down_last_win = 0;
static Window _ecore_x_mouse_down_last_last_win = 0;
e = ev;
if (_ecore_x_last_event_mouse_move)
{
- _ecore_x_last_event_mouse_move_event = NULL;
- _ecore_x_last_event_mouse_move = 0;
+ _ecore_x_last_event_mouse_move_event = NULL;
+ _ecore_x_last_event_mouse_move = 0;
}
+
free(e);
-}
+} /* _ecore_x_event_free_mouse_move */
EAPI void
ecore_x_event_mask_set(Ecore_X_Window w, Ecore_X_Event_Mask mask)
XSetWindowAttributes s_attr;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!w) w = DefaultRootWindow(_ecore_x_disp);
+ 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);
-}
+} /* ecore_x_event_mask_set */
EAPI void
ecore_x_event_mask_unset(Ecore_X_Window w, Ecore_X_Event_Mask mask)
XSetWindowAttributes s_attr;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!w) w = DefaultRootWindow(_ecore_x_disp);
+ 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);
-}
+} /* ecore_x_event_mask_unset */
#if 0
static void
Ecore_X_Event_Window_Prop_Name_Class_Change *e;
e = ev;
- if (e->name) free(e->name);
- if (e->clas) free(e->clas);
+ if (e->name)
+ free(e->name);
+
+ if (e->clas)
+ free(e->clas);
+
free(e);
-}
+} /* _ecore_x_event_free_window_prop_name_class_change */
static void
_ecore_x_event_free_window_prop_title_change(void *data, void *ev)
Ecore_X_Event_Window_Prop_Title_Change *e;
e = ev;
- if (e->title) free(e->title);
+ if (e->title)
+ free(e->title);
+
free(e);
-}
+} /* _ecore_x_event_free_window_prop_title_change */
static void
_ecore_x_event_free_window_prop_visible_title_change(void *data, void *ev)
Ecore_X_Event_Window_Prop_Visible_Title_Change *e;
e = ev;
- if (e->title) free(e->title);
+ if (e->title)
+ free(e->title);
+
free(e);
-}
+} /* _ecore_x_event_free_window_prop_visible_title_change */
static void
_ecore_x_event_free_window_prop_icon_name_change(void *data, void *ev)
Ecore_X_Event_Window_Prop_Icon_Name_Change *e;
e = ev;
- if (e->name) free(e->name);
+ if (e->name)
+ free(e->name);
+
free(e);
-}
+} /* _ecore_x_event_free_window_prop_icon_name_change */
static void
_ecore_x_event_free_window_prop_visible_icon_name_change(void *data, void *ev)
Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change *e;
e = ev;
- if (e->name) free(e->name);
+ if (e->name)
+ free(e->name);
+
free(e);
-}
+} /* _ecore_x_event_free_window_prop_visible_icon_name_change */
static void
_ecore_x_event_free_window_prop_client_machine_change(void *data, void *ev)
Ecore_X_Event_Window_Prop_Client_Machine_Change *e;
e = ev;
- if (e->name) free(e->name);
+ if (e->name)
+ free(e->name);
+
free(e);
-}
-#endif
+} /* _ecore_x_event_free_window_prop_client_machine_change */
+
+#endif /* if 0 */
static void
_ecore_x_event_free_xdnd_enter(void *data __UNUSED__, void *ev)
e = ev;
for (i = 0; i < e->num_types; i++)
- XFree(e->types[i]);
+ XFree(e->types[i]);
free(e->types);
free(e);
-}
+} /* _ecore_x_event_free_xdnd_enter */
static void
_ecore_x_event_free_selection_notify(void *data __UNUSED__, void *ev)
e = ev;
sel = e->data;
- if (sel->free) sel->free(sel);
+ if (sel->free)
+ sel->free(sel);
+
free(e->target);
free(e);
-}
+} /* _ecore_x_event_free_selection_notify */
static unsigned int
_ecore_x_event_modifiers(unsigned int state)
{
- unsigned int modifiers = 0;
+ 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_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_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;
return modifiers;
-}
+} /* _ecore_x_event_modifiers */
void
-_ecore_mouse_move(unsigned int timestamp, unsigned int xmodifiers,
- int x, int y,
- int x_root, int y_root,
- 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_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 ;
+ if (!e)
+ return;
e->window = window;
e->root_window = root_win;
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);
+
+ 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_y = y_root;
_ecore_x_last_event_mouse_move_event = event;
-}
+} /* _ecore_mouse_move */
static void
_ecore_key_press(int event, XKeyEvent *xevent)
_ecore_x_last_event_mouse_move = 0;
keyname = XKeysymToString(XKeycodeToKeysym(xevent->display,
- xevent->keycode, 0));
+ xevent->keycode, 0));
if (!keyname)
{
- snprintf(keyname_buffer, sizeof(keyname_buffer), "Keycode-%i", xevent->keycode);
- keyname = keyname_buffer;
- if (!keyname) return ;
+ snprintf(keyname_buffer,
+ sizeof(keyname_buffer),
+ "Keycode-%i",
+ xevent->keycode);
+ keyname = keyname_buffer;
+ if (!keyname)
+ return;
}
sym = 0;
compose = NULL;
if (_ecore_x_ic)
{
- Status mbstatus;
+ Status mbstatus;
#ifdef X_HAVE_UTF8_STRING
- val = Xutf8LookupString(_ecore_x_ic, (XKeyEvent *)xevent, compose_buffer, sizeof(compose_buffer) - 1, &sym, &mbstatus);
-#else
- val = XmbLookupString(_ecore_x_ic, (XKeyEvent *)xevent, compose_buffer, sizeof(compose_buffer) - 1, &sym, &mbstatus);
-#endif
- if (mbstatus == XBufferOverflow)
- {
- tmp = malloc(sizeof (char) * (val + 1));
- if (!tmp) return ;
+ val = Xutf8LookupString(_ecore_x_ic,
+ (XKeyEvent *)xevent,
+ compose_buffer,
+ sizeof(compose_buffer) - 1,
+ &sym,
+ &mbstatus);
+#else /* ifdef X_HAVE_UTF8_STRING */
+ val = XmbLookupString(_ecore_x_ic,
+ (XKeyEvent *)xevent,
+ compose_buffer,
+ sizeof(compose_buffer) - 1,
+ &sym,
+ &mbstatus);
+#endif /* ifdef X_HAVE_UTF8_STRING */
+ if (mbstatus == XBufferOverflow)
+ {
+ tmp = malloc(sizeof (char) * (val + 1));
+ if (!tmp)
+ return;
- compose = tmp;
+ compose = tmp;
#ifdef X_HAVE_UTF8_STRING
- val = Xutf8LookupString(_ecore_x_ic, (XKeyEvent *)xevent, tmp, val, &sym, &mbstatus);
-#else
- val = XmbLookupString(_ecore_x_ic, (XKeyEvent *)xevent, tmp, val, &sym, &mbstatus);
-#endif
- if (val > 0)
- {
- tmp[val] = 0;
+ val = Xutf8LookupString(_ecore_x_ic,
+ (XKeyEvent *)xevent,
+ tmp,
+ val,
+ &sym,
+ &mbstatus);
+#else /* ifdef X_HAVE_UTF8_STRING */
+ val = XmbLookupString(_ecore_x_ic,
+ (XKeyEvent *)xevent,
+ tmp,
+ val,
+ &sym,
+ &mbstatus);
+#endif /* ifdef X_HAVE_UTF8_STRING */
+ if (val > 0)
+ {
+ tmp[val] = 0;
#ifndef X_HAVE_UTF8_STRING
- compose = eina_str_convert(nl_langinfo(CODESET), "UTF-8", tmp);
- free(tmp);
- tmp = compose;
-#endif
- }
- else compose = NULL;
- }
- else
- if (val > 0)
- {
- compose_buffer[val] = 0;
+ compose = eina_str_convert(nl_langinfo(CODESET), "UTF-8", tmp);
+ free(tmp);
+ tmp = compose;
+#endif /* ifndef X_HAVE_UTF8_STRING */
+ }
+ else
+ compose = NULL;
+ }
+ else
+ if (val > 0)
+ {
+ compose_buffer[val] = 0;
#ifdef X_HAVE_UTF8_STRING
- compose = compose_buffer;
-#else
- compose = eina_str_convert(nl_langinfo(CODESET), "UTF-8", compose_buffer);
- tmp = compose;
-#endif
- }
+ compose = compose_buffer;
+#else /* ifdef X_HAVE_UTF8_STRING */
+ compose = eina_str_convert(nl_langinfo(
+ CODESET), "UTF-8", compose_buffer);
+ tmp = compose;
+#endif /* ifdef X_HAVE_UTF8_STRING */
+ }
}
else
{
- 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);
- tmp = compose;
- }
+ 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);
+ tmp = compose;
+ }
}
key = XKeysymToString(sym);
- if (!key) key = keyname;
- if (!key) goto on_error;
+ if (!key)
+ key = keyname;
+
+ if (!key)
+ goto on_error;
- e = malloc(sizeof(Ecore_Event_Key) + strlen(key) + strlen(keyname) + (compose ? strlen(compose) : 0) + 3);
- if (!e) goto on_error;
+ 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->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);
+ 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);
_ecore_x_event_last_time = e->timestamp;
- on_error:
- if (tmp) free(tmp);
-}
+on_error:
+ if (tmp)
+ free(tmp);
+} /* _ecore_key_press */
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_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;
+ if (!e)
+ return NULL;
e->window = window;
e->root_window = root_win;
if (event_window == window)
{
- if (((int)(timestamp - _ecore_x_mouse_down_last_time) <=
- (int)(1000 * _ecore_x_double_click_time)) &&
- (window == _ecore_x_mouse_down_last_win) &&
- (event_window == _ecore_x_mouse_down_last_event_win)
- )
- e->double_click = 1;
- if (((int)(timestamp - _ecore_x_mouse_down_last_last_time) <=
- (int)(2 * 1000 * _ecore_x_double_click_time)) &&
- (window == _ecore_x_mouse_down_last_win) &&
- (window == _ecore_x_mouse_down_last_last_win) &&
- (event_window == _ecore_x_mouse_down_last_event_win) &&
- (event_window == _ecore_x_mouse_down_last_last_event_win)
- )
- {
- e->triple_click = 1;
- _ecore_x_mouse_down_did_triple = 1;
- }
- else
- _ecore_x_mouse_down_did_triple = 0;
+ if (((int)(timestamp - _ecore_x_mouse_down_last_time) <=
+ (int)(1000 * _ecore_x_double_click_time)) &&
+ (window == _ecore_x_mouse_down_last_win) &&
+ (event_window == _ecore_x_mouse_down_last_event_win)
+ )
+ e->double_click = 1;
+
+ if (((int)(timestamp - _ecore_x_mouse_down_last_last_time) <=
+ (int)(2 * 1000 * _ecore_x_double_click_time)) &&
+ (window == _ecore_x_mouse_down_last_win) &&
+ (window == _ecore_x_mouse_down_last_last_win) &&
+ (event_window == _ecore_x_mouse_down_last_event_win) &&
+ (event_window == _ecore_x_mouse_down_last_last_event_win)
+ )
+ {
+ e->triple_click = 1;
+ _ecore_x_mouse_down_did_triple = 1;
+ }
+ else
+ _ecore_x_mouse_down_did_triple = 0;
}
if (event == ECORE_EVENT_MOUSE_BUTTON_DOWN
&& !e->double_click
&& !e->triple_click)
- _ecore_x_mouse_up_count = 0;
-
+ _ecore_x_mouse_up_count = 0;
+
e->multi.device = dev;
e->multi.radius = (radx + rady) / 2;
e->multi.radius_x = radx;
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_event_add(event, e, NULL, NULL);
return e;
-}
+} /* _ecore_mouse_button */
void
_ecore_x_event_handle_any_event(XEvent *xevent)
{
- XEvent* ev = malloc(sizeof(XEvent));
-
+ XEvent *ev = malloc(sizeof(XEvent));
+
memcpy(ev, xevent, sizeof(XEvent));
ecore_event_add(ECORE_X_EVENT_ANY, ev, NULL, NULL);
-}
+} /* _ecore_x_event_handle_any_event */
void
_ecore_x_event_handle_key_press(XEvent *xevent)
{
- _ecore_key_press(ECORE_EVENT_KEY_DOWN, (XKeyEvent *) xevent);
-}
+ _ecore_key_press(ECORE_EVENT_KEY_DOWN, (XKeyEvent *)xevent);
+} /* _ecore_x_event_handle_key_press */
void
_ecore_x_event_handle_key_release(XEvent *xevent)
{
- _ecore_key_press(ECORE_EVENT_KEY_UP, (XKeyEvent *) xevent);
-}
+ _ecore_key_press(ECORE_EVENT_KEY_UP, (XKeyEvent *)xevent);
+} /* _ecore_x_event_handle_key_release */
void
_ecore_x_event_handle_button_press(XEvent *xevent)
_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;
+ 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))
- {
- int replay = 0;
-
- 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;
- }
- }
+ } /* switch */
+
+ 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,
+ {
+ _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;
-
- if (_ecore_x_mouse_down_did_triple)
- {
- _ecore_x_mouse_down_last_win = 0;
- _ecore_x_mouse_down_last_last_win = 0;
- _ecore_x_mouse_down_last_event_win = 0;
- _ecore_x_mouse_down_last_last_event_win = 0;
- _ecore_x_mouse_down_last_time = 0;
- _ecore_x_mouse_down_last_last_time = 0;
- }
-
- 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))
- {
- int replay = 0;
-
- 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;
- }
- }
-
- if (window == event_window)
- {
- if (!_ecore_x_mouse_down_did_triple)
- {
- _ecore_x_mouse_down_last_last_win = _ecore_x_mouse_down_last_win;
- if (xevent->xbutton.subwindow)
- _ecore_x_mouse_down_last_win = xevent->xbutton.subwindow;
- else
- _ecore_x_mouse_down_last_win = xevent->xbutton.window;
- _ecore_x_mouse_down_last_last_event_win = _ecore_x_mouse_down_last_event_win;
- _ecore_x_mouse_down_last_event_win = xevent->xbutton.window;
- _ecore_x_mouse_down_last_last_time = _ecore_x_mouse_down_last_time;
- _ecore_x_mouse_down_last_time = xevent->xbutton.time;
- }
- }
- }
+ }
+ {
+ Ecore_Event_Mouse_Button *e;
+ int event_window;
+ int window;
+
+ if (_ecore_x_mouse_down_did_triple)
+ {
+ _ecore_x_mouse_down_last_win = 0;
+ _ecore_x_mouse_down_last_last_win = 0;
+ _ecore_x_mouse_down_last_event_win = 0;
+ _ecore_x_mouse_down_last_last_event_win = 0;
+ _ecore_x_mouse_down_last_time = 0;
+ _ecore_x_mouse_down_last_last_time = 0;
+ }
+
+ 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;
+ }
+ }
+
+ if (window == event_window)
+ if (!_ecore_x_mouse_down_did_triple)
+ {
+ _ecore_x_mouse_down_last_last_win =
+ _ecore_x_mouse_down_last_win;
+ if (xevent->xbutton.subwindow)
+ _ecore_x_mouse_down_last_win = xevent->xbutton.subwindow;
+ else
+ _ecore_x_mouse_down_last_win = xevent->xbutton.window;
+
+ _ecore_x_mouse_down_last_last_event_win =
+ _ecore_x_mouse_down_last_event_win;
+ _ecore_x_mouse_down_last_event_win = xevent->xbutton.window;
+ _ecore_x_mouse_down_last_last_time =
+ _ecore_x_mouse_down_last_time;
+ _ecore_x_mouse_down_last_time = xevent->xbutton.time;
+ }
+
+ }
}
-}
+} /* _ecore_x_event_handle_button_press */
void
_ecore_x_event_handle_button_release(XEvent *xevent)
/* 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,
+ _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,
+ _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);
}
-}
+} /* _ecore_x_event_handle_button_release */
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_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,
+ 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
_ecore_x_last_event_mouse_move = 1;
/* Xdnd handling */
- _ecore_x_dnd_drag(xevent->xmotion.root, xevent->xmotion.x_root, xevent->xmotion.y_root);
-}
+ _ecore_x_dnd_drag(xevent->xmotion.root,
+ xevent->xmotion.x_root,
+ xevent->xmotion.y_root);
+} /* _ecore_x_event_handle_motion_notify */
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);
- }
-}
+ {
+ _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);
+ }
+} /* _ecore_x_event_handle_enter_notify */
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);
- }
-}
+ {
+ _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);
+ }
+} /* _ecore_x_event_handle_leave_notify */
void
_ecore_x_event_handle_focus_in(XEvent *xevent)
_ecore_x_last_event_mouse_move = 0;
if (_ecore_x_ic)
{
- char *str;
+ char *str;
+
+ XSetICValues(_ecore_x_ic, XNFocusWindow, xevent->xfocus.window, NULL);
+ if ((str = XmbResetIC(_ecore_x_ic)))
+ XFree(str);
- XSetICValues(_ecore_x_ic, XNFocusWindow, xevent->xfocus.window, NULL);
- if ((str = XmbResetIC(_ecore_x_ic)))
- XFree(str);
- XSetICFocus(_ecore_x_ic);
+ XSetICFocus(_ecore_x_ic);
}
+
e = calloc(1, sizeof(Ecore_X_Event_Window_Focus_In));
- if (!e) return;
+ 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;
+ 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);
-}
+} /* _ecore_x_event_handle_focus_in */
void
_ecore_x_event_handle_focus_out(XEvent *xevent)
Ecore_X_Event_Window_Focus_Out *e;
_ecore_x_last_event_mouse_move = 0;
- if (_ecore_x_ic) XUnsetICFocus(_ecore_x_ic);
+ if (_ecore_x_ic)
+ XUnsetICFocus(_ecore_x_ic);
+
e = calloc(1, sizeof(Ecore_X_Event_Window_Focus_Out));
- if (!e) return;
+ 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;
+ 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);
-}
+} /* _ecore_x_event_handle_focus_out */
void
_ecore_x_event_handle_keymap_notify(XEvent *xevent __UNUSED__)
{
_ecore_x_last_event_mouse_move = 0;
- /* FIXME: handle this event type */
-}
+ /* FIXME: handle this event type */
+} /* _ecore_x_event_handle_keymap_notify */
void
_ecore_x_event_handle_expose(XEvent *xevent)
_ecore_x_last_event_mouse_move = 0;
e = calloc(1, sizeof(Ecore_X_Event_Window_Damage));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = xevent->xexpose.window;
e->time = _ecore_x_event_last_time;
e->x = xevent->xexpose.x;
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);
-}
+ ecore_event_add(ECORE_X_EVENT_WINDOW_DAMAGE, e, NULL, NULL);
+} /* _ecore_x_event_handle_expose */
void
_ecore_x_event_handle_graphics_expose(XEvent *xevent)
_ecore_x_last_event_mouse_move = 0;
e = calloc(1, sizeof(Ecore_X_Event_Window_Damage));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = xevent->xgraphicsexpose.drawable;
e->time = _ecore_x_event_last_time;
e->x = xevent->xgraphicsexpose.x;
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);
-}
+ ecore_event_add(ECORE_X_EVENT_WINDOW_DAMAGE, e, NULL, NULL);
+} /* _ecore_x_event_handle_graphics_expose */
void
_ecore_x_event_handle_visibility_notify(XEvent *xevent)
Ecore_X_Event_Window_Visibility_Change *e;
e = calloc(1, sizeof(Ecore_X_Event_Window_Visibility_Change));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = xevent->xvisibility.window;
e->time = _ecore_x_event_last_time;
if (xevent->xvisibility.state == VisibilityFullyObscured)
- e->fully_obscured = 1;
+ e->fully_obscured = 1;
else
- e->fully_obscured = 0;
+ e->fully_obscured = 0;
+
ecore_event_add(ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE, e, NULL, NULL);
}
-}
+} /* _ecore_x_event_handle_visibility_notify */
void
_ecore_x_event_handle_create_notify(XEvent *xevent)
_ecore_x_last_event_mouse_move = 0;
e = calloc(1, sizeof(Ecore_X_Event_Window_Create));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = xevent->xcreatewindow.window;
e->parent = xevent->xcreatewindow.parent;
if (xevent->xcreatewindow.override_redirect)
- e->override = 1;
+ e->override = 1;
else
- e->override = 0;
+ e->override = 0;
+
e->x = xevent->xcreatewindow.x;
e->y = xevent->xcreatewindow.y;
e->w = xevent->xcreatewindow.width;
e->border = xevent->xcreatewindow.border_width;
e->time = _ecore_x_event_last_time;
ecore_event_add(ECORE_X_EVENT_WINDOW_CREATE, e, NULL, NULL);
-}
+} /* _ecore_x_event_handle_create_notify */
void
_ecore_x_event_handle_destroy_notify(XEvent *xevent)
_ecore_x_last_event_mouse_move = 0;
e = calloc(1, sizeof(Ecore_X_Event_Window_Destroy));
- if (!e) return;
- e->win = xevent->xdestroywindow.window;
+ 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);
-}
+ 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);
+} /* _ecore_x_event_handle_destroy_notify */
void
_ecore_x_event_handle_unmap_notify(XEvent *xevent)
_ecore_x_last_event_mouse_move = 0;
e = calloc(1, sizeof(Ecore_X_Event_Window_Hide));
- if (!e) return;
+ 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);
-}
+} /* _ecore_x_event_handle_unmap_notify */
void
_ecore_x_event_handle_map_notify(XEvent *xevent)
_ecore_x_last_event_mouse_move = 0;
e = calloc(1, sizeof(Ecore_X_Event_Window_Show));
- if (!e) return;
+ 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);
-}
+} /* _ecore_x_event_handle_map_notify */
void
_ecore_x_event_handle_map_request(XEvent *xevent)
_ecore_x_last_event_mouse_move = 0;
e = calloc(1, sizeof(Ecore_X_Event_Window_Show_Request));
- if (!e) return;
+ 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);
-}
+} /* _ecore_x_event_handle_map_request */
void
_ecore_x_event_handle_reparent_notify(XEvent *xevent)
_ecore_x_last_event_mouse_move = 0;
e = calloc(1, sizeof(Ecore_X_Event_Window_Reparent));
- if (!e) return;
+ 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);
-}
+} /* _ecore_x_event_handle_reparent_notify */
void
_ecore_x_event_handle_configure_notify(XEvent *xevent)
_ecore_x_last_event_mouse_move = 0;
e = calloc(1, sizeof(Ecore_X_Event_Window_Configure));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = xevent->xconfigure.window;
e->event_win = xevent->xconfigure.event;
e->abovewin = xevent->xconfigure.above;
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);
-}
+ ecore_event_add(ECORE_X_EVENT_WINDOW_CONFIGURE, e, NULL, NULL);
+} /* _ecore_x_event_handle_configure_notify */
void
_ecore_x_event_handle_configure_request(XEvent *xevent)
_ecore_x_last_event_mouse_move = 0;
e = calloc(1, sizeof(Ecore_X_Event_Window_Configure_Request));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = xevent->xconfigurerequest.window;
e->parent_win = xevent->xconfigurerequest.parent;
e->abovewin = xevent->xconfigurerequest.above;
e->time = _ecore_x_event_last_time;
if (xevent->xconfigurerequest.detail == Above)
- e->detail = ECORE_X_WINDOW_STACK_ABOVE;
+ e->detail = ECORE_X_WINDOW_STACK_ABOVE;
else if (xevent->xconfigurerequest.detail == Below)
- e->detail = ECORE_X_WINDOW_STACK_BELOW;
+ e->detail = ECORE_X_WINDOW_STACK_BELOW;
else if (xevent->xconfigurerequest.detail == TopIf)
- e->detail = ECORE_X_WINDOW_STACK_TOP_IF;
+ e->detail = ECORE_X_WINDOW_STACK_TOP_IF;
else if (xevent->xconfigurerequest.detail == BottomIf)
- e->detail = ECORE_X_WINDOW_STACK_BOTTOM_IF;
+ e->detail = ECORE_X_WINDOW_STACK_BOTTOM_IF;
else if (xevent->xconfigurerequest.detail == Opposite)
- e->detail = ECORE_X_WINDOW_STACK_OPPOSITE;
+ e->detail = ECORE_X_WINDOW_STACK_OPPOSITE;
ecore_event_add(ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST, e, NULL, NULL);
-}
+} /* _ecore_x_event_handle_configure_request */
void
_ecore_x_event_handle_gravity_notify(XEvent *xevent __UNUSED__)
{
_ecore_x_last_event_mouse_move = 0;
/* FIXME: handle this event type */
-}
+} /* _ecore_x_event_handle_gravity_notify */
void
_ecore_x_event_handle_resize_request(XEvent *xevent)
_ecore_x_last_event_mouse_move = 0;
e = calloc(1, sizeof(Ecore_X_Event_Window_Resize_Request));
- if (!e) return;
+ 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);
-}
+} /* _ecore_x_event_handle_resize_request */
void
_ecore_x_event_handle_circulate_notify(XEvent *xevent)
_ecore_x_last_event_mouse_move = 0;
e = calloc(1, sizeof(Ecore_X_Event_Window_Stack));
- if (!e) return;
+ 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;
+ e->detail = ECORE_X_WINDOW_STACK_ABOVE;
else
- e->detail = ECORE_X_WINDOW_STACK_BELOW;
+ 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);
-}
+} /* _ecore_x_event_handle_circulate_notify */
void
_ecore_x_event_handle_circulate_request(XEvent *xevent)
_ecore_x_last_event_mouse_move = 0;
e = calloc(1, sizeof(Ecore_X_Event_Window_Stack_Request));
- if (!e) return;
+ 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;
+ e->detail = ECORE_X_WINDOW_STACK_ABOVE;
else
- e->detail = ECORE_X_WINDOW_STACK_BELOW;
+ 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);
-}
+} /* _ecore_x_event_handle_circulate_request */
void
_ecore_x_event_handle_property_notify(XEvent *xevent)
*/
if (xevent->xproperty.atom == ECORE_X_ATOM_WM_CLASS)
{
- Ecore_X_Event_Window_Prop_Name_Class_Change *e;
+ Ecore_X_Event_Window_Prop_Name_Class_Change *e;
- e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Name_Class_Change));
- if (!e) return;
- ecore_x_window_prop_name_class_get(xevent->xproperty.window,
- &(e->name), &(e->clas));
+ e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Name_Class_Change));
+ if (!e)
+ return;
+
+ ecore_x_window_prop_name_class_get(xevent->xproperty.window,
+ &(e->name), &(e->clas));
e->time = xevent->xproperty.time;
_ecore_x_event_last_time = e->time;
- ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE, e,
+ ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE, e,
_ecore_x_event_free_window_prop_name_class_change, NULL);
}
- else if ((xevent->xproperty.atom == ECORE_X_ATOM_WM_NAME) ||
+ else if ((xevent->xproperty.atom == ECORE_X_ATOM_WM_NAME) ||
(xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_NAME))
{
- Ecore_X_Event_Window_Prop_Title_Change *e;
+ Ecore_X_Event_Window_Prop_Title_Change *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Title_Change));
+ if (!e)
+ return;
- e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Title_Change));
- if (!e) return;
- e->title = ecore_x_window_prop_title_get(xevent->xproperty.window);
+ e->title = ecore_x_window_prop_title_get(xevent->xproperty.window);
e->time = xevent->xproperty.time;
_ecore_x_event_last_time = e->time;
- ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE, e,
+ ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE, e,
_ecore_x_event_free_window_prop_title_change, NULL);
}
else if (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_VISIBLE_NAME)
{
- Ecore_X_Event_Window_Prop_Visible_Title_Change *e;
+ Ecore_X_Event_Window_Prop_Visible_Title_Change *e;
- e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Visible_Title_Change));
- if (!e) return;
- e->title = ecore_x_window_prop_visible_title_get(xevent->xproperty.window);
+ e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Visible_Title_Change));
+ if (!e)
+ return;
+
+ e->title = ecore_x_window_prop_visible_title_get(
+ xevent->xproperty.window);
e->time = xevent->xproperty.time;
_ecore_x_event_last_time = e->time;
- ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE, e,
- _ecore_x_event_free_window_prop_visible_title_change, NULL);
+ ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE,
+ e,
+ _ecore_x_event_free_window_prop_visible_title_change,
+ NULL);
}
- else if ((xevent->xproperty.atom == ECORE_X_ATOM_WM_ICON_NAME) ||
+ else if ((xevent->xproperty.atom == ECORE_X_ATOM_WM_ICON_NAME) ||
(xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_ICON_NAME))
{
- Ecore_X_Event_Window_Prop_Icon_Name_Change *e;
+ Ecore_X_Event_Window_Prop_Icon_Name_Change *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Icon_Name_Change));
+ if (!e)
+ return;
- e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Icon_Name_Change));
- if (!e) return;
- e->name = ecore_x_window_prop_icon_name_get(xevent->xproperty.window);
+ e->name = ecore_x_window_prop_icon_name_get(xevent->xproperty.window);
e->time = xevent->xproperty.time;
_ecore_x_event_last_time = e->time;
- ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE, e,
+ ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE, e,
_ecore_x_event_free_window_prop_icon_name_change, NULL);
}
else if (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME)
{
- Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change *e;
+ Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change *e;
- e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change));
- if (!e) return;
- e->name = ecore_x_window_prop_visible_icon_name_get(xevent->xproperty.window);
+ e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change));
+ if (!e)
+ return;
+
+ e->name = ecore_x_window_prop_visible_icon_name_get(
+ xevent->xproperty.window);
e->time = xevent->xproperty.time;
_ecore_x_event_last_time = e->time;
- ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE, e,
- _ecore_x_event_free_window_prop_visible_icon_name_change, NULL);
+ ecore_event_add(
+ ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE,
+ e,
+ _ecore_x_event_free_window_prop_visible_icon_name_change,
+ NULL);
}
else if (xevent->xproperty.atom == ECORE_X_ATOM_WM_CLIENT_MACHINE)
{
- Ecore_X_Event_Window_Prop_Client_Machine_Change *e;
+ Ecore_X_Event_Window_Prop_Client_Machine_Change *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Client_Machine_Change));
+ if (!e)
+ return;
- e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Client_Machine_Change));
- if (!e) return;
- e->name = ecore_x_window_prop_client_machine_get(xevent->xproperty.window);
+ e->name = ecore_x_window_prop_client_machine_get(
+ xevent->xproperty.window);
e->time = xevent->xproperty.time;
_ecore_x_event_last_time = e->time;
- ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE, e,
- _ecore_x_event_free_window_prop_client_machine_change, NULL);
+ ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE,
+ e,
+ _ecore_x_event_free_window_prop_client_machine_change,
+ NULL);
}
else if (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_PID)
{
- Ecore_X_Event_Window_Prop_Pid_Change *e;
+ Ecore_X_Event_Window_Prop_Pid_Change *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Pid_Change));
+ if (!e)
+ return;
- e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Pid_Change));
- if (!e) return;
- e->pid = ecore_x_window_prop_pid_get(xevent->xproperty.window);
+ e->pid = ecore_x_window_prop_pid_get(xevent->xproperty.window);
e->time = xevent->xproperty.time;
_ecore_x_event_last_time = e->time;
- ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE, e, NULL, NULL);
+ ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE, e, NULL, NULL);
}
else if (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_DESKTOP)
{
- Ecore_X_Event_Window_Prop_Desktop_Change *e;
+ Ecore_X_Event_Window_Prop_Desktop_Change *e;
- e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Desktop_Change));
- if (!e) return;
- e->desktop = ecore_x_window_prop_desktop_get(xevent->xproperty.window);
- ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE, e, NULL, NULL);
+ e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Desktop_Change));
+ if (!e)
+ return;
+
+ e->desktop = ecore_x_window_prop_desktop_get(xevent->xproperty.window);
+ ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE, e, NULL, NULL);
}
- else
-#endif
+ else
+#endif /* if 0 */
{
Ecore_X_Event_Window_Property *e;
e = calloc(1, sizeof(Ecore_X_Event_Window_Property));
- if (!e) return;
+ 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);
}
-}
+} /* _ecore_x_event_handle_property_notify */
void
_ecore_x_event_handle_selection_clear(XEvent *xevent)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
_ecore_x_last_event_mouse_move = 0;
d = _ecore_x_selection_get(xevent->xselectionclear.selection);
+/* errr..... why? paranoia.
if (d && (xevent->xselectionclear.time > d->time))
{
- _ecore_x_selection_set(None, NULL, 0,
- xevent->xselectionclear.selection);
+ _ecore_x_selection_set(None, NULL, 0,
+ xevent->xselectionclear.selection);
}
-
- /* Generate event for app cleanup */
+ */
+/* 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;
+ e->selection = ECORE_X_SELECTION_PRIMARY;
else if (sel == ECORE_X_ATOM_SELECTION_SECONDARY)
- e->selection = ECORE_X_SELECTION_SECONDARY;
+ e->selection = ECORE_X_SELECTION_SECONDARY;
else if (sel == ECORE_X_ATOM_SELECTION_CLIPBOARD)
- e->selection = ECORE_X_SELECTION_CLIPBOARD;
+ e->selection = ECORE_X_SELECTION_CLIPBOARD;
else
- e->selection = ECORE_X_SELECTION_OTHER;
+ e->selection = ECORE_X_SELECTION_OTHER;
+
ecore_event_add(ECORE_X_EVENT_SELECTION_CLEAR, e, NULL, NULL);
-}
+} /* _ecore_x_event_handle_selection_clear */
void
_ecore_x_event_handle_selection_request(XEvent *xevent)
Ecore_X_Event_Selection_Request *e;
Ecore_X_Selection_Intern *sd;
void *data;
+ int len;
+ int typesize;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
_ecore_x_last_event_mouse_move = 0;
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;
-
- if (!ecore_x_selection_convert(xevent->xselectionrequest.selection,
- xevent->xselectionrequest.target,
- &data))
- {
- /* Refuse selection, conversion to requested target failed */
- property = None;
- }
- else
- {
- /* FIXME: This does not properly handle large data transfers */
- ecore_x_window_prop_property_set(xevent->xselectionrequest.requestor,
- xevent->xselectionrequest.property,
- xevent->xselectionrequest.target,
- 8, data, sd->length);
- property = xevent->xselectionrequest.property;
- free(data);
- }
-
- ecore_x_selection_notify_send(xevent->xselectionrequest.requestor,
- xevent->xselectionrequest.selection,
- xevent->xselectionrequest.target,
- property,
- xevent->xselectionrequest.time);
- }
+ Ecore_X_Selection_Intern *si;
+
+ si = _ecore_x_selection_get(xevent->xselectionrequest.selection);
+ if (si->data)
+ {
+ Ecore_X_Atom property;
+ 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
+ {
+ /* 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);
+ }
}
+
return;
-}
+} /* _ecore_x_event_handle_selection_request */
void
_ecore_x_event_handle_selection_notify(XEvent *xevent)
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;
+ 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;
+ 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;
+ 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;
+ e->selection = ECORE_X_SELECTION_PRIMARY;
else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
- e->selection = ECORE_X_SELECTION_SECONDARY;
+ e->selection = ECORE_X_SELECTION_SECONDARY;
else if (selection == ECORE_X_ATOM_SELECTION_XDND)
- e->selection = ECORE_X_SELECTION_XDND;
+ e->selection = ECORE_X_SELECTION_XDND;
else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
- e->selection = ECORE_X_SELECTION_CLIPBOARD;
+ e->selection = ECORE_X_SELECTION_CLIPBOARD;
else
- e->selection = ECORE_X_SELECTION_OTHER;
+ 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_event_add(ECORE_X_EVENT_SELECTION_NOTIFY, e,
_ecore_x_event_free_selection_notify, NULL);
-}
+} /* _ecore_x_event_handle_selection_notify */
void
_ecore_x_event_handle_colormap_notify(XEvent *xevent)
_ecore_x_last_event_mouse_move = 0;
e = calloc(1,sizeof(Ecore_X_Event_Window_Colormap));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = xevent->xcolormap.window;
e->cmap = xevent->xcolormap.colormap;
e->time = _ecore_x_event_last_time;
e->installed = 1;
else
e->installed = 0;
+
ecore_event_add(ECORE_X_EVENT_WINDOW_COLORMAP, e, NULL, NULL);
-}
+} /* _ecore_x_event_handle_colormap_notify */
void
_ecore_x_event_handle_client_message(XEvent *xevent)
(xevent->xclient.format == 32) &&
(xevent->xclient.data.l[0] == (long)ECORE_X_ATOM_WM_DELETE_WINDOW))
{
- Ecore_X_Event_Window_Delete_Request *e;
+ 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);
- }
+ 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))
+ (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);
+ 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;
+ Ecore_X_Event_Xdnd_Enter *e;
+ Ecore_X_DND_Target *target;
- e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Enter));
- if (!e) return;
+ 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);
- 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;
+ 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);
+ 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.");
- return;
- }
- types = (Ecore_X_Atom *)data;
- e->types = calloc(num_ret, sizeof(char *));
- if (e->types)
- {
+ 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.");
+ 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)
- {
+ 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,
+ 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;
+ 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);
+ 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;
+ 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);
+ 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;
+ 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);
- }
+ 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;
+ 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);
+ 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 */
+ /* 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;
- int completed = 1;
+ Ecore_X_Event_Xdnd_Finished *e;
+ Ecore_X_DND_Source *source;
+ int completed = 1;
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))
- {
+ 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 = 0;
- 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);
+ /* Target successfully performed drop action */
+ ecore_x_selection_xdnd_clear();
+ source->state = ECORE_X_DND_SOURCE_IDLE;
+ }
+ else if (source->version >= 5)
+ {
+ completed = 0;
+ 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;
- }
+ 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)
- {
+ 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__);
- 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)
- {
+ }
+ 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__);
- 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);
+ 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))
+ && (xevent->xclient.format == 32)
+ && (xevent->xclient.data.l[0] == IconicState))
{
- Ecore_X_Event_Window_State_Request *e;
+ Ecore_X_Event_Window_State_Request *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Window_State_Request));
+ if (!e)
+ return;
- 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;
+ 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);
+ 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))
+ && (xevent->xclient.format == 32))
{
- Ecore_X_Event_Desktop_Change *e;
+ Ecore_X_Event_Desktop_Change *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Desktop_Change));
+ if (!e)
+ return;
- 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];
+ 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);
+ ecore_event_add(ECORE_X_EVENT_DESKTOP_CHANGE, e, NULL, NULL);
}
- else if ((xevent->xclient.message_type == ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS))
+ else if ((xevent->xclient.message_type ==
+ ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS))
{
- Ecore_X_Event_Frame_Extents_Request *e;
+ 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;
+ e = calloc(1, sizeof(Ecore_X_Event_Frame_Extents_Request));
+ if (!e)
+ return;
- ecore_event_add(ECORE_X_EVENT_FRAME_EXTENTS_REQUEST, e, NULL, NULL);
+ 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_Atom)xevent->xclient.data.l[0] ==
+ ECORE_X_ATOM_NET_WM_PING)
+ && (xevent->xclient.format == 32))
{
- Ecore_X_Event_Ping *e;
+ 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];
+ 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);
+ 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);
+ root = DefaultRootWindow(_ecore_x_disp);
if (xevent->xclient.window != root)
{
xevent->xclient.window = root;
- XSendEvent(_ecore_x_disp, root, False,
- SubstructureRedirectMask | SubstructureNotifyMask,
+ 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_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);
- }
+ (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))
+ && (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]);
+ /* 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);
+ 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);
}
-}
+} /* _ecore_x_event_handle_client_message */
void
_ecore_x_event_handle_mapping_notify(XEvent *xevent)
{
_ecore_x_last_event_mouse_move = 0;
XRefreshKeyboardMapping((XMappingEvent *)xevent);
-}
+} /* _ecore_x_event_handle_mapping_notify */
void
_ecore_x_event_handle_shape_change(XEvent *xevent)
_ecore_x_last_event_mouse_move = 0;
shape_event = (XShapeEvent *)xevent;
e = calloc(1, sizeof(Ecore_X_Event_Window_Shape));
- if (!e) return;
+ 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);
-}
+} /* _ecore_x_event_handle_shape_change */
void
_ecore_x_event_handle_screensaver_notify(XEvent *xevent)
_ecore_x_last_event_mouse_move = 0;
screensaver_event = (XScreenSaverNotifyEvent *)xevent;
e = calloc(1, sizeof(Ecore_X_Event_Screensaver_Notify));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = screensaver_event->window;
if (screensaver_event->state == ScreenSaverOn)
- e->on = 1;
- else
- e->on = 0;
+ e->on = 1;
+ else
+ e->on = 0;
+
e->time = screensaver_event->time;
ecore_event_add(ECORE_X_EVENT_SCREENSAVER_NOTIFY, e, NULL, NULL);
-#else
+#else /* ifdef ECORE_XSS */
xevent = NULL;
-#endif
-}
+#endif /* ifdef ECORE_XSS */
+} /* _ecore_x_event_handle_screensaver_notify */
void
_ecore_x_event_handle_sync_counter(XEvent *xevent)
_ecore_x_last_event_mouse_move = 0;
sync_counter_event = (XSyncCounterNotifyEvent *)xevent;
e = calloc(1, sizeof(Ecore_X_Event_Sync_Counter));
- if (!e) return;
+ if (!e)
+ return;
+
e->time = sync_counter_event->time;
ecore_event_add(ECORE_X_EVENT_SYNC_COUNTER, e, NULL, NULL);
-}
+} /* _ecore_x_event_handle_sync_counter */
void
_ecore_x_event_handle_sync_alarm(XEvent *xevent)
sync_alarm_event = (XSyncAlarmNotifyEvent *)xevent;
e = calloc(1, sizeof(Ecore_X_Event_Sync_Alarm));
- if (!e) return;
+ 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);
-}
+} /* _ecore_x_event_handle_sync_alarm */
#ifdef ECORE_XRANDR
void
_ecore_x_last_event_mouse_move = 0;
randr_event = (XRRScreenChangeNotifyEvent *)xevent;
if (!XRRUpdateConfiguration(xevent))
- ERR("Can't update RR config!");
+ ERR("Can't update RR config!");
e = calloc(1, sizeof(Ecore_X_Event_Screen_Change));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = randr_event->window;
e->root = randr_event->root;
- e->width = randr_event->width;
- e->height = randr_event->height;
+ 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->mm_width = randr_event->mwidth;
- e->mm_height = randr_event->mheight;
- e->rotation = randr_event->rotation;
+ 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);
-}
+} /* _ecore_x_event_handle_randr_change */
static void
_ecore_x_event_handle_randr_notify_crtc_change(const XRRNotifyEvent *xevent)
randr_event = (const XRRCrtcChangeNotifyEvent *)xevent;
e = calloc(1, sizeof(Ecore_X_Event_Randr_Crtc_Change));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = randr_event->window;
e->crtc = randr_event->crtc;
e->mode = randr_event->mode;
- e->rotation = randr_event->rotation;
- e->x = randr_event->x;
- e->y = randr_event->y;
- e->width = randr_event->width;
- e->height = randr_event->height;
+ 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);
-}
+} /* _ecore_x_event_handle_randr_notify_crtc_change */
static void
_ecore_x_event_handle_randr_notify_output_change(const XRRNotifyEvent *xevent)
randr_event = (const XRROutputChangeNotifyEvent *)xevent;
e = calloc(1, sizeof(Ecore_X_Event_Randr_Output_Change));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = randr_event->window;
e->output = randr_event->output;
e->crtc = randr_event->crtc;
e->mode = randr_event->mode;
- e->rotation = randr_event->rotation;
+ 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);
-}
+} /* _ecore_x_event_handle_randr_notify_output_change */
static void
_ecore_x_event_handle_randr_notify_output_property(const XRRNotifyEvent *xevent)
randr_event = (const XRROutputPropertyNotifyEvent *)xevent;
e = calloc(1, sizeof(Ecore_X_Event_Randr_Output_Property_Notify));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = randr_event->window;
e->output = randr_event->output;
e->property = randr_event->property;
e->time = randr_event->timestamp;
e->state = randr_event->state;
ecore_event_add(ECORE_X_EVENT_RANDR_OUTPUT_PROPERTY_NOTIFY, e, NULL, NULL);
-}
+} /* _ecore_x_event_handle_randr_notify_output_property */
void
_ecore_x_event_handle_randr_notify(XEvent *xevent)
switch (randr_event->subtype)
{
case RRNotify_CrtcChange:
- _ecore_x_event_handle_randr_notify_crtc_change(randr_event);
- break;
+ _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;
+ _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;
+ _ecore_x_event_handle_randr_notify_output_property(randr_event);
+ break;
+
default:
- ERR("Unknown XRandR RRNotify subtype: %d.",
- randr_event->subtype);
- break;
- }
-}
-#endif
+ ERR("Unknown XRandR RRNotify subtype: %d.",
+ randr_event->subtype);
+ break;
+ } /* switch */
+} /* _ecore_x_event_handle_randr_notify */
+
+#endif /* ifdef ECORE_XRANDR */
#ifdef ECORE_XFIXES
void
_ecore_x_last_event_mouse_move = 0;
/* Nothing here yet */
event = NULL;
-}
-#endif
+} /* _ecore_x_event_handle_fixes_selection_notify */
+
+#endif /* ifdef ECORE_XFIXES */
#ifdef ECORE_XDAMAGE
void
damage_event = (XDamageNotifyEvent *)event;
e = calloc(1, sizeof(Ecore_X_Event_Damage));
- if (!e) return;
+ if (!e)
+ return;
e->level = damage_event->level;
e->drawable = damage_event->drawable;
e->geometry.height = damage_event->geometry.height;
ecore_event_add(ECORE_X_EVENT_DAMAGE_NOTIFY, e, NULL, NULL);
-}
-#endif
+} /* _ecore_x_event_handle_damage_notify */
+
+#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;
-
+ Ecore_X_Event_Generic *e = (Ecore_X_Event_Generic *)ev;
+
if (e->data)
- {
- XFreeEventData(_ecore_x_disp, (XGenericEventCookie *)data);
- }
-#endif
-}
+ XFreeEventData(_ecore_x_disp, (XGenericEventCookie *)data);
+
+#endif /* ifdef ECORE_XI2 */
+} /* _ecore_x_event_free_generic_event */
void
_ecore_x_event_handle_generic_event(XEvent *event)
#ifdef ECORE_XI2
XGenericEvent *generic_event;
Ecore_X_Event_Generic *e;
-
+
LOGFN(__FILE__, __LINE__, __FUNCTION__);
generic_event = (XGenericEvent *)event;
-
+
e = calloc(1, sizeof(Ecore_X_Event_Generic));
- if (!e) return;
-
+ if (!e)
+ return;
+
if (XGetEventData(_ecore_x_disp, &event->xcookie))
{
e->cookie = event->xcookie.cookie;
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);
- }
-
- ecore_event_add(ECORE_X_EVENT_GENERIC, e, _ecore_x_event_free_generic_event, event);
-#endif
-}
+ _ecore_x_input_handler(event);
+
+ ecore_event_add(ECORE_X_EVENT_GENERIC,
+ e,
+ _ecore_x_event_free_generic_event,
+ event);
+#endif /* ifdef ECORE_XI2 */
+} /* _ecore_x_event_handle_generic_event */
+
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#include <stdlib.h>
static int _fixes_available;
#ifdef ECORE_XFIXES
static int _fixes_major, _fixes_minor;
-#endif
+#endif /* ifdef ECORE_XFIXES */
void
_ecore_x_fixes_init(void)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (XFixesQueryVersion(_ecore_x_disp, &_fixes_major, &_fixes_minor))
- _fixes_available = 1;
+ _fixes_available = 1;
else
- _fixes_available = 0;
-#else
+ _fixes_available = 0;
+
+#else /* ifdef ECORE_XFIXES */
_fixes_available = 0;
-#endif
-}
+#endif /* ifdef ECORE_XFIXES */
+} /* _ecore_x_fixes_init */
#ifdef ECORE_XFIXES
/* I don't know what to call this function. */
XRectangle *xrect;
int i;
- if (num == 0) return NULL;
+ if (num == 0)
+ return NULL;
xrect = malloc(sizeof(XRectangle) * num);
- if (!xrect) return NULL;
+ 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;
+ 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;
-}
+} /* _ecore_x_rectangle_ecore_to_x */
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;
+ if (num == 0)
+ return NULL;
+
rects = malloc(sizeof(Ecore_X_Rectangle) * num);
- if (!rects) return NULL;
+ 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;
+ 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
+} /* _ecore_x_rectangle_x_to_ecore */
+
+#endif /* ifdef ECORE_XFIXES */
EAPI Ecore_X_Region
ecore_x_region_new(Ecore_X_Rectangle *rects, int num)
region = XFixesCreateRegion(_ecore_x_disp, xrect, num);
free(xrect);
return region;
-#else
+#else /* ifdef ECORE_XFIXES */
return 0;
-#endif
-}
+#endif /* ifdef ECORE_XFIXES */
+} /* ecore_x_region_new */
EAPI Ecore_X_Region
ecore_x_region_new_from_bitmap(Ecore_X_Pixmap bitmap)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
region = XFixesCreateRegionFromBitmap(_ecore_x_disp, bitmap);
return region;
-#else
+#else /* ifdef ECORE_XFIXES */
return 0;
-#endif
-}
+#endif /* ifdef ECORE_XFIXES */
+} /* ecore_x_region_new_from_bitmap */
EAPI Ecore_X_Region
ecore_x_region_new_from_window(Ecore_X_Window win, Ecore_X_Region_Type type)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
region = XFixesCreateRegionFromWindow(_ecore_x_disp, win, type);
return region;
-#else
+#else /* ifdef ECORE_XFIXES */
return 0;
-#endif
-}
+#endif /* ifdef ECORE_XFIXES */
+} /* ecore_x_region_new_from_window */
EAPI Ecore_X_Region
ecore_x_region_new_from_gc(Ecore_X_GC gc)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
region = XFixesCreateRegionFromGC(_ecore_x_disp, gc);
return region;
-#else
+#else /* ifdef ECORE_XFIXES */
return 0;
-#endif
-}
+#endif /* ifdef ECORE_XFIXES */
+} /* ecore_x_region_new_from_gc */
EAPI Ecore_X_Region
ecore_x_region_new_from_picture(Ecore_X_Picture picture)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
region = XFixesCreateRegionFromPicture(_ecore_x_disp, picture);
return region;
-#else
+#else /* ifdef ECORE_XFIXES */
return 0;
-#endif
-}
+#endif /* ifdef ECORE_XFIXES */
+} /* ecore_x_region_new_from_picture */
EAPI void
ecore_x_region_free(Ecore_X_Region region)
#ifdef ECORE_XFIXES
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XFixesDestroyRegion(_ecore_x_disp, region);
-#endif
-}
+#endif /* ifdef ECORE_XFIXES */
+} /* ecore_x_region_free */
EAPI void
ecore_x_region_set(Ecore_X_Region region, Ecore_X_Rectangle *rects, int num)
XRectangle *xrect = _ecore_x_rectangle_ecore_to_x(rects, num);
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XFixesSetRegion(_ecore_x_disp, region, xrect, num);
-#endif
-}
+#endif /* ifdef ECORE_XFIXES */
+} /* ecore_x_region_set */
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
-}
+#endif /* ifdef ECORE_XFIXES */
+} /* ecore_x_region_copy */
EAPI void
-ecore_x_region_combine(Ecore_X_Region dest, Ecore_X_Region source1, Ecore_X_Region source2)
+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
-}
+#endif /* ifdef ECORE_XFIXES */
+} /* ecore_x_region_combine */
EAPI void
-ecore_x_region_intersect(Ecore_X_Region dest, Ecore_X_Region source1, Ecore_X_Region source2)
+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
-}
+#endif /* ifdef ECORE_XFIXES */
+} /* ecore_x_region_intersect */
EAPI void
-ecore_x_region_subtract(Ecore_X_Region dest, Ecore_X_Region source1, Ecore_X_Region source2)
+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
-}
+#endif /* ifdef ECORE_XFIXES */
+} /* ecore_x_region_subtract */
EAPI void
-ecore_x_region_invert(Ecore_X_Region dest, Ecore_X_Rectangle *bounds, Ecore_X_Region source)
+ecore_x_region_invert(Ecore_X_Region dest,
+ Ecore_X_Rectangle *bounds,
+ Ecore_X_Region source)
{
#ifdef ECORE_XFIXES
XRectangle *xbound;
xbound = _ecore_x_rectangle_ecore_to_x(bounds, num);
XFixesInvertRegion(_ecore_x_disp, dest, xbound, source);
-#endif
-}
+#endif /* ifdef ECORE_XFIXES */
+} /* ecore_x_region_invert */
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
-}
+#endif /* ifdef ECORE_XFIXES */
+} /* ecore_x_region_translate */
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
-}
+#endif /* ifdef ECORE_XFIXES */
+} /* ecore_x_region_extents */
EAPI Ecore_X_Rectangle *
-ecore_x_region_fetch(Ecore_X_Region region, int *num, Ecore_X_Rectangle *bounds){
+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).width = xbound.width;
(*bounds).height = xbound.height;
return rects;
-#else
+#else /* ifdef ECORE_XFIXES */
return NULL;
-#endif
-}
+#endif /* ifdef ECORE_XFIXES */
+} /* ecore_x_region_fetch */
EAPI void
-ecore_x_region_expand(Ecore_X_Region dest, Ecore_X_Region source, unsigned int left, unsigned int right, unsigned int top, unsigned int bottom)
+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
-}
+#endif /* ifdef ECORE_XFIXES */
+} /* ecore_x_region_expand */
EAPI void
-ecore_x_region_gc_clip_set(Ecore_X_Region region, Ecore_X_GC gc, int x_origin, int y_origin)
+ecore_x_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
-}
+#endif /* ifdef ECORE_XFIXES */
+} /* ecore_x_region_gc_clip_set */
EAPI void
-ecore_x_region_window_shape_set(Ecore_X_Region region, Ecore_X_Window win, Ecore_X_Shape_Type type, int x_offset, int y_offset)
+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
-}
+ XFixesSetWindowShapeRegion(_ecore_x_disp,
+ win,
+ type,
+ x_offset,
+ y_offset,
+ region);
+#endif /* ifdef ECORE_XFIXES */
+} /* ecore_x_region_window_shape_set */
EAPI void
-ecore_x_region_picture_clip_set(Ecore_X_Region region, Ecore_X_Picture picture, int x_origin, int y_origin)
+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
-}
+ XFixesSetPictureClipRegion(_ecore_x_disp,
+ picture,
+ x_origin,
+ y_origin,
+ region);
+#endif /* ifdef ECORE_XFIXES */
+} /* ecore_x_region_picture_clip_set */
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#include <string.h>
* @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)
+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 index;
- int i;
+ int mask;
+ int index;
+ int i;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!draw) draw = DefaultRootWindow(_ecore_x_disp);
+ if (!draw)
+ draw = DefaultRootWindow(_ecore_x_disp);
memset(&gcv, 0, sizeof (gcv));
gcv.function = value_list[index];
index++;
break;
+
case ECORE_X_GC_VALUE_MASK_PLANE_MASK:
gcv.plane_mask = value_list[index];
index++;
break;
+
case ECORE_X_GC_VALUE_MASK_FOREGROUND:
gcv.foreground = value_list[index];
index++;
break;
+
case ECORE_X_GC_VALUE_MASK_BACKGROUND:
gcv.background = value_list[index];
index++;
break;
+
case ECORE_X_GC_VALUE_MASK_LINE_WIDTH:
gcv.line_width = value_list[index];
index++;
break;
+
case ECORE_X_GC_VALUE_MASK_LINE_STYLE:
gcv.line_style = value_list[index];
index++;
break;
+
case ECORE_X_GC_VALUE_MASK_CAP_STYLE:
gcv.cap_style = value_list[index];
index++;
break;
+
case ECORE_X_GC_VALUE_MASK_JOIN_STYLE:
gcv.join_style = value_list[index];
index++;
break;
+
case ECORE_X_GC_VALUE_MASK_FILL_STYLE:
gcv.fill_style = value_list[index];
index++;
break;
+
case ECORE_X_GC_VALUE_MASK_FILL_RULE:
gcv.fill_rule = value_list[index];
index++;
break;
+
case ECORE_X_GC_VALUE_MASK_TILE:
gcv.tile = value_list[index];
index++;
break;
+
case ECORE_X_GC_VALUE_MASK_STIPPLE:
gcv.stipple = value_list[index];
index++;
break;
+
case ECORE_X_GC_VALUE_MASK_TILE_STIPPLE_ORIGIN_X:
gcv.ts_x_origin = value_list[index];
index++;
break;
+
case ECORE_X_GC_VALUE_MASK_TILE_STIPPLE_ORIGIN_Y:
gcv.ts_y_origin = value_list[index];
index++;
break;
+
case ECORE_X_GC_VALUE_MASK_FONT:
gcv.font = value_list[index];
index++;
break;
+
case ECORE_X_GC_VALUE_MASK_SUBWINDOW_MODE:
gcv.subwindow_mode = value_list[index];
index++;
break;
+
case ECORE_X_GC_VALUE_MASK_GRAPHICS_EXPOSURES:
gcv.graphics_exposures = value_list[index];
index++;
break;
+
case ECORE_X_GC_VALUE_MASK_CLIP_ORIGIN_X:
gcv.clip_x_origin = value_list[index];
index++;
break;
+
case ECORE_X_GC_VALUE_MASK_CLIP_ORIGIN_Y:
gcv.clip_y_origin = value_list[index];
index++;
break;
+
case ECORE_X_GC_VALUE_MASK_CLIP_MASK:
gcv.clip_mask = value_list[index];
index++;
break;
+
case ECORE_X_GC_VALUE_MASK_DASH_OFFSET:
gcv.dash_offset = value_list[index];
index++;
break;
+
case ECORE_X_GC_VALUE_MASK_DASH_LIST:
gcv.dashes = value_list[index];
index++;
break;
+
case ECORE_X_GC_VALUE_MASK_ARC_MODE:
gcv.arc_mode = value_list[index];
index++;
break;
- }
+ } /* switch */
}
return XCreateGC(_ecore_x_disp, draw, value_mask, &gcv);
-}
+} /* ecore_x_gc_new */
/**
* Deletes and frees the given graphics context.
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XFreeGC(_ecore_x_disp, gc);
-}
+} /* ecore_x_gc_free */
+
/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
-/*
* Various ICCCM related functions.
*
* This is ALL the code involving anything ICCCM related. for both WM and
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#include <stdlib.h>
#include <string.h>
#include "Ecore_X.h"
#include "Ecore_X_Atoms.h"
-
EAPI void
ecore_x_icccm_init(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
-}
+} /* ecore_x_icccm_init */
EAPI void
ecore_x_icccm_state_set(Ecore_X_Window win, Ecore_X_Window_State_Hint state)
{
- unsigned long c[2];
+ unsigned long c[2];
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (state == ECORE_X_WINDOW_STATE_HINT_WITHDRAWN)
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);
-}
+ ECORE_X_ATOM_WM_STATE, 32, PropModeReplace,
+ (unsigned char *)c, 2);
+} /* ecore_x_icccm_state_set */
EAPI Ecore_X_Window_State_Hint
ecore_x_icccm_state_get(Ecore_X_Window win)
{
unsigned char *prop_ret = NULL;
- Atom type_ret;
- unsigned long bytes_after, num_ret;
- int format_ret;
+ 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);
+ 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[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);
-
+ XFree(prop_ret);
+
return hint;
-}
+} /* ecore_x_icccm_state_get */
EAPI void
ecore_x_icccm_delete_window_send(Ecore_X_Window win, Ecore_X_Time t)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS,
- ECORE_X_EVENT_MASK_NONE,
- ECORE_X_ATOM_WM_DELETE_WINDOW,
- t, 0, 0, 0);
-}
+ ECORE_X_EVENT_MASK_NONE,
+ ECORE_X_ATOM_WM_DELETE_WINDOW,
+ t, 0, 0, 0);
+} /* ecore_x_icccm_delete_window_send */
EAPI void
ecore_x_icccm_take_focus_send(Ecore_X_Window win, Ecore_X_Time t)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS,
- ECORE_X_EVENT_MASK_NONE,
- ECORE_X_ATOM_WM_TAKE_FOCUS,
- t, 0, 0, 0);
-}
+ ECORE_X_EVENT_MASK_NONE,
+ ECORE_X_ATOM_WM_TAKE_FOCUS,
+ t, 0, 0, 0);
+} /* ecore_x_icccm_take_focus_send */
EAPI void
ecore_x_icccm_save_yourself_send(Ecore_X_Window win, Ecore_X_Time t)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS,
- ECORE_X_EVENT_MASK_NONE,
- ECORE_X_ATOM_WM_SAVE_YOURSELF,
- t, 0, 0, 0);
-}
+ ECORE_X_EVENT_MASK_NONE,
+ ECORE_X_ATOM_WM_SAVE_YOURSELF,
+ t, 0, 0, 0);
+} /* ecore_x_icccm_save_yourself_send */
EAPI void
ecore_x_icccm_move_resize_send(Ecore_X_Window win, int x, int y, int w, int h)
ev.xconfigure.above = None;
ev.xconfigure.override_redirect = False;
XSendEvent(_ecore_x_disp, win, False, StructureNotifyMask, &ev);
-}
+} /* ecore_x_icccm_move_resize_send */
EAPI void
ecore_x_icccm_hints_set(Ecore_X_Window win,
- int 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, int is_urgent)
+ int 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, int is_urgent)
{
- XWMHints *hints;
+ XWMHints *hints;
hints = XAllocWMHints();
if (!hints)
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;
+ hints->icon_pixmap = icon_pixmap;
+ hints->flags |= IconPixmapHint;
}
+
if (icon_mask != 0)
{
- hints->icon_mask = icon_mask;
- hints->flags |= IconMaskHint;
+ hints->icon_mask = icon_mask;
+ hints->flags |= IconMaskHint;
}
+
if (icon_window != 0)
{
- hints->icon_window = icon_window;
- hints->flags |= IconWindowHint;
+ hints->icon_window = icon_window;
+ hints->flags |= IconWindowHint;
}
+
if (window_group != 0)
{
- hints->window_group = window_group;
- hints->flags |= WindowGroupHint;
+ hints->window_group = window_group;
+ hints->flags |= WindowGroupHint;
}
+
if (is_urgent)
hints->flags |= XUrgencyHint;
+
XSetWMHints(_ecore_x_disp, win, hints);
XFree(hints);
-}
+} /* ecore_x_icccm_hints_set */
EAPI int
ecore_x_icccm_hints_get(Ecore_X_Window win,
- int *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, int *is_urgent)
+ int *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, int *is_urgent)
{
XWMHints *hints;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (accepts_focus)
*accepts_focus = 1;
+
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 = 0;
+
hints = XGetWMHints(_ecore_x_disp, win);
if (hints)
{
- if ((hints->flags & InputHint) && (accepts_focus))
- {
- if (hints->input)
- *accepts_focus = 1;
- else
- *accepts_focus = 0;
- }
- 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 = 1;
- }
- XFree(hints);
- return 1;
+ if ((hints->flags & InputHint) && (accepts_focus))
+ {
+ if (hints->input)
+ *accepts_focus = 1;
+ else
+ *accepts_focus = 0;
+ }
+
+ 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 = 1;
+
+ XFree(hints);
+ return 1;
}
+
return 0;
-}
+} /* ecore_x_icccm_hints_get */
EAPI void
ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win,
- int request_pos,
- Ecore_X_Gravity gravity,
- int min_w, int min_h,
- int max_w, int max_h,
- int base_w, int base_h,
- int step_x, int step_y,
- double min_aspect, double max_aspect)
+ int 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;
+ XSizeHints hint;
+ long mask;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!XGetWMNormalHints(_ecore_x_disp, win, &hint, &mask))
- {
- memset(&hint, 0, sizeof(XSizeHints));
- }
+ memset(&hint, 0, sizeof(XSizeHints));
hint.flags = 0;
if (request_pos)
- {
- hint.flags |= USPosition;
- }
+ hint.flags |= USPosition;
+
if (gravity != ECORE_X_GRAVITY_NW)
{
- hint.flags |= PWinGravity;
- hint.win_gravity = gravity;
+ 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;
+ 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;
+ 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;
+ 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;
+ 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;
+ 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);
-}
+} /* ecore_x_icccm_size_pos_hints_set */
EAPI int
ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win,
- int *request_pos,
- Ecore_X_Gravity *gravity,
- int *min_w, int *min_h,
- int *max_w, int *max_h,
- int *base_w, int *base_h,
- int *step_x, int *step_y,
- double *min_aspect, double *max_aspect)
+ int *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;
+ 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;
+ 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 0;
+ return 0;
if ((hint.flags & USPosition) || ((hint.flags & PPosition)))
{
- if (request_pos)
- *request_pos = 1;
- }
- else
- {
- if (request_pos)
- *request_pos = 0;
+ if (request_pos)
+ *request_pos = 1;
}
+ else if (request_pos)
+ *request_pos = 0;
+
if (hint.flags & PWinGravity)
{
- if (gravity)
- *gravity = hint.win_gravity;
- }
- else
- {
- if (gravity)
- *gravity = ECORE_X_GRAVITY_NW;
+ 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;
+ 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;
+ 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;
+ 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;
+ 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 (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 1;
-}
+} /* ecore_x_icccm_size_pos_hints_get */
EAPI void
ecore_x_icccm_title_set(Ecore_X_Window win, const char *t)
{
- char *list[1];
- XTextProperty xprop;
- int ret;
+ char *list[1];
+ XTextProperty xprop;
+ int ret;
- if (!t) return;
+ if (!t)
+ return;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
xprop.value = NULL;
list[0] = strdup(t);
ret =
Xutf8TextListToTextProperty(_ecore_x_disp, list, 1, XUTF8StringStyle,
- &xprop);
-#else
+ &xprop);
+#else /* ifdef X_HAVE_UTF8_STRING */
list[0] = strdup(t);
ret =
XmbTextListToTextProperty(_ecore_x_disp, list, 1, XStdICCTextStyle,
- &xprop);
-#endif
+ &xprop);
+#endif /* ifdef X_HAVE_UTF8_STRING */
if (ret >= Success)
{
- XSetWMName(_ecore_x_disp, win, &xprop);
- if (xprop.value) XFree(xprop.value);
+ XSetWMName(_ecore_x_disp, win, &xprop);
+ if (xprop.value)
+ XFree(xprop.value);
}
- else
+ else if (XStringListToTextProperty(list, 1, &xprop) >= Success)
{
- if (XStringListToTextProperty(list, 1, &xprop) >= Success)
- {
- XSetWMName(_ecore_x_disp, win, &xprop);
- if (xprop.value) XFree(xprop.value);
- }
+ XSetWMName(_ecore_x_disp, win, &xprop);
+ if (xprop.value)
+ XFree(xprop.value);
}
+
free(list[0]);
-}
+} /* ecore_x_icccm_title_set */
EAPI char *
ecore_x_icccm_title_get(Ecore_X_Window win)
{
- XTextProperty xprop;
+ 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 */
+ 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
- ret = XmbTextPropertyToTextList(_ecore_x_disp, &xprop,
- &list, &num);
-#endif
-
- 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;
- }
+ 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;
-}
+} /* ecore_x_icccm_title_get */
/**
* Set protocol atoms explicitly
* @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)
+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);
+ XSetWMProtocols(_ecore_x_disp, win, (Atom *)(protos), num);
else
- XDeleteProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_PROTOCOLS);
-}
+ XDeleteProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_PROTOCOLS);
+} /* ecore_x_icccm_protocol_atoms_set */
/**
* Set or unset a wm protocol property.
*/
EAPI void
ecore_x_icccm_protocol_set(Ecore_X_Window win,
- Ecore_X_WM_Protocol protocol, int on)
+ Ecore_X_WM_Protocol protocol, int on)
{
- Atom *protos = NULL;
- Atom proto;
- int protos_count = 0;
- int already_set = 0;
- int i;
+ 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)
if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count))
{
- protos = NULL;
- protos_count = 0;
+ protos = NULL;
+ protos_count = 0;
}
for (i = 0; i < protos_count; i++)
{
- if (protos[i] == proto)
- {
- already_set = 1;
- break;
- }
+ 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);
+ 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;
- }
- }
+ 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:
+leave:
if (protos)
- XFree(protos);
-
-}
+ XFree(protos);
+} /* ecore_x_icccm_protocol_set */
/**
* Determines whether a protocol is set for a window.
EAPI int
ecore_x_icccm_protocol_isset(Ecore_X_Window win, Ecore_X_WM_Protocol protocol)
{
- Atom proto, *protos = NULL;
- int i, ret = 0, protos_count = 0;
+ Atom proto, *protos = NULL;
+ int i, ret = 0, protos_count = 0;
/* check for invalid values */
if (protocol >= ECORE_X_WM_PROTOCOL_NUM)
for (i = 0; i < protos_count; i++)
if (protos[i] == proto)
- {
- ret = 1;
- break;
- }
+ {
+ ret = 1;
+ break;
+ }
- if (protos) XFree(protos);
- return ret;
+ if (protos)
+ XFree(protos);
-}
+ return ret;
+} /* ecore_x_icccm_protocol_isset */
/**
* 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;
+ 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);
-}
+} /* ecore_x_icccm_name_class_set */
/**
* 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;
-
+ XClassHint xch;
+
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (n) *n = NULL;
- if (c) *c = NULL;
+ 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);
+ 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);
}
-}
+} /* ecore_x_icccm_name_class_get */
/**
* 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 *
+EAPI char *
ecore_x_icccm_client_machine_get(Ecore_X_Window win)
{
- char *name;
+ char *name;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
name = ecore_x_window_prop_string_get(win, ECORE_X_ATOM_WM_CLIENT_MACHINE);
return name;
-}
+} /* ecore_x_icccm_client_machine_get */
/**
* Sets the WM_COMMAND property for @a win.
- *
+ *
* @param win The window.
* @param argc Number of arguments.
* @param argv Arguments.
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XSetCommand(_ecore_x_disp, win, argv, argc);
-}
+} /* ecore_x_icccm_command_set */
/**
* Get the WM_COMMAND property for @a win.
int i, c;
char **v;
- if (argc) *argc = 0;
- if (argv) *argv = NULL;
+ if (argc)
+ *argc = 0;
+
+ if (argv)
+ *argv = NULL;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!XGetCommand(_ecore_x_disp, win, &v, &c))
- return;
+ return;
+
if (c < 1)
{
- if (v)
- XFreeStringList(v);
- return;
+ if (v)
+ XFreeStringList(v);
+
+ return;
}
- if (argc) *argc = c;
+ 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("");
- }
+ (*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);
-}
+} /* ecore_x_icccm_command_get */
/**
* 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;
+ 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
+ XUTF8StringStyle, &xprop);
+#else /* ifdef X_HAVE_UTF8_STRING */
list[0] = strdup(t);
ret = XmbTextListToTextProperty(_ecore_x_disp, list, 1,
- XStdICCTextStyle, &xprop);
-#endif
+ XStdICCTextStyle, &xprop);
+#endif /* ifdef X_HAVE_UTF8_STRING */
if (ret >= Success)
{
- XSetWMIconName(_ecore_x_disp, win, &xprop);
- if (xprop.value) XFree(xprop.value);
+ XSetWMIconName(_ecore_x_disp, win, &xprop);
+ if (xprop.value)
+ XFree(xprop.value);
}
- else
+ else if (XStringListToTextProperty(list, 1, &xprop) >= Success)
{
- if (XStringListToTextProperty(list, 1, &xprop) >= Success)
- {
- XSetWMIconName(_ecore_x_disp, win, &xprop);
- if (xprop.value) XFree(xprop.value);
- }
+ XSetWMIconName(_ecore_x_disp, win, &xprop);
+ if (xprop.value)
+ XFree(xprop.value);
}
+
free(list[0]);
-}
+} /* ecore_x_icccm_icon_name_set */
/**
* 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 *
+EAPI char *
ecore_x_icccm_icon_name_get(Ecore_X_Window win)
{
- XTextProperty xprop;
+ 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 */
+ 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
- ret = XmbTextPropertyToTextList(_ecore_x_disp, &xprop,
- &list, &num);
-#endif
-
- 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;
- }
+ 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;
-}
+} /* ecore_x_icccm_icon_name_get */
/**
* Add a subwindow to the list of windows that need a different colormap installed.
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;
+ 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))
+ 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;
+ 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;
+ 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);
+ ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
+ XA_WINDOW, 32, data, num);
free(newset);
-}
+} /* ecore_x_icccm_colormap_window_set */
/**
* Remove a window from the list of colormap windows.
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;
+ 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))
+ ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
+ XA_WINDOW, 32, &old_data, &num))
return;
- oldset = (Window *) old_data;
+ 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 (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);
-}
+ if (old_data)
+ XFree(old_data);
+} /* ecore_x_icccm_colormap_window_unset */
/**
* Specify that a window is transient for another top-level window and should be handled accordingly.
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XSetTransientForHint(_ecore_x_disp, win, forwin);
-}
+} /* ecore_x_icccm_transient_for_set */
/**
* Remove the transient_for setting from a window.
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XDeleteProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_TRANSIENT_FOR);
-}
+} /* ecore_x_icccm_transient_for_unset */
/**
* Get the window this window is transient for, if any.
EAPI Ecore_X_Window
ecore_x_icccm_transient_for_get(Ecore_X_Window win)
{
- Window forwin;
+ Window forwin;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (XGetTransientForHint(_ecore_x_disp, win, &forwin))
- return (Ecore_X_Window) forwin;
+ return (Ecore_X_Window)forwin;
else
- return 0;
-
-}
+ return 0;
+} /* ecore_x_icccm_transient_for_get */
/**
* Set the window role hint.
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_string_set(win, ECORE_X_ATOM_WM_WINDOW_ROLE,
- (char *)role);
-}
+ (char *)role);
+} /* ecore_x_icccm_window_role_set */
/**
* Get the window role.
* @param win The window
* @return The window's role string.
*/
-EAPI char *
+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);
-}
+} /* ecore_x_icccm_window_role_get */
/**
* Set the window's client leader.
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_window_set(win, ECORE_X_ATOM_WM_CLIENT_LEADER,
- &l, 1);
-}
+ &l, 1);
+} /* ecore_x_icccm_client_leader_set */
/**
* Get the window's client leader.
EAPI Ecore_X_Window
ecore_x_icccm_client_leader_get(Ecore_X_Window win)
{
- Ecore_X_Window l;
+ 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;
+ &l, 1) > 0)
+ return l;
+
return 0;
-}
+} /* ecore_x_icccm_client_leader_get */
EAPI void
ecore_x_icccm_iconic_request_send(Ecore_X_Window win, Ecore_X_Window root)
{
XEvent xev;
- if (!win) return;
+ if (!win)
+ return;
+
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!root) root = DefaultRootWindow(_ecore_x_disp);
+ if (!root)
+ root = DefaultRootWindow(_ecore_x_disp);
xev.xclient.type = ClientMessage;
xev.xclient.serial = 0;
XSendEvent(_ecore_x_disp, root, False,
SubstructureNotifyMask | SubstructureRedirectMask, &xev);
-}
+} /* ecore_x_icccm_iconic_request_send */
/* FIXME: there are older E hints, gnome hints and mwm hints and new netwm */
/* hints. each should go in their own file/section so we know which */
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#include "ecore_x_private.h"
#include "Ecore_X.h"
static int _ecore_x_image_err = 0;
static void
-_ecore_x_image_error_handler(Display * d __UNUSED__, XErrorEvent * ev __UNUSED__)
+_ecore_x_image_error_handler(Display *d __UNUSED__, XErrorEvent *ev __UNUSED__)
{
_ecore_x_image_err = 1;
-}
+} /* _ecore_x_image_error_handler */
static void
_ecore_x_image_shm_check(void)
XErrorHandler ph;
XShmSegmentInfo shminfo;
XImage *xim;
-
- if (_ecore_x_image_shm_can != -1) return;
-
+
+ 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,
+
+ xim = XShmCreateImage(_ecore_x_disp,
+ DefaultVisual(_ecore_x_disp,
+ DefaultScreen(_ecore_x_disp)),
+ DefaultDepth(_ecore_x_disp,
DefaultScreen(_ecore_x_disp)),
- ZPixmap, NULL,
+ ZPixmap, NULL,
&shminfo, 1, 1);
if (!xim)
{
_ecore_x_image_shm_can = 0;
return;
}
-
+
shminfo.readOnly = False;
- shminfo.shmaddr = shmat(shminfo.shmid, 0, 0);
+ 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),
+ XShmGetImage(_ecore_x_disp, DefaultRootWindow(_ecore_x_disp),
xim, 0, 0, 0xffffffff);
XSync(_ecore_x_disp, False);
XSetErrorHandler((XErrorHandler)ph);
{
XShmDetach(_ecore_x_disp, &shminfo);
XDestroyImage(xim);
- shmdt(shminfo.shmaddr);
+ 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;
-}
+} /* _ecore_x_image_shm_check */
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;
+ 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;
+ if (!im)
+ return NULL;
+
LOGFN(__FILE__, __LINE__, __FUNCTION__);
im->w = w;
im->h = h;
_ecore_x_image_shm_check();
im->shm = _ecore_x_image_shm_can;
return im;
-}
+} /* ecore_x_image_new */
EAPI void
ecore_x_image_free(Ecore_X_Image *im)
shmctl(im->shminfo.shmid, IPC_RMID, 0);
}
}
- else
+ else if (im->xim)
{
- if (im->xim)
- {
- free(im->xim->data);
- im->xim->data = NULL;
- XDestroyImage(im->xim);
- }
+ free(im->xim->data);
+ im->xim->data = NULL;
+ XDestroyImage(im->xim);
}
+
free(im);
-}
+} /* ecore_x_image_free */
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),
+ ZPixmap, NULL, &(im->shminfo),
im->w, im->h);
- if (!im->xim) return;
+ if (!im->xim)
+ return;
- im->shminfo.shmid = shmget(IPC_PRIVATE,
+ 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->shminfo.shmaddr = shmat(im->shminfo.shmid, 0, 0);
im->xim->data = im->shminfo.shmaddr;
if ((im->xim->data == (char *)-1) ||
(im->xim->data == NULL))
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;
-}
+ 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;
+} /* _ecore_x_image_shm_create */
EAPI Eina_Bool
-ecore_x_image_get(Ecore_X_Image *im, Ecore_X_Drawable draw,
+ecore_x_image_get(Ecore_X_Image *im, Ecore_X_Drawable draw,
int x, int y, int sx, int sy, int w, int h)
{
- int ret = 1;
+ 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;
+ 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->data + (im->xim->bytes_per_line * sy) + (sx * im->bpp);
im->xim->width = w;
im->xim->height = h;
if (!XShmGetImage(_ecore_x_disp, draw, im->xim, x, y, 0xffffffff))
- ret = 0;
+ ret = EINA_FALSE;
+
ecore_x_sync();
}
// unavoidable thanks to mit-shm get api - tmp shm buf + copy into it
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);
+ spixels = ecore_x_image_data_get(tim,
+ &sbpl,
+ &srows,
+ &sbpp);
pixels = ecore_x_image_data_get(im, &bpl, &rows, &bpp);
if ((pixels) && (spixels))
{
}
}
}
+
ecore_x_image_free(tim);
}
}
+
XSetErrorHandler((XErrorHandler)ph);
- if (_ecore_x_image_err) ret = 0;
+ if (_ecore_x_image_err)
+ ret = EINA_FALSE;
}
else
{
printf("currently unimplemented ecore_x_image_get without shm\n");
- ret = 0;
+ ret = EINA_FALSE;
}
+
return ret;
-}
+} /* ecore_x_image_get */
EAPI void
-ecore_x_image_put(Ecore_X_Image *im __UNUSED__, Ecore_X_Drawable draw __UNUSED__, int x __UNUSED__, int y __UNUSED__, int sx __UNUSED__, int sy __UNUSED__, int w __UNUSED__, int h __UNUSED__)
+ecore_x_image_put(Ecore_X_Image *im __UNUSED__,
+ Ecore_X_Drawable draw __UNUSED__,
+ int x __UNUSED__,
+ int y __UNUSED__,
+ int sx __UNUSED__,
+ int sy __UNUSED__,
+ int w __UNUSED__,
+ int h __UNUSED__)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
printf("ecore_x_image_put: unimplemented!\n");
-}
+} /* ecore_x_image_put */
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;
+ 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;
-}
+} /* ecore_x_image_data_get */
+
/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
-/*
* Various MWM related functions.
*
* This is ALL the code involving anything MWM related. for both WM and
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#include <stdlib.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)
+#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;
+ CARD32 flags;
+ CARD32 functions;
+ CARD32 decorations;
+ INT32 inputmode;
+ CARD32 status;
}
MWMHints;
EAPI int
-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)
+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;
- int ret;
+ unsigned char *p = NULL;
+ MWMHints *mwmhints = NULL;
+ int num;
+ int ret;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ret = 0;
if (!ecore_x_window_prop_property_get(win,
- ECORE_X_ATOM_MOTIF_WM_HINTS,
- ECORE_X_ATOM_MOTIF_WM_HINTS,
- 32, &p, &num))
+ ECORE_X_ATOM_MOTIF_WM_HINTS,
+ ECORE_X_ATOM_MOTIF_WM_HINTS,
+ 32, &p, &num))
return 0;
- mwmhints = (MWMHints *) p;
+
+ 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 = 1;
- }
- free(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 = 1;
+ }
+
+ free(mwmhints);
}
+
return ret;
-}
+} /* ecore_x_mwm_hints_get */
EAPI void
ecore_x_mwm_borderless_set(Ecore_X_Window win, int borderless)
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);
-}
+ ecore_x_window_prop_property_set(win,
+ ECORE_X_ATOM_MOTIF_WM_HINTS,
+ ECORE_X_ATOM_MOTIF_WM_HINTS,
+ 32, (void *)data, 5);
+} /* ecore_x_mwm_borderless_set */
/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
-/*
* _NET_WM... aka Extended Window Manager Hint (EWMH) functions.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#include <stdio.h>
#include <string.h>
#include "ecore_x_private.h"
#include "Ecore_X.h"
-typedef struct _Ecore_X_Startup_Info Ecore_X_Startup_Info;
+typedef struct _Ecore_X_Startup_Info Ecore_X_Startup_Info;
struct _Ecore_X_Startup_Info
{
Ecore_X_Window win;
- int init;
+ int init;
- int buffer_size;
- char *buffer;
+ int buffer_size;
+ char *buffer;
- int length;
+ 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;
+ 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);
+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
-static void _ecore_x_netwm_startup_info_free(void *data);
+static int _ecore_x_netwm_startup_info_process(Ecore_X_Startup_Info *info);
+static int _ecore_x_netwm_startup_info_parse(Ecore_X_Startup_Info *info,
+ char *data);
+#endif /* if 0 */
+static void _ecore_x_netwm_startup_info_free(void *data);
/*
* 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)
+#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
ecore_x_netwm_init(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- startup_info = eina_hash_string_superfast_new(_ecore_x_netwm_startup_info_free);
-}
+ startup_info = eina_hash_string_superfast_new(
+ _ecore_x_netwm_startup_info_free);
+} /* ecore_x_netwm_init */
EAPI void
ecore_x_netwm_shutdown(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (startup_info)
- eina_hash_free(startup_info);
+ eina_hash_free(startup_info);
+
startup_info = NULL;
-}
+} /* ecore_x_netwm_shutdown */
/*
* WM identification
*/
EAPI void
ecore_x_netwm_wm_identify(Ecore_X_Window root, Ecore_X_Window check,
- const char *wm_name)
+ const char *wm_name)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- ecore_x_window_prop_window_set(root, ECORE_X_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);
+ 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);
-}
+ _ecore_x_window_prop_string_utf8_set(root,
+ ECORE_X_ATOM_NET_WM_NAME,
+ wm_name);
+} /* ecore_x_netwm_wm_identify */
/*
* Set supported atoms
*/
EAPI void
-ecore_x_netwm_supported_set(Ecore_X_Window root, Ecore_X_Atom *supported, int num)
+ecore_x_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);
-}
+ ecore_x_window_prop_atom_set(root,
+ ECORE_X_ATOM_NET_SUPPORTED,
+ supported,
+ num);
+} /* ecore_x_netwm_supported_set */
EAPI int
-ecore_x_netwm_supported_get(Ecore_X_Window root, Ecore_X_Atom **supported, int *num)
+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;
+ 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);
+ supported);
if (num_ret <= 0)
return 0;
- if (num) *num = num_ret;
+ if (num)
+ *num = num_ret;
+
return 1;
-}
+} /* ecore_x_netwm_supported_get */
/*
* Desktop configuration and status
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS,
- &n_desks, 1);
-}
+ &n_desks, 1);
+} /* ecore_x_netwm_desk_count_set */
EAPI void
ecore_x_netwm_desk_roots_set(Ecore_X_Window root,
- Ecore_X_Window *vroots, unsigned int n_desks)
+ 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);
-}
+ ecore_x_window_prop_window_set(root,
+ ECORE_X_ATOM_NET_VIRTUAL_ROOTS,
+ vroots,
+ n_desks);
+} /* ecore_x_netwm_desk_roots_set */
EAPI void
ecore_x_netwm_desk_names_set(Ecore_X_Window root,
- const char **names, unsigned int n_desks)
+ const char **names, unsigned int n_desks)
{
char ss[32], *buf;
const char *s;
for (i = 0; i < n_desks; i++)
{
- s = (names) ? names[i] : NULL;
- if (!s)
- {
- /* Default to "Desk-<number>" */
- sprintf(ss, "Desk-%d", i);
- s = ss;
- }
-
- l = strlen(s) + 1;
- buf = realloc(buf, len + l);
- memcpy(buf + len, s, l);
- len += l;
+ s = (names) ? names[i] : NULL;
+ if (!s)
+ {
+ /* Default to "Desk-<number>" */
+ sprintf(ss, "Desk-%d", i);
+ s = ss;
+ }
+
+ l = strlen(s) + 1;
+ buf = realloc(buf, len + l);
+ memcpy(buf + len, s, l);
+ len += l;
}
_ATOM_SET_UTF8_STRING_LIST(root, ECORE_X_ATOM_NET_DESKTOP_NAMES, buf, len);
free(buf);
-}
+} /* ecore_x_netwm_desk_names_set */
EAPI void
ecore_x_netwm_desk_size_set(Ecore_X_Window root, unsigned int width,
- unsigned int height)
+ unsigned int height)
{
unsigned int size[2];
size[0] = width;
size[1] = height;
ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_DESKTOP_GEOMETRY, size,
- 2);
-}
+ 2);
+} /* ecore_x_netwm_desk_size_set */
EAPI void
ecore_x_netwm_desk_viewports_set(Ecore_X_Window root,
- unsigned int *origins, unsigned int n_desks)
+ unsigned int *origins, unsigned int n_desks)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_DESKTOP_VIEWPORT,
- origins, 2 * n_desks);
-}
+ origins, 2 * n_desks);
+} /* ecore_x_netwm_desk_viewports_set */
EAPI void
ecore_x_netwm_desk_layout_set(Ecore_X_Window root, int orientation,
- int columns, int rows,
- int starting_corner)
+ int columns, int rows,
+ int starting_corner)
{
unsigned int layout[4];
layout[2] = rows;
layout[3] = starting_corner;
ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_DESKTOP_LAYOUT,
- layout, 4);
-}
+ layout, 4);
+} /* ecore_x_netwm_desk_layout_set */
EAPI void
ecore_x_netwm_desk_workareas_set(Ecore_X_Window root,
- unsigned int *areas, unsigned int n_desks)
+ unsigned int *areas, unsigned int n_desks)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_WORKAREA, areas,
- 4 * n_desks);
-}
+ 4 * n_desks);
+} /* ecore_x_netwm_desk_workareas_set */
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);
-}
+ 1);
+} /* ecore_x_netwm_desk_current_set */
EAPI void
ecore_x_netwm_showing_desktop_set(Ecore_X_Window root, int on)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
val = (on) ? 1 : 0;
ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_SHOWING_DESKTOP, &val,
- 1);
-}
+ 1);
+} /* ecore_x_netwm_showing_desktop_set */
/*
* Client status
/* Mapping order */
EAPI void
ecore_x_netwm_client_list_set(Ecore_X_Window root,
- Ecore_X_Window *p_clients, unsigned int n_clients)
+ 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);
-}
+ p_clients, n_clients);
+} /* ecore_x_netwm_client_list_set */
/* Stacking order */
EAPI void
-ecore_x_netwm_client_list_stacking_set(Ecore_X_Window root,
- Ecore_X_Window *p_clients,
- unsigned int n_clients)
+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);
-}
+ p_clients, n_clients);
+} /* ecore_x_netwm_client_list_stacking_set */
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);
-}
+ &win, 1);
+} /* ecore_x_netwm_client_active_set */
EAPI void
-ecore_x_netwm_client_active_request(Ecore_X_Window root, Ecore_X_Window win, int type, Ecore_X_Window current_win)
+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);
-
+ if (!root)
+ root = DefaultRootWindow(_ecore_x_disp);
+
xev.xclient.type = ClientMessage;
xev.xclient.display = _ecore_x_disp;
xev.xclient.window = win;
xev.xclient.data.l[3] = 0;
xev.xclient.data.l[4] = 0;
- XSendEvent(_ecore_x_disp, root, False,
- SubstructureRedirectMask | SubstructureNotifyMask, &xev);
-}
+ XSendEvent(_ecore_x_disp, root, False,
+ SubstructureRedirectMask | SubstructureNotifyMask, &xev);
+} /* ecore_x_netwm_client_active_request */
EAPI void
ecore_x_netwm_name_set(Ecore_X_Window win, const char *name)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
_ecore_x_window_prop_string_utf8_set(win, ECORE_X_ATOM_NET_WM_NAME, name);
-}
+} /* ecore_x_netwm_name_set */
EAPI int
ecore_x_netwm_name_get(Ecore_X_Window win, char **name)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (name)
- *name = _ecore_x_window_prop_string_utf8_get(win, ECORE_X_ATOM_NET_WM_NAME);
+ *name = _ecore_x_window_prop_string_utf8_get(win,
+ ECORE_X_ATOM_NET_WM_NAME);
+
return 1;
-}
+} /* ecore_x_netwm_name_get */
EAPI void
ecore_x_netwm_startup_id_set(Ecore_X_Window win, const char *id)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
_ecore_x_window_prop_string_utf8_set(win, ECORE_X_ATOM_NET_STARTUP_ID, id);
-}
+} /* ecore_x_netwm_startup_id_set */
EAPI int
ecore_x_netwm_startup_id_get(Ecore_X_Window win, char **id)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (id)
- *id = _ecore_x_window_prop_string_utf8_get(win, ECORE_X_ATOM_NET_STARTUP_ID);
+ *id = _ecore_x_window_prop_string_utf8_get(win,
+ ECORE_X_ATOM_NET_STARTUP_ID);
+
return 1;
-}
+} /* ecore_x_netwm_startup_id_get */
EAPI void
ecore_x_netwm_visible_name_set(Ecore_X_Window win, const char *name)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
_ecore_x_window_prop_string_utf8_set(win, ECORE_X_ATOM_NET_WM_VISIBLE_NAME,
- name);
-}
+ name);
+} /* ecore_x_netwm_visible_name_set */
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);
+ *name = _ecore_x_window_prop_string_utf8_get(
+ win,
+ ECORE_X_ATOM_NET_WM_VISIBLE_NAME);
+
return 1;
-}
+} /* ecore_x_netwm_visible_name_get */
EAPI void
ecore_x_netwm_icon_name_set(Ecore_X_Window win, const char *name)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
_ecore_x_window_prop_string_utf8_set(win, ECORE_X_ATOM_NET_WM_ICON_NAME,
- name);
-}
+ name);
+} /* ecore_x_netwm_icon_name_set */
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);
+ *name = _ecore_x_window_prop_string_utf8_get(
+ win,
+ ECORE_X_ATOM_NET_WM_ICON_NAME);
+
return 1;
-}
+} /* ecore_x_netwm_icon_name_get */
EAPI void
ecore_x_netwm_visible_icon_name_set(Ecore_X_Window win, const char *name)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
_ecore_x_window_prop_string_utf8_set(win,
- ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME,
- name);
-}
+ ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME,
+ name);
+} /* ecore_x_netwm_visible_icon_name_set */
EAPI int
ecore_x_netwm_visible_icon_name_get(Ecore_X_Window win, char **name)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (name)
- *name = _ecore_x_window_prop_string_utf8_get(win,
- ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME);
+ *name = _ecore_x_window_prop_string_utf8_get(
+ win,
+ ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME);
+
return 1;
-}
+} /* ecore_x_netwm_visible_icon_name_get */
EAPI void
ecore_x_netwm_desktop_set(Ecore_X_Window win, unsigned int desk)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_DESKTOP, &desk, 1);
-}
+} /* ecore_x_netwm_desktop_set */
EAPI int
ecore_x_netwm_desktop_get(Ecore_X_Window win, unsigned int *desk)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_DESKTOP,
- &tmp, 1);
+ &tmp, 1);
+
+ if (desk)
+ *desk = tmp;
- if (desk) *desk = tmp;
return ret == 1 ? 1 : 0;
-}
+} /* ecore_x_netwm_desktop_get */
/*
* _NET_WM_STRUT is deprecated
*/
EAPI void
ecore_x_netwm_strut_set(Ecore_X_Window win, int left, int right,
- int top, int bottom)
+ int top, int bottom)
{
unsigned int strut[4];
strut[2] = top;
strut[3] = bottom;
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_STRUT, strut, 4);
-}
+} /* ecore_x_netwm_strut_set */
/*
* _NET_WM_STRUT is deprecated
*/
EAPI int
ecore_x_netwm_strut_get(Ecore_X_Window win, int *left, int *right,
- int *top, int *bottom)
+ 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);
+ ret = ecore_x_window_prop_card32_get(win,
+ ECORE_X_ATOM_NET_WM_STRUT,
+ strut,
+ 4);
if (ret != 4)
- return 0;
+ return 0;
+
+ if (left)
+ *left = strut[0];
+
+ if (right)
+ *right = strut[1];
+
+ if (top)
+ *top = strut[2];
+
+ if (bottom)
+ *bottom = strut[3];
- if (left) *left = strut[0];
- if (right) *right = strut[1];
- if (top) *top = strut[2];
- if (bottom) *bottom = strut[3];
return 1;
-}
+} /* ecore_x_netwm_strut_get */
EAPI void
-ecore_x_netwm_strut_partial_set(Ecore_X_Window win, int left, int right,
- int top, int bottom, int left_start_y, int left_end_y,
- int right_start_y, int right_end_y, int top_start_x,
- int top_end_x, int bottom_start_x, int bottom_end_x)
+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];
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);
-}
+ ecore_x_window_prop_card32_set(win,
+ ECORE_X_ATOM_NET_WM_STRUT_PARTIAL,
+ strut,
+ 12);
+} /* ecore_x_netwm_strut_partial_set */
EAPI int
-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)
+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);
+ ret = ecore_x_window_prop_card32_get(win,
+ ECORE_X_ATOM_NET_WM_STRUT_PARTIAL,
+ strut,
+ 12);
if (ret != 12)
- return 0;
-
- 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 0;
+
+ 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 1;
-}
+} /* ecore_x_netwm_strut_partial_get */
EAPI int
ecore_x_netwm_icons_get(Ecore_X_Window win, Ecore_X_Icon **icon, int *num)
int num_ret;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (num) *num = 0;
- if (icon) *icon = NULL;
+ 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);
+ &data);
if (num_ret <= 0)
- return 0;
- if (!data) return 0;
+ return 0;
+
+ if (!data)
+ return 0;
+
if (num_ret < 2)
{
- free(data);
- return 0;
+ free(data);
+ return 0;
}
/* Check how many icons there are */
p = data;
while (p)
{
- len = p[0] * p[1];
- p += (len + 2);
- if ((p - data) > num_ret)
- {
- free(data);
- return 0;
- }
- icons++;
-
- if ((p - data) == num_ret)
- p = NULL;
+ len = p[0] * p[1];
+ p += (len + 2);
+ if ((p - data) > num_ret)
+ {
+ free(data);
+ return 0;
+ }
+
+ icons++;
+
+ if ((p - data) == num_ret)
+ p = NULL;
}
- if (num) *num = icons;
+ if (num)
+ *num = icons;
/* If the user doesn't want the icons, return */
if (!icon)
{
- free(data);
- return 1;
+ free(data);
+ return 1;
}
/* Allocate memory */
*icon = malloc(icons * sizeof(Ecore_X_Icon));
if (!(*icon))
{
- free(data);
- return 0;
+ free(data);
+ return 0;
}
/* 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 0;
- }
-
- 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);
+ 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 0;
+ }
+
+ 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 1;
-}
+} /* ecore_x_netwm_icons_get */
EAPI void
-ecore_x_netwm_icon_geometry_set(Ecore_X_Window win, int x, int y, int width, int height)
+ecore_x_netwm_icon_geometry_set(Ecore_X_Window win,
+ int x,
+ int y,
+ int width,
+ int height)
{
unsigned int geometry[4];
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);
-}
+ ecore_x_window_prop_card32_set(win,
+ ECORE_X_ATOM_NET_WM_ICON_GEOMETRY,
+ geometry,
+ 4);
+} /* ecore_x_netwm_icon_geometry_set */
EAPI int
-ecore_x_netwm_icon_geometry_get(Ecore_X_Window win, int *x, int *y, int *width, int *height)
+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);
+ ret = ecore_x_window_prop_card32_get(win,
+ ECORE_X_ATOM_NET_WM_ICON_GEOMETRY,
+ geometry,
+ 4);
if (ret != 4)
- return 0;
+ return 0;
+
+ if (x)
+ *x = geometry[0];
+
+ if (y)
+ *y = geometry[1];
+
+ if (width)
+ *width = geometry[2];
+
+ if (height)
+ *height = geometry[3];
- if (x) *x = geometry[0];
- if (y) *y = geometry[1];
- if (width) *width = geometry[2];
- if (height) *height = geometry[3];
return 1;
-}
+} /* ecore_x_netwm_icon_geometry_get */
EAPI void
ecore_x_netwm_pid_set(Ecore_X_Window win, int pid)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
tmp = pid;
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_PID,
- &tmp, 1);
-}
+ &tmp, 1);
+} /* ecore_x_netwm_pid_set */
EAPI int
ecore_x_netwm_pid_get(Ecore_X_Window win, int *pid)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_PID,
- &tmp, 1);
- if (pid) *pid = tmp;
+ &tmp, 1);
+ if (pid)
+ *pid = tmp;
+
return ret == 1 ? 1 : 0;
-}
+} /* ecore_x_netwm_pid_get */
EAPI void
ecore_x_netwm_handled_icons_set(Ecore_X_Window win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_HANDLED_ICONS,
- NULL, 0);
-}
+ NULL, 0);
+} /* ecore_x_netwm_handled_icons_set */
EAPI int
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);
+ NULL, 0);
return ret == 0 ? 1 : 0;
-}
+} /* ecore_x_netwm_handled_icons_get */
EAPI void
ecore_x_netwm_user_time_set(Ecore_X_Window win, unsigned int time)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_USER_TIME,
- &time, 1);
-}
+ &time, 1);
+} /* ecore_x_netwm_user_time_set */
EAPI int
ecore_x_netwm_user_time_get(Ecore_X_Window win, unsigned int *time)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_USER_TIME,
- &tmp, 1);
- if (time) *time = tmp;
+ &tmp, 1);
+ if (time)
+ *time = tmp;
+
return ret == 1 ? 1 : 0;
-}
+} /* ecore_x_netwm_user_time_get */
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;
+ return ECORE_X_WINDOW_STATE_MODAL;
else if (a == ECORE_X_ATOM_NET_WM_STATE_STICKY)
- return ECORE_X_WINDOW_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;
+ 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;
+ return ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ;
else if (a == ECORE_X_ATOM_NET_WM_STATE_SHADED)
- return ECORE_X_WINDOW_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;
+ 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;
+ return ECORE_X_WINDOW_STATE_SKIP_PAGER;
else if (a == ECORE_X_ATOM_NET_WM_STATE_HIDDEN)
- return ECORE_X_WINDOW_STATE_HIDDEN;
+ return ECORE_X_WINDOW_STATE_HIDDEN;
else if (a == ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN)
- return ECORE_X_WINDOW_STATE_FULLSCREEN;
+ return ECORE_X_WINDOW_STATE_FULLSCREEN;
else if (a == ECORE_X_ATOM_NET_WM_STATE_ABOVE)
- return ECORE_X_WINDOW_STATE_ABOVE;
+ return ECORE_X_WINDOW_STATE_ABOVE;
else if (a == ECORE_X_ATOM_NET_WM_STATE_BELOW)
- return ECORE_X_WINDOW_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;
+ return ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION;
else
- return ECORE_X_WINDOW_STATE_UNKNOWN;
-}
+ return ECORE_X_WINDOW_STATE_UNKNOWN;
+} /* _ecore_x_netwm_state_get */
static Ecore_X_Atom
_ecore_x_netwm_state_atom_get(Ecore_X_Window_State s)
switch(s)
{
case ECORE_X_WINDOW_STATE_MODAL:
- return ECORE_X_ATOM_NET_WM_STATE_MODAL;
+ return ECORE_X_ATOM_NET_WM_STATE_MODAL;
+
case ECORE_X_WINDOW_STATE_STICKY:
- return ECORE_X_ATOM_NET_WM_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;
+ 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;
+ return ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ;
+
case ECORE_X_WINDOW_STATE_SHADED:
- return ECORE_X_ATOM_NET_WM_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;
+ 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;
+ return ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER;
+
case ECORE_X_WINDOW_STATE_HIDDEN:
- return ECORE_X_ATOM_NET_WM_STATE_HIDDEN;
+ return ECORE_X_ATOM_NET_WM_STATE_HIDDEN;
+
case ECORE_X_WINDOW_STATE_FULLSCREEN:
- return ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN;
+ return ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN;
+
case ECORE_X_WINDOW_STATE_ABOVE:
- return ECORE_X_ATOM_NET_WM_STATE_ABOVE;
+ return ECORE_X_ATOM_NET_WM_STATE_ABOVE;
+
case ECORE_X_WINDOW_STATE_BELOW:
- return ECORE_X_ATOM_NET_WM_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;
+ return ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION;
+
default:
- return 0;
- }
-}
+ return 0;
+ } /* switch */
+} /* _ecore_x_netwm_state_atom_get */
EAPI void
-ecore_x_netwm_window_state_set(Ecore_X_Window win, Ecore_X_Window_State *state, unsigned int num)
+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;
+ 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;
+ ecore_x_window_prop_property_del(win, ECORE_X_ATOM_NET_WM_STATE);
+ return;
}
set = malloc(num * sizeof(Ecore_X_Atom));
- if (!set) return;
+ if (!set)
+ return;
for (i = 0; i < num; i++)
- set[i] = _ecore_x_netwm_state_atom_get(state[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);
-}
+} /* ecore_x_netwm_window_state_set */
EAPI int
-ecore_x_netwm_window_state_get(Ecore_X_Window win, Ecore_X_Window_State **state, unsigned int *num)
+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;
+ 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);
+ &atoms);
if (num_ret <= 0)
return 0;
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]);
+ *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;
+ if (num)
+ *num = num_ret;
}
free(atoms);
return 1;
-}
+} /* ecore_x_netwm_window_state_get */
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;
+ return ECORE_X_WINDOW_TYPE_DESKTOP;
else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK)
- return ECORE_X_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;
+ return ECORE_X_WINDOW_TYPE_TOOLBAR;
else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU)
- return ECORE_X_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;
+ return ECORE_X_WINDOW_TYPE_UTILITY;
else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH)
- return ECORE_X_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;
+ return ECORE_X_WINDOW_TYPE_DIALOG;
else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL)
- return ECORE_X_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;
+ 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;
+ return ECORE_X_WINDOW_TYPE_POPUP_MENU;
else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLTIP)
- return ECORE_X_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;
+ return ECORE_X_WINDOW_TYPE_NOTIFICATION;
else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_COMBO)
- return ECORE_X_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;
+ return ECORE_X_WINDOW_TYPE_DND;
else
- return ECORE_X_WINDOW_TYPE_UNKNOWN;
-}
+ return ECORE_X_WINDOW_TYPE_UNKNOWN;
+} /* _ecore_x_netwm_window_type_type_get */
static Ecore_X_Atom
_ecore_x_netwm_window_type_atom_get(Ecore_X_Window_Type type)
switch (type)
{
case ECORE_X_WINDOW_TYPE_DESKTOP:
- return ECORE_X_ATOM_NET_WM_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;
+ return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK;
+
case ECORE_X_WINDOW_TYPE_TOOLBAR:
- return ECORE_X_ATOM_NET_WM_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;
+ return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU;
+
case ECORE_X_WINDOW_TYPE_UTILITY:
- return ECORE_X_ATOM_NET_WM_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;
+ return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH;
+
case ECORE_X_WINDOW_TYPE_DIALOG:
- return ECORE_X_ATOM_NET_WM_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;
+ 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;
+ 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;
+ 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;
+ return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLTIP;
+
case ECORE_X_WINDOW_TYPE_NOTIFICATION:
- return ECORE_X_ATOM_NET_WM_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;
+ return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_COMBO;
+
case ECORE_X_WINDOW_TYPE_DND:
- return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DND;
+ return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DND;
+
default:
- return 0;
- }
-}
+ return 0;
+ } /* switch */
+} /* _ecore_x_netwm_window_type_atom_get */
/*
* FIXME: We should set WM_TRANSIENT_FOR if type is ECORE_X_WINDOW_TYPE_TOOLBAR
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);
-}
+ &atom, 1);
+} /* ecore_x_netwm_window_type_set */
/* FIXME: Maybe return 0 on some conditions? */
EAPI int
Ecore_X_Atom *atoms = NULL;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (type) *type = ECORE_X_WINDOW_TYPE_NORMAL;
+ 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);
+ 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]);
+ *type = _ecore_x_netwm_window_type_type_get(atoms[0]);
free(atoms);
- if (num >= 1) return 1;
+ if (num >= 1)
+ return 1;
+
return 0;
-}
+} /* ecore_x_netwm_window_type_get */
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;
+ if (types)
+ *types = NULL;
+
num = ecore_x_window_prop_atom_list_get(win,
- ECORE_X_ATOM_NET_WM_WINDOW_TYPE,
- &atoms);
+ ECORE_X_ATOM_NET_WM_WINDOW_TYPE,
+ &atoms);
if ((num <= 0) || (!atoms))
{
- if (atoms) free(atoms);
- return 0;
+ if (atoms)
+ free(atoms);
+
+ return 0;
}
+
atoms2 = malloc(num * sizeof(Ecore_X_Window_Type));
- if (!atoms2) return 0;
+ if (!atoms2)
+ return 0;
+
for (i = 0; i < num; i++)
- atoms2[i] = _ecore_x_netwm_window_type_type_get(atoms[i]);
+ atoms2[i] = _ecore_x_netwm_window_type_type_get(atoms[i]);
free(atoms);
- if (types) *types = atoms2;
- else free(atoms2);
+ if (types)
+ *types = atoms2;
+ else
+ free(atoms2);
+
return num;
-}
+} /* ecore_x_netwm_window_types_get */
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;
+ return ECORE_X_ATOM_NET_WM_ACTION_MOVE;
+
case ECORE_X_ACTION_RESIZE:
- return ECORE_X_ATOM_NET_WM_ACTION_RESIZE;
+ return ECORE_X_ATOM_NET_WM_ACTION_RESIZE;
+
case ECORE_X_ACTION_MINIMIZE:
- return ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE;
+ return ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE;
+
case ECORE_X_ACTION_SHADE:
- return ECORE_X_ATOM_NET_WM_ACTION_SHADE;
+ return ECORE_X_ATOM_NET_WM_ACTION_SHADE;
+
case ECORE_X_ACTION_STICK:
- return ECORE_X_ATOM_NET_WM_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;
+ return ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ;
+
case ECORE_X_ACTION_MAXIMIZE_VERT:
- return ECORE_X_ATOM_NET_WM_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;
+ return ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN;
+
case ECORE_X_ACTION_CHANGE_DESKTOP:
- return ECORE_X_ATOM_NET_WM_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;
+ return ECORE_X_ATOM_NET_WM_ACTION_CLOSE;
+
case ECORE_X_ACTION_ABOVE:
- return ECORE_X_ATOM_NET_WM_ACTION_ABOVE;
+ return ECORE_X_ATOM_NET_WM_ACTION_ABOVE;
+
case ECORE_X_ACTION_BELOW:
- return ECORE_X_ATOM_NET_WM_ACTION_BELOW;
+ return ECORE_X_ATOM_NET_WM_ACTION_BELOW;
+
default:
- return 0;
- }
-}
+ return 0;
+ } /* switch */
+} /* _ecore_x_netwm_action_atom_get */
/* FIXME: Get complete list */
EAPI int
LOGFN(__FILE__, __LINE__, __FUNCTION__);
num = ecore_x_window_prop_atom_list_get(win, ECORE_X_ATOM_NET_WM_WINDOW_TYPE,
- &atoms);
+ &atoms);
if (num <= 0)
- return ret;
+ return ret;
atom = _ecore_x_netwm_action_atom_get(action);
for (i = 0; i < num; ++i)
{
- if (atom == atoms[i])
- {
- ret = 1;
- break;
- }
+ if (atom == atoms[i])
+ {
+ ret = 1;
+ break;
+ }
}
free(atoms);
return ret;
-}
+} /* ecore_x_netwm_allowed_action_isset */
/* FIXME: Set complete list */
EAPI void
-ecore_x_netwm_allowed_action_set(Ecore_X_Window win, Ecore_X_Action *action, unsigned int num)
+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;
+ 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;
+ if (!set)
+ return;
for (i = 0; i < num; i++)
- set[i] = _ecore_x_netwm_action_atom_get(action[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);
+ ecore_x_window_prop_atom_set(win,
+ ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS,
+ set,
+ num);
free(set);
-}
+} /* ecore_x_netwm_allowed_action_set */
EAPI int
-ecore_x_netwm_allowed_action_get(Ecore_X_Window win, Ecore_X_Action **action, unsigned int *num)
+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;
+ if (num)
+ *num = 0;
- num_ret = ecore_x_window_prop_atom_list_get(win, ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS,
- &atoms);
+ 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 0;
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]);
+ *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;
+ if (num)
+ *num = num_ret;
}
free(atoms);
return 1;
-}
+} /* ecore_x_netwm_allowed_action_get */
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);
-}
+ &opacity, 1);
+} /* ecore_x_netwm_opacity_set */
EAPI int
ecore_x_netwm_opacity_get(Ecore_X_Window win, unsigned int *opacity)
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;
+ &tmp, 1);
+ if (opacity)
+ *opacity = tmp;
+
return ret == 1 ? 1 : 0;
-}
+} /* ecore_x_netwm_opacity_get */
EAPI void
ecore_x_netwm_frame_size_set(Ecore_X_Window win, int fl, int fr, int ft, int fb)
frames[1] = fr;
frames[2] = ft;
frames[3] = fb;
- ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_FRAME_EXTENTS, frames, 4);
-}
+ ecore_x_window_prop_card32_set(win,
+ ECORE_X_ATOM_NET_FRAME_EXTENTS,
+ frames,
+ 4);
+} /* ecore_x_netwm_frame_size_set */
EAPI int
-ecore_x_netwm_frame_size_get(Ecore_X_Window win, int *fl, int *fr, int *ft, int *fb)
+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);
+ ret = ecore_x_window_prop_card32_get(win,
+ ECORE_X_ATOM_NET_FRAME_EXTENTS,
+ frames,
+ 4);
if (ret != 4)
- return 0;
+ return 0;
+
+ if (fl)
+ *fl = frames[0];
+
+ if (fr)
+ *fr = frames[1];
+
+ if (ft)
+ *ft = frames[2];
+
+ if (fb)
+ *fb = frames[3];
- if (fl) *fl = frames[0];
- if (fr) *fr = frames[1];
- if (ft) *ft = frames[2];
- if (fb) *fb = frames[3];
return 1;
-}
+} /* ecore_x_netwm_frame_size_get */
EAPI int
-ecore_x_netwm_sync_counter_get(Ecore_X_Window win, Ecore_X_Sync_Counter *counter)
+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);
+ ret = ecore_x_window_prop_card32_get(
+ win,
+ ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER,
+ &tmp,
+ 1);
+
+ if (counter)
+ *counter = tmp;
- if (counter) *counter = tmp;
return ret == 1 ? 1 : 0;
-}
+} /* ecore_x_netwm_sync_counter_get */
EAPI void
ecore_x_netwm_ping_send(Ecore_X_Window win)
{
XEvent xev;
- if (!win) return;
+ if (!win)
+ return;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
xev.xclient.type = ClientMessage;
xev.xclient.data.l[4] = 0;
XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev);
-}
+} /* ecore_x_netwm_ping_send */
EAPI void
ecore_x_netwm_sync_request_send(Ecore_X_Window win, unsigned int serial)
XSyncValue value;
XEvent xev;
- if (!win) return;
+ if (!win)
+ return;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XSyncIntToValue(&value, (int)serial);
xev.xclient.data.l[4] = 0;
XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev);
-}
+} /* ecore_x_netwm_sync_request_send */
EAPI void
-ecore_x_netwm_state_request_send(Ecore_X_Window win, Ecore_X_Window root,
- Ecore_X_Window_State s1, Ecore_X_Window_State s2, int set)
+ecore_x_netwm_state_request_send(Ecore_X_Window win,
+ Ecore_X_Window root,
+ Ecore_X_Window_State s1,
+ Ecore_X_Window_State s2,
+ int set)
{
XEvent xev;
- if (!win) return;
-
+ if (!win)
+ return;
+
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!root) root = DefaultRootWindow(_ecore_x_disp);
+ if (!root)
+ root = DefaultRootWindow(_ecore_x_disp);
xev.xclient.type = ClientMessage;
xev.xclient.serial = 0;
xev.xclient.data.l[4] = 0;
XSendEvent(_ecore_x_disp, root, False,
- SubstructureNotifyMask | SubstructureRedirectMask, &xev);
-}
+ SubstructureNotifyMask | SubstructureRedirectMask, &xev);
+} /* ecore_x_netwm_state_request_send */
EAPI void
-ecore_x_netwm_desktop_request_send(Ecore_X_Window win, Ecore_X_Window root, unsigned int desktop)
+ecore_x_netwm_desktop_request_send(Ecore_X_Window win,
+ Ecore_X_Window root,
+ unsigned int desktop)
{
XEvent xev;
- if (!win) return;
-
+ if (!win)
+ return;
+
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!root) root = DefaultRootWindow(_ecore_x_disp);
+ if (!root)
+ root = DefaultRootWindow(_ecore_x_disp);
xev.xclient.type = ClientMessage;
xev.xclient.serial = 0;
xev.xclient.data.l[0] = desktop;
XSendEvent(_ecore_x_disp, root, False,
- SubstructureNotifyMask | SubstructureRedirectMask, &xev);
-}
+ SubstructureNotifyMask | SubstructureRedirectMask, &xev);
+} /* ecore_x_netwm_desktop_request_send */
int
-_ecore_x_netwm_startup_info_begin(Ecore_X_Window win __UNUSED__, char *data __UNUSED__)
+_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;
+ unsigned char *exists = 0;
+
+ if (!startup_info)
+ return 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);
+ 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;
+ 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;
+ _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);
+ eina_hash_modify(startup_info, (void *)info->win, info);
else
- eina_hash_add(startup_info, (void *)info->win, info);
+ 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
+ /* We have a '\0' in there, the message is done */
+ _ecore_x_netwm_startup_info_process(info);
+
+#endif /* if 0 */
return 1;
-}
+} /* _ecore_x_netwm_startup_info_begin */
int
-_ecore_x_netwm_startup_info(Ecore_X_Window win __UNUSED__, char *data __UNUSED__)
+_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;
+ if (!startup_info)
+ return 0;
+
info = eina_hash_find(startup_info, (void *)win);
- if (!info) return 0;
+ 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;
- }
+ 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
+ /* We have a '\0' in there, the message is done */
+ _ecore_x_netwm_startup_info_process(info);
+
+#endif /* if 0 */
return 1;
-}
+} /* _ecore_x_netwm_startup_info */
/*
* Set UTF-8 string property
*/
static void
_ecore_x_window_prop_string_utf8_set(Ecore_X_Window win, Ecore_X_Atom atom,
- const char *str)
+ const char *str)
{
XChangeProperty(_ecore_x_disp, win, atom, ECORE_X_ATOM_UTF8_STRING, 8,
- PropModeReplace, (unsigned char *)str, strlen(str));
-}
+ PropModeReplace, (unsigned char *)str, strlen(str));
+} /* _ecore_x_window_prop_string_utf8_set */
/*
* Get UTF-8 string property
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);
+ 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';
- }
+ 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;
-}
+} /* _ecore_x_window_prop_string_utf8_get */
#if 0 /* Unused */
/*
p = strchr(info->buffer, ':');
if (!p)
{
- eina_hash_del(startup_info, (void *)info->win);
- _ecore_x_netwm_startup_info_free(info);
- return 0;
+ 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;
+ 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;
- }
+ event = ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE;
else if (!strcmp(info->buffer, "remove"))
- event = ECORE_X_EVENT_STARTUP_SEQUENCE_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;
+ 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;
+ 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);
+ 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);
+ 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;
+ /* Discard buffer */
+ info->length = 0;
+ info->buffer[0] = 0;
}
+
return 1;
-}
+} /* _ecore_x_netwm_startup_info_process */
/*
* Parse startup info
{
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);
- }
+ 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;
+ if (!info->id)
+ return 0;
+
return 1;
-}
-#endif
+} /* _ecore_x_netwm_startup_info_parse */
+
+#endif /* if 0 */
/*
* Free startup info struct
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);
+ 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);
-}
+} /* _ecore_x_netwm_startup_info_free */
/*
* Is screen composited?
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 0;
+ if (atom == None)
+ atom = XInternAtom(_ecore_x_disp, buf, False);
+
+ if (atom == None)
+ return 0;
win = XGetSelectionOwner(_ecore_x_disp, atom);
return win != None;
-}
+} /* ecore_x_screen_is_composited */
EAPI void
ecore_x_screen_is_composited_set(int screen, Ecore_X_Window win)
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;
+ 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);
-}
+} /* ecore_x_screen_is_composited_set */
+
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#include "Ecore.h"
#include "ecore_x_private.h"
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));
+ 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);
-}
+} /* ecore_x_pixmap_new */
/**
* Deletes the reference to the given pixmap.
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XFreePixmap(_ecore_x_disp, pmap);
-}
+} /* ecore_x_pixmap_free */
/**
* Pastes a rectangular area of the given pixmap onto the given drawable.
* @ingroup Ecore_X_Pixmap_Group
*/
EAPI void
-ecore_x_pixmap_paste(Ecore_X_Pixmap pmap, Ecore_X_Drawable dest,
- Ecore_X_GC gc, int sx, int sy,
- int w, int h, int dx, int dy)
+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);
-}
+} /* ecore_x_pixmap_paste */
/**
* Retrieves the size of the given pixmap.
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);
-}
+ if (pmap)
+ ecore_x_drawable_geometry_get(pmap, x, y, w, h);
+} /* ecore_x_pixmap_geometry_get */
/**
* Retrieves the depth of the given pixmap.
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return ecore_x_drawable_depth_get(pmap);
-}
+} /* ecore_x_pixmap_depth_get */
#include <sys/param.h>
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 256
-#endif
+#endif /* ifndef MAXHOSTNAMELEN */
-#define XK_MISCELLANY 1
+#define XK_MISCELLANY 1
#include <X11/Xlib.h>
#include <X11/Xproto.h>
#include <X11/Xutil.h>
#include <X11/extensions/dpms.h>
#ifdef ECORE_XCURSOR
#include <X11/Xcursor/Xcursor.h>
-#endif
+#endif /* ifdef ECORE_XCURSOR */
#ifdef ECORE_XPRINT
#include <X11/extensions/Print.h>
-#endif
+#endif /* ifdef ECORE_XPRINT */
#ifdef ECORE_XINERAMA
#include <X11/extensions/Xinerama.h>
-#endif
+#endif /* ifdef ECORE_XINERAMA */
#ifdef ECORE_XRANDR
#include <X11/extensions/Xrandr.h>
-#endif
+#endif /* ifdef ECORE_XRANDR */
#ifdef ECORE_XSS
#include <X11/extensions/scrnsaver.h>
-#endif
+#endif /* ifdef ECORE_XSS */
#ifdef ECORE_XRENDER
#include <X11/extensions/Xrender.h>
-#endif
+#endif /* ifdef ECORE_XRENDER */
#ifdef ECORE_XFIXES
#include <X11/extensions/Xfixes.h>
-#endif
+#endif /* ifdef ECORE_XFIXES */
#ifdef ECORE_XCOMPOSITE
#include <X11/extensions/Xcomposite.h>
-#endif
+#endif /* ifdef ECORE_XCOMPOSITE */
#ifdef ECORE_XDAMAGE
#include <X11/extensions/Xdamage.h>
-#endif
+#endif /* ifdef ECORE_XDAMAGE */
#ifdef ECORE_XDPMS
#include <X11/extensions/dpms.h>
-#endif
+#endif /* ifdef ECORE_XDPMS */
#ifdef ECORE_XKB
#include <X11/XKBlib.h>
-#endif
+#endif /* ifdef ECORE_XKB */
#ifdef ECORE_XI2
#include <X11/extensions/XInput2.h>
-#endif
+#endif /* ifdef ECORE_XI2 */
#include "Ecore.h"
#include "ecore_private.h"
extern int _ecore_xlib_log_dom;
#ifdef ECORE_XLIB_DEFAULT_LOG_COLOR
# undef ECORE_XLIB_DEFAULT_LOG_COLOR
-#endif
+#endif /* ifdef ECORE_XLIB_DEFAULT_LOG_COLOR */
#define ECORE_XLIB_DEFAULT_LOG_COLOR EINA_COLOR_BLUE
#ifdef ERR
# undef ERR
-#endif
+#endif /* ifdef ERR */
#define ERR(...) EINA_LOG_DOM_ERR(_ecore_xlib_log_dom, __VA_ARGS__)
#ifdef DBG
# undef DBG
-#endif
+#endif /* ifdef DBG */
#define DBG(...) EINA_LOG_DOM_DBG(_ecore_xlib_log_dom, __VA_ARGS__)
#ifdef INF
# undef INF
-#endif
+#endif /* ifdef INF */
#define INF(...) EINA_LOG_DOM_INFO(_ecore_xlib_log_dom, __VA_ARGS__)
#ifdef WRN
# undef WRN
-#endif
+#endif /* ifdef WRN */
#define WRN(...) EINA_LOG_DOM_WARN(_ecore_xlib_log_dom, __VA_ARGS__)
#ifdef CRIT
# undef CRIT
-#endif
+#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;
+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;
+ 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;
+typedef struct _Ecore_X_Selection_Converter Ecore_X_Selection_Converter;
struct _Ecore_X_Selection_Converter
{
- Ecore_X_Atom target;
- int (*convert)(char *target, void *data, int size,
- void **data_ret, int *size_ret);
+ Ecore_X_Atom target;
+ int (*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;
+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);
+ char *target;
+ void *(*parse)(const char *target, void *data, int size, int format);
Ecore_X_Selection_Parser *next;
};
-typedef struct _Ecore_X_DND_Source
+typedef struct _Ecore_X_DND_Source
{
- int version;
+ int version;
Ecore_X_Window win, dest;
-
+
enum {
ECORE_X_DND_SOURCE_IDLE,
ECORE_X_DND_SOURCE_DRAGGING,
ECORE_X_DND_SOURCE_CONVERTING
} state;
- struct {
- short x, y;
+ struct
+ {
+ short x, y;
unsigned short width, height;
} rectangle;
- struct {
+ struct
+ {
Ecore_X_Window window;
- int x, y;
+ int x, y;
} prev;
- Time time;
+ Time time;
Ecore_X_Atom action, accepted_action;
-
- int will_accept;
- int suppress;
- int await_status;
+ int will_accept;
+ int suppress;
+
+ int await_status;
} Ecore_X_DND_Source;
-typedef struct _Ecore_X_DND_Target
+typedef struct _Ecore_X_DND_Target
{
- int version;
+ int version;
Ecore_X_Window win, source;
-
+
enum {
ECORE_X_DND_TARGET_IDLE,
ECORE_X_DND_TARGET_ENTERED
} state;
- struct {
+ struct
+ {
int x, y;
} pos;
-
- Time time;
+
+ Time time;
Ecore_X_Atom action, accepted_action;
-
- int will_accept;
-} Ecore_X_DND_Target;
+ int will_accept;
+} Ecore_X_DND_Target;
extern int ECORE_X_MODIFIER_SHIFT;
extern int ECORE_X_MODIFIER_CTRL;
extern int ECORE_X_LOCK_CAPS;
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 int _ecore_x_xcursor;
-extern XIC _ecore_x_ic;
-
-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 int (*_ecore_window_grab_replay_func) (void *data, int event_type, void *event);
-extern void *_ecore_window_grab_replay_data;
+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 int _ecore_x_xcursor;
+extern XIC _ecore_x_ic;
+
+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);
-void _ecore_x_event_handle_sync_counter(XEvent *xevent);
-void _ecore_x_event_handle_sync_alarm(XEvent *xevent);
+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);
+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
+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
+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
-void _ecore_x_event_handle_generic_event(XEvent *xevent);
+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);
+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);
-int _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);
-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);
+ _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);
+int _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);
+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);
+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_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_atoms_init(void);
+void _ecore_x_atoms_init(void);
extern int _ecore_x_xi2_opcode;
-void _ecore_x_input_init(void);
-void _ecore_x_input_shutdown(void);
-void _ecore_x_input_handler(XEvent* xevent);
+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_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);
//#define LOGFNS 1
#ifdef LOGFNS
+#include <stdio.h>
#define LOGFN(fl, ln, fn) printf("-ECORE-X: %25s: %5i - %s\n", fl, ln, fn);
-#else
+#else /* ifdef LOGFNS */
#define LOGFN(fl, ln, fn)
-#endif
+#endif /* ifdef LOGFNS */
-#endif
+#endif /* ifndef _ECORE_X_PRIVATE_H */
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
-
-#include <stdlib.h>
+#endif /* ifdef HAVE_CONFIG_H */
#include "ecore_x_private.h"
+#include "ecore_x_randr.h"
-static int _randr_available = 0;
+static Eina_Bool _randr_available = EINA_FALSE;
#ifdef ECORE_XRANDR
-static int _randr_major, _randr_minor, _randr_version;
+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)
-#endif
+
+#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)
_randr_minor = 3;
_randr_version = 0;
+ _ecore_x_disp = _ecore_x_disp;
+ _ecore_x_randr_get_screen_resources = NULL;
if (XRRQueryVersion(_ecore_x_disp, &_randr_major, &_randr_minor))
- {
- _randr_version = (_randr_major << 16) | _randr_minor;
- _randr_available = 1;
- }
+ {
+ _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 = 0;
+ _randr_available = EINA_FALSE;
+
#else
- _randr_available = 0;
+ _randr_available = EINA_FALSE;
#endif
}
-EAPI int
+/*
+ * @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)
{
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
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_events_select(Ecore_X_Window win, int on)
+ecore_x_randr_version_get(void)
{
#ifdef ECORE_XRANDR
- int mask;
-
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!on)
- mask = 0;
+ if (_randr_available)
+ {
+ return _randr_version;
+ }
else
- {
- mask = RRScreenChangeNotifyMask;
- if (_randr_version >= RANDR_1_2)
- mask |= (RRCrtcChangeNotifyMask |
- RROutputChangeNotifyMask |
- RROutputPropertyNotifyMask);
- }
-
- XRRSelectInput(_ecore_x_disp, win, mask);
+ {
+ return Ecore_X_Randr_Unset;
+ }
- return 1;
-#else
- return 0;
#endif
}
-EAPI Ecore_X_Randr_Rotation
-ecore_x_randr_screen_rotations_get(Ecore_X_Window root)
-{
-#ifdef ECORE_XRANDR
- Rotation rot, crot;
-
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
- rot = XRRRotations(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp, root), &crot);
- return rot;
-#else
- return 0;
-#endif
-}
-
-EAPI Ecore_X_Randr_Rotation
-ecore_x_randr_screen_rotation_get(Ecore_X_Window root)
-{
-#ifdef ECORE_XRANDR
- Rotation crot = 0;
-
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
- XRRRotations(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp, root), &crot);
- return crot;
-#else
- return 0;
-#endif
-}
-
-EAPI void
-ecore_x_randr_screen_rotation_set(Ecore_X_Window root, Ecore_X_Randr_Rotation rot)
+Eina_Bool
+_ecore_x_randr_root_validate(Ecore_X_Window root)
{
#ifdef ECORE_XRANDR
- XRRScreenConfiguration *xrrcfg;
- SizeID sizeid;
- Rotation crot;
-
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
- xrrcfg = XRRGetScreenInfo(_ecore_x_disp, root);
- if (!xrrcfg) return;
- sizeid = XRRConfigCurrentConfiguration(xrrcfg, &crot);
- XRRSetScreenConfig(_ecore_x_disp, xrrcfg, root, sizeid, rot, CurrentTime);
- XRRFreeScreenConfigInfo(xrrcfg);
-#endif
-}
-
-EAPI Ecore_X_Screen_Size *
-ecore_x_randr_screen_sizes_get(Ecore_X_Window root, int *num)
-{
-#ifdef ECORE_XRANDR
- Ecore_X_Screen_Size *ret;
- XRRScreenSize *sizes;
- int i, n;
-
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (num) *num = 0;
-
- /* we don't have to free sizes, no idea why not */
- sizes = XRRSizes(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp, root), &n);
- ret = calloc(n, sizeof(Ecore_X_Screen_Size));
- 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;
- }
- return ret;
-#else
- if (num) *num = 0;
- return NULL;
-#endif
-}
-
-EAPI Ecore_X_Screen_Size
-ecore_x_randr_current_screen_size_get(Ecore_X_Window root)
-{
- Ecore_X_Screen_Size ret = { -1, -1 };
-#ifdef ECORE_XRANDR
- XRRScreenSize *sizes;
- XRRScreenConfiguration *sc;
- SizeID size_index;
- Rotation rotation;
- int n;
-
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
- sc = XRRGetScreenInfo(_ecore_x_disp, root);
- if (!sc)
- {
- ERR("Couldn't get screen information for %d", root);
- return ret;
- }
- size_index = XRRConfigCurrentConfiguration(sc, &rotation);
-
- sizes = XRRSizes(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp, root), &n);
- if (size_index < n)
- {
- ret.width = sizes[size_index].width;
- ret.height = sizes[size_index].height;
- }
- XRRFreeScreenConfigInfo(sc);
-#endif
- return ret;
-}
-
-EAPI int
-ecore_x_randr_screen_size_set(Ecore_X_Window root, Ecore_X_Screen_Size size)
-{
-#ifdef ECORE_XRANDR
- XRRScreenConfiguration *sc;
- XRRScreenSize *sizes;
- int i, n, size_index = -1;
-
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
- sizes = XRRSizes(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp, root), &n);
- for (i = 0; i < n; i++)
- {
- if ((sizes[i].width == size.width) && (sizes[i].height == size.height))
- {
- size_index = i;
- break;
- }
- }
- if (size_index == -1) return 0;
-
- sc = XRRGetScreenInfo(_ecore_x_disp, root);
- if (XRRSetScreenConfig(_ecore_x_disp, sc,
- root, size_index,
- RR_Rotate_0, CurrentTime))
- {
- ERR("Can't set new screen size!");
- XRRFreeScreenConfigInfo(sc);
- return 0;
- }
- XRRFreeScreenConfigInfo(sc);
- return 1;
-#else
- return 0;
-#endif
-}
-
-EAPI Ecore_X_Screen_Refresh_Rate
-ecore_x_randr_current_screen_refresh_rate_get(Ecore_X_Window root)
-{
- Ecore_X_Screen_Refresh_Rate ret = { -1 };
-#ifdef ECORE_XRANDR
- XRRScreenConfiguration *sc;
-
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
- sc = XRRGetScreenInfo(_ecore_x_disp, root);
- if (!sc)
- {
- ERR("Couldn't get screen information for %d", root);
- return ret;
- }
- ret.rate = XRRConfigCurrentRate(sc);
- XRRFreeScreenConfigInfo(sc);
-#endif
- return ret;
-}
-
-EAPI Ecore_X_Screen_Refresh_Rate *
-ecore_x_randr_screen_refresh_rates_get(Ecore_X_Window root, int size_id, int *num)
-{
-#ifdef ECORE_XRANDR
- Ecore_X_Screen_Refresh_Rate *ret = NULL;
- XRRScreenConfiguration *sc;
- short *rates;
- int i, n;
-
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (num) *num = 0;
-
- sc = XRRGetScreenInfo(_ecore_x_disp, root);
- if (!sc)
- {
- ERR("Couldn't get screen information for %d", root);
- return ret;
- }
-
- rates = XRRRates(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp, root), size_id, &n);
- ret = calloc(n, sizeof(Ecore_X_Screen_Refresh_Rate));
- if (!ret)
- {
- XRRFreeScreenConfigInfo(sc);
- return NULL;
- }
-
- if (num) *num = n;
- for (i = 0; i < n; i++)
- {
- ret[i].rate = rates[i];
- }
- XRRFreeScreenConfigInfo(sc);
- return ret;
-#else
- if (num) *num = 0;
- return NULL;
-#endif
-}
-
-EAPI int
-ecore_x_randr_screen_refresh_rate_set(Ecore_X_Window root, Ecore_X_Screen_Size size, Ecore_X_Screen_Refresh_Rate rate)
-{
-#ifdef ECORE_XRANDR
- XRRScreenConfiguration *sc;
- XRRScreenSize *sizes;
- int i, n, size_index = -1;
+ Ecore_X_Randr_Screen scr = -1;
+ if (root && RANDR_VALIDATE_ROOT(scr, root))
+ return EINA_TRUE;
+ else
+ return EINA_FALSE;
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
- sizes = XRRSizes(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp, root), &n);
- for (i = 0; i < n; i++)
- {
- if ((sizes[i].width == size.width) && (sizes[i].height == size.height))
- {
- size_index = i;
- break;
- }
- }
- if (size_index == -1) return 0;
-
- sc = XRRGetScreenInfo(_ecore_x_disp, root);
- if (XRRSetScreenConfigAndRate(_ecore_x_disp, sc,
- root, size_index,
- RR_Rotate_0, rate.rate, CurrentTime))
- {
- ERR("Can't set new screen size and refresh rate!");
- XRRFreeScreenConfigInfo(sc);
- return 0;
- }
- XRRFreeScreenConfigInfo(sc);
- return 1;
#else
- return 1;
+ return EINA_FALSE;
#endif
}
--- /dev/null
+#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
--- /dev/null
+/*
+ * vim:ts=8:sw=3:sts=8:expandtab:cino=>5n-3f0^-2{2
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif /* ifdef HAVE_CONFIG_H */
+
+#include "ecore_x_private.h"
+#include "ecore_x_randr.h"
+
+#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 */
+} /* ecore_x_randr_screen_primary_output_orientations_get */
+
+/*
+ * @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 */
+} /* ecore_x_randr_screen_primary_output_orientation_get */
+
+/*
+ * @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 */
+} /* ecore_x_randr_screen_primary_output_orientation_set */
+
+/*
+ * @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);
+ 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 */
+} /* ecore_x_randr_screen_primary_output_sizes_get */
+
+/*
+ * @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 index;
+ Rotation orientation;
+ int n;
+
+ if (!(sc = XRRGetScreenInfo(_ecore_x_disp, root)))
+ {
+ ERR("Couldn't get screen information for %d", root);
+ return;
+ }
+
+ index = XRRConfigCurrentConfiguration(sc, &orientation);
+
+ sizes =
+ XRRSizes(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp,
+ root), &n);
+ if ((index < n) && (index >= 0))
+ {
+ if (w)
+ *w = sizes[index].width;
+
+ if (h)
+ *h = sizes[index].height;
+
+ if (w_mm)
+ *w_mm = sizes[index].mwidth;
+
+ if (h_mm)
+ *h_mm = sizes[index].mheight;
+
+ if (size_index)
+ *size_index = index;
+ }
+
+ XRRFreeScreenConfigInfo(sc);
+#endif /* ifdef ECORE_XRANDR */
+} /* ecore_x_randr_screen_primary_output_current_size_get */
+
+/*
+ * @brief sets a given screen's primary output size, but disables all other outputs at the same time
+ * @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;
+ XRRScreenSize *sizes;
+ Eina_Bool ret = EINA_FALSE;
+ int nsizes = 0;
+
+ if (size_index >= 0 && _ecore_x_randr_root_validate(root))
+ {
+ sizes =
+ XRRSizes(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp,
+ 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 */
+} /* ecore_x_randr_screen_primary_output_size_set */
+
+/*
+ * @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 */
+} /* ecore_x_randr_screen_primary_output_current_refresh_rate_get */
+
+/*
+ * @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 */
+} /* ecore_x_randr_screen_primary_output_refresh_rates_get */
+
+//>= 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 */
+} /* ecore_x_randr_screen_primary_output_refresh_rate_set */
--- /dev/null
+/*
+ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "ecore_x_private.h"
+#include "ecore_x_randr.h"
+
+#define Ecore_X_Randr_None 0
+#define Ecore_X_Randr_Unset -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))))
+ strncpy(ret[i]->name, res->modes[i].name,
+ res->modes[i].nameLength);
+ 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 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;
+ if (!(ret->name =
+ strndup(res->modes[i].name, res->modes[i].nameLength)))
+ {
+ ret->name = NULL;
+ ret->nameLength = 0;
+ }
+ else
+ ret->nameLength = res->modes[i].nameLength;
+
+ 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
+}
+
+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.
+ * @para 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 successfull. 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 clone)
+{
+#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,
+ clone) &&
+ (res =
+ _ecore_x_randr_get_screen_resources (_ecore_x_disp,
+ root)) &&
+ (clone_crtc_info = XRRGetCrtcInfo(_ecore_x_disp, res, clone)))
+ {
+ 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,
+ clone,
+ 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 == 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.
+ * @crtc_r1 the CRTC to be positioned.
+ * @crtc_r2 the CRTC the position should be relative to
+ * @position the relation between the crtcs
+ * @aligment 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
+}
+
+
+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.
+ * @root window that this information should be queried for.
+ * @output the output which's clones we concern
+ * @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
+ * @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 bewow command is correct, but due to a bug in libXrandr
+ * it doesn't work. Therefor we stick with strlen().
+ * Replace the line below with the following once
+ * libXrandr >= git revision '25d793ab4ec111658e541c94eba4893a81d6a3b7'.
+ * is shipped and standard.
+ *
+ * *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
+ * @w width of given mode in px
+ * @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
+ * @output the XID of the output
+ * @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 == NULL)
+ || !_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 neccessary 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[ncrtc];
+ Eina_Bool ret = EINA_TRUE;
+ int i, cw, ch, w_max, h_max, nw, nh;
+
+ 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) ||
+ ((crtc_info[i]->x + crtc_info[i]->width + dx) > w_max)
+ || ((crtc_info[i]->y + dy) < 0) ||
+ ((crtc_info[i]->y + crtc_info[i]->height + dy) > h_max)
+ )
+ goto _ecore_x_randr_move_crtcs_fail_free_crtc_info;
+
+ nw = MAX((crtc_info[i]->x + crtc_info[i]->width + dx), nw);
+ nh = MAX((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; i++)
+ {
+ if (!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)
+ 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++)
+ {
+ 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 ((crtc_info->x + crtc_info->width) > w_n)
+ w_n = (crtc_info->x + crtc_info->width);
+
+ if ((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);
+ }
+ fprintf(stderr, "E_RANDR: babam, resize! Trying to move all CRTCs with dx %d and dy %d", dx_min, dy_min);
+ 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
+}
--- /dev/null
+/*
+ * vim:ts=8:sw=3:sts=8:expandtab:cino=>5n-3f0^-2{2
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "ecore_x_private.h"
+#include "ecore_x_randr.h"
+
+#define Ecore_X_Randr_None 0
+#define Ecore_X_Randr_Unset -1
+
+#ifdef ECORE_XRANDR
+
+#define RANDR_1_3 ((1 << 16) | 3)
+#define RANDR_CHECK_1_3_RET(ret) if(_randr_version < RANDR_1_3) return ret
+
+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
+}
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#include "ecore_x_private.h"
-
/*
* [x] XCreateRegion
* [ ] XPolygonRegion
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return (Ecore_X_XRegion *)XCreateRegion();
-}
+} /* ecore_x_xregion_new */
EAPI void
ecore_x_xregion_free(Ecore_X_XRegion *region)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!region)
- return;
+ return;
XDestroyRegion((Region)region);
-}
+} /* ecore_x_xregion_free */
EAPI int
ecore_x_xregion_set(Ecore_X_XRegion *region, Ecore_X_GC gc)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return XSetRegion(_ecore_x_disp, gc, (Region)region);
-}
+} /* ecore_x_xregion_set */
EAPI void
ecore_x_xregion_translate(Ecore_X_XRegion *region, int x, int y)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!region)
- return;
+ return;
/* return value not used */
XOffsetRegion((Region)region, x, y);
-}
+} /* ecore_x_xregion_translate */
EAPI int
-ecore_x_xregion_intersect(Ecore_X_XRegion *dst, Ecore_X_XRegion *r1, Ecore_X_XRegion *r2)
+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);
-}
+} /* ecore_x_xregion_intersect */
EAPI int
-ecore_x_xregion_union(Ecore_X_XRegion *dst, Ecore_X_XRegion *r1, Ecore_X_XRegion *r2)
+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);
-}
+} /* ecore_x_xregion_union */
EAPI int
-ecore_x_xregion_union_rect(Ecore_X_XRegion *dst, Ecore_X_XRegion *src, Ecore_X_Rectangle *rect)
+ecore_x_xregion_union_rect(Ecore_X_XRegion *dst,
+ Ecore_X_XRegion *src,
+ Ecore_X_Rectangle *rect)
{
XRectangle xr;
xr.height = rect->height;
return XUnionRectWithRegion(&xr, (Region)src, (Region)dst);
-}
+} /* ecore_x_xregion_union_rect */
EAPI int
-ecore_x_xregion_subtract(Ecore_X_XRegion *dst, Ecore_X_XRegion *rm, Ecore_X_XRegion *rs)
+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);
-}
+} /* ecore_x_xregion_subtract */
EAPI int
ecore_x_xregion_is_empty(Ecore_X_XRegion *region)
{
if (!region)
- return 1;
+ return 1;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return !XEmptyRegion((Region)region);
-}
+} /* ecore_x_xregion_is_empty */
EAPI int
ecore_x_xregion_is_equal(Ecore_X_XRegion *r1, Ecore_X_XRegion *r2)
{
if (!r1 || !r2)
- return 0;
+ return 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return XEqualRegion((Region)r1, (Region)r1);
-}
+} /* ecore_x_xregion_is_equal */
EAPI int
ecore_x_xregion_point_contain(Ecore_X_XRegion *region, int x, int y)
{
if (!region)
- return 0;
+ return 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return XPointInRegion((Region)region, x, y);
-}
+} /* ecore_x_xregion_point_contain */
EAPI int
ecore_x_xregion_rect_contain(Ecore_X_XRegion *region, Ecore_X_Rectangle *rect)
{
if (!region || !rect)
- return 0;
+ return 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- return XRectInRegion((Region)region, rect->x, rect->y, rect->width, rect->height);
-}
+ return XRectInRegion((Region)region,
+ rect->x,
+ rect->y,
+ rect->width,
+ rect->height);
+} /* ecore_x_xregion_rect_contain */
+
/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
-/*
* Screensaver code
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#include "Ecore.h"
#include "ecore_x_private.h"
EAPI int
ecore_x_screensaver_event_available_get(void)
{
- if (_screensaver_available >= 0) return _screensaver_available;
+ if (_screensaver_available >= 0)
+ return _screensaver_available;
+
#ifdef ECORE_XSS
int _screensaver_major, _screensaver_minor;
_screensaver_major = 1;
_screensaver_minor = 0;
- if (XScreenSaverQueryVersion(_ecore_x_disp, &_screensaver_major, &_screensaver_minor))
- _screensaver_available = 1;
+ if (XScreenSaverQueryVersion(_ecore_x_disp, &_screensaver_major,
+ &_screensaver_minor))
+ _screensaver_available = 1;
else
- _screensaver_available = 0;
-#else
+ _screensaver_available = 0;
+
+#else /* ifdef ECORE_XSS */
_screensaver_available = 0;
-#endif
+#endif /* ifdef ECORE_XSS */
return _screensaver_available;
-}
+} /* ecore_x_screensaver_event_available_get */
EAPI int
ecore_x_screensaver_idle_time_get(void)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
xss = XScreenSaverAllocInfo();
- XScreenSaverQueryInfo(_ecore_x_disp, RootWindow(_ecore_x_disp, DefaultScreen(_ecore_x_disp)), xss);
+ XScreenSaverQueryInfo(_ecore_x_disp,
+ RootWindow(_ecore_x_disp, DefaultScreen(
+ _ecore_x_disp)), xss);
idle = xss->idle / 1000;
XFree(xss);
return idle;
-#endif
+#endif /* ifdef ECORE_XSS */
return 0;
-}
+} /* ecore_x_screensaver_idle_time_get */
EAPI void
-ecore_x_screensaver_set(int timeout, int interval, int prefer_blanking, int allow_exposures)
+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);
-}
+ XSetScreenSaver(_ecore_x_disp,
+ timeout,
+ interval,
+ prefer_blanking,
+ allow_exposures);
+} /* ecore_x_screensaver_set */
EAPI void
ecore_x_screensaver_timeout_set(int timeout)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo);
XSetScreenSaver(_ecore_x_disp, timeout, pint, pblank, pexpo);
-}
+} /* ecore_x_screensaver_timeout_set */
EAPI int
ecore_x_screensaver_timeout_get(void)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo);
return pto;
-}
+} /* ecore_x_screensaver_timeout_get */
EAPI void
ecore_x_screensaver_blank_set(int blank)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo);
XSetScreenSaver(_ecore_x_disp, pto, pint, blank, pexpo);
-}
+} /* ecore_x_screensaver_blank_set */
EAPI int
ecore_x_screensaver_blank_get(void)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo);
return pblank;
-}
+} /* ecore_x_screensaver_blank_get */
EAPI void
ecore_x_screensaver_expose_set(int expose)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo);
XSetScreenSaver(_ecore_x_disp, pto, pint, pblank, expose);
-}
+} /* ecore_x_screensaver_expose_set */
EAPI int
ecore_x_screensaver_expose_get(void)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo);
return pexpo;
-}
+} /* ecore_x_screensaver_expose_get */
EAPI void
ecore_x_screensaver_interval_set(int interval)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo);
XSetScreenSaver(_ecore_x_disp, pto, interval, pblank, pexpo);
-}
+} /* ecore_x_screensaver_interval_set */
EAPI int
ecore_x_screensaver_interval_get(void)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo);
return pint;
-}
+} /* ecore_x_screensaver_interval_get */
EAPI void
ecore_x_screensaver_event_listen_set(int on)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
root = DefaultRootWindow(_ecore_x_disp);
if (on)
- XScreenSaverSelectInput(_ecore_x_disp, root, ScreenSaverNotifyMask);
+ XScreenSaverSelectInput(_ecore_x_disp, root, ScreenSaverNotifyMask);
else
- XScreenSaverSelectInput(_ecore_x_disp, root, 0);
-#endif
-}
+ XScreenSaverSelectInput(_ecore_x_disp, root, 0);
+#endif /* ifdef ECORE_XSS */
+} /* ecore_x_screensaver_event_listen_set */
+
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#include <stdlib.h>
#include <string.h>
static Ecore_X_Selection_Converter *converters = NULL;
static Ecore_X_Selection_Parser *parsers = NULL;
-static int _ecore_x_selection_converter_text(char *target, void *data, int size, void **data_ret, int *size_ret);
-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);
+static int _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))
memset(selections, 0, sizeof(selections));
/* Initialize converters */
- ecore_x_selection_converter_atom_add(ECORE_X_ATOM_TEXT,
- _ecore_x_selection_converter_text);
+ ecore_x_selection_converter_atom_add(ECORE_X_ATOM_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
+ 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_text);
ecore_x_selection_converter_atom_add(ECORE_X_ATOM_STRING,
- _ecore_x_selection_converter_text);
+ _ecore_x_selection_converter_text);
/* Initialize parsers */
ecore_x_selection_parser_add("text/plain",
- _ecore_x_selection_parser_text);
+ _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_text);
ecore_x_selection_parser_add("text/uri-list",
- _ecore_x_selection_parser_files);
+ _ecore_x_selection_parser_files);
ecore_x_selection_parser_add("_NETSCAPE_URL",
- _ecore_x_selection_parser_files);
+ _ecore_x_selection_parser_files);
ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_TARGETS,
- _ecore_x_selection_parser_targets);
-}
+ _ecore_x_selection_parser_targets);
+} /* _ecore_x_selection_data_init */
void
_ecore_x_selection_shutdown(void)
cnv = converters;
while (cnv)
{
- Ecore_X_Selection_Converter *tmp;
+ Ecore_X_Selection_Converter *tmp;
- tmp = cnv->next;
- free(cnv);
- cnv = tmp;
+ tmp = cnv->next;
+ free(cnv);
+ cnv = tmp;
}
converters = NULL;
prs = parsers;
while (prs)
{
- Ecore_X_Selection_Parser *tmp;
+ Ecore_X_Selection_Parser *tmp;
- tmp = prs;
- prs = prs->next;
- free(tmp->target);
- free(tmp);
+ tmp = prs;
+ prs = prs->next;
+ free(tmp->target);
+ free(tmp);
}
parsers = NULL;
-}
+} /* _ecore_x_selection_shutdown */
Ecore_X_Selection_Intern *
_ecore_x_selection_get(Ecore_X_Atom selection)
{
if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
- return &selections[0];
+ return &selections[0];
else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
- return &selections[1];
+ return &selections[1];
else if (selection == ECORE_X_ATOM_SELECTION_XDND)
- return &selections[2];
+ return &selections[2];
else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
- return &selections[3];
+ return &selections[3];
else
- return NULL;
-}
+ return NULL;
+} /* _ecore_x_selection_get */
-int
-_ecore_x_selection_set(Window w, const void *data, int size, Ecore_X_Atom selection)
+int
+_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 0;
-
+ return 0;
+
if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
- in = 0;
+ in = 0;
else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
- in = 1;
+ in = 1;
else if (selection == ECORE_X_ATOM_SELECTION_XDND)
- in = 2;
+ in = 2;
else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
- in = 3;
+ in = 3;
else
- return 0;
+ return 0;
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);
- memcpy(buf, data, size);
- selections[in].data = buf;
+ selections[in].win = w;
+ selections[in].selection = selection;
+ selections[in].length = size;
+ selections[in].time = _ecore_x_event_last_time;
+
+ buf = malloc(size);
+ memcpy(buf, data, size);
+ selections[in].data = buf;
}
- else
+ else if (selections[in].data)
{
- if (selections[in].data)
- {
- free(selections[in].data);
- memset(&selections[in], 0, sizeof(Ecore_X_Selection_Data));
- }
+ free(selections[in].data);
+ memset(&selections[in], 0, sizeof(Ecore_X_Selection_Data));
}
return 1;
-}
+} /* _ecore_x_selection_set */
/**
* 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
+ * @return Returns 1 if the ownership of the selection was successfully
* claimed, or 0 if unsuccessful.
*/
-EAPI int
+EAPI int
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);
-}
+} /* ecore_x_selection_primary_set */
/**
* Release ownership of the primary selection
* or 0 if unsuccessful.
*
*/
-EAPI int
+EAPI int
ecore_x_selection_primary_clear(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return _ecore_x_selection_set(None, NULL, 0, ECORE_X_ATOM_SELECTION_PRIMARY);
-}
+} /* ecore_x_selection_primary_clear */
/**
* Claim ownership of the SECONDARY selection and set its data.
* @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
+ * @return Returns 1 if the ownership of the selection was successfully
* claimed, or 0 if unsuccessful.
*/
-EAPI int
+EAPI int
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);
-}
+ return _ecore_x_selection_set(w,
+ data,
+ size,
+ ECORE_X_ATOM_SELECTION_SECONDARY);
+} /* ecore_x_selection_secondary_set */
/**
* Release ownership of the secondary selection
* or 0 if unsuccessful.
*
*/
-EAPI int
+EAPI int
ecore_x_selection_secondary_clear(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- return _ecore_x_selection_set(None, NULL, 0, ECORE_X_ATOM_SELECTION_SECONDARY);
-}
+ return _ecore_x_selection_set(None,
+ NULL,
+ 0,
+ ECORE_X_ATOM_SELECTION_SECONDARY);
+} /* ecore_x_selection_secondary_clear */
/**
* 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
+ * @return Returns 1 if the ownership of the selection was successfully
* claimed, or 0 if unsuccessful.
*/
-EAPI int
+EAPI int
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);
-}
+} /* ecore_x_selection_xdnd_set */
/**
* Release ownership of the XDND selection
* or 0 if unsuccessful.
*
*/
-EAPI int
+EAPI int
ecore_x_selection_xdnd_clear(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return _ecore_x_selection_set(None, NULL, 0, ECORE_X_ATOM_SELECTION_XDND);
-}
+} /* ecore_x_selection_xdnd_clear */
/**
* Claim ownership of the CLIPBOARD selection and set its data.
* @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
+ * @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 int
+EAPI int
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);
-}
+ return _ecore_x_selection_set(w,
+ data,
+ size,
+ ECORE_X_ATOM_SELECTION_CLIPBOARD);
+} /* ecore_x_selection_clipboard_set */
/**
* Release ownership of the clipboard selection
* or 0 if unsuccessful.
*
*/
-EAPI int
+EAPI int
ecore_x_selection_clipboard_clear(void)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- return _ecore_x_selection_set(None, NULL, 0, ECORE_X_ATOM_SELECTION_CLIPBOARD);
-}
+ return _ecore_x_selection_set(None,
+ NULL,
+ 0,
+ ECORE_X_ATOM_SELECTION_CLIPBOARD);
+} /* ecore_x_selection_clipboard_clear */
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;
+ x_target = ECORE_X_ATOM_TEXT;
else if (!strcmp(target, ECORE_X_SELECTION_TARGET_COMPOUND_TEXT))
- x_target = ECORE_X_ATOM_COMPOUND_TEXT;
+ x_target = ECORE_X_ATOM_COMPOUND_TEXT;
else if (!strcmp(target, ECORE_X_SELECTION_TARGET_STRING))
- x_target = ECORE_X_ATOM_STRING;
+ x_target = ECORE_X_ATOM_STRING;
else if (!strcmp(target, ECORE_X_SELECTION_TARGET_UTF8_STRING))
- x_target = ECORE_X_ATOM_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;
+ x_target = ECORE_X_ATOM_FILE_NAME;
else
- {
- x_target = ecore_x_atom_get(target);
- }
+ x_target = ecore_x_atom_get(target);
return x_target;
-}
+} /* _ecore_x_selection_target_atom_get */
char *
_ecore_x_selection_target_get(Ecore_X_Atom target)
/* FIXME: Should not return mem allocated with strdup or X mixed,
* one should use free to free, the other XFree */
if (target == ECORE_X_ATOM_FILE_NAME)
- return strdup(ECORE_X_SELECTION_TARGET_FILENAME);
+ return strdup(ECORE_X_SELECTION_TARGET_FILENAME);
else if (target == ECORE_X_ATOM_STRING)
- return strdup(ECORE_X_SELECTION_TARGET_STRING);
+ return strdup(ECORE_X_SELECTION_TARGET_STRING);
else if (target == ECORE_X_ATOM_UTF8_STRING)
- return strdup(ECORE_X_SELECTION_TARGET_UTF8_STRING);
+ return strdup(ECORE_X_SELECTION_TARGET_UTF8_STRING);
else if (target == ECORE_X_ATOM_TEXT)
- return strdup(ECORE_X_SELECTION_TARGET_TEXT);
+ return strdup(ECORE_X_SELECTION_TARGET_TEXT);
else
- return XGetAtomName(_ecore_x_disp, target);
-}
+ return XGetAtomName(_ecore_x_disp, target);
+} /* _ecore_x_selection_target_get */
-static void
-_ecore_x_selection_request(Ecore_X_Window w, Ecore_X_Atom selection, const char *target_str)
+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;
+ prop = ECORE_X_ATOM_SELECTION_PROP_PRIMARY;
else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
- prop = ECORE_X_ATOM_SELECTION_PROP_SECONDARY;
+ prop = ECORE_X_ATOM_SELECTION_PROP_SECONDARY;
else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
- prop = ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD;
+ prop = ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD;
else
- return;
+ return;
XConvertSelection(_ecore_x_disp, selection, target, prop,
- w, CurrentTime);
-}
+ w, CurrentTime);
+} /* _ecore_x_selection_request */
-EAPI void
+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);
-}
+} /* ecore_x_selection_primary_request */
-EAPI void
+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);
-}
+} /* ecore_x_selection_secondary_request */
-EAPI void
+EAPI void
ecore_x_selection_xdnd_request(Ecore_X_Window w, const char *target)
{
Ecore_X_Atom atom;
_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);
-}
+ ECORE_X_ATOM_SELECTION_PROP_XDND, w,
+ _target->time);
+} /* ecore_x_selection_xdnd_request */
-EAPI void
+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);
-}
+} /* ecore_x_selection_clipboard_request */
EAPI void
-ecore_x_selection_converter_atom_add(Ecore_X_Atom target,
- int (*func)(char *target, void *data, int size, void **data_ret, int *size_ret))
+ecore_x_selection_converter_atom_add(Ecore_X_Atom target,
+ int (*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)
+ 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));
- cnv = cnv->next;
+ 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));
+ cnv = cnv->next;
}
else
{
- converters = calloc(1, sizeof(Ecore_X_Selection_Converter));
- cnv = converters;
+ converters = calloc(1, sizeof(Ecore_X_Selection_Converter));
+ cnv = converters;
}
+
cnv->target = target;
cnv->convert = func;
-}
+} /* ecore_x_selection_converter_atom_add */
EAPI void
-ecore_x_selection_converter_add(char *target,
- int (*func)(char *target, void *data, int size, void **data_ret, int *size_ret))
+ecore_x_selection_converter_add(char *target,
+ int (*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;
+ return;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
x_target = _ecore_x_selection_target_atom_get(target);
ecore_x_selection_converter_atom_add(x_target, func);
-}
+} /* ecore_x_selection_converter_add */
EAPI void
ecore_x_selection_converter_atom_del(Ecore_X_Atom target)
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;
+ 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;
}
-}
+} /* ecore_x_selection_converter_atom_del */
EAPI void
ecore_x_selection_converter_del(char *target)
Ecore_X_Atom x_target;
if (!target)
- return;
+ return;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
x_target = _ecore_x_selection_target_atom_get(target);
ecore_x_selection_converter_atom_del(x_target);
-}
+} /* ecore_x_selection_converter_del */
EAPI int
-ecore_x_selection_notify_send(Ecore_X_Window requestor, Ecore_X_Atom selection, Ecore_X_Atom target, Ecore_X_Atom property, Ecore_X_Time time)
+ecore_x_selection_notify_send(Ecore_X_Window requestor,
+ Ecore_X_Atom selection,
+ Ecore_X_Atom target,
+ Ecore_X_Atom property,
+ Ecore_X_Time time)
{
- XEvent xev;
+ XEvent xev;
XSelectionEvent xnotify;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
xev.xselection = xnotify;
return ((XSendEvent(_ecore_x_disp, requestor, False, 0, &xev) > 0) ? 1 : 0);
-}
+} /* ecore_x_selection_notify_send */
/* Locate and run conversion callback for specified selection target */
EAPI int
-ecore_x_selection_convert(Ecore_X_Atom selection, Ecore_X_Atom target, void **data_ret)
+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;
- int size;
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);
- free(tgt_str);
- if (r)
- {
- *data_ret = data;
- return r;
- }
- else
- return 0;
- }
+ 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 0;
+ }
}
/* 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 0;
+ return 0;
- /* Default, just return the data
- *data_ret = malloc(sel->length);
- memcpy(*data_ret, sel->data, sel->length);
- free(tgt_str);
- return 1;
- */
-}
+ /* Default, just return the data
+ *data_ret = malloc(sel->length);
+ memcpy(*data_ret, sel->data, sel->length);
+ free(tgt_str);
+ return 1;
+ */
+} /* ecore_x_selection_convert */
/* TODO: We need to work out a mechanism for automatic conversion to any requested
* locale using Ecore_Txt functions */
/* Converter for standard non-utf8 text targets */
static int
-_ecore_x_selection_converter_text(char *target, void *data, int size, void **data_ret, int *size_ret)
+_ecore_x_selection_converter_text(char *target,
+ void *data,
+ int size,
+ void **data_ret,
+ int *size_ret,
+ Ecore_X_Atom *targprop __UNUSED__,
+ int *s __UNUSED__)
{
XTextProperty text_prop;
char *mystr;
XICCEncodingStyle style;
if (!data || !size)
- return 0;
+ return 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!strcmp(target, ECORE_X_SELECTION_TARGET_TEXT))
- style = XTextStyle;
+ style = XTextStyle;
else if (!strcmp(target, ECORE_X_SELECTION_TARGET_COMPOUND_TEXT))
- style = XCompoundTextStyle;
+ style = XCompoundTextStyle;
else if (!strcmp(target, ECORE_X_SELECTION_TARGET_STRING))
- style = XStringStyle;
+ style = XStringStyle;
+
#ifdef X_HAVE_UTF8_STRING
else if (!strcmp(target, ECORE_X_SELECTION_TARGET_UTF8_STRING))
- style = XUTF8StringStyle;
-#endif
+ style = XUTF8StringStyle;
+#endif /* ifdef X_HAVE_UTF8_STRING */
else
- return 0;
-
+ return 0;
if (!(mystr = strdup(data)))
- return 0;
+ return 0;
#ifdef X_HAVE_UTF8_STRING
- if (Xutf8TextListToTextProperty(_ecore_x_disp, &mystr, 1, style, &text_prop) == Success)
+ if (Xutf8TextListToTextProperty(_ecore_x_disp, &mystr, 1, style,
+ &text_prop) == Success)
{
- int bufsize = strlen((char *)text_prop.value) + 1;
- *data_ret = malloc(bufsize);
- memcpy(*data_ret, text_prop.value, bufsize);
- *size_ret = bufsize;
- XFree(text_prop.value);
- free(mystr);
- return 1;
+ int bufsize = strlen((char *)text_prop.value) + 1;
+ *data_ret = malloc(bufsize);
+ memcpy(*data_ret, text_prop.value, bufsize);
+ *size_ret = bufsize;
+ XFree(text_prop.value);
+ free(mystr);
+ return 1;
}
-#else
- if (XmbTextListToTextProperty(_ecore_x_disp, &mystr, 1, style, &text_prop) == Success)
+
+#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);
- memcpy(*data_ret, text_prop.value, bufsize);
- *size_ret = bufsize;
- XFree(text_prop.value);
- free(mystr);
- return 1;
+ int bufsize = strlen(text_prop.value) + 1;
+ *data_ret = malloc(bufsize);
+ memcpy(*data_ret, text_prop.value, bufsize);
+ *size_ret = bufsize;
+ XFree(text_prop.value);
+ free(mystr);
+ return 1;
}
-#endif
+
+#endif /* ifdef X_HAVE_UTF8_STRING */
else
{
- free(mystr);
- return 0;
+ free(mystr);
+ return 0;
}
-}
+} /* _ecore_x_selection_converter_text */
EAPI void
ecore_x_selection_parser_add(const char *target,
- void *(*func)(const char *target, void *data, int size, int format))
+ void *(*func)(const char *target, void *data,
+ int size,
+ int format))
{
Ecore_X_Selection_Parser *prs;
if (!target)
- return;
+ return;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
prs = parsers;
- if (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));
- prs = prs->next;
+ while (prs->next)
+ {
+ if (!strcmp(prs->target, target))
+ {
+ prs->parse = func;
+ return;
+ }
+
+ prs = prs->next;
+ }
+
+ prs->next = calloc(1, sizeof(Ecore_X_Selection_Parser));
+ prs = prs->next;
}
else
{
- parsers = calloc(1, sizeof(Ecore_X_Selection_Parser));
- prs = parsers;
+ parsers = calloc(1, sizeof(Ecore_X_Selection_Parser));
+ prs = parsers;
}
+
prs->target = strdup(target);
prs->parse = func;
-}
+} /* ecore_x_selection_parser_add */
EAPI void
ecore_x_selection_parser_del(const char *target)
Ecore_X_Selection_Parser *prs, *prev_prs;
if (!target)
- return;
+ return;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
prev_prs = NULL;
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;
+ 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;
}
-}
+} /* ecore_x_selection_parser_del */
/* Locate and run conversion callback for specified selection target */
void *
{
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);
- return sel;
- }
+ if (!strcmp(prs->target, target))
+ {
+ sel = prs->parse(target, data, size, format);
+ return sel;
+ }
}
/* Default, just return the data */
sel->format = format;
sel->data = data;
return sel;
-}
+} /* _ecore_x_selection_parse */
static int
_ecore_x_selection_data_default_free(void *data)
free(sel->data);
free(sel);
return 1;
-}
+} /* _ecore_x_selection_data_default_free */
static void *
-_ecore_x_selection_parser_files(const char *target, void *_data, int size, int format __UNUSED__)
+_ecore_x_selection_parser_files(const char *target,
+ void *_data,
+ int size,
+ int format __UNUSED__)
{
Ecore_X_Selection_Data_Files *sel;
char *data = _data;
if (strcmp(target, "text/uri-list") &&
strcmp(target, "_NETSCAPE_URL"))
- return NULL;
+ return NULL;
sel = calloc(1, sizeof(Ecore_X_Selection_Data_Files));
ECORE_X_SELECTION_DATA(sel)->free = _ecore_x_selection_data_files_free;
if (data[size - 1])
{
- /* Isn't nul terminated */
- size++;
- data = realloc(data, size);
- data[size - 1] = 0;
+ /* Isn't nul terminated */
+ size++;
+ data = realloc(data, size);
+ data[size - 1] = 0;
}
tmp = malloc(size);
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++;
- sel->files = realloc(sel->files, sel->num_files * sizeof(char *));
- sel->files[sel->num_files - 1] = strdup(tmp);
- tmp[0] = 0;
- i = 0;
- }
- }
+ 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++;
+ sel->files =
+ realloc(sel->files, sel->num_files * sizeof(char *));
+ sel->files[sel->num_files - 1] = strdup(tmp);
+ tmp[0] = 0;
+ i = 0;
+ }
+ }
}
if (i > 0)
{
- tmp[i] = 0;
- sel->num_files++;
- sel->files = realloc(sel->files, sel->num_files * sizeof(char *));
- sel->files[sel->num_files - 1] = strdup(tmp);
+ tmp[i] = 0;
+ sel->num_files++;
+ sel->files = realloc(sel->files, sel->num_files * sizeof(char *));
+ sel->files[sel->num_files - 1] = strdup(tmp);
}
+
free(tmp);
free(data);
ECORE_X_SELECTION_DATA(sel)->length = sel->num_files;
return ECORE_X_SELECTION_DATA(sel);
-}
+} /* _ecore_x_selection_parser_files */
static int
_ecore_x_selection_data_files_free(void *data)
sel = data;
if (sel->files)
{
- for (i = 0; i < sel->num_files; i++)
- free(sel->files[i]);
- free(sel->files);
+ for (i = 0; i < sel->num_files; i++)
+ free(sel->files[i]);
+ free(sel->files);
}
+
free(sel);
return 0;
-}
+} /* _ecore_x_selection_data_files_free */
static void *
-_ecore_x_selection_parser_text(const char *target __UNUSED__, void *_data, int size, int format __UNUSED__)
+_ecore_x_selection_parser_text(const char *target __UNUSED__,
+ void *_data,
+ int size,
+ int format __UNUSED__)
{
Ecore_X_Selection_Data_Text *sel;
char *data = _data;
if (data[size - 1])
{
- /* Isn't nul terminated */
- size++;
- data = realloc(data, size);
- data[size - 1] = 0;
+ /* Isn't nul terminated */
+ size++;
+ data = realloc(data, size);
+ data[size - 1] = 0;
}
sel->text = (char *)data;
ECORE_X_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_TEXT;
ECORE_X_SELECTION_DATA(sel)->free = _ecore_x_selection_data_text_free;
return sel;
-}
+} /* _ecore_x_selection_parser_text */
static int
_ecore_x_selection_data_text_free(void *data)
free(sel->text);
free(sel);
return 1;
-}
+} /* _ecore_x_selection_data_text_free */
static void *
-_ecore_x_selection_parser_targets(const char *target __UNUSED__, void *data, int size, int format __UNUSED__)
+_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;
sel->num_targets = size - 2;
sel->targets = malloc((size - 2) * sizeof(char *));
for (i = 2; i < size; i++)
- sel->targets[i - 2] = XGetAtomName(_ecore_x_disp, targets[i]);
- free(data);
+ 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;
-}
+} /* _ecore_x_selection_parser_targets */
static int
_ecore_x_selection_data_targets_free(void *data)
if (sel->targets)
{
- for (i = 0; i < sel->num_targets; i++)
- XFree(sel->targets[i]);
- free(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;
-}
+} /* _ecore_x_selection_data_targets_free */
+
/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
-/*
* XSync code
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#include "Ecore.h"
#include "ecore_x_private.h"
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);
+ XSyncIntToValue(&values.delta, 1);
values.events = True;
alarm = XSyncCreateAlarm(_ecore_x_disp,
- XSyncCACounter |
- XSyncCAValueType |
- XSyncCAValue |
- XSyncCATestType |
- XSyncCADelta |
- XSyncCAEvents,
- &values);
+ XSyncCACounter |
+ XSyncCAValueType |
+ XSyncCAValue |
+ XSyncCATestType |
+ XSyncCADelta |
+ XSyncCAEvents,
+ &values);
ecore_x_sync();
return alarm;
-}
+} /* ecore_x_sync_alarm_new */
EAPI int
ecore_x_sync_alarm_free(Ecore_X_Sync_Alarm alarm)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return XSyncDestroyAlarm(_ecore_x_disp, alarm);
-}
+} /* ecore_x_sync_alarm_free */
EAPI int
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);
+ *val = (unsigned int)XSyncValueLow32(value);
return 1;
}
-
+
return 0;
-}
+} /* ecore_x_sync_counter_query */
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;
-}
+} /* ecore_x_sync_counter_new */
EAPI void
ecore_x_sync_counter_free(Ecore_X_Sync_Counter counter)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XSyncDestroyCounter(_ecore_x_disp, counter);
-}
+} /* ecore_x_sync_counter_free */
EAPI void
ecore_x_sync_counter_inc(Ecore_X_Sync_Counter counter, int by)
{
XSyncValue v;
-
+
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XSyncIntToValue(&v, by);
XSyncChangeCounter(_ecore_x_disp, counter, v);
-}
+} /* ecore_x_sync_counter_inc */
EAPI void
ecore_x_sync_counter_val_wait(Ecore_X_Sync_Counter counter, int val)
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XSyncQueryCounter(_ecore_x_disp, counter, &v);
- XSyncIntToValue(&v, val);
+ XSyncIntToValue(&v, val);
XSyncIntToValue(&v2, val + 1);
cond.trigger.counter = counter;
cond.trigger.value_type = XSyncAbsolute;
cond.event_threshold = v2;
XSyncAwait(_ecore_x_disp, &cond, 1);
// XSync(_ecore_x_disp, False); // dont need this
-}
+} /* ecore_x_sync_counter_val_wait */
+
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#include <stdlib.h>
#ifdef ECORE_XTEST
# include <X11/extensions/XTest.h>
-#endif
+#endif /* ifdef ECORE_XTEST */
#include "ecore_x_private.h"
#include "Ecore_X.h"
#include <string.h>
-
EAPI int
ecore_x_test_fake_key_down(const char *key)
{
#ifdef ECORE_XTEST
- KeyCode keycode = 0;
- KeySym keysym;
-
+ KeyCode keycode = 0;
+ KeySym keysym;
+
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!strncmp(key, "Keycode-", 8))
- keycode = atoi(key + 8);
+ keycode = atoi(key + 8);
else
{
- keysym = XStringToKeysym(key);
- if (keysym == NoSymbol) return 0;
- keycode = XKeysymToKeycode(_ecore_x_disp, keysym);
+ keysym = XStringToKeysym(key);
+ if (keysym == NoSymbol)
+ return 0;
+
+ keycode = XKeysymToKeycode(_ecore_x_disp, keysym);
}
- if (keycode == 0) return 0;
+
+ if (keycode == 0)
+ return 0;
+
return XTestFakeKeyEvent(_ecore_x_disp, keycode, 1, 0);
-#else
+#else /* ifdef ECORE_XTEST */
return 0;
-#endif
-}
+#endif /* ifdef ECORE_XTEST */
+} /* ecore_x_test_fake_key_down */
EAPI int
ecore_x_test_fake_key_up(const char *key)
{
#ifdef ECORE_XTEST
- KeyCode keycode = 0;
- KeySym keysym;
-
+ KeyCode keycode = 0;
+ KeySym keysym;
+
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!strncmp(key, "Keycode-", 8))
- keycode = atoi(key + 8);
+ keycode = atoi(key + 8);
else
{
- keysym = XStringToKeysym(key);
- if (keysym == NoSymbol) return 0;
- keycode = XKeysymToKeycode(_ecore_x_disp, keysym);
+ keysym = XStringToKeysym(key);
+ if (keysym == NoSymbol)
+ return 0;
+
+ keycode = XKeysymToKeycode(_ecore_x_disp, keysym);
}
- if (keycode == 0) return 0;
+
+ if (keycode == 0)
+ return 0;
+
return XTestFakeKeyEvent(_ecore_x_disp, keycode, 0, 0);
-#else
+#else /* ifdef ECORE_XTEST */
return 0;
-#endif
-}
+#endif /* ifdef ECORE_XTEST */
+} /* ecore_x_test_fake_key_up */
EAPI int
ecore_x_test_fake_key_press(const char *key)
{
#ifdef ECORE_XTEST
- KeyCode keycode = 0;
- KeySym keysym = 0;
- int shift = 0;
-
+ KeyCode keycode = 0;
+ KeySym keysym = 0;
+ int shift = 0;
+
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!strncmp(key, "Keycode-", 8))
- keycode = atoi(key + 8);
+ keycode = atoi(key + 8);
else
{
- keysym = XStringToKeysym(key);
- if (keysym == NoSymbol) return 0;
- 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;
+ keysym = XStringToKeysym(key);
+ if (keysym == NoSymbol)
+ return 0;
+
+ 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;
+ 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,
+ 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);
+ XTestFakeKeyEvent(_ecore_x_disp,
+ XKeysymToKeycode(_ecore_x_disp, XK_Shift_L), 0, 0);
+
return 1;
-#else
+#else /* ifdef ECORE_XTEST */
return 0;
-#endif
-}
+#endif /* ifdef ECORE_XTEST */
+} /* ecore_x_test_fake_key_press */
EAPI const char *
ecore_x_keysym_string_get(int keysym)
{
return XKeysymToString(keysym);
-}
+} /* ecore_x_keysym_string_get */
+
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#include <stdlib.h>
#include <sys/types.h>
#include "Ecore_X.h"
#include "Ecore_X_Atoms.h"
-static int ignore_num = 0;
+static int ignore_num = 0;
static Ecore_X_Window *ignore_list = NULL;
/**
EAPI Ecore_X_Window
ecore_x_window_new(Ecore_X_Window parent, int x, int y, int w, int h)
{
- Window win;
+ 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;
+ 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;
+ 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 |
+ 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);
+ CWBorderPixel |
+ CWBackPixmap |
+ CWSaveUnder |
+ CWDontPropagate |
+ CWEventMask |
+ CWBitGravity |
+ CWWinGravity,
+ &attr);
+
+ if (parent == DefaultRootWindow(_ecore_x_disp))
+ ecore_x_window_defaults_set(win);
+
return win;
-}
+} /* ecore_x_window_new */
/**
* Creates a window with the override redirect attribute set to @c True.
EAPI Ecore_X_Window
ecore_x_window_override_new(Ecore_X_Window parent, int x, int y, int w, int h)
{
- Window win;
+ 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;
+ 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;
+ 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 |
+ 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);
+ CWBorderPixel |
+ CWBackPixmap |
+ CWSaveUnder |
+ CWDontPropagate |
+ CWEventMask |
+ CWBitGravity |
+ CWWinGravity,
+ &attr);
return win;
-}
+} /* ecore_x_window_override_new */
/**
* Creates a new input window.
EAPI Ecore_X_Window
ecore_x_window_input_new(Ecore_X_Window parent, int x, int y, int w, int h)
{
- Window win;
+ Window win;
XSetWindowAttributes attr;
-
+
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (parent == 0) parent = DefaultRootWindow(_ecore_x_disp);
- attr.override_redirect = True;
+ 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;
+ 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);
+ 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;
-}
+} /* ecore_x_window_input_new */
/**
* @defgroup Ecore_X_Window_Properties_Group X Window Property Functions
/* 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); */
+ (char *)buf); */
if (XStringListToTextProperty(hostname, 1, &xprop))
{
- XSetWMClientMachine(_ecore_x_disp, win, &xprop);
- XFree(xprop.value);
+ XSetWMClientMachine(_ecore_x_disp, win, &xprop);
+ XFree(xprop.value);
}
/*
ecore_app_args_get(&argc, &argv);
ecore_x_icccm_command_set(win, argc, argv);
-}
+} /* ecore_x_window_defaults_set */
EAPI void
ecore_x_window_configure(Ecore_X_Window win,
{
XWindowChanges xwc;
- if (!win) return;
-
+ if (!win)
+ return;
+
LOGFN(__FILE__, __LINE__, __FUNCTION__);
xwc.x = x;
xwc.stack_mode = stack_mode;
XConfigureWindow(_ecore_x_disp, win, mask, &xwc);
-}
+} /* ecore_x_window_configure */
/**
* @defgroup Ecore_X_Window_Destroy_Group X Window Destroy Functions
* a smart idea.
*/
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (win) XDestroyWindow(_ecore_x_disp, win);
-}
+ if (win)
+ XDestroyWindow(_ecore_x_disp, win);
+} /* ecore_x_window_free */
/**
* Set if a window should be ignored.
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (ignore)
{
- if (ignore_list)
- {
- for (i = 0; i < ignore_num; i++)
- {
- if (win == ignore_list[i])
- return;
- }
- ignore_list = realloc(ignore_list, (ignore_num + 1) * sizeof(Ecore_X_Window));
- if (!ignore_list) return;
- ignore_list[ignore_num++] = win;
- }
- else
- {
- ignore_num = 0;
- ignore_list = malloc(sizeof(Ecore_X_Window));
- ignore_list[ignore_num++] = win;
- }
+ if (ignore_list)
+ {
+ for (i = 0; i < ignore_num; i++)
+ {
+ if (win == ignore_list[i])
+ return;
+ }
+ ignore_list =
+ realloc(ignore_list, (ignore_num + 1) * sizeof(Ecore_X_Window));
+ if (!ignore_list)
+ return;
+
+ ignore_list[ignore_num++] = win;
+ }
+ else
+ {
+ ignore_num = 0;
+ ignore_list = malloc(sizeof(Ecore_X_Window));
+ ignore_list[ignore_num++] = win;
+ }
}
else
{
- if (!ignore_list) return;
- for (i = 0, j = 0; i < ignore_num; i++)
- {
- if (win != ignore_list[i])
- ignore_list[i] = ignore_list[j++];
- else
- ignore_num--;
- }
- ignore_list = realloc(ignore_list, ignore_num * sizeof(Ecore_X_Window));
+ if (!ignore_list)
+ return;
+
+ for (i = 0, j = 0; i < ignore_num; i++)
+ {
+ if (win != ignore_list[i])
+ ignore_list[i] = ignore_list[j++];
+ else
+ ignore_num--;
+ }
+ ignore_list = realloc(ignore_list, ignore_num * sizeof(Ecore_X_Window));
}
-}
+} /* ecore_x_window_ignore_set */
/**
* Get the ignore list
EAPI Ecore_X_Window *
ecore_x_window_ignore_list(int *num)
{
- if (num) *num = ignore_num;
+ if (num)
+ *num = ignore_num;
+
return ignore_list;
-}
+} /* ecore_x_window_ignore_list */
/**
* Sends a delete request to the given window.
/* sorry sir, deleting the root window doesn't sound like
* a smart idea.
*/
- if (!win) return;
+ if (!win)
+ return;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
xev.xclient.type = ClientMessage;
xev.xclient.data.l[1] = CurrentTime;
XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev);
-}
+} /* ecore_x_window_delete_request_send */
/**
* @defgroup Ecore_X_Window_Visibility_Group X Window Visibility Functions
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XMapWindow(_ecore_x_disp, win);
-}
+} /* ecore_x_window_show */
/**
* Hides a window.
LOGFN(__FILE__, __LINE__, __FUNCTION__);
root = win;
if (ScreenCount(_ecore_x_disp) == 1)
- root = DefaultRootWindow(_ecore_x_disp);
+ root = DefaultRootWindow(_ecore_x_disp);
else
- XGetGeometry(_ecore_x_disp, win, &root, &idum, &idum, &uidum, &uidum, &uidum, &uidum);
+ 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.window = win;
xev.xunmap.from_configure = False;
XSendEvent(_ecore_x_disp, xev.xunmap.event, False,
- SubstructureRedirectMask | SubstructureNotifyMask, &xev);
+ SubstructureRedirectMask | SubstructureNotifyMask, &xev);
XUnmapWindow(_ecore_x_disp, win);
-}
+} /* ecore_x_window_hide */
/**
* @defgroup Ecore_X_Window_Geometry_Group X Window Geometry Functions
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XMoveWindow(_ecore_x_disp, win, x, y);
-}
+} /* ecore_x_window_move */
/**
* Resizes a window.
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;
+ if (w < 1)
+ w = 1;
+
+ if (h < 1)
+ h = 1;
+
XResizeWindow(_ecore_x_disp, win, w, h);
-}
+} /* ecore_x_window_resize */
/**
* Moves and resizes a window.
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;
+ if (w < 1)
+ w = 1;
+
+ if (h < 1)
+ h = 1;
+
XMoveResizeWindow(_ecore_x_disp, win, x, y, w, h);
-}
+} /* ecore_x_window_move_resize */
/**
* @defgroup Ecore_X_Window_Focus_Functions X Window Focus Functions
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);
+ 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);
-}
+} /* ecore_x_window_focus */
/**
* Sets the focus to the given window at a specific time.
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);
+ 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);
-}
+} /* ecore_x_window_focus_at_time */
/**
* gets the focus to the window @p win.
{
Window win;
int revert_mode;
-
+
LOGFN(__FILE__, __LINE__, __FUNCTION__);
win = 0;
XGetInputFocus(_ecore_x_disp, &win, &revert_mode);
return win;
-}
+} /* ecore_x_window_focus_get */
/**
* @defgroup Ecore_X_Window_Z_Order_Group X Window Z Order Functions
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XRaiseWindow(_ecore_x_disp, win);
-}
+} /* ecore_x_window_raise */
/**
* Lowers the given window.
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XLowerWindow(_ecore_x_disp, win);
-}
+} /* ecore_x_window_lower */
/**
* @defgroup Ecore_X_Window_Parent_Group X Window Parent Functions
* @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)
+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);
+ if (new_parent == 0)
+ new_parent = DefaultRootWindow(_ecore_x_disp);
+
XReparentWindow(_ecore_x_disp, win, new_parent, x, y);
-}
+} /* ecore_x_window_reparent */
/**
* Retrieves the size of the given window.
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);
+ if (win == 0)
+ win = DefaultRootWindow(_ecore_x_disp);
+
ecore_x_drawable_geometry_get(win, &dummy_x, &dummy_y, w, h);
-}
+} /* ecore_x_window_size_get */
/**
* Retrieves the geometry of the given window.
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);
+ if (!win)
+ win = DefaultRootWindow(_ecore_x_disp);
+
ecore_x_drawable_geometry_get(win, x, y, w, h);
-}
+} /* ecore_x_window_geometry_get */
/**
* Retrieves the width of the border of the given window.
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
/* doesn't make sense to call this on a root window */
- if (!win) return 0;
+ if (!win)
+ return 0;
+
return ecore_x_drawable_border_width_get(win);
-}
+} /* ecore_x_window_border_width_get */
/**
* Sets the width of the border of the given window.
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
/* doesn't make sense to call this on a root window */
- if (!win) return;
+ if (!win)
+ return;
+
XSetWindowBorderWidth (_ecore_x_disp, win, width);
-}
+} /* ecore_x_window_border_width_set */
/**
* Retrieves the depth of the given window.
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return ecore_x_drawable_depth_get(win);
-}
-
+} /* ecore_x_window_depth_get */
+
/**
* To be documented.
*
ecore_x_window_cursor_show(Ecore_X_Window win, int show)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (win == 0) win = DefaultRootWindow(_ecore_x_disp);
+ 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);
+ 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);
- }
-}
+ XDefineCursor(_ecore_x_disp, win, 0);
+} /* ecore_x_window_cursor_show */
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);
+ XUndefineCursor(_ecore_x_disp, win);
else
- XDefineCursor(_ecore_x_disp, win, c);
-}
+ XDefineCursor(_ecore_x_disp, win, c);
+} /* ecore_x_window_cursor_set */
/**
* Finds out whether the given window is currently visible.
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return (XGetWindowAttributes(_ecore_x_disp, win, &attr) &&
(attr.map_state == IsViewable));
-}
-
+} /* ecore_x_window_visible_get */
-
-typedef struct _Shadow Shadow;
+typedef struct _Shadow Shadow;
struct _Shadow
{
- Shadow *parent;
- Shadow **children;
- Window win;
- int children_num;
- short x, y;
- unsigned short w, h;
+ Shadow *parent;
+ Shadow **children;
+ Window win;
+ int children_num;
+ short x, y;
+ unsigned short w, h;
};
static Shadow **shadow_base = NULL;
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;
+ 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;
-
+ 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;
+ 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))
+ &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;
- }
- }
+ 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);
+
+ if (list)
+ XFree(list);
+
return s;
-}
+} /* _ecore_x_window_tree_walk */
static void
_ecore_x_window_tree_shadow_free1(Shadow *s)
{
int i;
- if (!s) return;
+ 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);
+ 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);
-}
+} /* _ecore_x_window_tree_shadow_free1 */
static void
_ecore_x_window_tree_shadow_free(void)
{
int i;
-
- if (!shadow_base) return;
+
+ 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]);
+ if (!shadow_base[i])
+ continue;
+
+ _ecore_x_window_tree_shadow_free1(shadow_base[i]);
}
free(shadow_base);
shadow_base = NULL;
shadow_num = 0;
-}
+} /* _ecore_x_window_tree_shadow_free */
static void
_ecore_x_window_tree_shadow_populate(void)
{
- Ecore_X_Window *roots;
- int i, num;
-
+ 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);
+ 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);
}
-}
+} /* _ecore_x_window_tree_shadow_populate */
/*
-static int shadow_count = 0;
+ static int shadow_count = 0;
-static void
-_ecore_x_window_tree_shadow_start(void)
-{
+ 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)
-{
+ 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->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;
- }
- }
+ 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;
-}
+} /* _ecore_x_window_shadow_tree_find_shadow */
static Shadow *
_ecore_x_window_shadow_tree_find(Window base)
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;
+ if (!shadow_base[i])
+ continue;
+
+ if ((s = _ecore_x_window_shadow_tree_find_shadow(shadow_base[i], base)))
+ return s;
}
return NULL;
-}
+} /* _ecore_x_window_shadow_tree_find */
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)
+_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;
+ 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;
- }
- }
- }
+ 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;
-}
+} /* _ecore_x_window_shadow_tree_at_xy_get_shadow */
static Window
_ecore_x_window_shadow_tree_at_xy_get(Window base, int bx, int by, int x, int y,
- Ecore_X_Window *skip, int skip_num)
+ Ecore_X_Window *skip, int skip_num)
{
Shadow *s;
-
+
if (!shadow_base)
{
- _ecore_x_window_tree_shadow_populate();
- if (!shadow_base) return 0;
+ _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);
-}
+ if (!s)
+ return 0;
+
+ return _ecore_x_window_shadow_tree_at_xy_get_shadow(s,
+ bx,
+ by,
+ x,
+ y,
+ skip,
+ skip_num);
+} /* _ecore_x_window_shadow_tree_at_xy_get */
/**
* Retrieves the top, visible window at the given location,
* @ingroup Ecore_X_Window_Geometry_Group
*/
EAPI Ecore_X_Window
-ecore_x_window_shadow_tree_at_xy_with_skip_get(Ecore_X_Window base, int x, int y, Ecore_X_Window *skip, int skip_num)
+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);
-}
+ return _ecore_x_window_shadow_tree_at_xy_get(base,
+ 0,
+ 0,
+ x,
+ y,
+ skip,
+ skip_num);
+} /* ecore_x_window_shadow_tree_at_xy_with_skip_get */
/**
* Retrieves the parent window a given window has. This uses the shadow window
* @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)
+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;
+ _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;
- }
+ 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;
-}
+} /* ecore_x_window_shadow_parent_get */
/**
* Flushes the window shadow tree so nothing is stored.
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
_ecore_x_window_tree_shadow_free();
-}
+} /* ecore_x_window_shadow_tree_flush */
/**
* Retrieves the root window a given window is on.
XWindowAttributes att;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!XGetWindowAttributes(_ecore_x_disp, win, &att)) return 0;
+ if (!XGetWindowAttributes(_ecore_x_disp, win, &att))
+ return 0;
+
return att.root;
-}
+} /* ecore_x_window_root_get */
static Window
_ecore_x_window_at_xy_get(Window base, int bx, int by, int x, int y,
- Ecore_X_Window *skip, int skip_num)
+ 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;
+ 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;
+ return 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_geometry_get(base, &wx, &wy, &ww, &wh);
wy += by;
if (!((x >= wx) && (y >= wy) && (x < (wx + ww)) && (y < (wy + wh))))
- return 0;
+ return 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!XQueryTree(_ecore_x_disp, base, &root_win, &parent_win, &list, &num))
- return base;
+ 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);
+ 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;
-}
+} /* _ecore_x_window_at_xy_get */
/**
* Retrieves the top, visible window at the given location.
EAPI Ecore_X_Window
ecore_x_window_at_xy_get(int x, int y)
{
- Ecore_X_Window win, root;
-
+ 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;
-}
+} /* ecore_x_window_at_xy_get */
/**
* Retrieves the top, visible window at the given location,
* @ingroup Ecore_X_Window_Geometry_Group
*/
EAPI Ecore_X_Window
-ecore_x_window_at_xy_with_skip_get(int x, int y, Ecore_X_Window *skip, int skip_num)
+ecore_x_window_at_xy_with_skip_get(int x,
+ int y,
+ Ecore_X_Window *skip,
+ int skip_num)
{
- Ecore_X_Window win, root;
-
+ 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;
-}
+} /* ecore_x_window_at_xy_with_skip_get */
EAPI Ecore_X_Window
ecore_x_window_at_xy_begin_get(Ecore_X_Window begin, int x, int y)
{
- Ecore_X_Window win;
-
+ 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;
-}
+} /* ecore_x_window_at_xy_begin_get */
/**
* Retrieves the parent window of the given window.
EAPI Ecore_X_Window
ecore_x_window_parent_get(Ecore_X_Window win)
{
- Window root, parent, *children = NULL;
- unsigned int num;
+ 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;
-}
+} /* ecore_x_window_parent_get */
/**
* Sets the background color of the given window.
*/
EAPI void
ecore_x_window_background_color_set(Ecore_X_Window win, unsigned short r,
- unsigned short g, unsigned short b)
+ unsigned short g, unsigned short b)
{
XSetWindowAttributes attr;
Colormap map;
attr.background_pixel = col.pixel;
XChangeWindowAttributes(_ecore_x_disp, win, CWBackPixel, &attr);
-}
+} /* ecore_x_window_background_color_set */
EAPI void
ecore_x_window_gravity_set(Ecore_X_Window win, Ecore_X_Gravity grav)
{
XSetWindowAttributes att;
-
+
LOGFN(__FILE__, __LINE__, __FUNCTION__);
att.win_gravity = grav;
XChangeWindowAttributes(_ecore_x_disp, win, CWWinGravity, &att);
-}
+} /* ecore_x_window_gravity_set */
EAPI void
ecore_x_window_pixel_gravity_set(Ecore_X_Window win, Ecore_X_Gravity grav)
{
XSetWindowAttributes att;
-
+
LOGFN(__FILE__, __LINE__, __FUNCTION__);
att.bit_gravity = grav;
XChangeWindowAttributes(_ecore_x_disp, win, CWBitGravity, &att);
-}
+} /* ecore_x_window_pixel_gravity_set */
EAPI void
ecore_x_window_pixmap_set(Ecore_X_Window win, Ecore_X_Pixmap pmap)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XSetWindowBackgroundPixmap(_ecore_x_disp, win, pmap);
-}
+} /* ecore_x_window_pixmap_set */
EAPI void
ecore_x_window_area_clear(Ecore_X_Window win, int x, int y, int w, int h)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XClearArea(_ecore_x_disp, win, x, y, w, h, False);
-}
+} /* ecore_x_window_area_clear */
EAPI void
ecore_x_window_area_expose(Ecore_X_Window win, int x, int y, int w, int h)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XClearArea(_ecore_x_disp, win, x, y, w, h, True);
-}
+} /* ecore_x_window_area_expose */
EAPI void
ecore_x_window_override_set(Ecore_X_Window win, int override)
{
XSetWindowAttributes att;
-
+
LOGFN(__FILE__, __LINE__, __FUNCTION__);
att.override_redirect = override;
XChangeWindowAttributes(_ecore_x_disp, win, CWOverrideRedirect, &att);
-}
+} /* ecore_x_window_override_set */
-#ifdef ECORE_XRENDER
+#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, int override, int saveunder)
+_ecore_x_window_argb_internal_new(Ecore_X_Window parent,
+ int x,
+ int y,
+ int w,
+ int h,
+ int override,
+ int saveunder)
{
- Window win;
- XSetWindowAttributes attr;
- XWindowAttributes att;
- XVisualInfo *xvi;
- XVisualInfo vi_in;
- int nvi, i, scr = 0;
- XRenderPictFormat *fmt;
- Visual *vis;
-
+ 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);
+ 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;
- }
- }
+ /* 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 == NULL) return 0;
+ VisualScreenMask |
+ VisualDepthMask |
+ VisualClassMask,
+ &vi_in,
+ &nvi);
+ if (xvi == NULL)
+ 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;
- }
+ 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.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;
+ 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);
+ 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);
+ if (parent == DefaultRootWindow(_ecore_x_disp))
+ ecore_x_window_defaults_set(win);
+
return win;
-}
-#endif
+} /* _ecore_x_window_argb_internal_new */
+
+#endif /* ifdef ECORE_XRENDER */
EAPI int
ecore_x_window_argb_get(Ecore_X_Window win)
{
-#ifdef ECORE_XRENDER
+#ifdef ECORE_XRENDER
XWindowAttributes att;
XRenderPictFormat *fmt;
att.visual = 0;
- if (!XGetWindowAttributes(_ecore_x_disp, win, &att)) return 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;
+ if (!fmt)
+ return 0;
+
+ if ((fmt->type == PictTypeDirect) && (fmt->direct.alphaMask))
+ return 1;
+
return 0;
-#else
+#else /* ifdef ECORE_XRENDER */
return 0;
-#endif
-}
+#endif /* ifdef ECORE_XRENDER */
+} /* ecore_x_window_argb_get */
/**
* Creates a new window.
* @ingroup Ecore_X_Window_Create_Group
*/
EAPI Ecore_X_Window
-ecore_x_window_manager_argb_new(Ecore_X_Window parent, int x, int y, int w, int h)
+ecore_x_window_manager_argb_new(Ecore_X_Window parent,
+ int x,
+ int y,
+ int w,
+ int h)
{
-#ifdef ECORE_XRENDER
+#ifdef ECORE_XRENDER
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return _ecore_x_window_argb_internal_new(parent, x, y, w, h, 1, 0);
-#else
+#else /* ifdef ECORE_XRENDER */
return 0;
-#endif
-}
+#endif /* ifdef ECORE_XRENDER */
+} /* ecore_x_window_manager_argb_new */
/**
* Creates a new window.
EAPI Ecore_X_Window
ecore_x_window_argb_new(Ecore_X_Window parent, int x, int y, int w, int h)
{
-#ifdef ECORE_XRENDER
+#ifdef ECORE_XRENDER
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return _ecore_x_window_argb_internal_new(parent, x, y, w, h, 0, 0);
-#else
+#else /* ifdef ECORE_XRENDER */
return 0;
-#endif
-}
+#endif /* ifdef ECORE_XRENDER */
+} /* ecore_x_window_argb_new */
/**
* Creates a window with the override redirect attribute set to @c True.
* @ingroup Ecore_X_Window_Create_Group
*/
EAPI Ecore_X_Window
-ecore_x_window_override_argb_new(Ecore_X_Window parent, int x, int y, int w, int h)
+ecore_x_window_override_argb_new(Ecore_X_Window parent,
+ int x,
+ int y,
+ int w,
+ int h)
{
-#ifdef ECORE_XRENDER
+#ifdef ECORE_XRENDER
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return _ecore_x_window_argb_internal_new(parent, x, y, w, h, 1, 0);
-#else
+#else /* ifdef ECORE_XRENDER */
return 0;
-#endif
-}
+#endif /* ifdef ECORE_XRENDER */
+} /* ecore_x_window_override_argb_new */
+
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include <limits.h>
-#define _ATOM_SET_CARD32(win, atom, p_val, cnt) \
- XChangeProperty(_ecore_x_disp, win, atom, XA_CARDINAL, 32, PropModeReplace, \
+#define _ATOM_SET_CARD32(win, atom, p_val, cnt)\
+ XChangeProperty(_ecore_x_disp, win, atom, XA_CARDINAL, 32, PropModeReplace,\
(unsigned char *)p_val, cnt)
/*
*/
EAPI void
ecore_x_window_prop_card32_set(Ecore_X_Window win, Ecore_X_Atom atom,
- unsigned int *val, unsigned int num)
+ unsigned int *val, unsigned int num)
{
#if SIZEOF_INT == SIZEOF_LONG
_ATOM_SET_CARD32(win, atom, val, num);
-#else
- long *v2;
- unsigned int i;
+#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
-}
+#endif /* if SIZEOF_INT == SIZEOF_LONG */
+} /* ecore_x_window_prop_card32_set */
/*
* Get CARD32 (array) property
*/
EAPI int
ecore_x_window_prop_card32_get(Ecore_X_Window win, Ecore_X_Atom atom,
- unsigned int *val, unsigned int len)
+ 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;
+ 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)
+ 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;
- }
+ num = -1;
else if (num_ret == 0 || !prop_ret)
- {
- num = 0;
- }
+ 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 (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;
-}
+} /* ecore_x_window_prop_card32_get */
/*
* Get CARD32 (array) property of any length
*/
EAPI int
ecore_x_window_prop_card32_list_get(Ecore_X_Window win, Ecore_X_Atom atom,
- unsigned int **plst)
+ 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;
+ 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)
+ 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;
- }
+ num = -1;
else if (num_ret == 0 || !prop_ret)
- {
- num = 0;
- }
+ num = 0;
else
{
- val = malloc(num_ret * sizeof(unsigned int));
- for (i = 0; i < num_ret; i++)
- val[i] = ((unsigned long *)prop_ret)[i];
- num = num_ret;
- *plst = val;
+ val = malloc(num_ret * sizeof(unsigned int));
+ 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;
-}
+} /* ecore_x_window_prop_card32_list_get */
/*
* Set X ID (array) property
*/
EAPI void
ecore_x_window_prop_xid_set(Ecore_X_Window win, Ecore_X_Atom atom,
- Ecore_X_Atom type, Ecore_X_ID * lst,
- unsigned int num)
+ Ecore_X_Atom 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
- unsigned long *pl;
- unsigned int i;
+ (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);
+ (unsigned char *)pl, num);
free(pl);
-#endif
-}
+#endif /* if SIZEOF_INT == SIZEOF_LONG */
+} /* ecore_x_window_prop_xid_set */
/*
* Get X ID (array) property
*/
EAPI int
ecore_x_window_prop_xid_get(Ecore_X_Window win, Ecore_X_Atom atom,
- Ecore_X_Atom type, Ecore_X_ID * lst,
- unsigned int len)
+ Ecore_X_Atom 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;
+ 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)
+ type, &type_ret, &format_ret, &num_ret,
+ &bytes_after, &prop_ret) != Success)
return -1;
if (type_ret != type || format_ret != 32)
- {
- num = -1;
- }
+ num = -1;
else if (num_ret == 0 || !prop_ret)
- {
- num = 0;
- }
+ 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 (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;
-}
+} /* ecore_x_window_prop_xid_get */
/*
* Get X ID (array) property
*/
EAPI int
ecore_x_window_prop_xid_list_get(Ecore_X_Window win, Ecore_X_Atom atom,
- Ecore_X_Atom type, Ecore_X_ID ** val)
+ Ecore_X_Atom 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;
+ 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)
+ type, &type_ret, &format_ret, &num_ret,
+ &bytes_after, &prop_ret) != Success)
return -1;
if (type_ret != type || format_ret != 32)
- {
- num = -1;
- }
+ num = -1;
else if (num_ret == 0 || !prop_ret)
- {
- num = 0;
- }
+ 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;
+ 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;
-}
+} /* ecore_x_window_prop_xid_list_get */
/*
* Remove/add/toggle X ID list item.
*/
EAPI void
ecore_x_window_prop_xid_list_change(Ecore_X_Window win, Ecore_X_Atom atom,
- Ecore_X_Atom type, Ecore_X_ID item, int op)
+ Ecore_X_Atom type, Ecore_X_ID item, int op)
{
- Ecore_X_ID *lst;
- int i, num;
+ 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 */
+ {
+ return; /* Error - assuming invalid window */
+ }
/* Is it there? */
for (i = 0; i < num; i++)
{
- if (lst[i] == item)
- break;
+ 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];
+ /* 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;
+ /* 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:
+done:
if (lst)
free(lst);
-}
+} /* ecore_x_window_prop_xid_list_change */
/*
* Set Atom (array) property
*/
EAPI void
ecore_x_window_prop_atom_set(Ecore_X_Window win, Ecore_X_Atom atom,
- Ecore_X_Atom * lst, unsigned int num)
+ Ecore_X_Atom *lst, unsigned int num)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_xid_set(win, atom, XA_ATOM, lst, num);
-}
+} /* ecore_x_window_prop_atom_set */
/*
* Get Atom (array) property
*/
EAPI int
ecore_x_window_prop_atom_get(Ecore_X_Window win, Ecore_X_Atom atom,
- Ecore_X_Atom * lst, unsigned int len)
+ Ecore_X_Atom *lst, unsigned int len)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return ecore_x_window_prop_xid_get(win, atom, XA_ATOM, lst, len);
-}
+} /* ecore_x_window_prop_atom_get */
/*
* Get Atom (array) property
*/
EAPI int
ecore_x_window_prop_atom_list_get(Ecore_X_Window win, Ecore_X_Atom atom,
- Ecore_X_Atom ** plst)
+ Ecore_X_Atom **plst)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return ecore_x_window_prop_xid_list_get(win, atom, XA_ATOM, plst);
-}
+} /* ecore_x_window_prop_atom_list_get */
/*
* Remove/add/toggle atom list item.
*/
EAPI void
ecore_x_window_prop_atom_list_change(Ecore_X_Window win, Ecore_X_Atom atom,
- Ecore_X_Atom item, int op)
+ Ecore_X_Atom item, int op)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_xid_list_change(win, atom, XA_ATOM, item, op);
-}
+} /* ecore_x_window_prop_atom_list_change */
/*
* Set Window (array) property
*/
EAPI void
ecore_x_window_prop_window_set(Ecore_X_Window win, Ecore_X_Atom atom,
- Ecore_X_Window * lst, unsigned int num)
+ Ecore_X_Window *lst, unsigned int num)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
ecore_x_window_prop_xid_set(win, atom, XA_WINDOW, lst, num);
-}
+} /* ecore_x_window_prop_window_set */
/*
* Get Window (array) property
*/
EAPI int
ecore_x_window_prop_window_get(Ecore_X_Window win, Ecore_X_Atom atom,
- Ecore_X_Window * lst, unsigned int len)
+ Ecore_X_Window *lst, unsigned int len)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return ecore_x_window_prop_xid_get(win, atom, XA_WINDOW, lst, len);
-}
+} /* ecore_x_window_prop_window_get */
/*
* Get Window (array) property
*/
EAPI int
ecore_x_window_prop_window_list_get(Ecore_X_Window win, Ecore_X_Atom atom,
- Ecore_X_Window ** plst)
+ Ecore_X_Window **plst)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return ecore_x_window_prop_xid_list_get(win, atom, XA_WINDOW, plst);
-}
+} /* ecore_x_window_prop_window_list_get */
/**
* To be documented.
ecore_x_window_prop_any_type(void)
{
return AnyPropertyType;
-}
+} /* ecore_x_window_prop_any_type */
/**
* To be documented.
* 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)
+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 (win == 0)
+ win = DefaultRootWindow(_ecore_x_disp);
+
if (size != 32)
- XChangeProperty(_ecore_x_disp, win, property, type, size, PropModeReplace,
- (unsigned char *)data, number);
+ 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);
- }
+ 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);
+ }
}
-}
+} /* ecore_x_window_prop_property_set */
/**
* To be documented.
* FIXME: To be fixed.
*/
EAPI int
-ecore_x_window_prop_property_get(Ecore_X_Window win, Ecore_X_Atom property, Ecore_X_Atom type, int size __UNUSED__, unsigned char **data, int *num)
+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 char *prop_ret = NULL;
/* make sure these are initialized */
- if (num) *num = 0;
+ if (num)
+ *num = 0;
if (data)
- *data = NULL;
+ *data = NULL;
else /* we can't store the retrieved data, so just return */
- return 0;
+ return 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!win) win = DefaultRootWindow(_ecore_x_disp);
+ 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;
- }
-
+
+ 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;
+ 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;
+ 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;
- }
+ for (i = 0; i < num_ret; i++)
+ ((unsigned int *)*data)[i] = ((unsigned long *)prop_ret)[i];
+ break;
+ } /* switch */
XFree(prop_ret);
- if (num) *num = num_ret;
+ if (num)
+ *num = num_ret;
+
return size_ret;
-}
+} /* ecore_x_window_prop_property_get */
EAPI void
ecore_x_window_prop_property_del(Ecore_X_Window win, Ecore_X_Atom property)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XDeleteProperty(_ecore_x_disp, win, property);
-}
+} /* ecore_x_window_prop_property_del */
EAPI Ecore_X_Atom *
ecore_x_window_prop_list(Ecore_X_Window win, int *num_ret)
Ecore_X_Atom *atoms;
Atom *atom_ret;
int num = 0, i;
-
+
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (num_ret) *num_ret = 0;
+ if (num_ret)
+ *num_ret = 0;
atom_ret = XListProperties(_ecore_x_disp, win, &num);
- if (!atom_ret) return NULL;
+ 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;
+ for (i = 0; i < num; i++) atoms[i] = atom_ret[i];
+ if (num_ret)
+ *num_ret = num;
}
+
XFree(atom_ret);
return atoms;
-}
+} /* ecore_x_window_prop_list */
/**
* Set a window string property.
* @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)
+ecore_x_window_prop_string_set(Ecore_X_Window win,
+ Ecore_X_Atom type,
+ const char *str)
{
- XTextProperty xtp;
+ XTextProperty xtp;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (win == 0) win = DefaultRootWindow(_ecore_x_disp);
+ 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);
-}
+} /* ecore_x_window_prop_string_set */
/**
* 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;
+ XTextProperty xtp;
+ char *str = NULL;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (win == 0) win = DefaultRootWindow(_ecore_x_disp);
+ 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
- {
+ 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
- s = XmbTextPropertyToTextList(_ecore_x_disp, &xtp,
- &list, &items);
-#endif
- 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);
+ 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;
-}
+} /* ecore_x_window_prop_string_get */
EAPI int
-ecore_x_window_prop_protocol_isset(Ecore_X_Window win,
+ecore_x_window_prop_protocol_isset(Ecore_X_Window win,
Ecore_X_WM_Protocol protocol)
{
Atom proto, *protos = NULL;
/* check for invalid values */
if (protocol >= ECORE_X_WM_PROTOCOL_NUM)
- return 0;
+ return 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
proto = _ecore_x_atoms_wm_protocols[protocol];
if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count))
- return ret;
+ return ret;
for (i = 0; i < protos_count; i++)
- if (protos[i] == proto)
- {
- ret = 1;
- break;
- }
+ if (protos[i] == proto)
+ {
+ ret = 1;
+ break;
+ }
XFree(protos);
return ret;
-}
+} /* ecore_x_window_prop_protocol_isset */
/**
* To be documented.
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;
+ return NULL;
+
+ if ((!protos) || (protos_count <= 0))
+ 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;
+ 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;
- }
+ 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;
-}
+} /* ecore_x_window_prop_protocol_list_get */
+
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#include <stdlib.h>
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XShapeCombineMask(_ecore_x_disp, win, ShapeBounding, 0, 0, mask, ShapeSet);
-}
+} /* ecore_x_window_shape_mask_set */
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);
-}
+ XShapeCombineShape(_ecore_x_disp,
+ win,
+ ShapeBounding,
+ 0,
+ 0,
+ shape_win,
+ ShapeBounding,
+ ShapeSet);
+} /* ecore_x_window_shape_window_set */
EAPI void
-ecore_x_window_shape_window_set_xy(Ecore_X_Window win, Ecore_X_Window shape_win, int x, int y)
+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);
-}
+ XShapeCombineShape(_ecore_x_disp,
+ win,
+ ShapeBounding,
+ x,
+ y,
+ shape_win,
+ ShapeBounding,
+ ShapeSet);
+} /* ecore_x_window_shape_window_set_xy */
EAPI void
-ecore_x_window_shape_rectangle_set(Ecore_X_Window win, int x, int y, int w, int h)
+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);
-}
+ XShapeCombineRectangles(_ecore_x_disp,
+ win,
+ ShapeBounding,
+ 0,
+ 0,
+ &rect,
+ 1,
+ ShapeSet,
+ Unsorted);
+} /* ecore_x_window_shape_rectangle_set */
EAPI void
-ecore_x_window_shape_rectangles_set(Ecore_X_Window win, Ecore_X_Rectangle *rects, int num)
+ecore_x_window_shape_rectangles_set(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)
- {
- 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;
- }
- }
- else
- num = 0;
+ rect = malloc(sizeof(XRectangle) * num);
+ if (rect)
+ 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;
+ }
+ else
+ num = 0;
}
- XShapeCombineRectangles(_ecore_x_disp, win, ShapeBounding, 0, 0, rect, num, ShapeSet, Unsorted);
- if (rect) free(rect);
-}
+
+ XShapeCombineRectangles(_ecore_x_disp,
+ win,
+ ShapeBounding,
+ 0,
+ 0,
+ rect,
+ num,
+ ShapeSet,
+ Unsorted);
+ if (rect)
+ free(rect);
+} /* ecore_x_window_shape_rectangles_set */
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);
-}
+ XShapeCombineShape(_ecore_x_disp,
+ win,
+ ShapeBounding,
+ 0,
+ 0,
+ shape_win,
+ ShapeBounding,
+ ShapeUnion);
+} /* ecore_x_window_shape_window_add */
EAPI void
-ecore_x_window_shape_window_add_xy(Ecore_X_Window win, Ecore_X_Window shape_win, int x, int y)
+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);
-}
+ XShapeCombineShape(_ecore_x_disp,
+ win,
+ ShapeBounding,
+ x,
+ y,
+ shape_win,
+ ShapeBounding,
+ ShapeUnion);
+} /* ecore_x_window_shape_window_add_xy */
EAPI void
-ecore_x_window_shape_rectangle_add(Ecore_X_Window win, int x, int y, int w, int h)
+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);
-}
+ XShapeCombineRectangles(_ecore_x_disp,
+ win,
+ ShapeBounding,
+ 0,
+ 0,
+ &rect,
+ 1,
+ ShapeUnion,
+ Unsorted);
+} /* ecore_x_window_shape_rectangle_add */
EAPI void
-ecore_x_window_shape_rectangle_clip(Ecore_X_Window win, int x, int y, int w, int h)
+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);
-}
+ XShapeCombineRectangles(_ecore_x_disp,
+ win,
+ ShapeBounding,
+ 0,
+ 0,
+ &rect,
+ 1,
+ ShapeIntersect,
+ Unsorted);
+} /* ecore_x_window_shape_rectangle_clip */
EAPI void
-ecore_x_window_shape_rectangles_add(Ecore_X_Window win, Ecore_X_Rectangle *rects, int num)
+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)
- {
- 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;
- }
- }
- else
- num = 0;
+ rect = malloc(sizeof(XRectangle) * num);
+ if (rect)
+ 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;
+ }
+ else
+ num = 0;
}
- XShapeCombineRectangles(_ecore_x_disp, win, ShapeBounding, 0, 0, rect, num, ShapeUnion, Unsorted);
- if (rect) free(rect);
-}
+
+ XShapeCombineRectangles(_ecore_x_disp,
+ win,
+ ShapeBounding,
+ 0,
+ 0,
+ rect,
+ num,
+ ShapeUnion,
+ Unsorted);
+ if (rect)
+ free(rect);
+} /* ecore_x_window_shape_rectangles_add */
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)
{
- rects = malloc(sizeof(Ecore_X_Rectangle) * num);
- if (rects)
- {
- 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);
+ rects = malloc(sizeof(Ecore_X_Rectangle) * num);
+ if (rects)
+ 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;
+
+ if (num_ret)
+ *num_ret = num;
+
return rects;
-}
+} /* ecore_x_window_shape_rectangles_get */
EAPI void
ecore_x_window_shape_events_select(Ecore_X_Window win, int on)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (on)
- XShapeSelectInput(_ecore_x_disp, win, ShapeNotifyMask);
+ XShapeSelectInput(_ecore_x_disp, win, ShapeNotifyMask);
else
- XShapeSelectInput(_ecore_x_disp, win, 0);
-}
+ XShapeSelectInput(_ecore_x_disp, win, 0);
+} /* ecore_x_window_shape_events_select */
/**
* Sets the input shape of the given window to that given by the pixmap @p mask.
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
#ifdef ShapeInput
- XShapeCombineMask(_ecore_x_disp, win, ShapeInput, 0, 0, mask, ShapeSet);
-#else
+ XShapeCombineMask(_ecore_x_disp, win, ShapeInput, 0, 0, mask, ShapeSet);
+#else /* ifdef ShapeInput */
XShapeCombineMask(_ecore_x_disp, win, ShapeBounding, 0, 0, mask, ShapeSet);
-#endif
-}
+#endif /* ifdef ShapeInput */
+} /* ecore_x_window_shape_input_mask_set */
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#include <string.h>
#ifdef ECORE_XI2
#include "Ecore_Input.h"
-#endif
+#endif /* ifdef ECORE_XI2 */
int _ecore_x_xi2_opcode = -1;
#ifdef ECORE_XI2
static XIDeviceInfo *_ecore_x_xi2_devs = NULL;
static int _ecore_x_xi2_num = 0;
-#endif
+#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",
+
+ 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_devs = XIQueryDevice(_ecore_x_disp, XIAllDevices,
&_ecore_x_xi2_num);
-#endif
-}
+#endif /* ifdef ECORE_XI2 */
+} /* _ecore_x_input_init */
void
_ecore_x_input_shutdown(void)
XIFreeDeviceInfo(_ecore_x_xi2_devs);
_ecore_x_xi2_devs = NULL;
}
+
_ecore_x_xi2_num = 0;
_ecore_x_xi2_opcode = -1;
-#endif
-}
+#endif /* ifdef ECORE_XI2 */
+} /* _ecore_x_input_shutdown */
void
-_ecore_x_input_handler(XEvent* xevent)
+_ecore_x_input_handler(XEvent *xevent)
{
#ifdef ECORE_XI2
XIDeviceEvent *evd = (XIDeviceEvent *)(xevent->xcookie.data);
int devid = evd->deviceid;
-
+
//printf("deviceID = %d\n", devid);
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;
- }
-#endif
-}
+ 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;
+ } /* switch */
+#endif /* ifdef ECORE_XI2 */
+} /* _ecore_x_input_handler */
EAPI Eina_Bool
ecore_x_input_multi_select(Ecore_X_Window win)
{
#ifdef ECORE_XI2
- int i, find = 0;
+ int i;
+ Eina_Bool find = EINA_FALSE;
- if (!_ecore_x_xi2_devs) return 0;
+ if (!_ecore_x_xi2_devs)
+ return 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
for (i = 0; i < _ecore_x_xi2_num; i++)
XISetMask(mask, XI_ButtonRelease);
XISetMask(mask, XI_Motion);
XISelectEvents(_ecore_x_disp, win, &eventmask, 1);
- find = 1;
+ find = EINA_TRUE;
}
}
return find;
-#else
- return 0;
-#endif
-}
+#else /* ifdef ECORE_XI2 */
+ return EINA_FALSE;
+#endif /* ifdef ECORE_XI2 */
+} /* ecore_x_input_multi_select */
+
/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
-/*
* Xinerama code
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#include "Ecore.h"
#include "ecore_x_private.h"
#ifdef ECORE_XINERAMA
static XineramaScreenInfo *_xin_info = NULL;
static int _xin_scr_num = 0;
-#endif
+#endif /* ifdef ECORE_XINERAMA */
EAPI int
ecore_x_xinerama_screen_count_get(void)
int event_base, error_base;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (_xin_info) XFree(_xin_info);
+ 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;
+ _xin_info = XineramaQueryScreens(_ecore_x_disp, &_xin_scr_num);
+ if (_xin_info)
+ return _xin_scr_num;
}
-#endif
+
+#endif /* ifdef ECORE_XINERAMA */
return 0;
-}
+} /* ecore_x_xinerama_screen_count_get */
EAPI int
ecore_x_xinerama_screen_geometry_get(int screen, int *x, int *y, int *w, int *h)
#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 1;
- }
- }
+ 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 1;
+ }
+ }
}
-#endif
- if (x) *x = 0;
- if (y) *y = 0;
- if (w) *w = DisplayWidth(_ecore_x_disp, 0);
- if (h) *h = DisplayHeight(_ecore_x_disp, 0);
+
+#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 0;
-}
+} /* ecore_x_xinerama_screen_geometry_get */
+
$(top_builddir)/src/lib/ecore/libecore.la \
$(top_builddir)/src/lib/ecore_con/libecore_con.la
+if BUILD_ECORE_X
+ecore_suite_LDADD += \
+$(top_builddir)/src/lib/ecore_x/libecore_x.la
+endif
+
endif
EXTRA_DIST = ecore_suite.h
# include <config.h>
#endif
+#include "ecore_suite.h"
+
#include <Ecore.h>
#include <Eina.h>
#include <unistd.h>
-
-#include "ecore_suite.h"
-
+#include <stdio.h>
static int _log_dom;
#define INF(...) EINA_LOG_DOM_INFO(_log_dom, __VA_ARGS__)
-static int
+static Eina_Bool
_quit_cb(void *data)
{
Eina_Bool *val = data;
*val = EINA_TRUE;
ecore_main_loop_quit();
- return 0;
+ return EINA_FALSE;
}
-static int
+static Eina_Bool
_dummy_cb(void *data)
{
- return (int)(long)data;
+ return !!data;
}
START_TEST(ecore_test_ecore_init)
}
END_TEST
-static int _timer3(void *data)
+static Eina_Bool _timer3(void *data)
{
/* timer 3, do nothing */
- return 0;
+ return EINA_FALSE;
}
-static int _timer2(void *data)
+static Eina_Bool _timer2(void *data)
{
/* timer 2, quit inner mainloop */
ecore_main_loop_quit();
- return 0;
+ return EINA_FALSE;
}
-static int _timer1(void *data)
+static Eina_Bool _timer1(void *data)
{
/* timer 1, begin inner mainloop */
int *times = data;
ecore_main_loop_quit();
- return 0;
+ return EINA_FALSE;
}
START_TEST(ecore_test_ecore_main_loop_timer_inner)
}
END_TEST
-static int
+static Eina_Bool
_fd_handler_cb(void *data, Ecore_Fd_Handler *handler __UNUSED__)
{
Eina_Bool *val = data;
*val = EINA_TRUE;
ecore_main_loop_quit();
- return 0;
+ return EINA_FALSE;
}
START_TEST(ecore_test_ecore_main_loop_fd_handler)
}
END_TEST
-static int
+static Eina_Bool
_event_handler_cb(void *data, int type __UNUSED__, void *event __UNUSED__)
{
Eina_Bool *val = data;
*val = EINA_TRUE;
ecore_main_loop_quit();
- return 0;
+ return EINA_FALSE;
}
START_TEST(ecore_test_ecore_main_loop_event)
}
END_TEST
-static int
+static Eina_Bool
_timer_quit_recursive(void *data)
{
INF(" _timer_quit_recursive: begin");
ecore_main_loop_quit(); /* quits inner main loop */
INF(" _timer_quit_recursive: end");
- return 0;
+ return EINA_FALSE;
}
-static int
+static Eina_Bool
_event_recursive_cb(void *data, int type, void *event)
{
Ecore_Event *e;
INF(" guard = %d", guard);
INF(" event_recursive_cb: end");
- return 0;
+ return EINA_FALSE;
}
}
END_TEST
+/* TODO: change to HAVE_ECORE_X when xcb implementation is done */
+#ifdef HAVE_ECORE_X_XLIB
+
+START_TEST(ecore_test_ecore_x_bell)
+{
+ int ret = 0, i;
+ ecore_x_init(NULL);
+
+ printf("You should hear 3 beeps now.\n");
+ for (i=0; i < 3; i++)
+ {
+ ret = ecore_x_bell(0);
+ fail_if(ret != EINA_TRUE);
+ ecore_x_sync();
+ sleep(1);
+ }
+ ecore_x_shutdown();
+}
+END_TEST
+
+#endif
+
void ecore_test_ecore(TCase *tc)
{
tcase_add_test(tc, ecore_test_ecore_init);
tcase_add_test(tc, ecore_test_ecore_main_loop_event);
tcase_add_test(tc, ecore_test_ecore_main_loop_timer_inner);
tcase_add_test(tc, ecore_test_ecore_main_loop_event_recursive);
+
+/* TODO: change to HAVE_ECORE_X when xcb implementation is done */
+#ifdef HAVE_ECORE_X_XLIB
+ tcase_add_test(tc, ecore_test_ecore_x_bell);
+#endif
}