Alright, I spent some time now reading e17's code. Here's what

I've changed, this is big, so read this carefully :)

* I've added debugging macros for messages and function call
tracing. Usage:

  D("Creating item %i %i %i\n", x, y, z);

Define DEBUG to use the D macro.

  D_ENTER;
  D_RETURN;
  D_RETURN_(x);

These are for call tracing. Use D_RETURN_(x) when returning
something from a function. Define DEBUG_NEST to use this.

* added iconbar header file to Makefile.am
* added proper new()/cleanup() calls for E_Delayed_Action;

* I've completely rewritten the object and observer handling. Bye
bye macros, this was nasty. It'll be hard enough to avoid leaks
with usecounting in C. We now basically have the same system as gtk.
There's a clear separation of observer and object code now.
An E_Object by itself has nothing to do with observing or being
observed, therefore, there are now E_Observers and E_Observees
that are derived from E_Object. IMPORTANT: The cleanup system now
reflects the reference count system, therefore, all ..._free()
calls are now static, because the destructor should never be called explicitly, but implicitly through e_object_unref(). The object handling
now is as follows:

  - The cleanup functions clean up everything that is contained in
a struct, but NOT the struct itself. Instead of the final
free() call, they call the destructor of the base class. The
calls will walk up the hierarchy and clean up what's contained in
every struct, and the final e_object_cleanup() will free the
structure itself. E_Delayed_Action is a good example.

  - The only calls that influence the reference count are
e_object_ref() and e_object_unref(). If you need to do things
before an object gets destroyed, you can query the use count using
e_object_get_usecount() and check if it's equal to 1. So this:

  OBJ_UNREF(b);
  OBJ_IF_FREE(b)
   {
     ecore_window_reparent(e->win, 0, 0, 0);
     e_icccm_release(e->win);
     OBJ_FREE(b);
   }

   now is this:

  if (e_object_get_usecount(E_OBJECT(b)) == 1)
    {
      ecore_window_reparent(e->win, 0, 0, 0);
      e_icccm_release(e->win);
    }

   e_object_unref(E_OBJECT(b));

object.h and observer.h are completely commented, it shouldn't be
too hard to understand. This'll need to be documented in the manual
anyway.

* E_Objects are now used in lots of places where void* were used as
pointers to objects before, especially in the actions code. This is
obviously better, as it will generate compiler warnings when people
want to pass things to functions that expect E_Objects. This could
probably be more restrictive.

* Added typedefs for the function prototypes in E_Action_Impl. Those
fat signatures were just painful to read in the function
declarations/implementations.

* I've also tried to give parameters more useful names. Calling an
object "o" is a lot of fun when you want to grep for it.

* Included is also Graham's latest menu.c patch. Sorry for the
delay, Graham.

* I've added checks to the menu code that make sure that menus
don't pop up when they're empty (which resulted in a little useless
rectangle).

I guess that's it for now. Sorry if I broke anything, but this was
necessary imho.


SVN revision: 5605
This commit is contained in:
cpk 2001-11-02 17:07:52 +00:00 committed by cpk
parent 59eda55bb7
commit 02379472ae
49 changed files with 3968 additions and 1213 deletions

View File

@ -1,48 +1,4 @@
/* config.h.in. Generated automatically from configure.in by autoheader. */
/* Define if using alloca.c. */
#undef C_ALLOCA
/* Define to empty if the keyword does not work. */
#undef const
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
This function is required for alloca.c support on those systems. */
#undef CRAY_STACKSEG_END
/* Define if you have alloca, as a function or macro. */
#undef HAVE_ALLOCA
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
#undef HAVE_ALLOCA_H
/* Define if you have a working `mmap' system call. */
#undef HAVE_MMAP
/* Define as __inline if that's what the C compiler calls it. */
#undef inline
/* Define to `long' if <sys/types.h> doesn't define. */
#undef off_t
/* Define if you need to in order for stat and other things to work. */
#undef _POSIX_SOURCE
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at run-time.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown
*/
#undef STACK_DIRECTION
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* config.h.in. Generated automatically from configure.ac by autoheader. */
#undef ENLIGHTENMENT_VERSION
#undef ENLIGHTENMENT_MAJOR
#undef ENLIGHTENMENT_MINOR
@ -60,81 +16,191 @@
#undef PACKAGE_LIB_DIR
#undef USE_FERITE
/* Define if you have the __argz_count function. */
#undef HAVE___ARGZ_COUNT
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
systems. This function is required for `alloca.c' support on those systems.
*/
#undef CRAY_STACKSEG_END
/* Define if you have the __argz_next function. */
#undef HAVE___ARGZ_NEXT
/* Define if using `alloca.c'. */
#undef C_ALLOCA
/* Define if you have the __argz_stringify function. */
#undef HAVE___ARGZ_STRINGIFY
/* Define to 1 if translation of program messages to the user's native
language is requested. */
#undef ENABLE_NLS
/* Define if you have the dcgettext function. */
#undef HAVE_DCGETTEXT
/* Define if you have `alloca', as a function or macro. */
#undef HAVE_ALLOCA
/* Define if you have the getcwd function. */
#undef HAVE_GETCWD
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
#undef HAVE_ALLOCA_H
/* Define if you have the getpagesize function. */
#undef HAVE_GETPAGESIZE
/* Define if you have the munmap function. */
#undef HAVE_MUNMAP
/* Define if you have the putenv function. */
#undef HAVE_PUTENV
/* Define if you have the setenv function. */
#undef HAVE_SETENV
/* Define if you have the setlocale function. */
#undef HAVE_SETLOCALE
/* Define if you have the stpcpy function. */
#undef HAVE_STPCPY
/* Define if you have the strcasecmp function. */
#undef HAVE_STRCASECMP
/* Define if you have the strchr function. */
#undef HAVE_STRCHR
/* Define if you have the strdup function. */
#undef HAVE_STRDUP
/* Define if you have the <argz.h> header file. */
/* Define if you have the <argz.h> header file. */
#undef HAVE_ARGZ_H
/* Define if you have the <limits.h> header file. */
/* Define if you have the `dcgettext' function. */
#undef HAVE_DCGETTEXT
/* Define if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define if you have the `feof_unlocked' function. */
#undef HAVE_FEOF_UNLOCKED
/* Define if you have the `fgets_unlocked' function. */
#undef HAVE_FGETS_UNLOCKED
/* Define if you have the `getcwd' function. */
#undef HAVE_GETCWD
/* Define if you have the `getegid' function. */
#undef HAVE_GETEGID
/* Define if you have the `geteuid' function. */
#undef HAVE_GETEUID
/* Define if you have the `getgid' function. */
#undef HAVE_GETGID
/* Define if you have the `getpagesize' function. */
#undef HAVE_GETPAGESIZE
/* Define if the GNU gettext() function is already present or preinstalled. */
#undef HAVE_GETTEXT
/* Define if you have the `getuid' function. */
#undef HAVE_GETUID
/* Define if you have the iconv() function. */
#undef HAVE_ICONV
/* Define if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
#undef HAVE_LANGINFO_CODESET
/* Define if your <locale.h> file defines LC_MESSAGES. */
#undef HAVE_LC_MESSAGES
/* Define if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define if you have the <locale.h> header file. */
/* Define if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
/* Define if you have the <malloc.h> header file. */
/* Define if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H
/* Define if you have the <nl_types.h> header file. */
/* Define if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define if you have the `mempcpy' function. */
#undef HAVE_MEMPCPY
/* Define if you have a working `mmap' system call. */
#undef HAVE_MMAP
/* Define if you have the `munmap' function. */
#undef HAVE_MUNMAP
/* Define if you have the <nl_types.h> header file. */
#undef HAVE_NL_TYPES_H
/* Define if you have the <string.h> header file. */
/* Define if you have the `putenv' function. */
#undef HAVE_PUTENV
/* Define if you have the `setenv' function. */
#undef HAVE_SETENV
/* Define if you have the `setlocale' function. */
#undef HAVE_SETLOCALE
/* Define if you have the <stddef.h> header file. */
#undef HAVE_STDDEF_H
/* Define if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define if you have the `stpcpy' function. */
#undef HAVE_STPCPY
/* Define if you have the `strcasecmp' function. */
#undef HAVE_STRCASECMP
/* Define if you have the `strchr' function. */
#undef HAVE_STRCHR
/* Define if you have the `strdup' function. */
#undef HAVE_STRDUP
/* Define if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define if you have the <sys/param.h> header file. */
/* Define if you have the `strtoul' function. */
#undef HAVE_STRTOUL
/* Define if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
/* Define if you have the <unistd.h> header file. */
/* Define if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define if you have the `tsearch' function. */
#undef HAVE_TSEARCH
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define if you have the i library (-li). */
#undef HAVE_LIBI
/* Define if you have the `__argz_count' function. */
#undef HAVE___ARGZ_COUNT
/* Define if you have the `__argz_next' function. */
#undef HAVE___ARGZ_NEXT
/* Define if you have the `__argz_stringify' function. */
#undef HAVE___ARGZ_STRINGIFY
/* Define as const if the declaration of iconv() needs const. */
#undef ICONV_CONST
/* Name of package */
#undef PACKAGE
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at run-time.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown */
#undef STACK_DIRECTION
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Version number of package */
#undef VERSION
/* Define if using the dmalloc debugging malloc package */
#undef WITH_DMALLOC
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
/* Define as `__inline' if that's what the C compiler calls it, or to nothing
if it is not supported. */
#undef inline
/* Define to `long' if <sys/types.h> does not define. */
#undef off_t
/* Define to `unsigned' if <sys/types.h> does not define. */
#undef size_t

View File

@ -5,7 +5,7 @@ BIT=$1"/.e_iconbar.bits.db"
setup ()
{
PREFIX="/usr/local"
PREFIX="/usr/local/e17"
SYSIC="/usr/share/pixmaps"
USRIC=$HOME"/stuff/icons"
NUM=0

View File

@ -133,6 +133,9 @@
!Isrc/iconbar.c
!Isrc/menu.h
!Isrc/menu.c
!Isrc/object.h
!Isrc/observer.h
!Isrc/place.h
!Isrc/view.h
</section>

View File

@ -1,3 +1,15 @@
2001-10-22 gettextize <bug-gnu-utils@gnu.org>
* Makefile.in.in: Upgrade to gettext-0.10.39.
2001-10-21 gettextize <bug-gnu-utils@gnu.org>
* Makefile.in.in: Upgrade to gettext-0.10.39.
2001-10-21 gettextize <bug-gnu-utils@gnu.org>
* Makefile.in.in: Upgrade to gettext-0.10.39.
2001-10-13 gettextize <bug-gnu-utils@gnu.org>
* Makefile.in.in: Upgrade to gettext-0.10.39.

View File

@ -1,14 +1,18 @@
# Makefile for program source directory in GNU NLS utilities package.
# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
# Copyright (C) 1995-1997, 2000, 2001 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
#
# This file file be copied and used freely without restrictions. It can
# be used in projects which are not available under the GNU Public License
# be used in projects which are not available under the GNU General Public License
# but which still want to provide support for the GNU gettext functionality.
# Please note that the actual code is *not* freely available.
PACKAGE = @PACKAGE@
VERSION = @VERSION@
# These two variables depend on the location of this directory.
subdir = po
top_builddir = ..
SHELL = /bin/sh
@SET_MAKE@
@ -18,24 +22,20 @@ VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
datadir = $(prefix)/@DATADIRNAME@
datadir = @datadir@
localedir = $(datadir)/locale
gnulocaledir = $(prefix)/share/locale
gettextsrcdir = $(prefix)/share/gettext/po
subdir = po
DESTDIR =
gettextsrcdir = $(datadir)/gettext/po
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
MKINSTALLDIRS = $(top_srcdir)/@MKINSTALLDIRS@
MKINSTALLDIRS = @MKINSTALLDIRS@
mkinstalldirs = $(SHELL) `case "$(MKINSTALLDIRS)" in /*) echo "$(MKINSTALLDIRS)" ;; *) echo "$(top_builddir)/$(MKINSTALLDIRS)" ;; esac`
CC = @CC@
GENCAT = @GENCAT@
GMSGFMT = PATH=../src:$$PATH @GMSGFMT@
GMSGFMT = @GMSGFMT@
MSGFMT = @MSGFMT@
XGETTEXT = PATH=../src:$$PATH @XGETTEXT@
MSGMERGE = PATH=../src:$$PATH msgmerge
XGETTEXT = @XGETTEXT@
MSGMERGE = msgmerge
DEFS = @DEFS@
CFLAGS = @CFLAGS@
@ -45,20 +45,17 @@ INCLUDES = -I.. -I$(top_srcdir)/intl
COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
SOURCES = cat-id-tbl.c
POFILES = @POFILES@
GMOFILES = @GMOFILES@
DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \
stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)
$(POFILES) $(GMOFILES)
POTFILES = \
CATALOGS = @CATALOGS@
CATOBJEXT = @CATOBJEXT@
INSTOBJEXT = @INSTOBJEXT@
.SUFFIXES:
.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
.SUFFIXES: .c .o .po .pox .gmo .mo
.c.o:
$(COMPILE) $<
@ -72,19 +69,19 @@ INSTOBJEXT = @INSTOBJEXT@
.po.gmo:
file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
&& rm -f $$file && $(GMSGFMT) -o $$file $<
.po.cat:
sed -f ../intl/po2msg.sed < $< > $*.msg \
&& rm -f $@ && $(GENCAT) $@ $*.msg
&& rm -f $$file && $(GMSGFMT) --statistics -o $$file $<
all: all-@USE_NLS@
all-yes: cat-id-tbl.c $(CATALOGS)
all-yes: $(CATALOGS)
all-no:
$(srcdir)/$(PACKAGE).pot: $(POTFILES)
# Note: Target 'all' must not depend on target '$(srcdir)/$(PACKAGE).pot',
# otherwise packages like GCC can not be built if only parts of the source
# have been downloaded.
$(srcdir)/$(PACKAGE).pot: $(POTFILES) $(srcdir)/POTFILES.in
$(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
--add-comments --keyword=_ --keyword=N_ \
--files-from=$(srcdir)/POTFILES.in \
@ -92,78 +89,35 @@ $(srcdir)/$(PACKAGE).pot: $(POTFILES)
|| ( rm -f $(srcdir)/$(PACKAGE).pot \
&& mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot )
$(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
$(srcdir)/stamp-cat-id: $(PACKAGE).pot
rm -f cat-id-tbl.tmp
sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \
| sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp
if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \
rm cat-id-tbl.tmp; \
else \
echo cat-id-tbl.c changed; \
rm -f $(srcdir)/cat-id-tbl.c; \
mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \
fi
cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
install: install-exec install-data
install-exec:
install-data: install-data-@USE_NLS@
install-data-no: all
install-data-yes: all
if test -r "$(MKINSTALLDIRS)"; then \
$(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
else \
$(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
fi
@catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
cat=`basename $$cat`; \
case "$$cat" in \
*.gmo) destdir=$(DESTDIR)$(gnulocaledir);; \
*) destdir=$(DESTDIR)$(localedir);; \
esac; \
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
dir=$$destdir/$$lang/LC_MESSAGES; \
if test -r "$(MKINSTALLDIRS)"; then \
$(MKINSTALLDIRS) $$dir; \
else \
$(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \
fi; \
if test -r $$cat; then \
$(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
else \
$(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
echo "installing $(srcdir)/$$cat as" \
"$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
fi; \
if test -r $$cat.m; then \
$(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
else \
if test -r $(srcdir)/$$cat.m ; then \
$(INSTALL_DATA) $(srcdir)/$$cat.m \
$$dir/$(PACKAGE)$(INSTOBJEXT).m; \
echo "installing $(srcdir)/$$cat as" \
"$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
else \
true; \
fi; \
fi; \
done
if test "$(PACKAGE)" = "gettext"; then \
if test -r "$(MKINSTALLDIRS)"; then \
$(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
else \
$(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
fi; \
$(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
$(INSTALL_DATA) $(srcdir)/Makefile.in.in \
$(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
else \
: ; \
fi
install-data-no: all
install-data-yes: all
$(mkinstalldirs) $(DESTDIR)$(datadir)
@catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
cat=`basename $$cat`; \
lang=`echo $$cat | sed 's/\.gmo$$//'`; \
dir=$(localedir)/$$lang/LC_MESSAGES; \
$(mkinstalldirs) $(DESTDIR)$$dir; \
if test -r $$cat; then \
$(INSTALL_DATA) $$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \
echo "installing $$cat as $(DESTDIR)$$dir/$(PACKAGE).mo"; \
else \
$(INSTALL_DATA) $(srcdir)/$$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \
echo "installing $(srcdir)/$$cat as" \
"$(DESTDIR)$$dir/$(PACKAGE).mo"; \
fi; \
done
# Define this as empty until I found a useful application.
installcheck:
@ -172,76 +126,68 @@ uninstall:
catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
cat=`basename $$cat`; \
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
lang=`echo $$cat | sed 's/\.gmo$$//'`; \
rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE).mo; \
done
rm -f $(DESTDIR)$(gettextsrcdir)/po-Makefile.in.in
if test "$(PACKAGE)" = "gettext"; then \
rm -f $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
else \
: ; \
fi
check: all
cat-id-tbl.o: ../intl/libgettext.h
dvi info tags TAGS ID:
mostlyclean:
rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp
rm -f core core.* *.pox $(PACKAGE).po *.new.po
rm -fr *.o
clean: mostlyclean
distclean: clean
rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
rm -f Makefile Makefile.in POTFILES *.mo
maintainer-clean: distclean
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
rm -f $(GMOFILES)
distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
dist distdir: update-po $(DISTFILES)
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
dist distdir:
$(MAKE) update-po
@$(MAKE) dist2
# This is a separate target because 'update-po' must be executed before.
dist2: $(DISTFILES)
dists="$(DISTFILES)"; \
for file in $$dists; do \
ln $(srcdir)/$$file $(distdir) 2> /dev/null \
|| cp -p $(srcdir)/$$file $(distdir); \
if test -f $$file; then dir=.; else dir=$(srcdir); fi; \
cp -p $$dir/$$file $(distdir); \
done
update-po: Makefile
$(MAKE) $(PACKAGE).pot
PATH=`pwd`/../src:$$PATH; \
if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; fi; \
cd $(srcdir); \
catalogs='$(CATALOGS)'; \
catalogs='$(GMOFILES)'; \
for cat in $$catalogs; do \
cat=`basename $$cat`; \
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
mv $$lang.po $$lang.old.po; \
lang=`echo $$cat | sed 's/\.gmo$$//'`; \
echo "$$lang:"; \
if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
rm -f $$lang.old.po; \
if $(MSGMERGE) $$lang.po $(PACKAGE).pot -o $$lang.new.po; then \
mv -f $$lang.new.po $$lang.po; \
else \
echo "msgmerge for $$cat failed!"; \
rm -f $$lang.po; \
mv $$lang.old.po $$lang.po; \
rm -f $$lang.new.po; \
fi; \
done
$(MAKE) update-gmo
POTFILES: POTFILES.in
( if test 'x$(srcdir)' != 'x.'; then \
posrcprefix='$(top_srcdir)/'; \
else \
posrcprefix="../"; \
fi; \
rm -f $@-t $@ \
&& (sed -e '/^#/d' -e '/^[ ]*$$/d' \
-e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
| sed -e '$$s/\\$$//') > $@-t \
&& chmod a-w $@-t \
&& mv $@-t $@ )
update-gmo: Makefile $(GMOFILES)
@:
Makefile: Makefile.in.in ../config.status POTFILES
cd .. \
Makefile: Makefile.in.in $(top_builddir)/config.status POTFILES.in
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
$(SHELL) ./config.status

View File

@ -2,9 +2,14 @@
DISTCLEANFILES = e_ferite_gen_*
## Enable -DDEBUG for debugging messages, -DDEBUG_NEST
## for call tracing. Caution -- this will produce a *lot*
## of output!
DEBUGFLAGS = -g -DDEBUG -DDEBUG_NEST
INCLUDES = \
-I$(top_srcdir)/intl \
@evas_cflags@ @edb_cflags@ @ebits_cflags@ @ecore_cflags@ @efsd_cflags@ @ferite_cflags@
@evas_cflags@ @edb_cflags@ @ebits_cflags@ @ecore_cflags@ @efsd_cflags@ @ferite_cflags@ $(DEBUGFLAGS)
bin_PROGRAMS = enlightenment
@ -24,6 +29,7 @@ enlightenment_SOURCES = \
border.h border.c \
config.h config.c \
cursors.c cursors.h \
debug.c debug.h \
delayed.h delayed.c \
desktops.h desktops.c \
embed.c embed.h \
@ -33,6 +39,7 @@ enlightenment_SOURCES = \
$(ferite_c) \
guides.h guides.c \
icccm.h icccm.c \
iconbar.h iconbar.c\
icons.c \
ipc.h ipc.c \
keys.h keys.c \
@ -40,6 +47,8 @@ enlightenment_SOURCES = \
match.c match.h \
menu.h menu.c \
menubuild.h menubuild.c \
object.h object.c \
observer.h observer.c\
pack.c \
place.c place.h \
resist.h resist.c \
@ -48,7 +57,6 @@ enlightenment_SOURCES = \
text.h text.c \
util.h util.c \
view.h view.c \
e.h \
iconbar.c
e.h
enlightenment_LDADD = @evas_libs@ @edb_libs@ @ebits_libs@ @ecore_libs@ @efsd_libs@ @ferite_libs@ -lm -lc $(INTLLIBS)

File diff suppressed because it is too large Load Diff

View File

@ -2,25 +2,25 @@
#define E_ACTIONS_H
#include "e.h"
#include "object.h"
typedef struct _E_Action E_Action;
typedef struct _E_Action_Impl E_Action_Impl;
typedef struct _E_Active_Action_Timer E_Active_Action_Timer;
typedef enum e_action_type
{
ACT_MOUSE_IN,
ACT_MOUSE_OUT,
ACT_MOUSE_CLICK,
ACT_MOUSE_DOUBLE,
ACT_MOUSE_TRIPLE,
ACT_MOUSE_UP,
ACT_MOUSE_CLICKED,
ACT_MOUSE_MOVE,
ACT_KEY_DOWN,
ACT_KEY_UP
}
E_Action_Type;
{
ACT_MOUSE_IN,
ACT_MOUSE_OUT,
ACT_MOUSE_CLICK,
ACT_MOUSE_DOUBLE,
ACT_MOUSE_TRIPLE,
ACT_MOUSE_UP,
ACT_MOUSE_CLICKED,
ACT_MOUSE_MOVE,
ACT_KEY_DOWN,
ACT_KEY_UP
} E_Action_Type;
struct _E_Active_Action_Timer
{
@ -30,7 +30,7 @@ struct _E_Active_Action_Timer
struct _E_Action
{
OBJ_PROPERTIES;
E_Object o;
char *name;
char *action;
@ -40,21 +40,29 @@ struct _E_Action
char *key;
int modifiers;
E_Action_Impl *action_impl;
void *object;
E_Object *object;
int started;
int grabbed;
};
typedef void (*E_Action_Start_Func)(E_Object *o, E_Action *a,
void *data, int x, int y, int rx, int ry);
typedef void (*E_Action_Cont_Func) (E_Object *o, E_Action *a,
void *data, int x, int y, int rx, int ry, int dx, int dy);
typedef void (*E_Action_Stop_Func) (E_Object *o, E_Action *a,
void *data, int x, int y, int rx, int ry);
struct _E_Action_Impl
{
OBJ_PROPERTIES;
E_Object o;
char *action;
void (*func_start) (void *o, E_Action *a, void *data, int x, int y, int rx, int ry);
void (*func_cont) (void *o, E_Action *a, void *data, int x, int y, int rx, int ry, int dx, int dy);
void (*func_stop) (void *o, E_Action *a, void *data, int x, int y, int rx, int ry);
E_Action_Start_Func func_start;
E_Action_Cont_Func func_cont;
E_Action_Stop_Func func_stop;
};
/**
* e_action_init - Actions implementation initializer
@ -65,22 +73,20 @@ struct _E_Action_Impl
void e_action_init(void);
int e_action_start(char *action, E_Action_Type act, int button, char *key,
Ecore_Event_Key_Modifiers mods, void *o, void *data,
Ecore_Event_Key_Modifiers mods, E_Object *o, void *data,
int x, int y, int rx, int ry);
void e_action_stop(char *action, E_Action_Type act, int button, char *key,
Ecore_Event_Key_Modifiers mods, void *o, void *data,
Ecore_Event_Key_Modifiers mods, E_Object *o, void *data,
int x, int y, int rx, int ry);
void e_action_cont(char *action, E_Action_Type act, int button, char *key,
Ecore_Event_Key_Modifiers mods, void *o, void *data,
Ecore_Event_Key_Modifiers mods, E_Object *o, void *data,
int x, int y, int rx, int ry, int dx, int dy);
void e_action_stop_by_object(void *o, void *data, int x, int y, int rx, int ry);
void e_action_stop_by_object(E_Object *o, void *data, int x, int y, int rx, int ry);
void e_action_stop_by_type(char *action);
void e_action_add_proto(char *action,
void (*func_start) (void *o, E_Action *a, void *data, int x, int y, int rx, int ry),
void (*func_cont) (void *o, E_Action *a, void *data, int x, int y, int rx, int ry, int dx, int dy),
void (*func_stop) (void *o, E_Action *a, void *data, int x, int y, int rx, int ry));
void e_action_del_timer(void *o, char *name);
void e_action_add_timer(void *o, char *name);
void e_action_del_timer_object(void *o);
void e_action_add_impl(char *action, E_Action_Start_Func func_start,
E_Action_Cont_Func func_cont, E_Action_Stop_Func func_stop);
void e_action_del_timer(E_Object *object, char *name);
void e_action_add_timer(E_Object *object, char *name);
void e_action_del_timer_object(E_Object *object);
#endif

View File

@ -1,12 +1,15 @@
#include "e.h"
#include "debug.h"
#include "background.h"
#include "util.h"
void
e_background_free(E_Background *bg)
static void
e_background_cleanup(E_Background *bg)
{
Evas_List l;
D_ENTER;
if (bg->layers)
{
for (l = bg->layers; l; l = l->next)
@ -23,7 +26,10 @@ e_background_free(E_Background *bg)
}
if (bg->file) FREE (bg->file);
if (bg->base_obj) evas_del_object(bg->evas, bg->base_obj);
FREE(bg);
e_object_cleanup(E_OBJECT(bg));
D_RETURN;
}
E_Background *
@ -31,11 +37,14 @@ e_background_new(void)
{
E_Background *bg;
D_ENTER;
bg = NEW(E_Background, 1);
ZERO(bg, E_Background, 1);
OBJ_INIT(bg, e_background_free);
e_object_init(E_OBJECT(bg), (E_Cleanup_Func) e_background_cleanup);
return bg;
D_RETURN_(bg);
}
E_Background *
@ -45,15 +54,17 @@ e_background_load(char *file)
E_DB_File *db;
int i, num;
D_ENTER;
db = e_db_open_read(file);
if (!db) return NULL;
if (!db) D_RETURN_(NULL);
num = 0;
e_db_int_get(db, "/type/bg", &num);
if (num != 1)
{
e_db_close(db);
e_db_flush();
return NULL;
D_RETURN_(NULL);
}
e_db_int_get(db, "/layers/count", &num);
@ -101,7 +112,7 @@ e_background_load(char *file)
sprintf(buf, "/layers/%i/bg.b", i); e_db_int_get(db, buf, &(bl->bg.b));
sprintf(buf, "/layers/%i/bg.a", i); e_db_int_get(db, buf, &(bl->bg.a));
}
return bg;
D_RETURN_(bg);
}
void
@ -110,9 +121,11 @@ e_background_realize(E_Background *bg, Evas evas)
Evas_List l;
int ww, hh, count;
if (bg->evas) return;
D_ENTER;
if (bg->evas) D_RETURN;
bg->evas = evas;
if (!bg->evas) return;
if (!bg->evas) D_RETURN;
for (count = 0, l = bg->layers; l; l = l->next, count++)
{
E_Background_Layer *bl;
@ -149,6 +162,7 @@ e_background_realize(E_Background *bg, Evas evas)
bg->geom.h = 0;
e_background_set_size(bg, ww, hh);
D_RETURN;
}
void
@ -156,10 +170,12 @@ e_background_set_scroll(E_Background *bg, int sx, int sy)
{
Evas_List l;
if ((bg->geom.sx == sx) && (bg->geom.sy == sy)) return;
D_ENTER;
if ((bg->geom.sx == sx) && (bg->geom.sy == sy)) D_RETURN;
bg->geom.sx = sx;
bg->geom.sy = sy;
if (!bg->evas) return;
if (!bg->evas) D_RETURN;
for (l = bg->layers; l; l = l->next)
{
E_Background_Layer *bl;
@ -173,6 +189,7 @@ e_background_set_scroll(E_Background *bg, int sx, int sy)
bl->fw, bl->fh);
}
}
D_RETURN;
}
void
@ -180,7 +197,9 @@ e_background_set_size(E_Background *bg, int w, int h)
{
Evas_List l;
if ((bg->geom.w == w) && (bg->geom.h == h)) return;
D_ENTER;
if ((bg->geom.w == w) && (bg->geom.h == h)) D_RETURN;
bg->geom.w = w;
bg->geom.h = h;
for (l = bg->layers; l; l = l->next)
@ -229,6 +248,7 @@ e_background_set_size(E_Background *bg, int w, int h)
}
}
}
D_RETURN;
}
void
@ -236,6 +256,8 @@ e_background_set_color_class(E_Background *bg, char *cc, int r, int g, int b, in
{
Evas_List l;
D_ENTER;
for (l = bg->layers; l; l = l->next)
{
E_Background_Layer *bl;
@ -252,4 +274,6 @@ e_background_set_color_class(E_Background *bg, char *cc, int r, int g, int b, in
}
}
}
D_RETURN;
}

View File

@ -1,6 +1,8 @@
#ifndef E_BACKGROUND_H
#define E_BACKGROUND_H
#include "object.h"
typedef struct _E_Background E_Background;
typedef struct _E_Background_Layer E_Background_Layer;
@ -14,7 +16,7 @@ E_Background_Type;
struct _E_Background
{
OBJ_PROPERTIES;
E_Object o;
Evas evas;
char *file;
@ -24,9 +26,9 @@ struct _E_Background
int w, h;
} geom;
Evas_List layers;
Evas_List layers;
Evas_Object base_obj;
Evas_Object base_obj;
};
@ -59,9 +61,9 @@ struct _E_Background_Layer
};
void e_background_free(E_Background *bg);
E_Background *e_background_new(void);
E_Background *e_background_load(char *file);
void e_background_realize(E_Background *bg, Evas evas);
void e_background_set_scroll(E_Background *bg, int sx, int sy);
void e_background_set_size(E_Background *bg, int w, int h);

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,7 @@
#define E_BORDER_H
#include "e.h"
#include "observer.h"
#ifndef E_DESKTOPS_TYPEDEF
#define E_DESKTOPS_TYPEDEF
@ -22,7 +23,7 @@ struct _E_Grab
struct _E_Border
{
OBJ_PROPERTIES;
E_Observee obs;
struct {
Window main;
@ -141,13 +142,13 @@ struct _E_Border
*/
void e_border_init(void);
E_Border *e_border_new(void);
void e_border_update_borders(void);
void e_border_apply_border(E_Border *b);
void e_border_reshape(E_Border *b);
E_Border *e_border_adopt(Window win, int use_client_pos);
void e_border_adopt_children(Window win);
E_Border *e_border_new(void);
void e_border_free(E_Border *b);
void e_border_remove_mouse_grabs(E_Border *b);
void e_border_remove_click_grab(E_Border *b);
void e_border_attach_mouse_grabs(E_Border *b);

View File

@ -1,3 +1,4 @@
#include "debug.h"
#include "config.h"
#include "util.h"
@ -7,9 +8,9 @@ static char cfg_root[] = "";
{ \
if (!strcmp(type, _key)) \
{ \
if ((_var)[0]) return (_var); \
if ((_var)[0]) D_RETURN_(_var); \
sprintf((_var), ## _args); \
return (_var); \
D_RETURN_(_var); \
} \
}
@ -32,6 +33,8 @@ static char cfg_fonts_dir[PATH_MAX] = "";
char *
e_config_get(char *type)
{
D_ENTER;
/* for now use the system defaults and not the user copied settings */
/* so if i chnage stuff i dont have to rm my personaly settings and */
/* have e re-install them. yes this is different from e16 - the */
@ -75,7 +78,8 @@ e_config_get(char *type)
PACKAGE_DATA_DIR"/data/backgrounds/");
E_CONF("fonts", cfg_fonts_dir,
PACKAGE_DATA_DIR"/data/fonts/");
return "";
D_RETURN_("");
}
void
@ -83,6 +87,8 @@ e_config_init(void)
{
char buf[PATH_MAX];
D_ENTER;
#if 1 /* for now don't do this. i think a cp -r will be needed later anyway */
if (!e_file_is_dir(e_config_user_dir())) e_file_mkdir(e_config_user_dir());
sprintf(buf, "%sappearance", e_config_user_dir());
@ -108,11 +114,15 @@ e_config_init(void)
#if 0
ts();
#endif
D_RETURN;
}
void
e_config_set_user_dir(char *dir)
{
D_ENTER;
strcpy(cfg_root, dir);
/* reset the cached dir paths */
cfg_grabs_db[0] = 0;
@ -132,19 +142,24 @@ e_config_set_user_dir(char *dir)
cfg_fonts_dir[0] = 0;
/* init again - if the user hasnt got all the data */
e_config_init();
D_RETURN;
}
char *
e_config_user_dir(void)
{
if (cfg_user_dir[0]) return cfg_user_dir;
if (cfg_root[0]) return cfg_root;
D_ENTER;
if (cfg_user_dir[0]) D_RETURN_(cfg_user_dir);
if (cfg_root[0]) D_RETURN_(cfg_root);
#if 1 /* disabled for now - use system ones only */
sprintf(cfg_user_dir, "%s/.e/", e_file_home());
#else
sprintf(cfg_user_dir, PACKAGE_DATA_DIR"/data/config/");
#endif
return cfg_user_dir;
D_RETURN_(cfg_user_dir);
}
void
@ -157,6 +172,8 @@ e_config_type_add_node(E_Config_Base_Type *base, char *prefix,
{
E_Config_Node *cfg_node;
D_ENTER;
cfg_node = NEW(E_Config_Node, 1);
ZERO(cfg_node, E_Config_Node, 1);
@ -171,6 +188,8 @@ e_config_type_add_node(E_Config_Base_Type *base, char *prefix,
e_strdup(cfg_node->def_str, def_str);
}
base->nodes = evas_list_append(base->nodes, cfg_node);
D_RETURN;
}
E_Config_Base_Type *
@ -178,9 +197,12 @@ e_config_type_new(void)
{
E_Config_Base_Type *t;
D_ENTER;
t = NEW(E_Config_Base_Type, 1);
ZERO(t, E_Config_Base_Type, 1);
return t;
D_RETURN_(t);
}
void *
@ -191,9 +213,14 @@ e_config_load(char *file, char *prefix, E_Config_Base_Type *type)
Evas_List l;
char *data;
if (!e_file_exists(file)) return NULL;
D_ENTER;
if (!e_file_exists(file)) D_RETURN_(NULL);
db = e_db_open_read(file);
if (!db) return NULL;
if (!db)
D_RETURN_(NULL);
data = NEW(char, type->size);
ZERO(data, char , type->size);
for (l = type->nodes; l; l = l->next)
@ -272,7 +299,8 @@ e_config_load(char *file, char *prefix, E_Config_Base_Type *type)
}
}
e_db_close(db);
return data;
D_RETURN_(data);
}
@ -299,6 +327,8 @@ void ts(void)
E_Config_Base_Type *cf_list;
E_Config_Base_Type *cf_element;
D_ENTER;
cf_element = e_config_type_new();
E_CONFIG_NODE(cf_element, "name", E_CFG_TYPE_STR, NULL, List_Element, name, 0, 0, "DEFAULT_NAME");
E_CONFIG_NODE(cf_element, "size", E_CFG_TYPE_INT, NULL, List_Element, size, 777, 0, NULL);
@ -336,6 +366,8 @@ void ts(void)
}
exit(0);
}
D_RETURN;
}
#endif

View File

@ -1,3 +1,4 @@
#include "debug.h"
#include "cursors.h"
#include "config.h"
#include "util.h"
@ -24,8 +25,10 @@ static void
e_cursors_idle(void *data)
{
int change = 0;
D_ENTER;
if (!cursor_change) return;
if (!cursor_change) D_RETURN;
if ((prev_cursor) && (cur_cursor) && (strcmp(prev_cursor, cur_cursor)))
change = 1;
if ((prev_cursor) && (!cur_cursor))
@ -39,14 +42,18 @@ e_cursors_idle(void *data)
cur_cursor = NULL;
cursor_change = 0;
return;
D_RETURN;
UN(data);
}
static void
e_cursors_set(char *type)
{
D_ENTER;
e_cursors_display_in_window(0, type);
D_RETURN;
}
static E_Cursor *
@ -54,6 +61,8 @@ e_cursors_find(char *type)
{
Evas_List l;
D_ENTER;
for (l = cursors; l; l = l->next)
{
E_Cursor *c;
@ -70,12 +79,12 @@ e_cursors_find(char *type)
IF_FREE(c->type);
ecore_cursor_free(c->cursor);
FREE(c);
return NULL;
D_RETURN_(NULL);
}
return c;
D_RETURN_(c);
}
}
return NULL;
D_RETURN_(NULL);
}
void
@ -83,6 +92,8 @@ e_cursors_display_in_window(Window win, char *type)
{
E_Cursor *c;
D_ENTER;
if (!type) type = "Default";
c = e_cursors_find(type);
if (!c)
@ -222,23 +233,33 @@ e_cursors_display_in_window(Window win, char *type)
ecore_cursor_set(win, c->cursor);
else
{
if (!strcmp(type, "Default")) return;
if (!strcmp(type, "Default")) D_RETURN;
e_cursors_display_in_window(win, "Default");
}
D_RETURN;
}
void
e_cursors_display(char *type)
{
D_ENTER;
IF_FREE(cur_cursor);
e_strdup(cur_cursor, type);
printf("%s\n", type);
cursor_change = 1;
D_RETURN;
}
void
e_cursors_init(void)
{
D_ENTER;
ecore_event_filter_idle_handler_add(e_cursors_idle, NULL);
e_cursors_set("Default");
D_RETURN;
}

86
src/debug.c Normal file
View File

@ -0,0 +1,86 @@
/*
Copyright (C) 2000, 2001 Christian Kreibich <cK@whoop.org>.
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 and its documentation and acknowledgment shall be
given in the documentation 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.
*/
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdarg.h>
#include <stdio.h>
#include <sys/time.h>
#include <unistd.h>
#include "debug.h"
static int calldepth = 0;
static void debug_whitespace(int calldepth);
static void debug_print_info(void);
static void
debug_whitespace(int calldepth)
{
int i;
for (i = 0; i < 2*calldepth; i++)
printf("-");
}
static void
debug_print_info(void)
{
printf("e17 dbg: ");
}
void
e_debug_enter(const char *file, const char *func)
{
calldepth++;
printf("ENTER ");
debug_print_info();
debug_whitespace(calldepth);
printf("%s, %s()\n", file, func);
fflush(stdout);
}
void
e_debug_D_RETURN(const char *file, const char *func)
{
printf("RETURN ");
debug_print_info();
debug_whitespace(calldepth);
printf("%s, %s()\n", file, func);
fflush(stdout);
calldepth--;
}

64
src/debug.h Normal file
View File

@ -0,0 +1,64 @@
/*
Copyright (C) 2000, 2001 Christian Kreibich <cK@whoop.org>.
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 and its documentation and acknowledgment shall be
given in the documentation 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.
*/
#ifndef E_DEBUG_H
#define E_DEBUG_H
#include <unistd.h>
#include <stdio.h>
#ifdef DEBUG
#define D(fmt, args...) printf(fmt, ## args);
#else
#define D(msg)
#endif
#ifdef DEBUG_NEST
void e_debug_enter(const char *file, const char *func);
void e_debug_return(const char *file, const char *func);
#define D_ENTER efsd_debug_enter(__FILE__, __FUNCTION__)
#define D_RETURN \
{ \
efsd_debug_return(__FILE__, __FUNCTION__); \
return; \
}
#define D_RETURN_(x) \
{ \
efsd_debug_return(__FILE__, __FUNCTION__); \
\
return x; \
}
#else
#define D_ENTER
#define D_RETURN return
#define D_RETURN_(x) return (x)
#endif
#endif

View File

@ -1,29 +1,65 @@
#include <string.h>
#include "debug.h"
#include "delayed.h"
static void
e_delayed_action_cleanup(E_Delayed_Action *eda)
{
D_ENTER;
e_delayed_action_cancel(eda);
e_observer_cleanup(E_OBSERVER(eda));
D_RETURN;
}
E_Delayed_Action *
e_delayed_action_new(Ecore_Event_Type event,
double delay, E_Delay_Func delay_func)
{
E_Delayed_Action *eda = NULL;
D_ENTER;
eda = NEW(E_Delayed_Action, 1);
memset(eda, 0, sizeof(E_Delayed_Action));
e_observer_init(E_OBSERVER(eda), event, e_delayed_action_start,
(E_Cleanup_Func) e_delayed_action_cleanup);
eda->delay = delay;
eda->delay_func = delay_func;
D_RETURN_(eda);
}
void
e_delayed_action_start(void *obs, void *obj)
e_delayed_action_start(E_Observer *obs, E_Observee *obj)
{
char event_name[1024];
E_Delayed_Action *eda = obs;
E_Delayed_Action *eda = (E_Delayed_Action*) obs;
snprintf(event_name, 1024, "_e_delayed_action_notify(%d)", eda->e_event);
D_ENTER;
snprintf(event_name, 1024, "_e_delayed_action_notify(%d)", obs->event);
ecore_add_event_timer(event_name, eda->delay, eda->delay_func, 0, obj);
D_RETURN;
}
void
e_delayed_action_cancel(void *obs)
e_delayed_action_cancel(E_Delayed_Action *eda)
{
E_Delayed_Action *eda = obs;
char event_name[1024];
snprintf(event_name, 1024, "_e_delayed_action_notify(%d)", eda->e_event);
D_ENTER;
snprintf(event_name, 1024, "_e_delayed_action_notify(%d)", E_OBSERVER(eda)->event);
ecore_del_event_timer(event_name);
}
void
e_delayed_action_free(void *obs)
{
e_delayed_action_cancel(obs);
free(obs);
D_RETURN;
}

View File

@ -2,26 +2,25 @@
#define E_DELAYED_H
#include "e.h"
#include "observer.h"
typedef struct _E_Delayed_Action E_Delayed_Action;
typedef void (*E_Delay_Func)(int val, void *obj);
struct _E_Delayed_Action {
OBS_PROPERTIES;
typedef struct _e_delayed_action
{
E_Observer obs;
double delay;
void (*delay_func)(int val, void *obj);
};
double delay;
E_Delay_Func delay_func;
#define E_DELAYED_ACT_INIT(_e_da, _e_act, _e_delay, _e_act_cb) \
{ \
OBS_INIT(_e_da, _e_act, e_delayed_action_start, e_delayed_action_free); \
_e_da->delay = _e_delay; \
_e_da->delay_func = _e_act_cb; \
}
} E_Delayed_Action;
void e_delayed_action_start(void *obs, void *obj);
void e_delayed_action_cancel(void *obs);
void e_delayed_action_free(void *obs);
E_Delayed_Action *e_delayed_action_new(Ecore_Event_Type event,
double delay, E_Delay_Func delay_func);
void e_delayed_action_start(E_Observer *obs, E_Observee *obj);
void e_delayed_action_cancel(E_Delayed_Action *eda);
#endif

View File

@ -1,3 +1,4 @@
#include "debug.h"
#include "desktops.h"
#include "config.h"
#include "actions.h"
@ -6,6 +7,7 @@
#include "view.h"
#include "icccm.h"
#include "util.h"
#include "object.h"
static Evas_List desktops = NULL;
static Window e_base_win = 0;
@ -16,10 +18,11 @@ static void ecore_idle(void *data);
static void
ecore_idle(void *data)
{
D_ENTER;
/* FIXME -- Raster, how is this related to the desktop code? */
e_db_flush();
return;
D_RETURN;
UN(data);
}
@ -27,7 +30,9 @@ void
e_desktops_init(void)
{
E_Desktop *desk;
D_ENTER;
ecore_window_get_geometry(0, NULL, NULL, &screen_w, &screen_h);
e_base_win = ecore_window_override_new(0, 0, 0, screen_w, screen_h);
ecore_window_show(e_base_win);
@ -44,6 +49,8 @@ e_desktops_init(void)
e_icccm_set_desk_area_size(0, 1, 1);
e_icccm_set_desk_area(0, 0, 0);
e_icccm_set_desk(0, 0);
D_RETURN;
}
void
@ -53,8 +60,10 @@ e_desktops_scroll(E_Desktop *desk, int dx, int dy)
int xd, yd, wd, hd;
int grav, grav_stick;
D_ENTER;
/* set grav */
if ((dx ==0) && (dy == 0)) return;
if ((dx ==0) && (dy == 0)) D_RETURN;
desk->x -= dx;
desk->y -= dy;
xd = yd = wd = hd = 0;
@ -145,29 +154,36 @@ e_desktops_scroll(E_Desktop *desk, int dx, int dy)
b->changed = 1;
}
}
D_RETURN;
}
void
e_desktops_free(E_Desktop *desk)
e_desktops_cleanup(E_Desktop *desk)
{
D_ENTER;
while (desk->windows)
{
E_Border *b;
b = desk->windows->data;
e_action_stop_by_object(b, NULL, 0, 0, 0, 0);
OBJ_UNREF(b);
OBJ_IF_FREE(b)
e_action_stop_by_object(E_OBJECT(b), NULL, 0, 0, 0, 0);
if (e_object_get_usecount(E_OBJECT(b)) == 1)
{
ecore_window_reparent(b->win.client, 0, 0, 0);
e_icccm_release(b->win.client);
OBJ_FREE(b);
ecore_window_reparent(b->win.client, 0, 0, 0);
e_icccm_release(b->win.client);
}
}
ecore_window_destroy(desk->win.main);
IF_FREE(desk->name);
IF_FREE(desk->dir);
FREE(desk);
e_object_cleanup(E_OBJECT(desk));
D_RETURN;
}
void
@ -176,7 +192,9 @@ e_desktops_init_file_display(E_Desktop *desk)
E_View *v;
E_Border *b;
char buf[PATH_MAX];
D_ENTER;
v = e_view_new();
v->size.w = desk->real.w;
v->size.h = desk->real.h;
@ -213,6 +231,8 @@ e_desktops_init_file_display(E_Desktop *desk)
b->client.is_desktop = 1;
if (v->options.back_pixmap) e_view_update(v);
D_RETURN;
}
E_Desktop *
@ -220,10 +240,12 @@ e_desktops_new(void)
{
E_Desktop *desk;
D_ENTER;
desk = NEW(E_Desktop, 1);
ZERO(desk, E_Desktop, 1);
OBJ_INIT(desk, e_desktops_free);
e_object_init(E_OBJECT(desk), (E_Cleanup_Func) e_desktops_cleanup);
desk->win.main = ecore_window_override_new(e_base_win, 0, 0, screen_w, screen_h);
desk->win.container = ecore_window_override_new(desk->win.main, 0, 0, screen_w, screen_h);
@ -240,50 +262,71 @@ e_desktops_new(void)
desktops = evas_list_append(desktops, desk);
return desk;
D_RETURN_(desk);
}
void
e_desktops_add_border(E_Desktop *d, E_Border *b)
{
if ((!d) || (!b)) return;
D_ENTER;
if ((!d) || (!b)) D_RETURN;
b->desk = d;
b->client.desk = d->desk.desk;
b->client.area.x = d->desk.area.x;
b->client.area.y = d->desk.area.y;
e_border_raise(b);
D_RETURN;
}
void
e_desktops_del_border(E_Desktop *d, E_Border *b)
{
if ((!d) || (!b)) return;
D_ENTER;
if ((!d) || (!b)) D_RETURN;
d->windows = evas_list_remove(d->windows, b);
b->desk = NULL;
D_RETURN;
}
void
e_desktops_delete(E_Desktop *d)
{
OBJ_DO_FREE(d);
D_ENTER;
e_object_unref(E_OBJECT(d));
D_RETURN;
}
void
e_desktops_show(E_Desktop *d)
{
D_ENTER;
ecore_window_show(d->win.main);
D_RETURN;
}
void
e_desktops_hide(E_Desktop *d)
{
D_ENTER;
ecore_window_hide(d->win.main);
D_RETURN;
}
int
e_desktops_get_num(void)
{
return 8;
D_ENTER;
D_RETURN_(8);
}
E_Desktop *
@ -292,28 +335,39 @@ e_desktops_get(int d)
Evas_List l;
int i;
D_ENTER;
for (i = 0, l = desktops; l; l = l->next, i++)
{
if (i == d) return (E_Desktop *)l->data;
if (i == d)
D_RETURN_((E_Desktop *)l->data);
}
return NULL;
D_RETURN_(NULL);
}
int
e_desktops_get_current(void)
{
E_Desktop *desk;
D_ENTER;
desk = e_desktops_get(0);
if (desk)
return desk->desk.desk;
return 0;
D_RETURN_(desk->desk.desk);
D_RETURN_(0);
}
void
e_desktops_goto_desk(int d)
{
D_ENTER;
e_desktops_goto(d, 0, 0);
D_RETURN;
}
void
@ -321,6 +375,8 @@ e_desktops_goto(int d, int ax, int ay)
{
E_Desktop *desk;
D_ENTER;
desk = e_desktops_get(0);
if (desk)
{
@ -329,7 +385,7 @@ e_desktops_goto(int d, int ax, int ay)
if ((d == desk->desk.desk) &&
(ax == desk->desk.area.x) &&
(ay == desk->desk.area.y)) return;
(ay == desk->desk.area.y)) D_RETURN;
dx = ax - desk->desk.area.x;
dy = ay - desk->desk.area.y;
@ -371,4 +427,6 @@ e_desktops_goto(int d, int ax, int ay)
e_icccm_set_desk_area(0, desk->desk.area.x, desk->desk.area.y);
e_icccm_set_desk(0, desk->desk.desk);
}
D_RETURN;
}

View File

@ -4,6 +4,7 @@
#include "e.h"
#include "view.h"
#include "border.h"
#include "object.h"
#ifndef E_DESKTOPS_TYPEDEF
#define E_DESKTOPS_TYPEDEF
@ -12,7 +13,7 @@ typedef struct _E_Desktop E_Desktop;
struct _E_Desktop
{
OBJ_PROPERTIES;
E_Object o;
char *name;
char *dir;

91
src/e.h
View File

@ -97,82 +97,6 @@ printf("%3.3f : %s()\n", __p->total, __p->func); \
#define E_PROF_DUMP
#endif
/* Observer macros */
#define OBS_PROPERTIES \
Evas_List watched; \
Ecore_Event_Type e_event; \
void (*e_obs_notify)(void *_e_obs, void *_e_obj); \
void (*e_obs_free)(void *_e_obs);
#define OBS_INIT(_e_obs, _e_event, _e_obs_notify, _e_obs_free) \
{ \
_e_obs->watched = NULL; \
_e_obs->e_event = _e_event; \
_e_obs->e_obs_notify = _e_obs_notify; \
_e_obs->e_obs_free = _e_obs_free; \
}
#define OBS_REGISTER(_e_obs, _e_obj) \
{ \
_e_obj->observers = evas_list_append(_e_obj->observers, _e_obs); \
_e_obs->watched = evas_list_append(_e_obs->watched, _e_obj); \
}
#define OBS_UNREGISTER(_e_obj, _e_obs) \
{ \
_e_obj->observers = evas_list_remove(_e_obj->observers, _e_obs); \
_e_obs->watched = evas_list_remove(_e_obs->watched, _e_obj); \
}
#define OBS_NOTIFY(_e_obj, _e_event) \
{ \
Evas_List obs; \
obs = _e_obj->observers; \
while (obs) { \
if (((E_Observer *)obs->data)->e_event == ECORE_EVENT_MAX || \
((E_Observer *)obs->data)->e_event == _e_event) \
((E_Observer *)obs->data)->e_obs_notify(obs->data, _e_obj); \
obs = obs->next; \
} \
}
#define OBS_FREE(_e_obs) \
{ \
E_Object *_e_obj; \
E_Observer *_notify; \
while (_e_obs->watched) { \
_e_obj = _e_obj->watched->data; \
OBS_UNREGISTER(_e_obj, _e_obs); \
_e_obs->e_obs_free(_notify); \
} \
}
/* object macros */
#define OBJ_REF(_e_obj) _e_obj->references++
#define OBJ_UNREF(_e_obj) _e_obj->references--
#define OBJ_IF_FREE(_e_obj) if (_e_obj->references == 0)
#define OBJ_FREE(_e_obj) \
{ \
E_Observer *act; \
while (_e_obj->observers) { \
act = _e_obj->observers->data; \
OBS_UNREGISTER(_e_obj, act); \
} \
_e_obj->e_obj_free(_e_obj); \
}
#define OBJ_DO_FREE(_e_obj) \
{ \
OBJ_UNREF(_e_obj); \
OBJ_IF_FREE(_e_obj) \
{ \
OBJ_FREE(_e_obj); \
} \
}
#define OBJ_PROPERTIES \
int references; \
void (*e_obj_free) (void *e_obj); \
Evas_List observers;
#define OBJ_INIT(_e_obj, _e_obj_free_func) \
{ \
_e_obj->references = 1; \
_e_obj->e_obj_free = (void *) _e_obj_free_func; \
_e_obj->observers = NULL; \
}
/* misc util macros */
#define INTERSECTS(x, y, w, h, xx, yy, ww, hh) \
@ -184,19 +108,4 @@ Evas_List observers;
(!((((x2) + (w2)) <= (x1)) || ((x2) >= ((x1) + (w1)))))
#define UN(_blah) _blah = 0
/* data type prototypes... not actually used */
typedef struct _E_Object E_Object;
typedef struct _E_Observer E_Observer;
/* actual data struct members */
struct _E_Object
{
OBJ_PROPERTIES;
};
struct _E_Observer
{
OBS_PROPERTIES;
};
#endif

View File

@ -1,34 +1,51 @@
#include "debug.h"
#include "e_ferite.h"
#include "e_ferite_gen_header.h"
void e_ferite_init(void)
{
D_ENTER;
printf( "Initialising ferite....\n" );
ferite_init( 0, NULL );
D_RETURN;
}
void e_ferite_deinit(void)
{
D_ENTER;
printf( "Deinitialising ferite....\n" );
ferite_deinit();
D_RETURN;
}
int e_ferite_script_error( FeriteScript *script, char *errmsg, int val )
{
D_ENTER;
fprintf( stderr, "e17: ferite error: %s\n", errmsg );
return 1;
D_RETURN_(1);
}
int e_ferite_script_warning( FeriteScript *script, char *warnmsg )
{
D_ENTER;
fprintf( stderr, "e17: ferite warning: %s\n", warnmsg );
return 1;
D_RETURN_(1);
}
void e_ferite_run( char *txt )
{
FeriteScript *script = NULL;
D_ENTER;
printf( "Compiling script `%s'\n", txt );
script = __ferite_compile_string( txt );
e_ferite_register( script, script->mainns );
@ -38,4 +55,6 @@ void e_ferite_run( char *txt )
ferite_script_execute( script );
printf( "Cleaning up.\n" );
ferite_script_delete( script );
D_RETURN;
}

View File

@ -1,3 +1,4 @@
#include "debug.h"
#include "embed.h"
typedef struct _Embed Embed_Private;
@ -17,9 +18,13 @@ e_embed_text_func_show(void *_data)
{
Embed_Private *em;
D_ENTER;
em = _data;
if (em->clip_obj) evas_show(em->evas, em->clip_obj);
e_text_show(em->text_obj);
D_RETURN;
}
static void
@ -27,9 +32,13 @@ e_embed_text_func_hide(void *_data)
{
Embed_Private *em;
D_ENTER;
em = _data;
if (em->clip_obj) evas_hide(em->evas, em->clip_obj);
e_text_hide(em->text_obj);
D_RETURN;
}
static void
@ -37,9 +46,13 @@ e_embed_text_func_move(void *_data, double x, double y)
{
Embed_Private *em;
D_ENTER;
em = _data;
if (em->clip_obj) evas_move(em->evas, em->clip_obj, x, y);
e_text_move(em->text_obj, x, y);
D_RETURN;
}
static void
@ -47,9 +60,13 @@ e_embed_text_func_resize(void *_data, double w, double h)
{
Embed_Private *em;
D_ENTER;
em = _data;
if (em->clip_obj) evas_resize(em->evas, em->clip_obj, w, h);
e_text_resize(em->text_obj, w, h);
D_RETURN;
}
static void
@ -57,9 +74,13 @@ e_embed_text_func_raise(void *_data)
{
Embed_Private *em;
D_ENTER;
em = _data;
if (em->clip_obj) evas_raise(em->evas, em->clip_obj);
e_text_raise(em->text_obj);
D_RETURN;
}
static void
@ -67,9 +88,13 @@ e_embed_text_func_lower(void *_data)
{
Embed_Private *em;
D_ENTER;
em = _data;
if (em->clip_obj) evas_lower(em->evas, em->clip_obj);
e_text_lower(em->text_obj);
D_RETURN;
}
static void
@ -77,9 +102,13 @@ e_embed_text_func_set_layer(void *_data, int l)
{
Embed_Private *em;
D_ENTER;
em = _data;
if (em->clip_obj) evas_set_layer(em->evas, em->clip_obj, l);
e_text_set_layer(em->text_obj, l);
D_RETURN;
}
static void
@ -87,6 +116,8 @@ e_embed_text_func_set_clip(void *_data, Evas_Object clip)
{
Embed_Private *em;
D_ENTER;
em = _data;
if (em->clip_obj)
{
@ -102,11 +133,17 @@ e_embed_text_func_set_clip(void *_data, Evas_Object clip)
else
e_text_unset_clip(em->text_obj);
}
D_RETURN;
}
static void
e_embed_text_func_set_color_class(void *_data, char *cc, int r, int g, int b, int a)
{
D_ENTER;
D_RETURN;
UN(_data);
UN(cc);
UN(r);
@ -120,10 +157,14 @@ e_embed_text_func_get_min_size(void *_data, double *w, double *h)
{
Embed_Private *em;
D_ENTER;
em = _data;
e_text_get_min_size(em->text_obj, w, h);
if (em->clip_x) *w = 0;
if (em->clip_y) *h = 0;
D_RETURN;
}
static void
@ -131,10 +172,14 @@ e_embed_text_func_get_max_size(void *_data, double *w, double *h)
{
Embed_Private *em;
D_ENTER;
em = _data;
e_text_get_max_size(em->text_obj, w, h);
if (em->clip_x) *w = 999999999;
if (em->clip_y) *h = 999999999;
D_RETURN;
}
/***/
@ -144,6 +189,8 @@ e_embed_text(Ebits_Object o, char *bit_name, Evas evas, E_Text *text_obj, int cl
{
Embed_Private *em;
D_ENTER;
em = NEW(Embed_Private, 1);
ZERO(em, Embed_Private, 1);
em->o = o;
@ -171,7 +218,7 @@ e_embed_text(Ebits_Object o, char *bit_name, Evas evas, E_Text *text_obj, int cl
e_embed_text_func_get_min_size,
e_embed_text_func_get_max_size,
em);
return em;
D_RETURN_(em);
}
/*****************************************************************************/
@ -181,8 +228,12 @@ e_embed_image_func_show(void *_data)
{
Embed_Private *em;
D_ENTER;
em = _data;
evas_show(em->evas, em->image_obj);
D_RETURN;
}
static void
@ -190,8 +241,12 @@ e_embed_image_func_hide(void *_data)
{
Embed_Private *em;
D_ENTER;
em = _data;
evas_hide(em->evas, em->image_obj);
D_RETURN;
}
static void
@ -199,8 +254,12 @@ e_embed_image_func_move(void *_data, double x, double y)
{
Embed_Private *em;
D_ENTER;
em = _data;
evas_move(em->evas, em->image_obj, x, y);
D_RETURN;
}
static void
@ -208,9 +267,13 @@ e_embed_image_func_resize(void *_data, double w, double h)
{
Embed_Private *em;
D_ENTER;
em = _data;
evas_resize(em->evas, em->image_obj, w, h);
evas_set_image_fill(em->evas, em->image_obj, 0, 0, w, h);
D_RETURN;
}
static void
@ -218,8 +281,12 @@ e_embed_image_func_raise(void *_data)
{
Embed_Private *em;
D_ENTER;
em = _data;
evas_raise(em->evas, em->image_obj);
D_RETURN;
}
static void
@ -227,8 +294,12 @@ e_embed_image_func_lower(void *_data)
{
Embed_Private *em;
D_ENTER;
em = _data;
evas_lower(em->evas, em->image_obj);
D_RETURN;
}
static void
@ -236,8 +307,12 @@ e_embed_image_func_set_layer(void *_data, int l)
{
Embed_Private *em;
D_ENTER;
em = _data;
evas_set_layer(em->evas, em->image_obj, l);
D_RETURN;
}
static void
@ -245,11 +320,15 @@ e_embed_image_func_set_clip(void *_data, Evas_Object clip)
{
Embed_Private *em;
D_ENTER;
em = _data;
if (clip)
evas_set_clip(em->evas, em->image_obj, clip);
else
evas_unset_clip(em->evas, em->image_obj);
D_RETURN;
}
static void
@ -257,9 +336,13 @@ e_embed_image_func_set_color_class(void *_data, char *cc, int r, int g, int b, i
{
Embed_Private *em;
D_ENTER;
em = _data;
if ((cc) && (!strcmp(cc, "icon")))
evas_set_color(em->evas, em->image_obj, r, g, b, a);
D_RETURN;
}
static void
@ -268,12 +351,16 @@ e_embed_image_func_get_min_size(void *_data, double *w, double *h)
Embed_Private *em;
int iw, ih;
D_ENTER;
em = _data;
iw = 0;
ih = 0;
evas_get_image_size(em->evas, em->image_obj, &iw, &ih);
if (w) *w = iw;
if (h) *h = ih;
D_RETURN;
}
static void
@ -282,10 +369,14 @@ e_embed_image_func_get_max_size(void *_data, double *w, double *h)
Embed_Private *em;
int iw, ih;
D_ENTER;
em = _data;
evas_get_image_size(em->evas, em->image_obj, &iw, &ih);
if (w) *w = iw;
if (h) *h = ih;
D_RETURN;
}
/***/
@ -295,6 +386,8 @@ e_embed_image_object(Ebits_Object o, char *bit_name, Evas evas, Evas_Object imag
{
Embed_Private *em;
D_ENTER;
em = NEW(Embed_Private, 1);
ZERO(em, Embed_Private, 1);
em->o = o;
@ -313,7 +406,7 @@ e_embed_image_object(Ebits_Object o, char *bit_name, Evas evas, Evas_Object imag
e_embed_image_func_get_min_size,
e_embed_image_func_get_max_size,
em);
return em;
D_RETURN_(em);
}
/*****/
@ -323,7 +416,11 @@ e_embed_free(Embed emb)
{
Embed_Private *em;
D_ENTER;
em = emb;
if (em->clip_obj) evas_del_object(em->evas, em->clip_obj);
FREE(em);
D_RETURN;
}

View File

@ -1,3 +1,4 @@
#include "debug.h"
#include "entry.h"
#include "config.h"
#include "util.h"
@ -19,6 +20,8 @@ e_clear_selection(Ecore_Event * ev)
{
Ecore_Event_Clear_Selection *e;
Evas_List l;
D_ENTER;
e = ev->event;
for (l = entries; l; l = l->next)
@ -35,6 +38,8 @@ e_clear_selection(Ecore_Event * ev)
e_entry_configure(entry);
}
}
D_RETURN;
}
static void
@ -43,6 +48,8 @@ e_paste_request(Ecore_Event * ev)
Ecore_Event_Paste_Request *e;
Evas_List l;
D_ENTER;
e = ev->event;
for (l = entries; l; l = l->next)
{
@ -58,6 +65,8 @@ e_paste_request(Ecore_Event * ev)
e_entry_insert_text(entry, type);
}
}
D_RETURN;
}
static void
@ -66,6 +75,8 @@ e_entry_down_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
E_Entry *entry;
int pos;
D_ENTER;
entry = _data;
if ((_b == 2) && (!entry->mouse_down))
{
@ -99,6 +110,8 @@ e_entry_down_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
entry->select.start = -1;
e_entry_configure(entry);
}
D_RETURN;
UN(_o);
}
@ -108,9 +121,13 @@ e_entry_up_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
E_Entry *entry;
/* int pos; */
D_ENTER;
entry = _data;
if (_b == entry->mouse_down) entry->mouse_down = 0;
e_entry_configure(entry);
D_RETURN;
UN(_e);
UN(_o);
UN(_x);
@ -122,6 +139,8 @@ e_entry_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
{
E_Entry *entry;
D_ENTER;
entry = _data;
if (entry->mouse_down > 0)
{
@ -192,6 +211,8 @@ e_entry_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
}
e_entry_configure(entry);
}
D_RETURN;
UN(_o);
UN(_b);
UN(_y);
@ -203,6 +224,8 @@ e_entry_realize(E_Entry *entry)
char *entries;
char buf[PATH_MAX];
D_ENTER;
entries = e_config_get("entries");
sprintf(buf, "%s/%s", entries, "base.bits.db");
entry->obj_base = ebits_load(buf);
@ -241,11 +264,15 @@ e_entry_realize(E_Entry *entry)
evas_callback_add(entry->evas, entry->event_box, CALLBACK_MOUSE_DOWN, e_entry_down_cb, entry);
evas_callback_add(entry->evas, entry->event_box, CALLBACK_MOUSE_UP, e_entry_up_cb, entry);
evas_callback_add(entry->evas, entry->event_box, CALLBACK_MOUSE_MOVE, e_entry_move_cb, entry);
D_RETURN;
}
static void
e_entry_unrealize(E_Entry *entry)
{
D_ENTER;
if (entry->event_box) evas_del_object(entry->evas, entry->event_box);
if (entry->text) evas_del_object(entry->evas, entry->text);
if (entry->clip_box) evas_del_object(entry->evas, entry->clip_box);
@ -258,6 +285,8 @@ e_entry_unrealize(E_Entry *entry)
entry->obj_base = NULL;
entry->obj_cursor = NULL;
entry->obj_selection = NULL;
D_RETURN;
}
static void
@ -266,8 +295,10 @@ e_entry_configure(E_Entry *entry)
int p1l, p1r, p1t, p1b;
int p2l, p2r, p2t, p2b;
if (!entry->evas) return;
if (!entry->event_box) return;
D_ENTER;
if (!entry->evas) D_RETURN;
if (!entry->event_box) D_RETURN;
p1l = p1r = p1t = p1b = 0;
if (entry->obj_base) ebits_get_insets(entry->obj_base, &p1l, &p1r, &p1t, &p1b);
p2l = p2r = p2t = p2b = 0;
@ -354,22 +385,32 @@ e_entry_configure(E_Entry *entry)
if (entry->obj_selection)
ebits_hide(entry->obj_selection);
}
D_RETURN;
}
void
e_entry_init(void)
{
D_ENTER;
ecore_event_filter_handler_add(ECORE_EVENT_PASTE_REQUEST, e_paste_request);
ecore_event_filter_handler_add(ECORE_EVENT_CLEAR_SELECTION, e_clear_selection);
D_RETURN;
}
void
e_entry_free(E_Entry *entry)
{
D_ENTER;
entries = evas_list_remove(entries, entry);
e_entry_unrealize(entry);
IF_FREE(entry->buffer);
FREE(entry);
D_RETURN;
}
E_Entry *
@ -377,19 +418,24 @@ e_entry_new(void)
{
E_Entry *entry;
D_ENTER;
entry = NEW(E_Entry, 1);
ZERO(entry, E_Entry, 1);
e_strdup(entry->buffer, "");
entry->select.start = -1;
entry->end_width = 4;
entries = evas_list_prepend(entries, entry);
return entry;
D_RETURN_(entry);
}
void
e_entry_handlecore_keypress(E_Entry *entry, Ecore_Event_Key_Down *e)
{
if (!entry->focused) return;
D_ENTER;
if (!entry->focused) D_RETURN;
if (!strcmp(e->key, "Up"))
{
}
@ -497,11 +543,15 @@ e_entry_handlecore_keypress(E_Entry *entry, Ecore_Event_Key_Down *e)
}
}
e_entry_configure(entry);
D_RETURN;
}
void
e_entry_set_evas(E_Entry *entry, Evas evas)
{
D_ENTER;
if (entry->evas) e_entry_unrealize(entry);
entry->evas = evas;
e_entry_realize(entry);
@ -511,99 +561,137 @@ e_entry_set_evas(E_Entry *entry, Evas evas)
entry->visible = 0;
e_entry_show(entry);
}
D_RETURN;
}
void
e_entry_show(E_Entry *entry)
{
if (entry->visible) return;
D_ENTER;
if (entry->visible) D_RETURN;
entry->visible = 1;
if (!entry->evas) return;
if (!entry->evas) D_RETURN;
if (entry->obj_base) ebits_show(entry->obj_base);
if (entry->obj_cursor) ebits_show(entry->obj_cursor);
if (entry->obj_selection) ebits_show(entry->obj_selection);
evas_show(entry->evas, entry->event_box);
evas_show(entry->evas, entry->clip_box);
evas_show(entry->evas, entry->text);
D_RETURN;
}
void
e_entry_hide(E_Entry *entry)
{
if (!entry->visible) return;
D_ENTER;
if (!entry->visible) D_RETURN;
entry->visible = 0;
if (!entry->evas) return;
if (!entry->evas) D_RETURN;
if (entry->obj_base) ebits_hide(entry->obj_base);
if (entry->obj_cursor) ebits_hide(entry->obj_cursor);
if (entry->obj_selection) ebits_hide(entry->obj_selection);
evas_hide(entry->evas, entry->event_box);
evas_hide(entry->evas, entry->clip_box);
evas_hide(entry->evas, entry->text);
D_RETURN;
}
void
e_entry_raise(E_Entry *entry)
{
D_ENTER;
if (entry->obj_base) ebits_raise(entry->obj_base);
evas_raise(entry->evas, entry->clip_box);
evas_raise(entry->evas, entry->text);
if (entry->obj_selection) ebits_raise(entry->obj_selection);
if (entry->obj_cursor) ebits_raise(entry->obj_cursor);
evas_raise(entry->evas, entry->event_box);
D_RETURN;
}
void
e_entry_lower(E_Entry *entry)
{
D_ENTER;
evas_lower(entry->evas, entry->event_box);
if (entry->obj_cursor) ebits_lower(entry->obj_cursor);
if (entry->obj_selection) ebits_lower(entry->obj_selection);
evas_lower(entry->evas, entry->text);
evas_lower(entry->evas, entry->clip_box);
if (entry->obj_base) ebits_lower(entry->obj_base);
D_RETURN;
}
void
e_entry_set_layer(E_Entry *entry, int l)
{
D_ENTER;
if (entry->obj_base) ebits_set_layer(entry->obj_base, l);
evas_set_layer(entry->evas, entry->clip_box, l);
evas_set_layer(entry->evas, entry->text, l);
if (entry->obj_selection) ebits_set_layer(entry->obj_selection, l);
if (entry->obj_cursor) ebits_set_layer(entry->obj_cursor, l);
evas_set_layer(entry->evas, entry->event_box, l);
D_RETURN;
}
void
e_entry_set_clip(E_Entry *entry, Evas_Object clip)
{
D_ENTER;
evas_set_clip(entry->evas, entry->clip_box, clip);
if (entry->obj_base)
ebits_set_clip(entry->obj_base, clip);
D_RETURN;
}
void
e_entry_unset_clip(E_Entry *entry)
{
D_ENTER;
evas_unset_clip(entry->evas, entry->clip_box);
if (entry->obj_base)
ebits_unset_clip(entry->obj_base);
D_RETURN;
}
void
e_entry_move(E_Entry *entry, int x, int y)
{
D_ENTER;
entry->x = x;
entry->y = y;
e_entry_configure(entry);
D_RETURN;
}
void
e_entry_resize(E_Entry *entry, int w, int h)
{
D_ENTER;
entry->w = w;
entry->h = h;
e_entry_configure(entry);
D_RETURN;
}
void
@ -612,6 +700,8 @@ e_entry_query_max_size(E_Entry *entry, int *w, int *h)
int p1l, p1r, p1t, p1b;
int p2l, p2r, p2t, p2b;
D_ENTER;
p1l = p1r = p1t = p1b = 0;
if (entry->obj_base) ebits_get_insets(entry->obj_base, &p1l, &p1r, &p1t, &p1b);
p2l = p2r = p2t = p2b = 0;
@ -619,6 +709,8 @@ e_entry_query_max_size(E_Entry *entry, int *w, int *h)
if (w) *w = evas_get_text_width(entry->evas, entry->text) + p1l + p1r + p2l + p2r;
if (h) *h = evas_get_text_height(entry->evas, entry->text) + p1t + p1b + p2t + p2b;
D_RETURN;
}
void
@ -627,12 +719,16 @@ e_entry_max_size(E_Entry *entry, int *w, int *h)
int p1l, p1r, p1t, p1b;
int p2l, p2r, p2t, p2b;
D_ENTER;
p1l = p1r = p1t = p1b = 0;
if (entry->obj_base) ebits_get_insets(entry->obj_base, &p1l, &p1r, &p1t, &p1b);
p2l = p2r = p2t = p2b = 0;
if (entry->obj_cursor) ebits_get_insets(entry->obj_cursor, &p2l, &p2r, &p2t, &p2b);
if (w) *w = 8000;
if (h) *h = evas_get_text_height(entry->evas, entry->text) + p1t + p1b + p2t + p2b;
D_RETURN;
}
void
@ -641,12 +737,16 @@ e_entry_min_size(E_Entry *entry, int *w, int *h)
int p1l, p1r, p1t, p1b;
int p2l, p2r, p2t, p2b;
D_ENTER;
p1l = p1r = p1t = p1b = 0;
if (entry->obj_base) ebits_get_insets(entry->obj_base, &p1l, &p1r, &p1t, &p1b);
p2l = p2r = p2t = p2b = 0;
if (entry->obj_cursor) ebits_get_insets(entry->obj_cursor, &p2l, &p2r, &p2t, &p2b);
if (w) *w = p1l + p1r + p2l + p2r + entry->min_size;
if (h) *h = evas_get_text_height(entry->evas, entry->text) + p1t + p1b + p2t + p2b;
D_RETURN;
}
void
@ -655,6 +755,8 @@ e_entry_set_size(E_Entry *entry, int w, int h)
int p1l, p1r, p1t, p1b;
int p2l, p2r, p2t, p2b;
D_ENTER;
p1l = p1r = p1t = p1b = 0;
if (entry->obj_base) ebits_get_insets(entry->obj_base, &p1l, &p1r, &p1t, &p1b);
p2l = p2r = p2t = p2b = 0;
@ -664,13 +766,17 @@ e_entry_set_size(E_Entry *entry, int w, int h)
entry->min_size = w;
e_entry_configure(entry);
}
D_RETURN;
UN(h);
}
void
e_entry_set_focus(E_Entry *entry, int focused)
{
if (entry->focused == focused) return;
D_ENTER;
if (entry->focused == focused) D_RETURN;
entry->focused = focused;
e_entry_configure(entry);
if (entry->focused)
@ -683,11 +789,15 @@ e_entry_set_focus(E_Entry *entry, int focused)
if (entry->func_focus_out)
entry->func_focus_out(entry, entry->data_focus_out);
}
D_RETURN;
}
void
e_entry_set_text(E_Entry *entry, const char *text)
{
D_ENTER;
IF_FREE(entry->buffer);
e_strdup(entry->buffer, text);
evas_set_text(entry->evas, entry->text, entry->buffer);
@ -696,53 +806,79 @@ e_entry_set_text(E_Entry *entry, const char *text)
e_entry_configure(entry);
if (entry->func_changed)
entry->func_changed(entry, entry->data_changed);
D_RETURN;
}
const char *
e_entry_get_text(E_Entry *entry)
{
return entry->buffer;
D_ENTER;
D_RETURN_(entry->buffer);
}
void
e_entry_set_cursor(E_Entry *entry, int cursor_pos)
{
D_ENTER;
entry->cursor_pos = cursor_pos;
e_entry_configure(entry);
D_RETURN;
}
int
e_entry_get_cursor(E_Entry *entry)
{
return entry->cursor_pos;
D_ENTER;
D_RETURN_(entry->cursor_pos);
}
void
e_entry_set_changed_callback(E_Entry *entry, void (*func) (E_Entry *_entry, void *_data), void *data)
{
D_ENTER;
entry->func_changed = func;
entry->data_changed = data;
D_RETURN;
}
void
e_entry_set_enter_callback(E_Entry *entry, void (*func) (E_Entry *_entry, void *_data), void *data)
{
D_ENTER;
entry->func_enter = func;
entry->data_enter = data;
D_RETURN;
}
void
e_entry_set_focus_in_callback(E_Entry *entry, void (*func) (E_Entry *_entry, void *_data), void *data)
{
D_ENTER;
entry->func_focus_in = func;
entry->data_focus_in = data;
D_RETURN;
}
void
e_entry_set_focus_out_callback(E_Entry *entry, void (*func) (E_Entry *_entry, void *_data), void *data)
{
D_ENTER;
entry->func_focus_out = func;
entry->data_focus_out = data;
D_RETURN;
}
void
@ -750,7 +886,9 @@ e_entry_insert_text(E_Entry *entry, char *text)
{
char *str2;
if (!text) return;
D_ENTER;
if (!text) D_RETURN;
str2 = malloc(strlen(e_entry_get_text(entry)) + 1 + strlen(text));
str2[0] = 0;
strncat(str2, entry->buffer, entry->cursor_pos);
@ -760,6 +898,8 @@ e_entry_insert_text(E_Entry *entry, char *text)
free(str2);
entry->cursor_pos+=strlen(text);
e_entry_configure(entry);
D_RETURN;
}
void
@ -767,6 +907,8 @@ e_entry_clear_selection(E_Entry *entry)
{
char *str2;
D_ENTER;
if (entry->select.start >= 0)
{
e_strdup(str2, e_entry_get_text(entry));
@ -779,6 +921,8 @@ e_entry_clear_selection(E_Entry *entry)
entry->select.start = -1;
}
e_entry_configure(entry);
D_RETURN;
}
void
@ -786,11 +930,15 @@ e_entry_delete_to_left(E_Entry *entry)
{
char *str2;
D_ENTER;
e_strdup(str2, e_entry_get_text(entry));
strcpy(&(str2[entry->cursor_pos - 1]), &(entry->buffer[entry->cursor_pos]));
entry->cursor_pos--;
e_entry_set_text(entry, str2);
e_entry_configure(entry);
D_RETURN;
}
void
@ -798,16 +946,22 @@ e_entry_delete_to_right(E_Entry *entry)
{
char *str2;
D_ENTER;
e_strdup(str2, e_entry_get_text(entry));
strcpy(&(str2[entry->cursor_pos]), &(entry->buffer[entry->cursor_pos + 1]));
e_entry_set_text(entry, str2);
free(str2);
e_entry_configure(entry);
D_RETURN;
}
char *
e_entry_get_selection(E_Entry *entry)
{
D_ENTER;
if (entry->select.start >= 0)
{
char *str2;
@ -818,7 +972,8 @@ e_entry_get_selection(E_Entry *entry)
len = strlen(entry->buffer) - entry->select.start;
str2 = e_memdup(&(entry->buffer[entry->select.start]), len + 1);
str2[len] = 0;
return str2;
D_RETURN_(str2);
}
return NULL;
D_RETURN_(NULL);
}

View File

@ -1,3 +1,4 @@
#include "debug.h"
#include "exec.h"
#include "desktops.h"
#include "util.h"
@ -8,8 +9,12 @@ static char **e_argv = NULL;
void
e_exec_set_args(int argc, char **argv)
{
D_ENTER;
e_argc = argc;
e_argv = argv;
D_RETURN;
}
void
@ -18,6 +23,8 @@ e_exec_restart(void)
int i, num;
char exe[PATH_MAX];
D_ENTER;
printf("e_exec_restart()\n");
/* unset events on root */
ecore_window_set_events(0, XEV_NONE);
@ -40,6 +47,8 @@ e_exec_restart(void)
strcat(exe, " ");
}
execl("/bin/sh", "/bin/sh", "-c", exe, NULL);
D_RETURN;
}
pid_t
@ -47,13 +56,16 @@ e_exec_run(char *exe)
{
pid_t pid;
D_ENTER;
pid = fork();
if (pid)
return pid;
D_RETURN_(pid);
setsid();
execl("/bin/sh", "/bin/sh", "-c", exe, NULL);
exit(0);
return 0;
D_RETURN_(0);
}
pid_t
@ -61,14 +73,17 @@ e_exec_run_in_dir(char *exe, char *dir)
{
pid_t pid;
D_ENTER;
pid = fork();
if (pid)
return pid;
D_RETURN_(pid);
chdir(dir);
setsid();
execl("/bin/sh", "/bin/sh", "-c", exe, NULL);
exit(0);
return 0;
D_RETURN_(0);
}
pid_t
@ -80,10 +95,12 @@ e_exec_in_dir_with_env(char *exe, char *dir, int *launch_id_ret, char **env, cha
char *exe2;
pid_t pid;
D_ENTER;
launch_id++;
if (launch_id_ret) *launch_id_ret = launch_id;
pid = fork();
if (pid) return pid;
if (pid) D_RETURN_(pid);
chdir(dir);
setsid();
if (env)
@ -108,5 +125,6 @@ e_exec_in_dir_with_env(char *exe, char *dir, int *launch_id_ret, char **env, cha
execl("/bin/sh", "/bin/sh", "-c", exe2, NULL);
exit(0);
return 0;
D_RETURN_(0);
}

View File

@ -1,3 +1,4 @@
#include "debug.h"
#include "fs.h"
#include "exec.h"
@ -15,13 +16,17 @@ static void e_fs_flush_timeout(int val, void *data);
static void
e_fs_flush_timeout(int val, void *data)
{
if (!ec) return;
D_ENTER;
if (!ec) D_RETURN;
if (efsd_commands_pending(ec) > 0)
{
if (efsd_flush(ec) > 0)
ecore_add_event_timer("e_fs_flush_timeout()",
0.00, e_fs_flush_timeout, 0, NULL);
}
D_RETURN;
UN(data);
UN(val);
}
@ -29,7 +34,11 @@ e_fs_flush_timeout(int val, void *data)
static void
e_fs_idle(void *data)
{
D_ENTER;
e_fs_flush_timeout(0, NULL);
D_RETURN;
UN(data);
}
@ -38,6 +47,8 @@ e_fs_child_handle(Ecore_Event *ev)
{
Ecore_Event_Child *e;
D_ENTER;
e = ev->event;
printf("pid went splat! (%i)\n", e->pid);
if (e->pid == efsd_pid)
@ -48,6 +59,8 @@ e_fs_child_handle(Ecore_Event *ev)
efsd_pid = 0;
_e_fs_restarter(1, NULL);
}
D_RETURN;
}
static void
@ -55,6 +68,8 @@ _e_fs_fd_handle(int fd)
{
double start, current;
D_ENTER;
start = ecore_get_time();
while ((ec) && efsd_events_pending(ec))
{
@ -92,12 +107,16 @@ _e_fs_fd_handle(int fd)
break;
}
}
D_RETURN;
}
static void
_e_fs_restarter(int val, void *data)
{
if (ec) return;
D_ENTER;
if (ec) D_RETURN;
ec = efsd_open();
@ -131,6 +150,8 @@ _e_fs_restarter(int val, void *data)
if (gap > 10.0) gap = 10.0;
ecore_add_event_timer("e_fs_restarter", gap, _e_fs_restarter, val + 1, NULL);
}
D_RETURN;
UN(data);
}
@ -139,35 +160,47 @@ e_fs_add_restart_handler(void (*func) (void *data), void *data)
{
E_FS_Restarter *rs;
D_ENTER;
rs = NEW(E_FS_Restarter, 1);
ZERO(rs, E_FS_Restarter, 1);
rs->func = func;
rs->data = data;
fs_restart_handlers = evas_list_append(fs_restart_handlers, rs);
return rs;
D_RETURN_(rs);
}
void
e_fs_del_restart_handler(E_FS_Restarter *rs)
{
D_ENTER;
if (evas_list_find(fs_restart_handlers, rs))
{
fs_restart_handlers = evas_list_remove(fs_restart_handlers, rs);
FREE(rs);
}
D_RETURN;
}
void
e_fs_add_event_handler(void (*func) (EfsdEvent *ev))
{
if (!func) return;
D_ENTER;
if (!func) D_RETURN;
fs_handlers = evas_list_append(fs_handlers, func);
D_RETURN;
}
void
e_fs_init(void)
{
D_ENTER;
/* Hook in an fs handler that gets called whenever
a child of this process exits.
*/
@ -182,10 +215,14 @@ e_fs_init(void)
*/
ecore_event_filter_idle_handler_add(e_fs_idle, NULL);
_e_fs_restarter(0, NULL);
D_RETURN;
}
EfsdConnection *
e_fs_get_connection(void)
{
return ec;
D_ENTER;
D_RETURN_(ec);
}

View File

@ -1,3 +1,4 @@
#include "debug.h"
#include "guides.h"
#include "text.h"
#include "config.h"
@ -48,7 +49,11 @@ static void e_guides_update(void);
static void
e_guides_idle(void *data)
{
D_ENTER;
e_guides_update();
D_RETURN;
UN(data);
}
@ -60,7 +65,9 @@ e_guides_update(void)
char *font_dir;
int redraw;
if (!guides.changed) return;
D_ENTER;
if (!guides.changed) D_RETURN;
redraw = 0;
if (guides.prev.visible != guides.current.visible)
@ -474,96 +481,136 @@ e_guides_update(void)
}
}
guides.prev = guides.current;
D_RETURN;
}
void
e_guides_show(void)
{
if (guides.current.visible) return;
D_ENTER;
if (guides.current.visible) D_RETURN;
guides.changed = 1;
guides.current.visible = 1;
D_RETURN;
}
void
e_guides_hide(void)
{
if (!guides.current.visible) return;
D_ENTER;
if (!guides.current.visible) D_RETURN;
guides.changed = 1;
guides.current.visible = 0;
D_RETURN;
}
void
e_guides_move(int x, int y)
{
D_ENTER;
if ((guides.current.x == x) &&
(guides.current.y == y)) return;
(guides.current.y == y)) D_RETURN;
guides.changed = 1;
guides.current.x = x;
guides.current.y = y;
D_RETURN;
}
void
e_guides_resize(int w, int h)
{
D_ENTER;
if ((guides.current.w == w) &&
(guides.current.h == h)) return;
(guides.current.h == h)) D_RETURN;
guides.changed = 1;
guides.current.w = w;
guides.current.h = h;
D_RETURN;
}
void
e_guides_display_text(char *text)
{
D_ENTER;
if ((guides.current.display.text) && (text) &&
(!strcmp(guides.current.display.text, text))) return;
(!strcmp(guides.current.display.text, text))) D_RETURN;
guides.changed = 1;
IF_FREE(guides.current.display.text);
guides.current.display.text = NULL;
guides.prev.display.text = (char *)1;
e_strdup(guides.current.display.text, text);
D_RETURN;
}
void
e_guides_display_icon(char *icon)
{
D_ENTER;
if ((guides.current.display.icon) && (icon) &&
(!strcmp(guides.current.display.icon, icon))) return;
(!strcmp(guides.current.display.icon, icon))) D_RETURN;
guides.changed = 1;
IF_FREE(guides.current.display.icon);
guides.current.display.icon = NULL;
guides.prev.display.icon = (char *)1;
e_strdup(guides.current.display.icon, icon);
D_RETURN;
}
void
e_guides_set_display_location(E_Guides_Location loc)
{
if (guides.current.display.loc == loc) return;
D_ENTER;
if (guides.current.display.loc == loc) D_RETURN;
guides.changed = 1;
guides.current.display.loc = loc;
D_RETURN;
}
void
e_guides_set_display_alignment(double x, double y)
{
D_ENTER;
if ((guides.current.display.align.x == x) &&
(guides.current.display.align.y == y)) return;
(guides.current.display.align.y == y)) D_RETURN;
guides.changed = 1;
guides.current.display.align.x = x;
guides.current.display.align.y = y;
D_RETURN;
}
void
e_guides_set_mode(E_Guides_Mode mode)
{
if (guides.current.mode == mode) return;
D_ENTER;
if (guides.current.mode == mode) D_RETURN;
guides.changed = 1;
guides.current.mode = mode;
D_RETURN;
}
void e_guides_init(void)
{
D_ENTER;
guides.changed = 0;
guides.current.display.loc = E_GUIDES_DISPLAY_LOCATION_SCREEN_MIDDLE;
@ -593,4 +640,6 @@ void e_guides_init(void)
guides.disp.image = NULL;
ecore_event_filter_idle_handler_add(e_guides_idle, NULL);
D_RETURN;
}

View File

@ -1,3 +1,4 @@
#include "debug.h"
#include "e.h"
#include "border.h"
#include "icccm.h"
@ -48,7 +49,11 @@ MWMHints;
void
e_icccm_move_resize(Window win, int x, int y, int w, int h)
{
D_ENTER;
ecore_window_send_event_move_resize(win, x, y, w, h);
D_RETURN;
}
void
@ -60,6 +65,8 @@ e_icccm_delete(Window win)
int size;
int del_win = 0;
D_ENTER;
ECORE_ATOM(a_wm_delete_window, "WM_DELETE_WINDOW");
ECORE_ATOM(a_wm_protocols, "WM_PROTOCOLS");
@ -87,6 +94,8 @@ e_icccm_delete(Window win)
{
ecore_window_kill_client(win);
}
D_RETURN;
}
void
@ -95,10 +104,14 @@ e_icccm_state_mapped(Window win)
static Atom a_wm_state = 0;
unsigned int data[2];
D_ENTER;
ECORE_ATOM(a_wm_state, "WM_STATE");
data[0] = NormalState;
data[1] = 0;
ecore_window_property_set(win, a_wm_state, a_wm_state, 32, data, 2);
D_RETURN;
}
void
@ -107,10 +120,14 @@ e_icccm_state_iconified(Window win)
static Atom a_wm_state = 0;
unsigned int data[2];
D_ENTER;
ECORE_ATOM(a_wm_state, "WM_STATE");
data[0] = IconicState;
data[1] = 0;
ecore_window_property_set(win, a_wm_state, a_wm_state, 32, data, 2);
D_RETURN;
}
void
@ -119,22 +136,34 @@ e_icccm_state_withdrawn(Window win)
static Atom a_wm_state = 0;
unsigned int data[2];
D_ENTER;
ECORE_ATOM(a_wm_state, "WM_STATE");
data[0] = WithdrawnState;
data[1] = 0;
ecore_window_property_set(win, a_wm_state, a_wm_state, 32, data, 2);
D_RETURN;
}
void
e_icccm_adopt(Window win)
{
D_ENTER;
ecore_window_add_to_save_set(win);
D_RETURN;
}
void
e_icccm_release(Window win)
{
D_ENTER;
ecore_window_del_from_save_set(win);
D_RETURN;
}
void
@ -143,6 +172,8 @@ e_icccm_get_pos_info(Window win, E_Border *b)
XSizeHints hint;
int mask;
D_ENTER;
if (ecore_window_get_wm_size_hints(win, &hint, &mask))
{
if ((hint.flags & USPosition) || ((hint.flags & PPosition)))
@ -164,6 +195,8 @@ e_icccm_get_pos_info(Window win, E_Border *b)
b->client.pos.requested = 0;
}
}
D_RETURN;
}
void
@ -174,6 +207,8 @@ e_icccm_get_size_info(Window win, E_Border *b)
int mask;
XSizeHints hint;
D_ENTER;
grav = NorthWestGravity;
mask = 0;
min_w = 0;
@ -238,6 +273,8 @@ e_icccm_get_size_info(Window win, E_Border *b)
b->client.min.aspect = aspect_min;
b->client.max.aspect = aspect_max;
b->changed = 1;
D_RETURN;
}
void
@ -247,6 +284,8 @@ e_icccm_get_mwm_hints(Window win, E_Border *b)
MWMHints *mwmhints;
int size;
D_ENTER;
ECORE_ATOM(a_motif_wm_hints, "_MOTIF_WM_HINTS");
mwmhints = ecore_window_property_get(win, a_motif_wm_hints, a_motif_wm_hints, &size);
@ -258,7 +297,7 @@ e_icccm_get_mwm_hints(Window win, E_Border *b)
if (num < PROP_MWM_HINTS_ELEMENTS)
{
FREE(mwmhints);
return;
D_RETURN;
}
if (mwmhints->flags & MWM_HINTS_DECORATIONS)
{
@ -278,6 +317,8 @@ e_icccm_get_mwm_hints(Window win, E_Border *b)
}
FREE(mwmhints);
}
D_RETURN;
}
void
@ -287,6 +328,8 @@ e_icccm_get_layer(Window win, E_Border *b)
int *props;
int size;
D_ENTER;
ECORE_ATOM(a_win_layer, "_WIN_LAYER");
props = ecore_window_property_get(win, a_win_layer, XA_CARDINAL, &size);
@ -298,6 +341,8 @@ e_icccm_get_layer(Window win, E_Border *b)
if (num > 0) b->client.layer = props[0];
FREE(props);
}
D_RETURN;
}
void
@ -305,6 +350,8 @@ e_icccm_get_title(Window win, E_Border *b)
{
char *title;
D_ENTER;
title = ecore_window_get_title(win);
if (b->client.title)
@ -312,7 +359,7 @@ e_icccm_get_title(Window win, E_Border *b)
if ((title) && (!strcmp(title, b->client.title)))
{
FREE(title);
return;
D_RETURN;
}
b->changed = 1;
FREE(b->client.title);
@ -320,12 +367,16 @@ e_icccm_get_title(Window win, E_Border *b)
b->client.title = NULL;
if (title) b->client.title = title;
else e_strdup(b->client.title, "No Title");
D_RETURN;
}
void
e_icccm_get_class(Window win, E_Border *b)
{
D_ENTER;
IF_FREE(b->client.name);
IF_FREE(b->client.class);
b->client.name = NULL;
@ -333,43 +384,65 @@ e_icccm_get_class(Window win, E_Border *b)
ecore_window_get_name_class(win, &(b->client.name), &(b->client.class));
if (!b->client.name) e_strdup(b->client.name, "Unknown");
if (!b->client.class) e_strdup(b->client.class, "Unknown");
D_RETURN;
}
void
e_icccm_get_hints(Window win, E_Border *b)
{
D_ENTER;
ecore_window_get_hints(win, &(b->client.takes_focus),
&(b->client.initial_state), NULL, NULL, NULL,
&(b->client.group));
D_RETURN;
}
void
e_icccm_get_machine(Window win, E_Border *b)
{
D_ENTER;
IF_FREE(b->client.machine);
b->client.machine = NULL;
b->client.machine = ecore_window_get_machine(win);
D_RETURN;
}
void
e_icccm_get_command(Window win, E_Border *b)
{
D_ENTER;
IF_FREE(b->client.command);
b->client.command = NULL;
b->client.command = ecore_window_get_command(win);
D_RETURN;
}
void
e_icccm_get_icon_name(Window win, E_Border *b)
{
D_ENTER;
IF_FREE(b->client.icon_name);
b->client.icon_name = NULL;
b->client.icon_name = ecore_window_get_icon_name(win);
D_RETURN;
}
void
e_icccm_get_state(Window win, E_Border *b)
{
D_ENTER;
D_RETURN;
}
void
@ -378,12 +451,16 @@ e_icccm_set_frame_size(Window win, int l, int r, int t, int b)
static Atom a_e_frame_size = 0;
int props[4];
D_ENTER;
ECORE_ATOM(a_e_frame_size, "_E_FRAME_SIZE");
props[0] = l;
props[1] = r;
props[2] = t;
props[3] = b;
ecore_window_property_set(win, a_e_frame_size, XA_CARDINAL, 32, props, 4);
D_RETURN;
}
void
@ -392,10 +469,14 @@ e_icccm_set_desk_area(Window win, int ax, int ay)
static Atom a_win_area = 0;
int props[2];
D_ENTER;
ECORE_ATOM(a_win_area, "_WIN_AREA");
props[0] = ax;
props[1] = ay;
ecore_window_property_set(win, a_win_area, XA_CARDINAL, 32, props, 2);
D_RETURN;
}
void
@ -404,10 +485,14 @@ e_icccm_set_desk_area_size(Window win, int ax, int ay)
static Atom a_win_area_count = 0;
int props[2];
D_ENTER;
ECORE_ATOM(a_win_area_count, "_WIN_AREA_COUNT");
props[0] = ax;
props[1] = ay;
ecore_window_property_set(win, a_win_area_count, XA_CARDINAL, 32, props, 2);
D_RETURN;
}
void
@ -416,9 +501,13 @@ e_icccm_set_desk(Window win, int d)
static Atom a_win_workspace = 0;
int props[2];
D_ENTER;
ECORE_ATOM(a_win_workspace, "_WIN_WORKSPACE");
props[0] = d;
ecore_window_property_set(win, a_win_workspace, XA_CARDINAL, 32, props, 1);
D_RETURN;
}
int
@ -426,17 +515,23 @@ e_icccm_is_shaped(Window win)
{
int w, h, num;
int shaped = 1;
XRectangle *rect;
D_ENTER;
ecore_window_get_geometry(win, NULL, NULL, &w, &h);
rect = ecore_window_get_shape_rectangles(win, &num);
if (!rect) return 1;
if (!rect)
D_RETURN_(1);
if ((num == 1) &&
(rect[0].x == 0) && (rect[0].y == 0) &&
(rect[0].width == w) && (rect[0].height == h))
shaped = 0;
XFree(rect);
return shaped;
D_RETURN_(shaped);
}
void
@ -452,6 +547,8 @@ e_icccm_handle_property_change(Atom a, E_Border *b)
static Atom a_wm_icon_name = 0;
static Atom a_wm_state = 0;
D_ENTER;
ECORE_ATOM(a_wm_normal_hints, "WM_NORMAL_HINTS");
ECORE_ATOM(a_motif_wm_hints, "_MOTIF_WM_HINTS");
ECORE_ATOM(a_wm_name, "WM_NAME");
@ -471,18 +568,26 @@ e_icccm_handle_property_change(Atom a, E_Border *b)
else if (a == a_wm_command) e_icccm_get_command(b->win.client, b);
else if (a == a_wm_icon_name) e_icccm_get_icon_name(b->win.client, b);
else if (a == a_wm_state) e_icccm_get_state(b->win.client, b);
D_RETURN;
}
void
e_icccm_handle_client_message(Ecore_Event_Message *e)
{
return;
D_ENTER;
D_RETURN;
UN(e);
}
void
e_icccm_advertise_e_compat(void)
{
D_ENTER;
D_RETURN;
}
void
@ -491,10 +596,14 @@ e_icccm_advertise_mwm_compat(void)
static Atom a_motif_wm_info = 0;
int props[2];
D_ENTER;
ECORE_ATOM(a_motif_wm_info, "_MOTIF_WM_INFO");
props[0] = 2;
props[0] = ecore_window_root();
ecore_window_property_set(0, a_motif_wm_info, a_motif_wm_info, 32, props, 2);
D_RETURN;
}
void
@ -508,6 +617,8 @@ e_icccm_advertise_gnome_compat(void)
int props[32];
Window win;
D_ENTER;
ECORE_ATOM(a_win_protocols, "_WIN_PROTOCOLS");
ECORE_ATOM(a_win_layer, "_WIN_LAYER");
props[0] = a_win_protocols;
@ -523,14 +634,24 @@ e_icccm_advertise_gnome_compat(void)
props[0] = win;
ecore_window_property_set(win, a_win_supporting_wm_check, XA_CARDINAL, 32, props, 1);
ecore_window_property_set(0, a_win_supporting_wm_check, XA_CARDINAL, 32, props, 1);
D_RETURN;
}
void
e_icccm_advertise_kde_compat(void)
{
D_ENTER;
D_RETURN;
}
void
e_icccm_advertise_net_compat(void)
{
D_ENTER;
D_RETURN;
}

View File

@ -1,3 +1,4 @@
#include "debug.h"
#include "iconbar.h"
#include "util.h"
@ -26,12 +27,59 @@ static void ib_mouse_out(void *data, Evas _e, Evas_Object _o, int _b, int _x, in
static void ib_mouse_down(void *data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
static void ib_mouse_up(void *data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
static void e_iconbar_icon_cleanup(E_Iconbar_Icon *ic);
/* NB: comments here for illustration & helping people understand E's code */
/* This is a start of the comments. if you feel they are not quite good */
/* as you figure things out and if you think they could be more helpful */
/* please feel free to add to them to make them easier to read and be more */
/* helpful. */
/**
* e_iconbar_cleanup - Iconbar destructor.
* @ib: The iconbar to be cleaned up.
*
* How do we free these pesky little urchins...
*/
static void
e_iconbar_cleanup(E_Iconbar *ib)
{
char buf[PATH_MAX];
D_ENTER;
/* tell the view we attached to that somehting in it changed. this way */
/* the view will now it needs to redraw */
ib->view->changed = 1;
/* free up our ebits */
if (ib->bit) ebits_free(ib->bit);
/* if we have any icons... */
if (ib->icons)
{
Evas_List l;
/* go thru the list of icon and unref each one.. ie - free it */
for (l = ib->icons; l; l = l->next)
{
E_Iconbar_Icon *ic;
ic = l->data;
e_object_unref(E_OBJECT(ic));
}
/* free the list itself */
evas_list_free(ib->icons);
}
/* delete any timers intended to work on this iconbar */
sprintf(buf, "iconbar_reload:%s", ib->view->dir);
ecore_del_event_timer(buf);
/* call the destructor of the base class */
e_object_cleanup(E_OBJECT(ib));
D_RETURN;
}
/**
* e_iconbar_init - Init function
*
@ -40,6 +88,8 @@ static void ib_mouse_up(void *data, Evas _e, Evas_Object _o, int _b, int _x, int
void
e_iconbar_init()
{
D_ENTER;
/* we set up config structure and types so the config system can just */
/* read a db and dump it right into memory - including lists of stuff */
@ -59,6 +109,8 @@ e_iconbar_init()
/* the list */
cf_iconbar = e_config_type_new();
E_CONFIG_NODE(cf_iconbar, "icons", E_CFG_TYPE_LIST, cf_iconbar_icon, E_Iconbar, icons, 0, 0, NULL);
D_RETURN;
}
/**
@ -72,6 +124,8 @@ e_iconbar_new(E_View *v)
char buf[PATH_MAX];
E_Iconbar *ib;
D_ENTER;
/* first we want to load the iconbar data itself - ie the config info */
/* for what icons we have and what they execute */
sprintf(buf, "%s/.e_iconbar.db", v->dir);
@ -89,11 +143,11 @@ e_iconbar_new(E_View *v)
/* flush edb cached handled */
e_db_flush();
/* no iconbar config loaded ? return NULL */
if (!ib) return NULL;
if (!ib) D_RETURN_(NULL);
/* now that the config system has doe the loading. we need to init the */
/* object and set up ref counts and free method */
OBJ_INIT(ib, e_iconbar_free);
e_object_init(E_OBJECT(ib), (E_Cleanup_Func) e_iconbar_cleanup);
/* the iconbar needs to know what view it's in */
ib->view = v;
@ -105,7 +159,8 @@ e_iconbar_new(E_View *v)
ic = l->data;
/* and init the iocnbar icon object */
OBJ_INIT(ic, e_iconbar_icon_free);
e_object_init(E_OBJECT(ic), (E_Cleanup_Func) e_iconbar_icon_cleanup);
/* and have the iconbar icon knwo what iconbar it belongs to */
ic->iconbar = ib;
}
@ -118,62 +173,26 @@ e_iconbar_new(E_View *v)
if (!ib->bit)
{
/* unref the iconbar (and thus it will get freed and all icons in it */
OBJ_DO_FREE(ib);
e_object_unref(E_OBJECT(ib));
/* return NULL - no iconbar worth doing here if we don't know where */
/* to put it */
return NULL;
D_RETURN_(NULL);
}
/* aaah. our nicely constructed iconbar data struct with all the goodies */
/* we need. return it. she's ready for use. */
return ib;
D_RETURN_(ib);
}
/**
* e_iconbar_free - Iconbar destructor.
* @ib: The iconbar to be freed
*
* How do we free these pesky little urchins...
*/
void
e_iconbar_free(E_Iconbar *ib)
{
char buf[PATH_MAX];
/* tell the view we attached to that somehting in it changed. this way */
/* the view will now it needs to redraw */
ib->view->changed = 1;
/* free up our ebits */
if (ib->bit) ebits_free(ib->bit);
/* if we have any icons... */
if (ib->icons)
{
Evas_List l;
/* go thru the list of icon and unref each one.. ie - free it */
for (l = ib->icons; l; l = l->next)
{
E_Iconbar_Icon *ic;
ic = l->data;
OBJ_DO_FREE(ic);
}
/* free the list itself */
evas_list_free(ib->icons);
}
/* delete any timers intended to work on this iconbar */
sprintf(buf, "iconbar_reload:%s", ib->view->dir);
ecore_del_event_timer(buf);
/* free the iconbar struct */
FREE(ib);
}
/**
* e_iconbar_icon_free -- Iconbar icon destructor
* e_iconbar_icon_cleanup -- Iconbar icon destructor
* @ic: The icon that is to be freed
*/
void
e_iconbar_icon_free(E_Iconbar_Icon *ic)
static void
e_iconbar_icon_cleanup(E_Iconbar_Icon *ic)
{
D_ENTER;
/* if we have an imageobject. nuke it */
if (ic->image) evas_del_object(ic->iconbar->view->evas, ic->image);
/* free strings ... if they exist */
@ -186,8 +205,11 @@ e_iconbar_icon_free(E_Iconbar_Icon *ic)
FREE(ic->hi.timer);
}
if (ic->hi.image) evas_del_object(ic->iconbar->view->evas, ic->hi.image);
/* nuke that struct */
FREE(ic);
/* Call the destructor of the base class */
e_object_cleanup(E_OBJECT(ic));
D_RETURN;
}
/**
@ -203,6 +225,8 @@ e_iconbar_realize(E_Iconbar *ib)
{
Evas_List l;
D_ENTER;
/* go thru every icon in the iconbar */
for (l = ib->icons; l; l = l->next)
{
@ -254,6 +278,8 @@ e_iconbar_realize(E_Iconbar *ib)
/* but fixes the iconbar so its the size of the view, in the right */
/* place and arranges the icons in their right spots */
e_iconbar_fix(ib);
D_RETURN;
}
/**
@ -269,6 +295,8 @@ e_iconbar_fix(E_Iconbar *ib)
Evas_List l;
double ix, iy, aw, ah;
D_ENTER;
/* move the ebit to 0,0 */
ebits_move(ib->bit, 0, 0);
/* resize it to fill the whole view. the internal geometry of the */
@ -350,6 +378,8 @@ e_iconbar_fix(E_Iconbar *ib)
iy += h;
}
}
D_RETURN;
}
/**
@ -365,6 +395,8 @@ e_iconbar_fix(E_Iconbar *ib)
void
e_iconbar_file_add(E_View *v, char *file)
{
D_ENTER;
/* is the file of interest ? */
if ((!strcmp(".e_iconbar.db", file)) ||
(!strcmp(".e_iconbar.bits.db", file)))
@ -376,6 +408,8 @@ e_iconbar_file_add(E_View *v, char *file)
/* in 0.5 secs call our timout handler */
ecore_add_event_timer(buf, 0.5, ib_reload_timeout, 0, v);
}
D_RETURN;
}
/**
@ -388,6 +422,8 @@ e_iconbar_file_add(E_View *v, char *file)
void
e_iconbar_file_delete(E_View *v, char *file)
{
D_ENTER;
/* is the file of interest */
if ((!strcmp(".e_iconbar.db", file)) ||
(!strcmp(".e_iconbar.bits.db", file)))
@ -396,10 +432,12 @@ e_iconbar_file_delete(E_View *v, char *file)
/* nuked. no need to keep it around. */
if (v->iconbar)
{
OBJ_DO_FREE(v->iconbar);
e_object_unref(E_OBJECT(v->iconbar));
v->iconbar = NULL;
}
}
D_RETURN;
}
/**
@ -412,6 +450,8 @@ e_iconbar_file_delete(E_View *v, char *file)
void
e_iconbar_file_change(E_View *v, char *file)
{
D_ENTER;
/* is the file that changed of interest */
if ((!strcmp(".e_iconbar.db", file)) ||
(!strcmp(".e_iconbar.bits.db", file)))
@ -423,6 +463,8 @@ e_iconbar_file_change(E_View *v, char *file)
/* in 0.5 secsm call the realod timeout */
ecore_add_event_timer(buf, 0.5, ib_reload_timeout, 0, v);
}
D_RETURN;
}
@ -436,16 +478,23 @@ ib_reload_timeout(int val, void *data)
{
E_View *v;
D_ENTER;
/* get our view pointer */
v = (E_View *)data;
/* if we have an iconbar.. well nuke it */
if (v->iconbar) OBJ_DO_FREE(v->iconbar);
v->iconbar = NULL;
if (e_object_unref(E_OBJECT(v->iconbar)) == 0)
v->iconbar = NULL;
/* try load a new iconbar */
if (!v->iconbar) v->iconbar = e_iconbar_new(v);
/* if the iconbar loaded and theres an evas - we're realized */
/* so realize the iconbar */
if ((v->iconbar) && (v->evas)) e_iconbar_realize(v->iconbar);
D_RETURN;
}
/* this timeout is responsible for doing the mouse over animation */
@ -455,6 +504,8 @@ ib_timeout(int val, void *data)
E_Iconbar_Icon *ic;
double t;
D_ENTER;
/* get the iconbar icon we are dealign with */
ic = (E_Iconbar_Icon *)data;
/* val <= 0 AND we're hilited ? first call as a timeout handler. */
@ -564,6 +615,8 @@ ib_timeout(int val, void *data)
ecore_add_event_timer(ic->hi.timer, 0.05, ib_timeout, val, data);
/* flag the view that we changed */
ic->iconbar->view->changed = 1;
D_RETURN;
}
/* called when an ebits object bit needs to be shown */
@ -573,6 +626,8 @@ ib_bits_show(void *data)
E_Iconbar *ib;
Evas_List l;
D_ENTER;
ib = (E_Iconbar *)data;
/* show all the icons */
for (l = ib->icons; l; l = l->next)
@ -582,6 +637,8 @@ ib_bits_show(void *data)
ic = l->data;
evas_show(ic->iconbar->view->evas, ic->image);
}
D_RETURN;
}
/* called when an ebit object bit needs to hide */
@ -591,6 +648,8 @@ ib_bits_hide(void *data)
E_Iconbar *ib;
Evas_List l;
D_ENTER;
ib = (E_Iconbar *)data;
/* hide all the icons */
for (l = ib->icons; l; l = l->next)
@ -600,6 +659,8 @@ ib_bits_hide(void *data)
ic = l->data;
evas_hide(ic->iconbar->view->evas, ic->image);
}
D_RETURN;
}
/* called when an ebit objetc bit needs to move */
@ -609,10 +670,14 @@ ib_bits_move(void *data, double x, double y)
E_Iconbar *ib;
Evas_List l;
D_ENTER;
ib = (E_Iconbar *)data;
/* dont do anything.. just record the geometry. we'll deal with it later */
ib->icon_area.x = x;
ib->icon_area.y = y;
D_RETURN;
}
/* called when an ebit object bit needs to resize */
@ -622,10 +687,14 @@ ib_bits_resize(void *data, double w, double h)
E_Iconbar *ib;
Evas_List l;
D_ENTER;
ib = (E_Iconbar *)data;
/* dont do anything.. just record the geometry. we'll deal with it later */
ib->icon_area.w = w;
ib->icon_area.h = h;
D_RETURN;
}
/* called when the ebits object bit needs to be raised */
@ -635,6 +704,8 @@ ib_bits_raise(void *data)
E_Iconbar *ib;
Evas_List l;
D_ENTER;
ib = (E_Iconbar *)data;
/* raise all the icons */
for (l = ib->icons; l; l = l->next)
@ -644,6 +715,8 @@ ib_bits_raise(void *data)
ic = l->data;
evas_raise(ic->iconbar->view->evas, ic->image);
}
D_RETURN;
}
/* called when the ebits object bit needs to be lowered */
@ -653,6 +726,8 @@ ib_bits_lower(void *data)
E_Iconbar *ib;
Evas_List l;
D_ENTER;
ib = (E_Iconbar *)data;
/* lower all the icons */
for (l = ib->icons; l; l = l->next)
@ -662,6 +737,8 @@ ib_bits_lower(void *data)
ic = l->data;
evas_lower(ic->iconbar->view->evas, ic->image);
}
D_RETURN;
}
/* called when the ebits object bit needs to change layers */
@ -671,6 +748,8 @@ ib_bits_set_layer(void *data, int lay)
E_Iconbar *ib;
Evas_List l;
D_ENTER;
ib = (E_Iconbar *)data;
/* set the layer for all the icons */
for (l = ib->icons; l; l = l->next)
@ -680,6 +759,8 @@ ib_bits_set_layer(void *data, int lay)
ic = l->data;
evas_set_layer(ic->iconbar->view->evas, ic->image, lay);
}
D_RETURN;
}
/* not used... err.. ebits clips for us to the maximum allowed space of */
@ -687,28 +768,44 @@ ib_bits_set_layer(void *data, int lay)
static void
ib_bits_set_clip(void *data, Evas_Object clip)
{
D_ENTER;
D_RETURN;
}
/* we arent going to recolor our icons here according to color class */
static void
ib_bits_set_color_class(void *data, char *cc, int r, int g, int b, int a)
{
D_ENTER;
D_RETURN;
}
/* our minimum size for icon space is 0x0 */
static void
ib_bits_get_min_size(void *data, double *w, double *h)
{
D_ENTER;
*w = 0;
*h = 0;
D_RETURN;
}
/* our maximum is huge */
static void
ib_bits_get_max_size(void *data, double *w, double *h)
{
D_ENTER;
*w = 999999;
*h = 999999;
D_RETURN;
}
@ -723,6 +820,8 @@ ib_mouse_in(void *data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
{
E_Iconbar_Icon *ic;
D_ENTER;
/* get he iconbaricon pointer from the data member */
ic = (E_Iconbar_Icon *)data;
/* set hilited flag */
@ -744,6 +843,8 @@ ib_mouse_in(void *data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
/* a redraw is needed */
ic->iconbar->view->changed = 1;
D_RETURN;
}
/* called when a mouse goes out of an icon object */
@ -752,6 +853,8 @@ ib_mouse_out(void *data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
{
E_Iconbar_Icon *ic;
D_ENTER;
/* get he iconbaricon pointer from the data member */
ic = (E_Iconbar_Icon *)data;
/* unset hilited flag */
@ -759,6 +862,8 @@ ib_mouse_out(void *data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
/* tell the view the iconbar is in.. something changed that might mean */
/* a redraw is needed */
ic->iconbar->view->changed = 1;
D_RETURN;
}
/* called when the mouse goes down on an icon object */
@ -767,14 +872,21 @@ ib_mouse_down(void *data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
{
E_Iconbar_Icon *ic;
D_ENTER;
/* get he iconbaricon pointer from the data member */
ic = (E_Iconbar_Icon *)data;
/* run something! */
if (ic->exec) e_exec_run(ic->exec);
D_RETURN;
}
/* called when the mouse goes up on an icon object */
static void
ib_mouse_up(void *data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
{
D_ENTER;
D_RETURN;
}

View File

@ -5,6 +5,7 @@
#include "config.h"
#include "exec.h"
#include "view.h"
#include "object.h"
typedef struct _E_Iconbar_Icon E_Iconbar_Icon;
#ifndef E_ICONBAR_TYPEDEF
@ -19,7 +20,7 @@ typedef struct _E_View E_View;
struct _E_Iconbar
{
OBJ_PROPERTIES;
E_Object o;
E_View *view;
Evas_List icons;
@ -32,7 +33,7 @@ struct _E_Iconbar
struct _E_Iconbar_Icon
{
OBJ_PROPERTIES;
E_Object o;
E_Iconbar *iconbar;
@ -51,7 +52,6 @@ struct _E_Iconbar_Icon
void e_iconbar_init(void);
E_Iconbar *e_iconbar_new(E_View *v);
void e_iconbar_free(E_Iconbar *ib);
void e_iconbar_icon_free(E_Iconbar_Icon *);
void e_iconbar_realize(E_Iconbar *ib);
void e_iconbar_fix(E_Iconbar *ib);

View File

@ -1,3 +1,4 @@
#include "debug.h"
#include "keys.h"
#include "actions.h"
@ -9,6 +10,8 @@ e_key_down(Ecore_Event * ev)
{
Ecore_Event_Key_Down *e;
D_ENTER;
e = ev->event;
if (e->win == ecore_get_key_grab_win())
{
@ -17,6 +20,8 @@ e_key_down(Ecore_Event * ev)
e_action_start("Key_Binding", ACT_KEY_DOWN, 0, e->key, e->mods,
NULL, NULL, 0, 0, 0, 0);
}
D_RETURN;
}
static void
@ -24,6 +29,8 @@ e_key_up(Ecore_Event * ev)
{
Ecore_Event_Key_Up *e;
D_ENTER;
e = ev->event;
if (e->win == ecore_get_key_grab_win())
{
@ -32,26 +39,40 @@ e_key_up(Ecore_Event * ev)
e_action_start("Key_Binding", ACT_KEY_UP, 0, e->key, e->mods,
NULL, NULL, 0, 0, 0, 0);
}
D_RETURN;
}
void
e_keys_init(void)
{
D_ENTER;
/* load up our actions .... once to get some grabbed keys */
e_action_start("", ACT_KEY_DOWN, 0, NULL, ECORE_EVENT_KEY_MODIFIER_NONE,
NULL, NULL, 0, 0, 0, 0);
ecore_event_filter_handler_add(ECORE_EVENT_KEY_DOWN, e_key_down);
ecore_event_filter_handler_add(ECORE_EVENT_KEY_UP, e_key_up);
D_RETURN;
}
void
e_keys_grab(char *key, Ecore_Event_Key_Modifiers mods, int anymod)
{
D_ENTER;
ecore_key_grab(key, mods, anymod, 0);
D_RETURN;
}
void
e_keys_ungrab(char *key, Ecore_Event_Key_Modifiers mods, int anymod)
{
D_ENTER;
ecore_key_ungrab(key, mods, anymod);
D_RETURN;
}

View File

@ -1,3 +1,4 @@
#include "debug.h"
#include "actions.h"
#include "guides.h"
#include "cursors.h"
@ -31,13 +32,19 @@ static void setup(void);
static void cb_exit(void)
{
D_ENTER;
E_PROF_DUMP;
D_RETURN;
}
static void
wm_running_error(Display * d, XErrorEvent * ev)
{
D_ENTER;
if ((ev->request_code == X_ChangeWindowAttributes) &&
(ev->error_code == BadAccess))
{
@ -45,12 +52,16 @@ wm_running_error(Display * d, XErrorEvent * ev)
fprintf(stderr, "Exiting Enlightenment. Error.\n");
exit(-2);
}
D_RETURN;
UN(d);
}
static void
setup(void)
{
D_ENTER;
ecore_grab();
ecore_sync();
@ -59,6 +70,8 @@ setup(void)
e_border_adopt_children(0);
ecore_ungrab();
D_RETURN;
}
int

View File

@ -1,8 +1,11 @@
#include "debug.h"
#include "match.h"
void
e_match_set_props(E_Border *b)
{
D_ENTER;
#if 0
/* if we have a match that says to ignore prog coords: */
b->client.pos.requested = 0;
@ -34,4 +37,6 @@ e_match_set_props(E_Border *b)
/* if we have a match specifying layer */
b->client.layer = match_layer;
#endif
D_RETURN;
}

File diff suppressed because it is too large Load Diff

View File

@ -2,13 +2,14 @@
#define E_MENU_H
#include "e.h"
#include "object.h"
typedef struct _E_Menu E_Menu;
typedef struct _E_Menu_Item E_Menu_Item;
struct _E_Menu
{
OBJ_PROPERTIES;
E_Object o;
struct {
int x, y, w, h;
@ -45,8 +46,6 @@ struct _E_Menu
struct _E_Menu_Item
{
OBJ_PROPERTIES;
int x, y;
struct {
struct {
@ -106,7 +105,6 @@ void e_menu_set_background(E_Menu *m);
void e_menu_set_sel(E_Menu *m, E_Menu_Item *mi);
void e_menu_set_sep(E_Menu *m, E_Menu_Item *mi);
void e_menu_set_state(E_Menu *m, E_Menu_Item *mi);
void e_menu_free(E_Menu *m);
E_Menu *e_menu_new(void );
void e_menu_hide(E_Menu *m);
void e_menu_show(E_Menu *m);

View File

@ -1,3 +1,4 @@
#include "debug.h"
#include "menu.h"
#include "menubuild.h"
#include "exec.h"
@ -24,10 +25,13 @@ static void
e_build_menu_cb_exec(E_Menu *m, E_Menu_Item *mi, void *data)
{
char *exe;
D_ENTER;
exe = data;
e_exec_run(exe);
return;
D_RETURN;
UN(m);
UN(mi);
}
@ -37,6 +41,8 @@ e_build_menu_cb_script(E_Menu *m, E_Menu_Item *mi, void *data)
{
char *script;
D_ENTER;
#ifdef USE_FERITE
script = data;
e_ferite_run(script);
@ -44,7 +50,7 @@ e_build_menu_cb_script(E_Menu *m, E_Menu_Item *mi, void *data)
printf( "No cookies for you. You will have to install ferite.\n" );
#endif
return;
D_RETURN;
UN(m);
UN(mi);
UN(script);
@ -56,6 +62,8 @@ e_build_menu_unbuild(E_Build_Menu *bm)
{
Evas_List l;
D_ENTER;
bm->menu = NULL;
if (bm->menus)
{
@ -68,7 +76,8 @@ e_build_menu_unbuild(E_Build_Menu *bm)
e_menu_update_shows(m);
e_menu_update_hides(m);
e_menu_update_finish(m);
OBJ_DO_FREE(m);
e_object_unref(E_OBJECT(m));
}
bm->menus = evas_list_free(bm->menus);
}
@ -80,6 +89,8 @@ e_build_menu_unbuild(E_Build_Menu *bm)
}
bm->commands = evas_list_free(bm->commands);
}
D_RETURN;
}
@ -92,12 +103,14 @@ e_build_menu_db_poll(int val, void *data)
time_t mod;
E_Build_Menu *bm;
D_ENTER;
bm = data;
mod = e_file_modified_time(bm->file);
if (mod <= bm->mod_time)
{
ecore_add_event_timer(bm->file, 1.0, e_build_menu_db_poll, 0, data);
return;
D_RETURN;
}
bm->mod_time = mod;
@ -106,7 +119,8 @@ e_build_menu_db_poll(int val, void *data)
if (!bm->menu) bm->mod_time = 0;
ecore_add_event_timer(bm->file, 1.0, e_build_menu_db_poll, 0, data);
return;
D_RETURN;
UN(val);
}
@ -116,12 +130,14 @@ e_build_menu_gnome_apps_poll(int val, void *data)
time_t mod;
E_Build_Menu *bm;
D_ENTER;
bm = data;
mod = e_file_modified_time(bm->file);
if (mod <= bm->mod_time)
{
ecore_add_event_timer(bm->file, 1.0, e_build_menu_gnome_apps_poll, 0, data);
return;
D_RETURN;
}
bm->mod_time = mod;
@ -130,7 +146,8 @@ e_build_menu_gnome_apps_poll(int val, void *data)
if (!bm->menu) bm->mod_time = 0;
ecore_add_event_timer(bm->file, 1.0, e_build_menu_gnome_apps_poll, 0, data);
return;
D_RETURN;
UN(val);
}
@ -141,8 +158,10 @@ e_build_menu_db_build_number(E_Build_Menu *bm, E_DB_File *db, int num)
char buf[PATH_MAX];
int num2, i2;
D_ENTER;
sprintf(buf, "/menu/%i/count", num);
if (!e_db_int_get(db, buf, &num2)) return NULL;
if (!e_db_int_get(db, buf, &num2)) D_RETURN_(NULL);
menu = e_menu_new();
e_menu_set_padding_icon(menu, 2);
e_menu_set_padding_state(menu, 2);
@ -194,7 +213,8 @@ e_build_menu_db_build_number(E_Build_Menu *bm, E_DB_File *db, int num)
e_menu_add_item(menu, menuitem);
}
bm->menus = evas_list_prepend(bm->menus, menu);
return menu;
D_RETURN_(menu);
}
static void
@ -203,14 +223,18 @@ e_build_menu_db_build(E_Build_Menu *bm)
E_DB_File *db;
int num;
D_ENTER;
e_db_flush();
db = e_db_open_read(bm->file);
if (!db) return;
if (!db) D_RETURN;
if (!e_db_int_get(db, "/menu/count", &num)) goto error;
if (num > 0) bm->menu = e_build_menu_db_build_number(bm, db, 0);
error:
e_db_close(db);
D_RETURN;
}
@ -223,6 +247,8 @@ e_build_menu_gnome_apps_build_dir(E_Build_Menu *bm, char *dir)
E_Menu *menu = NULL;
Evas_List l, entries = NULL;
D_ENTER;
menu = e_menu_new();
e_menu_set_padding_icon(menu, 2);
e_menu_set_padding_state(menu, 2);
@ -384,7 +410,8 @@ e_build_menu_gnome_apps_build_dir(E_Build_Menu *bm, char *dir)
}
if (entries) evas_list_free(entries);
bm->menus = evas_list_prepend(bm->menus, menu);
return menu;
D_RETURN_(menu);
}
static void
@ -392,18 +419,28 @@ e_build_menu_gnome_apps_build(E_Build_Menu *bm)
{
E_Menu *menu;
D_ENTER;
menu = e_build_menu_gnome_apps_build_dir(bm, bm->file);
bm->menu = menu;
D_RETURN;
}
void
e_build_menu_free(E_Build_Menu *bm)
static void
e_build_menu_cleanup(E_Build_Menu *bm)
{
D_ENTER;
ecore_del_event_timer(bm->file);
e_build_menu_unbuild(bm);
IF_FREE(bm->file);
build_menus = evas_list_remove(build_menus, bm);
FREE(bm);
/* Call the destructor of the base class */
e_object_cleanup(E_OBJECT(bm));
D_RETURN;
}
E_Build_Menu *
@ -411,16 +448,20 @@ e_build_menu_new_from_db(char *file)
{
E_Build_Menu *bm;
if (!file) return NULL;
D_ENTER;
if (!file) D_RETURN_(NULL);
bm = NEW(E_Build_Menu, 1);
ZERO(bm, E_Build_Menu, 1);
OBJ_INIT(bm, e_build_menu_free);
e_object_init(E_OBJECT(bm), (E_Cleanup_Func) e_build_menu_cleanup);
bm->file = strdup(file);
build_menus = evas_list_prepend(build_menus, bm);
e_build_menu_db_poll(0, bm);
return bm;
D_RETURN_(bm);
}
E_Build_Menu *
@ -428,14 +469,18 @@ e_build_menu_new_from_gnome_apps(char *dir)
{
E_Build_Menu *bm;
if (!dir) return NULL;
D_ENTER;
if (!dir) D_RETURN_(NULL);
bm = NEW(E_Build_Menu, 1);
ZERO(bm, E_Build_Menu, 1);
OBJ_INIT(bm, e_build_menu_free);
e_object_init(E_OBJECT(bm), (E_Cleanup_Func) e_build_menu_cleanup);
bm->file = strdup(dir);
build_menus = evas_list_prepend(build_menus, bm);
e_build_menu_gnome_apps_poll(0, bm);
return bm;
D_RETURN_(bm);
}

View File

@ -2,12 +2,13 @@
#define E_MENU_BUILD_H
#include "e.h"
#include "object.h"
typedef struct _E_Build_Menu E_Build_Menu;
struct _E_Build_Menu
{
OBJ_PROPERTIES;
E_Object o;
char *file;
time_t mod_time;
@ -18,7 +19,6 @@ struct _E_Build_Menu
Evas_List commands;
};
void e_build_menu_free(E_Build_Menu *bm);
E_Build_Menu *e_build_menu_new_from_db(char *file);
E_Build_Menu *e_build_menu_new_from_gnome_apps(char *dir);

79
src/object.c Normal file
View File

@ -0,0 +1,79 @@
#include "debug.h"
#include "object.h"
void
e_object_init(E_Object *obj, E_Cleanup_Func cleanup_func)
{
D_ENTER;
if (!obj)
D_RETURN;
memset(obj, 0, sizeof(E_Object));
obj->references = 1;
obj->cleanup_func = cleanup_func;
D_RETURN;
}
void
e_object_cleanup(E_Object *obj)
{
D_ENTER;
if (!obj)
D_RETURN;
free(obj);
D_RETURN;
}
void
e_object_ref(E_Object *obj)
{
D_ENTER;
if (!obj)
D_RETURN;
obj->references++;
printf("++ refcount on %p, now %i\n", obj, obj->references);
D_RETURN;
}
int
e_object_unref(E_Object *obj)
{
D_ENTER;
if (!obj)
D_RETURN_(-1);
obj->references--;
printf("-- refcount on %p, now %i\n", obj, obj->references);
if (obj->references == 0 && obj->cleanup_func)
{
printf("Refcount is zero, freeing.\n");
obj->cleanup_func(obj);
D_RETURN_(0);
}
D_RETURN_(obj->references);
}
int
e_object_get_usecount(E_Object *obj)
{
D_ENTER;
if (!obj)
D_RETURN_(-1);
D_RETURN_(obj->references);
}

78
src/object.h Normal file
View File

@ -0,0 +1,78 @@
#ifndef E_OBJECT_H
#define E_OBJECT_H
#include <Evas.h>
#include <Ecore.h>
#define E_OBJECT(x) ((E_Object*)(x))
typedef void (*E_Cleanup_Func) (void *object);
typedef struct _e_object
{
int references;
E_Cleanup_Func cleanup_func;
} E_Object;
/**
* e_object_init - Initializes an E object
* @obj The object to initalize
* @cleanup_func The destructor function for this object
*
* This function initializes an E object. It registers
* the @cleanup_func that is to be called when the use
* count on this object drops to zero. This destructor
* then cleans up the object, from the derived classes up
* the hierarchy to the highest ancestor, E_Object. You
* MUST call the destructor of the base class at the end
* of a destructor, or you're creating a leak. Moreover,
* those destructors MUST NOT call free() on the object
* itself, only clean up things that are pointed to etc.
* The final free() call has to happen in the root class,
* here, it happens in e_object_cleanup().
*/
void e_object_init(E_Object *obj, E_Cleanup_Func cleanup_func);
/**
* e_object_cleanup - Cleanup function for E_Objects
* @obj The object to clean up
*
* This is the most basic destructor function, the only
* one which does not call another base class destructor
* at the end. This is the place where the final free()
* call occurs.
*/
void e_object_cleanup(E_Object *obj);
/**
* e_object_ref - Increment the reference count of this object
* @obj The object whose reference count to increase
*/
void e_object_ref(E_Object *obj);
/**
* e_object_unref - Decrememnt the reference count of this object
* @obj The object whose reference count to decrease
*
* This function decreases an object's reference counter. If
* the counter drops to zero, the objects cleanup_func()
* that was passed with e_object_init() is called. This function
* is the destructor of the most derived class of this object,
* and works its way back to the root class's destructor,
* e_object_cleanup().
*/
int e_object_unref(E_Object *obj);
/**
* e_object_get_usecount - Returns the current use count
* @obj The object whose use count to return
*
* This function returns the use count of an object. Use this
* function when you want to perform tasks before an object
* gets cleaned up by checking if the use count is one,
* cleaning up, and then calling e_object_unref().
*/
int e_object_get_usecount(E_Object *obj);
#endif

146
src/observer.c Normal file
View File

@ -0,0 +1,146 @@
#include <string.h>
#include "debug.h"
#include "observer.h"
void
e_observer_init(E_Observer *obs, Ecore_Event_Type event,
E_Notify_Func notify_func,
E_Cleanup_Func cleanup_func)
{
D_ENTER;
if (!obs)
D_RETURN;
memset(obs, 0, sizeof(E_Observer));
obs->watched = NULL;
obs->event = event;
obs->notify_func = notify_func;
e_object_init(E_OBJECT(obs), cleanup_func);
D_RETURN;
}
void
e_observer_cleanup(E_Observer *obs)
{
E_Observee *o = NULL;
D_ENTER;
if (!obs)
D_RETURN;
while (obs->watched)
{
o = E_OBSERVEE(obs->watched->data);
e_observer_unregister_observee(obs, o);
}
/* Call the destructor of the base class */
e_object_cleanup(E_OBJECT(obs));
D_RETURN;
}
void
e_observer_register_observee(E_Observer *observer, E_Observee *observee)
{
D_ENTER;
if (!observer || !observee)
D_RETURN;
observee->observers = evas_list_append(observee->observers, observer);
observer->watched = evas_list_append(observer->watched, observee);
D_RETURN;
}
void
e_observer_unregister_observee(E_Observer *observer, E_Observee *observee)
{
D_ENTER;
if (!observer || !observee)
D_RETURN;
observee->observers = evas_list_remove(observee->observers, observer);
observer->watched = evas_list_remove(observer->watched, observee);
D_RETURN;
}
/* --------------------- Observee code below */
void
e_observee_init(E_Observee *obs, E_Cleanup_Func cleanup_func)
{
D_ENTER;
if (!obs)
D_RETURN;
memset(obs, 0, sizeof(E_Observee));
e_object_init(E_OBJECT(obs), cleanup_func);
D_RETURN;
}
void
e_observee_notify_observers(E_Observee *o, Ecore_Event_Type event)
{
Evas_List obs_list = NULL;
E_Observer *obs = NULL;
D_ENTER;
if (!o)
D_RETURN;
for (obs_list = o->observers; obs_list; obs_list = obs_list->next)
{
obs = E_OBSERVER(obs_list->data);
if (obs->event == ECORE_EVENT_MAX ||
obs->event == event)
{
obs->notify_func(obs, o);
}
}
D_RETURN;
}
void
e_observee_cleanup(E_Observee *obs)
{
E_Observer *observer = NULL;
D_ENTER;
if (!obs)
D_RETURN;
if (e_object_get_usecount(E_OBJECT(obs)) == 1)
{
while (obs->observers)
{
observer = E_OBSERVER(obs->observers->data);
e_observer_unregister_observee(observer, obs);
}
}
/* Call the destructor of the base class */
e_object_cleanup(E_OBJECT(obs));
D_RETURN;
}

107
src/observer.h Normal file
View File

@ -0,0 +1,107 @@
#ifndef E_OBSERVER_H
#define E_OBSERVER_H
#include <Ecore.h>
#include "e.h"
#include "object.h"
#define E_OBSERVER(x) ((E_Observer*)(x))
#define E_OBSERVEE(x) ((E_Observee*)(x))
typedef struct _e_observer E_Observer;
typedef struct _e_observee E_Observee;
typedef void(*E_Notify_Func)(E_Observer *observer, E_Observee *observee);
struct _e_observer
{
E_Object obj;
Evas_List watched; /* list<E_Observee> */
Ecore_Event_Type event;
E_Notify_Func notify_func;
};
struct _e_observee
{
E_Object obj;
Evas_List observers; /* list<E_Observer> */
};
/**
* e_observer_init - Initializes an observer
* @obs The observer to initialize
* @event The Ecore event for which this observer will be responsible
* @nofify_func The function the observer calls when it gets notified
* @cleanup_func The destructor function to pass to the E_Object initializer
*
* This function initializes an observer. Observees can register observers,
* which will call the given @notify_func when an observer issues an
* e_observee_notify_observers() call. Observers are derived from
* E_Objects, therefore, this function also handles E_Object initalization.
*/
void e_observer_init(E_Observer *obs, Ecore_Event_Type event,
E_Notify_Func notify_func,
E_Cleanup_Func cleanup_func);
/**
* e_observer_cleanup - Cleans up an observer.
* @obs The observer to clean up
*
* This function cleans up an observer by unregistering all observees.
*/
void e_observer_cleanup(E_Observer *obs);
/**
* e_observer_register_observee - Registers an observee
* @observer The observer which registers the observee
* @observee The observee which registers the observer
*
* This function registers the observer in the observee and vice versa.
*/
void e_observer_register_observee(E_Observer *observer, E_Observee *observee);
/**
* e_observer_unregister_observee - Unregisters an observee
* @observer The observer which unregisters the observee
* @observee The observee which unregisters the observer
*
* This function unregisters the observer in the observee and vice versa.
*/
void e_observer_unregister_observee(E_Observer *observer, E_Observee *observee);
/**
* e_observee_init - Initializes an observee.
* @obs The observee to initialize
* @cleanup_func The destructor function for cleaning this observee up
*
* This function initializes an observee. Observees are derived
* from E_Objects, which is why this function gets the destructor
* function as a parameter. It is passed on to e_object_init().
*/
void e_observee_init(E_Observee *obs, E_Cleanup_Func cleanup_func);
/**
* e_observee_cleanup - Cleans up an observee.
* @obs The observee to clean up
*
* This function cleans up an observee by unregistering it from all observers.
*/
void e_observee_cleanup(E_Observee *obs);
/**
* e_observee_notify_observers - Notify observers of a given Ecore event
* @o The observee which notifies its observers
* @event The event by which to filter the observers
*
* This function scans the registered observers in the observee
* and calls the notify_func() of the observers that are
* responsible for the given @event.
*/
void e_observee_notify_observers(E_Observee *o, Ecore_Event_Type event);
#endif

View File

@ -1,3 +1,4 @@
#include "debug.h"
#include "config.h"
#include "place.h"
#include "actions.h"
@ -15,8 +16,12 @@ e_mouse_down(Ecore_Event * ev)
{
Ecore_Event_Mouse_Down *e;
D_ENTER;
e = ev->event;
if (!win_place) return;
if (!win_place) D_RETURN;
D_RETURN;
}
static void
@ -24,13 +29,16 @@ e_mouse_up(Ecore_Event * ev)
{
Ecore_Event_Mouse_Up *e;
D_ENTER;
e = ev->event;
if (!win_place) return;
if (!win_place) D_RETURN;
e_action_stop("Window_Place", ACT_MOUSE_UP, 1, NULL,
ECORE_EVENT_KEY_MODIFIER_NONE, NULL, NULL, e->x, e->y, e->rx, e->ry);
ecore_window_destroy(win_place);
win_place = 0;
return;
D_RETURN;
}
static void
@ -38,13 +46,17 @@ e_mouse_move(Ecore_Event * ev)
{
Ecore_Event_Mouse_Move *e;
D_ENTER;
e = ev->event;
if (!win_place) return;
if (!win_place) D_RETURN;
e_action_cont("Window_Place", ACT_MOUSE_MOVE, 1, NULL,
ECORE_EVENT_KEY_MODIFIER_NONE, NULL, NULL, e->x, e->y, e->rx, e->ry,
e->rx - prx, e->ry - pry);
prx = e->rx;
pry = e->ry;
D_RETURN;
}
static int
@ -55,6 +67,8 @@ e_place_manual(E_Border *b, E_Desktop *desk, int *x, int *y)
int move_mode = E_GUIDES_BOX;
E_CFG_INT(cfg_window_move_mode, "settings", "/window/move/mode", E_GUIDES_BOX);
D_ENTER;
E_CONFIG_INT_GET(cfg_window_move_mode, move_mode);
w = b->current.requested.w;
h = b->current.requested.h;
@ -87,10 +101,10 @@ e_place_manual(E_Border *b, E_Desktop *desk, int *x, int *y)
/* start a move mode */
e_action_stop_by_type("Window_Place");
e_action_start("Window_Place", ACT_MOUSE_CLICK, 1, NULL,
ECORE_EVENT_KEY_MODIFIER_NONE, b, NULL, mx, my, rx, ry);
ECORE_EVENT_KEY_MODIFIER_NONE, E_OBJECT(b), NULL, mx, my, rx, ry);
if (move_mode != E_GUIDES_OPAQUE) return 0;
return 1;
if (move_mode != E_GUIDES_OPAQUE) D_RETURN_(0);
D_RETURN_(1);
}
static int
@ -101,6 +115,8 @@ e_place_smart(E_Border *b, E_Desktop *desk, int *x, int *y)
int *a_x = NULL, *a_y = NULL;
Evas_List l;
D_ENTER;
w = b->current.requested.w;
h = b->current.requested.h;
a_w = 2;
@ -411,7 +427,8 @@ e_place_smart(E_Border *b, E_Desktop *desk, int *x, int *y)
done:
FREE(a_x);
FREE(a_y);
return 1;
D_RETURN_(1);
}
static int
@ -419,11 +436,14 @@ e_place_middle(E_Border *b, E_Desktop *desk, int *x, int *y)
{
int w, h;
D_ENTER;
w = b->current.requested.w;
h = b->current.requested.h;
*x = (desk->real.w - w) / 2;
*y = (desk->real.h - h) / 2;
return 1;
D_RETURN_(1);
}
static int
@ -434,6 +454,8 @@ e_place_cascade(E_Border *b, E_Desktop *desk, int *x, int *y)
static int count_y = 0;
int pl, pr, pt, pb;
D_ENTER;
pl = pr = pt = pb = 0;
if (b->bits.l) ebits_get_insets(b->bits.l, &pl, &pr, &pt, &pb);
w = b->current.requested.w;
@ -444,7 +466,8 @@ e_place_cascade(E_Border *b, E_Desktop *desk, int *x, int *y)
*y = count_y;
count_x += pl;
count_y += pt;
return 1;
D_RETURN_(1);
}
static int
@ -452,6 +475,8 @@ e_place_random(E_Border *b, E_Desktop *desk, int *x, int *y)
{
int w, h;
D_ENTER;
w = b->current.requested.w;
h = b->current.requested.h;
@ -465,28 +490,45 @@ e_place_random(E_Border *b, E_Desktop *desk, int *x, int *y)
else
*y = 0;
return 1;
D_RETURN_(1);
}
int
e_place_border(E_Border *b, E_Desktop *desk, int *x, int *y, E_Placement_Mode mode)
{
int result = 1;
D_ENTER;
if (b->client.no_place)
return 1;
D_RETURN_(1);
if (mode == E_PLACE_MANUAL) return e_place_manual (b, desk, x, y);
if (mode == E_PLACE_SMART) return e_place_smart (b, desk, x, y);
if (mode == E_PLACE_MIDDLE) return e_place_middle (b, desk, x, y);
if (mode == E_PLACE_CASCADE) return e_place_cascade(b, desk, x, y);
if (mode == E_PLACE_RANDOM) return e_place_random (b, desk, x, y);
switch (mode)
{
case E_PLACE_MANUAL:
result = e_place_manual (b, desk, x, y);
case E_PLACE_SMART:
result = e_place_smart (b, desk, x, y);
case E_PLACE_MIDDLE:
result = e_place_middle (b, desk, x, y);
case E_PLACE_CASCADE:
result = e_place_cascade(b, desk, x, y);
case E_PLACE_RANDOM:
result = e_place_random (b, desk, x, y);
default:
}
return 1;
D_RETURN_(result);
}
void
e_place_init(void)
{
D_ENTER;
ecore_event_filter_handler_add(ECORE_EVENT_MOUSE_DOWN, e_mouse_down);
ecore_event_filter_handler_add(ECORE_EVENT_MOUSE_UP, e_mouse_up);
ecore_event_filter_handler_add(ECORE_EVENT_MOUSE_MOVE, e_mouse_move);
D_RETURN;
}

View File

@ -15,8 +15,27 @@ typedef enum e_placement_mode
}
E_Placement_Mode;
int e_place_border(E_Border *b, E_Desktop *desk, int *x, int *y, E_Placement_Mode mode);
/**
* e_place_init - window placement initialization
*
* This function registers the event handlers necessary
* to be able to manage window placement strategies.
*/
void e_place_init(void);
/**
* e_place_border - calculates window coordinates with given strategy
* @b: The border if the window for which to calculate coordinates
* @desk: The desktop on which to perform the calculation
* @x: Result pointer to an integer which gets the resulting x coordinate
* @y: Result pointer to an integer which gets the resulting y coordinate
* @mode: The placement mode. Any of the values in the E_Placement_Mode enum.
*
* This function calculates coordinates for a given window border
* and returns them in the @x and @y pointers. It does not actually
* place the window.
*/
int e_place_border(E_Border *b, E_Desktop *desk, int *x, int *y, E_Placement_Mode mode);
#endif

View File

@ -1,3 +1,4 @@
#include "debug.h"
#include "resist.h"
#include "config.h"
#include "desktops.h"
@ -16,6 +17,9 @@ e_resist_border(E_Border *b)
E_CFG_INT(cfg_resist, "settings", "/move/resist", 1);
E_CFG_INT(cfg_desk_resist, "settings", "/move/resist/desk", 32);
E_CFG_INT(cfg_win_resist, "settings", "/move/resist/win", 12);
D_ENTER;
E_CONFIG_INT_GET(cfg_resist, resist);
E_CONFIG_INT_GET(cfg_desk_resist, desk_resist);
@ -24,9 +28,9 @@ e_resist_border(E_Border *b)
{
b->current.x = b->current.requested.x;
b->current.y = b->current.requested.y;
return;
D_RETURN;
}
if (!b->desk) return;
if (!b->desk) D_RETURN;
dx = b->current.requested.x - b->previous.requested.x;
dy = b->current.requested.y - b->previous.requested.y;
/* edges of screen */
@ -131,4 +135,6 @@ rects = evas_list_append(rects, r); \
else
b->current.y = b->current.requested.y + resist_y;
}
D_RETURN;
}

View File

@ -1,3 +1,4 @@
#include "debug.h"
#include "scrollbar.h"
#include "config.h"
@ -13,6 +14,8 @@ static void e_sb_bar_move_cb(void *data, Ebits_Object o, char *class, int bt, in
static void
e_scrollbar_recalc(E_Scrollbar *sb)
{
D_ENTER;
if (sb->base)
{
double x, y, w, h;
@ -51,6 +54,8 @@ e_scrollbar_recalc(E_Scrollbar *sb)
sb->bar_pos.w = sb->bar_area.w;
sb->bar_pos.h = sb->bar_area.h;
}
D_RETURN;
UN(sb);
}
@ -59,6 +64,8 @@ e_scrollbar_setup_bits(E_Scrollbar *sb)
{
char buf[PATH_MAX];
D_ENTER;
if (sb->direction == 1)
{
sprintf(buf, "%s/scroll_base_v.bits.db", e_config_get("scrollbars"));
@ -90,6 +97,8 @@ e_scrollbar_setup_bits(E_Scrollbar *sb)
ebits_set_classed_bit_callback(sb->bar, "Scrollbar_Bar", CALLBACK_MOUSE_UP, e_sb_bar_up_cb, sb);
ebits_set_classed_bit_callback(sb->bar, "Scrollbar_Bar", CALLBACK_MOUSE_MOVE, e_sb_bar_move_cb, sb);
}
D_RETURN;
}
static void
@ -98,10 +107,12 @@ e_sb_base_down_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y,
E_Scrollbar *sb;
double prev;
D_ENTER;
sb = data;
if (sb->mouse_down) return;
if (sb->mouse_down) D_RETURN;
sb->mouse_down = bt;
if (!class) return;
if (!class) D_RETURN;
prev = sb->val;
if (!strcmp(class, "Scrollbar_Arrow1"))
{
@ -123,6 +134,8 @@ e_sb_base_down_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y,
{
if (sb->func_change) sb->func_change(sb->func_data, sb, sb->val);
}
D_RETURN;
}
static void
@ -130,10 +143,12 @@ e_sb_base_up_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y, i
{
E_Scrollbar *sb;
D_ENTER;
sb = data;
if (bt == sb->mouse_down) sb->mouse_down = 0;
else return;
if (!class) return;
else D_RETURN;
if (!class) D_RETURN;
if (!strcmp(class, "Scrollbar_Arrow1"))
{
}
@ -143,6 +158,8 @@ e_sb_base_up_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y, i
else if (!strcmp(class, "Scrollbar_Trough"))
{
}
D_RETURN;
}
static void
@ -150,13 +167,17 @@ e_sb_bar_down_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y,
{
E_Scrollbar *sb;
D_ENTER;
sb = data;
if (sb->mouse_down) return;
if (sb->mouse_down) D_RETURN;
sb->mouse_down = bt;
sb->down_x = x;
sb->down_y = y;
sb->mouse_x = x;
sb->mouse_y = y;
D_RETURN;
}
static void
@ -164,9 +185,15 @@ e_sb_bar_up_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y, in
{
E_Scrollbar *sb;
D_ENTER;
sb = data;
if (bt == sb->mouse_down) sb->mouse_down = 0;
else return;
if (bt == sb->mouse_down)
sb->mouse_down = 0;
else
D_RETURN;
D_RETURN;
}
static void
@ -176,8 +203,10 @@ e_sb_bar_move_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y,
int dx, dy;
double prev;
D_ENTER;
sb = data;
if (!sb->mouse_down) return;
if (!sb->mouse_down) D_RETURN;
dx = x - sb->mouse_x;
dy = y - sb->mouse_y;
sb->mouse_x = x;
@ -204,6 +233,8 @@ e_sb_bar_move_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y,
if (sb->bar) ebits_resize(sb->bar, sb->bar_pos.w, sb->bar_pos.h);
if (sb->func_change) sb->func_change(sb->func_data, sb, sb->val);
}
D_RETURN;
}
E_Scrollbar *
@ -211,29 +242,38 @@ e_scrollbar_new(void)
{
E_Scrollbar *sb;
D_ENTER;
sb = NEW(E_Scrollbar, 1);
ZERO(sb, E_Scrollbar, 1);
sb->range = 1.0;
sb->max = 1.0;
sb->w = 12;
sb->h = 64;
return sb;
D_RETURN_(sb);
}
void
e_scrollbar_free(E_Scrollbar *sb)
{
D_ENTER;
if (sb->evas)
{
if (sb->base) ebits_free(sb->base);
if (sb->bar) ebits_free(sb->bar);
}
FREE(sb);
D_RETURN;
}
void
e_scrollbar_add_to_evas(E_Scrollbar *sb, Evas evas)
{
D_ENTER;
if (sb->evas)
{
if (sb->base) ebits_free(sb->base);
@ -256,53 +296,77 @@ e_scrollbar_add_to_evas(E_Scrollbar *sb, Evas evas)
if (sb->bar) ebits_show(sb->bar);
}
}
D_RETURN;
}
void
e_scrollbar_show(E_Scrollbar *sb)
{
if (sb->visible) return;
D_ENTER;
if (sb->visible) D_RETURN;
sb->visible = 1;
if (sb->base) ebits_show(sb->base);
if (sb->bar) ebits_show(sb->bar);
D_RETURN;
}
void
e_scrollbar_hide(E_Scrollbar *sb)
{
if (!sb->visible) return;
D_ENTER;
if (!sb->visible) D_RETURN;
sb->visible = 0;
if (sb->base) ebits_hide(sb->base);
if (sb->bar) ebits_hide(sb->bar);
D_RETURN;
}
void
e_scrollbar_raise(E_Scrollbar *sb)
{
D_ENTER;
if (sb->base) ebits_raise(sb->base);
if (sb->bar) ebits_raise(sb->bar);
D_RETURN;
}
void
e_scrollbar_lower(E_Scrollbar *sb)
{
D_ENTER;
if (sb->bar) ebits_lower(sb->bar);
if (sb->base) ebits_lower(sb->base);
D_RETURN;
}
void
e_scrollbar_set_layer(E_Scrollbar *sb, int l)
{
if (l == sb->layer) return;
D_ENTER;
if (l == sb->layer) D_RETURN;
sb->layer = l;
if (sb->base) ebits_set_layer(sb->base, sb->layer);
if (sb->bar) ebits_set_layer(sb->bar, sb->layer);
D_RETURN;
}
void
e_scrollbar_set_direction(E_Scrollbar *sb, int d)
{
if (d == sb->direction) return;
D_ENTER;
if (d == sb->direction) D_RETURN;
sb->direction = d;
if (sb->evas)
{
@ -314,29 +378,39 @@ e_scrollbar_set_direction(E_Scrollbar *sb, int d)
sb->evas = NULL;
e_scrollbar_add_to_evas(sb, evas);
}
}
D_RETURN;
}
void
e_scrollbar_move(E_Scrollbar *sb, double x, double y)
{
if ((x == sb->x) && (y == sb->y)) return;
D_ENTER;
if ((x == sb->x) && (y == sb->y)) D_RETURN;
sb->x = x;
sb->y = y;
if (sb->base) ebits_move(sb->base, sb->x, sb->y);
e_scrollbar_recalc(sb);
if (sb->bar) ebits_move(sb->bar, sb->bar_pos.x, sb->bar_pos.y);
D_RETURN;
}
void
e_scrollbar_resize(E_Scrollbar *sb, double w, double h)
{
if ((w == sb->w) && (h == sb->h)) return;
D_ENTER;
if ((w == sb->w) && (h == sb->h)) D_RETURN;
sb->w = w;
sb->h = h;
if (sb->base) ebits_resize(sb->base, sb->w, sb->h);
e_scrollbar_recalc(sb);
if (sb->bar) ebits_move(sb->bar, sb->bar_pos.x, sb->bar_pos.y);
if (sb->bar) ebits_resize(sb->bar, sb->bar_pos.w, sb->bar_pos.h);
D_RETURN;
}
void
@ -344,14 +418,20 @@ e_scrollbar_set_change_func(E_Scrollbar *sb,
void (*func_change) (void *_data, E_Scrollbar *sb, double val),
void *data)
{
D_ENTER;
sb->func_change = func_change;
sb->func_data = data;
D_RETURN;
}
void
e_scrollbar_set_value(E_Scrollbar *sb, double val)
{
if (sb->val == val) return;
D_ENTER;
if (sb->val == val) D_RETURN;
if (val > sb->max - sb->range) val = sb->max - sb->range;
if (val < 0 ) val = 0;
sb->val = val;
@ -359,51 +439,71 @@ e_scrollbar_set_value(E_Scrollbar *sb, double val)
if (sb->bar) ebits_move(sb->bar, sb->bar_pos.x, sb->bar_pos.y);
if (sb->bar) ebits_resize(sb->bar, sb->bar_pos.w, sb->bar_pos.h);
if (sb->func_change) sb->func_change(sb->func_data, sb, sb->val);
D_RETURN;
}
void
e_scrollbar_set_range(E_Scrollbar *sb, double range)
{
if (sb->range == range) return;
D_ENTER;
if (sb->range == range) D_RETURN;
sb->range = range;
e_scrollbar_recalc(sb);
if (sb->bar) ebits_move(sb->bar, sb->bar_pos.x, sb->bar_pos.y);
if (sb->bar) ebits_resize(sb->bar, sb->bar_pos.w, sb->bar_pos.h);
D_RETURN;
}
void
e_scrollbar_set_max(E_Scrollbar *sb, double max)
{
if (sb->max == max) return;
D_ENTER;
if (sb->max == max) D_RETURN;
sb->max = max;
e_scrollbar_recalc(sb);
if (sb->bar) ebits_move(sb->bar, sb->bar_pos.x, sb->bar_pos.y);
if (sb->bar) ebits_resize(sb->bar, sb->bar_pos.w, sb->bar_pos.h);
D_RETURN;
}
double
e_scrollbar_get_value(E_Scrollbar *sb)
{
return sb->val;
D_ENTER;
D_RETURN_(sb->val);
}
double
e_scrollbar_get_range(E_Scrollbar *sb)
{
return sb->range;
D_ENTER;
D_RETURN_(sb->range);
}
double
e_scrollbar_get_max(E_Scrollbar *sb)
{
return sb->max;
D_ENTER;
D_RETURN_(sb->max);
}
void
e_scrollbar_get_geometry(E_Scrollbar *sb, double *x, double *y, double *w, double *h)
{
D_ENTER;
if (x) *x = sb->x;
if (y) *y = sb->y;
if (w) *w = sb->w;
if (h) *h = sb->h;
D_RETURN;
}

View File

@ -1,3 +1,4 @@
#include "debug.h"
#include "text.h"
E_Text *
@ -5,6 +6,8 @@ e_text_new(Evas evas, char *text, char *class)
{
E_Text *t;
D_ENTER;
t = NEW(E_Text, 1);
ZERO(t, E_Text, 1);
t->state = strdup("normal");
@ -38,12 +41,15 @@ e_text_new(Evas evas, char *text, char *class)
t->min.h = t->h + 2;
t->max.w = t->w + 2;
t->max.h = t->h + 2;
return t;
D_RETURN_(t);
}
void
e_text_free(E_Text *t)
{
D_ENTER;
IF_FREE(t->state);
IF_FREE(t->class);
IF_FREE(t->text);
@ -57,13 +63,17 @@ e_text_free(E_Text *t)
evas_del_object(t->evas, t->obj.text);
}
FREE(t);
D_RETURN;
}
void
e_text_set_text(E_Text *t, char *text)
{
D_ENTER;
if (!text) text = "";
if (!strcmp(t->text, text)) return;
if (!strcmp(t->text, text)) D_RETURN;
IF_FREE(t->text);
t->text = strdup(text);
evas_set_text(t->evas, t->obj.o1, t->text);
@ -77,102 +87,138 @@ e_text_set_text(E_Text *t, char *text)
t->min.h = t->h + 2;
t->max.w = t->w + 2;
t->max.h = t->h + 2;
D_RETURN;
}
void
e_text_set_layer(E_Text *t, int l)
{
if (t->layer == l) return;
D_ENTER;
if (t->layer == l) D_RETURN;
t->layer = l;
evas_set_layer(t->evas, t->obj.o1, t->layer);
evas_set_layer(t->evas, t->obj.o2, t->layer);
evas_set_layer(t->evas, t->obj.o3, t->layer);
evas_set_layer(t->evas, t->obj.o4, t->layer);
evas_set_layer(t->evas, t->obj.text, t->layer);
D_RETURN;
}
void
e_text_set_clip(E_Text *t, Evas_Object clip)
{
D_ENTER;
evas_set_clip(t->evas, t->obj.o1, clip);
evas_set_clip(t->evas, t->obj.o2, clip);
evas_set_clip(t->evas, t->obj.o3, clip);
evas_set_clip(t->evas, t->obj.o4, clip);
evas_set_clip(t->evas, t->obj.text, clip);
D_RETURN;
}
void
e_text_unset_clip(E_Text *t)
{
D_ENTER;
evas_unset_clip(t->evas, t->obj.o1);
evas_unset_clip(t->evas, t->obj.o2);
evas_unset_clip(t->evas, t->obj.o3);
evas_unset_clip(t->evas, t->obj.o4);
evas_unset_clip(t->evas, t->obj.text);
D_RETURN;
}
void
e_text_raise(E_Text *t)
{
D_ENTER;
evas_raise(t->evas, t->obj.o1);
evas_raise(t->evas, t->obj.o2);
evas_raise(t->evas, t->obj.o3);
evas_raise(t->evas, t->obj.o4);
evas_raise(t->evas, t->obj.text);
D_RETURN;
}
void
e_text_lower(E_Text *t)
{
D_ENTER;
evas_lower(t->evas, t->obj.text);
evas_lower(t->evas, t->obj.o4);
evas_lower(t->evas, t->obj.o3);
evas_lower(t->evas, t->obj.o2);
evas_lower(t->evas, t->obj.o1);
D_RETURN;
}
void
e_text_show(E_Text *t)
{
if (t->visible) return;
D_ENTER;
if (t->visible) D_RETURN;
t->visible = 1;
evas_show(t->evas, t->obj.o1);
evas_show(t->evas, t->obj.o2);
evas_show(t->evas, t->obj.o3);
evas_show(t->evas, t->obj.o4);
evas_show(t->evas, t->obj.text);
D_RETURN;
}
void
e_text_hide(E_Text *t)
{
if (!t->visible) return;
D_ENTER;
if (!t->visible) D_RETURN;
t->visible = 0;
evas_hide(t->evas, t->obj.o1);
evas_hide(t->evas, t->obj.o2);
evas_hide(t->evas, t->obj.o3);
evas_hide(t->evas, t->obj.o4);
evas_hide(t->evas, t->obj.text);
D_RETURN;
}
void
e_text_set_color(E_Text *t, int r, int g, int b, int a)
{
D_ENTER;
if ((r == t->color.r) &&
(g == t->color.g) &&
(b == t->color.b) &&
(a == t->color.a)) return;
(a == t->color.a)) D_RETURN;
t->color.r = r;
t->color.g = g;
t->color.b = b;
t->color.a = a;
evas_set_color(t->evas, t->obj.text, t->color.r, t->color.g, t->color.b, t->color.a);
D_RETURN;
}
void
e_text_move(E_Text *t, double x, double y)
{
if ((t->x == x) && (t->y == y)) return;
D_ENTER;
if ((t->x == x) && (t->y == y)) D_RETURN;
t->x = x;
t->y = y;
evas_move(t->evas, t->obj.o1, t->x + 1, t->y);
@ -180,11 +226,17 @@ e_text_move(E_Text *t, double x, double y)
evas_move(t->evas, t->obj.o3, t->x + 2, t->y + 1);
evas_move(t->evas, t->obj.o4, t->x + 1, t->y + 2);
evas_move(t->evas, t->obj.text, t->x + 1, t->y + 1);
D_RETURN;
}
void
e_text_resize(E_Text *t, double w, double h)
{
D_ENTER;
D_RETURN;
UN(t);
UN(w);
UN(h);
@ -193,42 +245,66 @@ e_text_resize(E_Text *t, double w, double h)
void
e_text_get_geometry(E_Text *t, double *x, double *y, double *w, double *h)
{
D_ENTER;
if (x) *x = t->x;
if (y) *y = t->y;
if (w) *w = t->w;
if (h) *h = t->h;
D_RETURN;
}
void
e_text_get_min_size(E_Text *t, double *w, double *h)
{
D_ENTER;
if (w) *w = t->min.w;
if (h) *h = t->min.h;
D_RETURN;
}
void
e_text_get_max_size(E_Text *t, double *w, double *h)
{
D_ENTER;
if (w) *w = t->max.w;
if (h) *h = t->max.h;
D_RETURN;
}
void
e_text_set_state(E_Text *t, char *state)
{
D_ENTER;
UN(t);
UN(state);
D_RETURN;
}
void
e_text_set_class(E_Text *t, char *class)
{
D_ENTER;
UN(t);
UN(class);
D_RETURN;
}
void
e_text_update_class(E_Text *t)
{
D_ENTER;
D_RETURN;
UN(t);
}

View File

@ -1,12 +1,16 @@
#include "debug.h"
#include "util.h"
time_t
e_file_modified_time(char *file)
{
struct stat st;
D_ENTER;
if (stat(file, &st) < 0) return 0;
return st.st_mtime;
if (stat(file, &st) < 0) D_RETURN_(0);
D_RETURN_(st.st_mtime);
}
void
@ -14,8 +18,12 @@ e_set_env(char *variable, char *content)
{
char env[PATH_MAX];
D_ENTER;
sprintf(env, "%s=%s", variable, content);
putenv(env);
D_RETURN;
}
int
@ -23,8 +31,11 @@ e_file_exists(char *file)
{
struct stat st;
if (stat(file, &st) < 0) return 0;
return 1;
D_ENTER;
if (stat(file, &st) < 0) D_RETURN_(0);
D_RETURN_(1);
}
int
@ -32,9 +43,12 @@ e_file_is_dir(char *file)
{
struct stat st;
if (stat(file, &st) < 0) return 0;
if (S_ISDIR(st.st_mode)) return 1;
return 0;
D_ENTER;
if (stat(file, &st) < 0) D_RETURN_(0);
if (S_ISDIR(st.st_mode)) D_RETURN_(1);
D_RETURN_(0);
}
char *
@ -42,11 +56,14 @@ e_file_home(void)
{
static char *home = NULL;
if (home) return home;
D_ENTER;
if (home) D_RETURN_(home);
home = getenv("HOME");
if (!home) home = getenv("TMPDIR");
if (!home) home = "/tmp";
return home;
D_RETURN_(home);
}
static mode_t default_mode = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
@ -54,8 +71,11 @@ static mode_t default_mode = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXG
int
e_file_mkdir(char *dir)
{
if (mkdir(dir, default_mode) < 0) return 0;
return 1;
D_ENTER;
if (mkdir(dir, default_mode) < 0) D_RETURN_(0);
D_RETURN_(1);
}
int
@ -65,18 +85,21 @@ e_file_cp(char *src, char *dst)
char buf[16384];
size_t num;
D_ENTER;
f1 = fopen(src, "rb");
if (!f1) return 0;
if (!f1) D_RETURN_(0);
f2 = fopen(dst, "wb");
if (!f2)
{
fclose(f1);
return 0;
D_RETURN_(0);
}
while ((num = fread(buf, 1, 16384, f1)) > 0) fwrite(buf, 1, num, f2);
fclose(f1);
fclose(f2);
return 1;
D_RETURN_(1);
}
char *
@ -85,9 +108,12 @@ e_file_real(char *file)
char buf[PATH_MAX];
char *f;
if (!realpath(file, buf)) return strdup("");
D_ENTER;
if (!realpath(file, buf)) D_RETURN_(strdup(""));
e_strdup(f, buf);
return f;
D_RETURN_(f);
}
char *
@ -96,14 +122,17 @@ e_file_get_file(char *file)
char *p;
char *f;
D_ENTER;
p = strrchr(file, '/');
if (!p)
{
e_strdup(f, file);
return f;
D_RETURN_(f);
}
e_strdup(f, &(p[1]));
return f;
D_RETURN_(f);
}
char *
@ -113,16 +142,19 @@ e_file_get_dir(char *file)
char *f;
char buf[PATH_MAX];
D_ENTER;
strcpy(buf, file);
p = strrchr(buf, '/');
if (!p)
{
e_strdup(f, file);
return f;
D_RETURN_(f);
}
*p = 0;
e_strdup(f, buf);
return f;
D_RETURN_(f);
}
void *
@ -130,17 +162,23 @@ e_memdup(void *data, int size)
{
void *data_dup;
D_ENTER;
data_dup = malloc(size);
if (!data_dup) return NULL;
if (!data_dup) D_RETURN_(NULL);
memcpy(data_dup, data, size);
return data_dup;
D_RETURN_(data_dup);
}
int
e_glob_matches(char *str, char *glob)
{
if (!fnmatch(glob, str, 0)) return 1;
return 0;
D_ENTER;
if (!fnmatch(glob, str, 0)) D_RETURN_(1);
D_RETURN_(0);
}
int
@ -151,7 +189,9 @@ e_file_can_exec(struct stat *st)
static gid_t gid = -1;
int ok;
if (!st) return 0;
D_ENTER;
if (!st) D_RETURN_(0);
ok = 0;
if (!have_uid) uid = getuid();
if (!have_uid) gid = getgid();
@ -168,7 +208,8 @@ e_file_can_exec(struct stat *st)
{
if (st->st_mode & S_IXOTH) ok = 1;
}
return ok;
D_RETURN_(ok);
}
char *
@ -178,10 +219,13 @@ e_file_link(char *link)
char *f;
int count;
if ((count = readlink(link, buf, sizeof(buf))) < 0) return NULL;
D_ENTER;
if ((count = readlink(link, buf, sizeof(buf))) < 0) D_RETURN_(NULL);
buf[count] = 0;
e_strdup(f, buf);
return f;
D_RETURN_(f);
}
Evas_List
@ -191,8 +235,10 @@ e_file_list_dir(char *dir)
struct dirent *dp;
Evas_List list;
D_ENTER;
dirp = opendir(dir);
if (!dirp) return NULL;
if (!dirp) D_RETURN_(NULL);
list = NULL;
while ((dp = readdir(dirp)))
{
@ -218,5 +264,6 @@ e_file_list_dir(char *dir)
}
}
closedir(dirp);
return list;
D_RETURN_(list);
}

File diff suppressed because it is too large Load Diff

View File

@ -7,6 +7,7 @@
#include "fs.h"
#include "text.h"
#include "iconbar.h"
#include "object.h"
#ifndef E_VIEW_TYPEDEF
#define E_VIEW_TYPEDEF
@ -24,7 +25,7 @@ typedef struct _E_Iconbar E_Iconbar;
struct _E_View
{
OBJ_PROPERTIES;
E_Object o;
char *dir;
@ -146,7 +147,7 @@ struct _E_View
struct _E_Icon
{
OBJ_PROPERTIES;
E_Object o;
char *file;
@ -230,7 +231,6 @@ void e_view_icon_invert_selection(E_Icon *ic);
void e_view_icon_select(E_Icon *ic);
void e_view_icon_deselect(E_Icon *ic);
void e_view_icon_exec(E_Icon *ic);
void e_view_icon_free(E_Icon *ic);
void e_view_icon_initial_show(E_Icon *ic);
void e_view_icon_set_mime(E_Icon *ic, char *base, char *mime);
void e_view_icon_set_link(E_Icon *ic, char *link);
@ -250,7 +250,6 @@ void e_view_file_deleted(int id, char *file);
void e_view_file_changed(int id, char *file);
void e_view_file_moved(int id, char *file);
E_View *e_view_find_by_monitor_id(int id);
void e_view_free(E_View *v);
E_View *e_view_new(void);
void e_view_set_background(E_View *v);
void e_view_set_dir(E_View *v, char *dir);