summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbdpngn <rbdpngn>2003-01-15 18:29:56 +0000
committerrbdpngn <rbdpngn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>2003-01-15 18:29:56 +0000
commit63e20e7f14fdca0cf3c85c38593a4a058747ae30 (patch)
tree8a1c5b1147fd56666579d35f2f8ea591ea7520a4
parentaeac895ef7a24971b19b59a876002f235b1132b1 (diff)
More SPLIT merging.
SVN revision: 6588
-rw-r--r--Makefile.am2
-rw-r--r--README12
-rwxr-xr-xautogen.sh4
-rw-r--r--configure.ac1
-rw-r--r--configure.in1
-rw-r--r--data/config/behavior/default/behavior.dbbin0 -> 155646 bytes
-rwxr-xr-xdata/scripts/build_db.sh38
-rw-r--r--po/ChangeLog27
-rwxr-xr-xsetup-gettext.sh202
-rw-r--r--src/Makefile.am13
-rw-r--r--src/actions.c205
-rw-r--r--src/actions.h7
-rw-r--r--src/background.c39
-rw-r--r--src/background.h10
-rw-r--r--src/block.c4
-rw-r--r--src/border.c876
-rw-r--r--src/border.h18
-rw-r--r--src/bordermenu.c65
-rw-r--r--src/bordermenu.h1
-rw-r--r--src/config.c507
-rw-r--r--src/config.h247
-rw-r--r--src/cursors.c4
-rw-r--r--src/data.c220
-rw-r--r--src/data.h97
-rw-r--r--src/debug.c2
-rw-r--r--src/delayed.c8
-rw-r--r--src/delayed.h6
-rw-r--r--src/desktops.c888
-rw-r--r--src/desktops.h49
-rw-r--r--src/e.h7
-rw-r--r--src/e_dir.c92
-rw-r--r--src/e_dir.h2
-rw-r--r--src/e_ferite.c76
-rw-r--r--src/e_ferite.fec170
-rw-r--r--src/e_ferite.h30
-rw-r--r--src/e_file.c9
-rw-r--r--src/e_file.h2
-rw-r--r--src/e_view_look.c15
-rw-r--r--src/e_view_machine.c12
-rw-r--r--src/e_view_machine.h6
-rw-r--r--src/embed.c64
-rw-r--r--src/embed.h4
-rw-r--r--src/entry.c167
-rw-r--r--src/entry.h12
-rw-r--r--src/epplet.c821
-rw-r--r--src/epplet.h123
-rw-r--r--src/exec.c6
-rw-r--r--src/file.c8
-rw-r--r--src/file.h2
-rw-r--r--src/focus.c2
-rw-r--r--src/fs.c8
-rw-r--r--src/guides.c103
-rw-r--r--src/iconbar.c456
-rw-r--r--src/iconbar.h15
-rw-r--r--src/icons.c173
-rw-r--r--src/icons.h6
-rw-r--r--src/main.c43
-rw-r--r--src/menu.c197
-rw-r--r--src/menu.h13
-rw-r--r--src/menubuild.c40
-rw-r--r--src/menubuild.h5
-rw-r--r--src/observer.c10
-rw-r--r--src/observer.h44
-rw-r--r--src/place.c10
-rw-r--r--src/resist.c20
-rw-r--r--src/scrollbar.c22
-rw-r--r--src/scrollbar.h4
-rw-r--r--src/text.c173
-rw-r--r--src/text.h16
-rw-r--r--src/util.c98
-rw-r--r--src/util.h17
-rw-r--r--src/view.c406
-rw-r--r--src/view.h30
-rw-r--r--src/view_layout.c63
-rw-r--r--src/view_layout.h9
-rw-r--r--tools/e_setup.c293
76 files changed, 3700 insertions, 3757 deletions
diff --git a/Makefile.am b/Makefile.am
index 71abbe967..c92690045 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,6 @@
1## Process this file with automake to produce Makefile.in 1## Process this file with automake to produce Makefile.in
2 2
3SUBDIRS = intl po src lib client tools doc 3SUBDIRS = po src lib client tools doc
4 4
5MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess \ 5MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess \
6 config.h.in config.sub configure install-sh \ 6 config.h.in config.sub configure install-sh \
diff --git a/README b/README
index 218dbe159..35d56eb66 100644
--- a/README
+++ b/README
@@ -1,3 +1,15 @@
1Additional notes
2
3todo
4 entry.c - check 'todo' entries (although nobody uses entries except for
5 me in med, do they?)
6 guides.c - imlib parts that aren't converted yet.
7 text.c
8 menu.c
9 menubuild.c - e_observer_init() call.
10 border.c - use e_evas_new_all in place of the inlined code. cleanup.
11
12
1+-----------------------------------------------------------------------------+ 13+-----------------------------------------------------------------------------+
2| Enlightenment 0.17.pre CVS Code.... | 14| Enlightenment 0.17.pre CVS Code.... |
3+-----------------------------------------------------------------------------+ 15+-----------------------------------------------------------------------------+
diff --git a/autogen.sh b/autogen.sh
index 4e702b73e..99abbd3fd 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -111,7 +111,7 @@ do
111 echo "Creating $dr/aclocal.m4 ..." 111 echo "Creating $dr/aclocal.m4 ..."
112 test -r $dr/aclocal.m4 || touch $dr/aclocal.m4 112 test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
113 echo "Running gettextize... Ignore non-fatal messages." 113 echo "Running gettextize... Ignore non-fatal messages."
114 echo "no" | gettextize --force --copy || abort "gettextize" 114 echo "no" | setup-gettext.sh
115 echo "Making $dr/aclocal.m4 writable ..." 115 echo "Making $dr/aclocal.m4 writable ..."
116 test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4 116 test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
117 fi 117 fi
@@ -120,7 +120,7 @@ do
120 echo "Creating $dr/aclocal.m4 ..." 120 echo "Creating $dr/aclocal.m4 ..."
121 test -r $dr/aclocal.m4 || touch $dr/aclocal.m4 121 test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
122 echo "Running gettextize... Ignore non-fatal messages." 122 echo "Running gettextize... Ignore non-fatal messages."
123 echo "no" | gettextize --force --copy || abort "gettextize" 123 echo "no" | setup-gettext.sh
124 echo "Making $dr/aclocal.m4 writable ..." 124 echo "Making $dr/aclocal.m4 writable ..."
125 test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4 125 test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
126 fi 126 fi
diff --git a/configure.ac b/configure.ac
index 39b6dc445..80f04f52c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -234,7 +234,6 @@ Makefile
234src/Makefile 234src/Makefile
235lib/Makefile 235lib/Makefile
236client/Makefile 236client/Makefile
237intl/Makefile
238po/Makefile.in 237po/Makefile.in
239tools/Makefile 238tools/Makefile
240doc/Makefile 239doc/Makefile
diff --git a/configure.in b/configure.in
index d04879932..6f3b040c7 100644
--- a/configure.in
+++ b/configure.in
@@ -233,7 +233,6 @@ Makefile
233src/Makefile 233src/Makefile
234lib/Makefile 234lib/Makefile
235client/Makefile 235client/Makefile
236intl/Makefile
237po/Makefile.in 236po/Makefile.in
238tools/Makefile 237tools/Makefile
239doc/Makefile 238doc/Makefile
diff --git a/data/config/behavior/default/behavior.db b/data/config/behavior/default/behavior.db
new file mode 100644
index 000000000..aeb15ca46
--- /dev/null
+++ b/data/config/behavior/default/behavior.db
Binary files differ
diff --git a/data/scripts/build_db.sh b/data/scripts/build_db.sh
index 53e464019..2005dbd2f 100755
--- a/data/scripts/build_db.sh
+++ b/data/scripts/build_db.sh
@@ -27,11 +27,26 @@ WINDOW_MODE_BORDER=1
27WINDOW_MODE_BOX=2 27WINDOW_MODE_BOX=2
28WINDOW_MODE_TECHNICAL=3 28WINDOW_MODE_TECHNICAL=3
29 29
30WINDOW_PLACE_MANUAL=0
31WINDOW_PLACE_SMART=1
32WINDOW_PLACE_MIDDLE=2
33WINDOW_PLACE_CASCADE=3
34WINDOW_PLACE_RANDOM=4
35
36DESKTOP_COUNT=8
37DESKTOP_SCROLL=0
38DESKTOP_SCROLL_STICKY=0
39DESKTOP_RESIST=3
40DESKTOP_SPEED=30
41DESKTOP_WIDTH=2
42DESKTOP_HEIGHT=2
43
30GUIDES_LOC_WIN=0 44GUIDES_LOC_WIN=0
31GUIDES_LOC_SCR=1 45GUIDES_LOC_SCR=1
32 46
47DB="./behavior.db"
48
33# actions defining how to react to things 49# actions defining how to react to things
34DB="./actions.db"
35NUM=0 50NUM=0
36edb_ed $DB add "/actions/"$NUM"/name" str "Title_Bar" 51edb_ed $DB add "/actions/"$NUM"/name" str "Title_Bar"
37edb_ed $DB add "/actions/"$NUM"/action" str "Window_Raise" 52edb_ed $DB add "/actions/"$NUM"/action" str "Window_Raise"
@@ -337,26 +352,41 @@ edb_ed $DB add "/actions/"$NUM"/button" int 0
337edb_ed $DB add "/actions/"$NUM"/key" str "Insert" 352edb_ed $DB add "/actions/"$NUM"/key" str "Insert"
338edb_ed $DB add "/actions/"$NUM"/modifiers" int $MOD_CTRL_ALT 353edb_ed $DB add "/actions/"$NUM"/modifiers" int $MOD_CTRL_ALT
339NUM=$[ $NUM + 1 ]; 354NUM=$[ $NUM + 1 ];
355edb_ed $DB add "/actions/"$NUM"/name" str "Key_Binding"
356edb_ed $DB add "/actions/"$NUM"/action" str "Window_Next"
357edb_ed $DB add "/actions/"$NUM"/params" str ""
358edb_ed $DB add "/actions/"$NUM"/event" int $ACT_KEY_DOWN
359edb_ed $DB add "/actions/"$NUM"/button" int 0
360edb_ed $DB add "/actions/"$NUM"/key" str "Tab"
361edb_ed $DB add "/actions/"$NUM"/modifiers" int $MOD_ALT
362NUM=$[ $NUM + 1 ];
340edb_ed $DB add "/actions/count" int $NUM 363edb_ed $DB add "/actions/count" int $NUM
341 364
365edb_ed $DB add "/desktops/count" int $DESKTOP_COUNT
366edb_ed $DB add "/desktops/scroll" int $DESKTOP_SCROLL
367edb_ed $DB add "/desktops/scroll_sticky" int $DESKTOP_SCROLL_STICKY
368edb_ed $DB add "/desktops/resist" int $DESKTOP_RESIST
369edb_ed $DB add "/desktops/speed" int $DESKTOP_SPEED
370edb_ed $DB add "/desktops/width" int $DESKTOP_WIDTH
371edb_ed $DB add "/desktops/height" int $DESKTOP_HEIGHT
372
342# basic settings 373# basic settings
343DB="./settings.db"
344edb_ed $DB add "/focus/mode " int $FOCUS_POINTER
345edb_ed $DB add "/move/resist" int 1 374edb_ed $DB add "/move/resist" int 1
346edb_ed $DB add "/move/resist/desk" int 24 375edb_ed $DB add "/move/resist/desk" int 24
347edb_ed $DB add "/move/resist/win" int 12 376edb_ed $DB add "/move/resist/win" int 12
348edb_ed $DB add "/menu/scroll/resist" int 5 377edb_ed $DB add "/menu/scroll/resist" int 5
349edb_ed $DB add "/menu/scroll/speed" int 12 378edb_ed $DB add "/menu/scroll/speed" int 12
379edb_ed $DB add "/window/focus/mode" int $FOCUS_POINTER
350edb_ed $DB add "/window/raise/auto" int 0 380edb_ed $DB add "/window/raise/auto" int 0
351edb_ed $DB add "/window/raise/delay" float 0.5 381edb_ed $DB add "/window/raise/delay" float 0.5
352edb_ed $DB add "/window/move/mode" int $WINDOW_MODE_OPAQUE 382edb_ed $DB add "/window/move/mode" int $WINDOW_MODE_OPAQUE
353edb_ed $DB add "/window/resize/mode" int $WINDOW_MODE_BOX 383edb_ed $DB add "/window/resize/mode" int $WINDOW_MODE_BOX
384edb_ed $DB add "/window/place/mode" int $WINDOW_PLACE_SMART
354edb_ed $DB add "/guides/display/x" float 0.5 385edb_ed $DB add "/guides/display/x" float 0.5
355edb_ed $DB add "/guides/display/y" float 0.5 386edb_ed $DB add "/guides/display/y" float 0.5
356edb_ed $DB add "/guides/display/location" int $GUIDES_LOC_SCR 387edb_ed $DB add "/guides/display/location" int $GUIDES_LOC_SCR
357 388
358# what events on windows are "grabbed" by the window manager 389# what events on windows are "grabbed" by the window manager
359DB="./grabs.db"
360NUM=0 390NUM=0
361edb_ed $DB add "/grabs/"$NUM"/button" int 1 391edb_ed $DB add "/grabs/"$NUM"/button" int 1
362edb_ed $DB add "/grabs/"$NUM"/modifiers" int $MOD_ALT 392edb_ed $DB add "/grabs/"$NUM"/modifiers" int $MOD_ALT
diff --git a/po/ChangeLog b/po/ChangeLog
index cde271bec..f63f9e044 100644
--- a/po/ChangeLog
+++ b/po/ChangeLog
@@ -98,32 +98,6 @@
98 98
99 * Makefile.in.in: Upgrade to gettext-0.10.39. 99 * Makefile.in.in: Upgrade to gettext-0.10.39.
100 100
101<<<<<<< ChangeLog
1022001-10-08 gettextize <bug-gnu-utils@gnu.org>
103
104 * Makefile.in.in: Upgrade to gettext-0.10.39.
105
1062001-10-08 gettextize <bug-gnu-utils@gnu.org>
107
108 * Makefile.in.in: Upgrade to gettext-0.10.39.
109
1102001-09-25 gettextize <bug-gnu-utils@gnu.org>
111
112 * Makefile.in.in: Upgrade to gettext-0.10.39.
113
1142001-09-25 gettextize <bug-gnu-utils@gnu.org>
115
116 * Makefile.in.in: Upgrade to gettext-0.10.39.
117
1182001-09-10 gettextize <bug-gnu-utils@gnu.org>
119
120 * Makefile.in.in: Upgrade to gettext-0.10.39.
121
1222001-09-10 gettextize <bug-gnu-utils@gnu.org>
123
124 * Makefile.in.in: Upgrade to gettext-0.10.39.
125
126=======
1272001-10-09 gettextize <bug-gnu-utils@gnu.org> 1012001-10-09 gettextize <bug-gnu-utils@gnu.org>
128 102
129 * Makefile.in.in: Upgrade to gettext-0.10.40. 103 * Makefile.in.in: Upgrade to gettext-0.10.40.
@@ -132,7 +106,6 @@
132 106
133 * Makefile.in.in: Upgrade to gettext-0.10.40. 107 * Makefile.in.in: Upgrade to gettext-0.10.40.
134 108
135>>>>>>> 1.6
1362001-08-31 gettextize <bug-gnu-utils@gnu.org> 1092001-08-31 gettextize <bug-gnu-utils@gnu.org>
137 110
138 * Makefile.in.in: Upgrade to gettext-0.10.39. 111 * Makefile.in.in: Upgrade to gettext-0.10.39.
diff --git a/setup-gettext.sh b/setup-gettext.sh
new file mode 100755
index 000000000..fd45c037f
--- /dev/null
+++ b/setup-gettext.sh
@@ -0,0 +1,202 @@
1#!/bin/sh
2#
3# setup-gettext - Provides compatibility with versions of gettext
4# from the 0.10.x series and 0.11.x.
5#
6# Copyright (C) 2002 Christian Hammond.
7#
8# This program is free software; you can redistribute it and/or
9# modify it under the terms of the GNU General Public License as
10# published by the Free Software Foundation; either version 2 of
11# the License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public
19# License along with this program; if not, write to the Free
20# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21# MA 02111-1307 USA
22#
23
24VERSION=0.1.3
25
26VERBOSE=0
27
28parse_gettext_version() {
29 GETTEXT_VERSION=`$GETTEXT_TOOL --version | sed -n 's/^.*\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\).*$/\1.\2.\3/p'`
30 GETTEXT_MAJOR_VERSION=`echo $GETTEXT_VERSION | sed -n 's/^\([0-9]\+\).*/\1/p'`
31 GETTEXT_MINOR_VERSION=`echo $GETTEXT_VERSION | sed -n 's/^[0-9]\+\.\([0-9]\+\).*/\1/p'`
32 GETTEXT_MICRO_VERSION=`echo $GETTEXT_VERSION | sed -n 's/^[0-9]\+\.[0-9]\+\.\([0-9]\+\).*/\1/p'`
33}
34
35find_gettext() {
36 GETTEXT_TOOL=autopoint
37
38 (autopoint --version) < /dev/null > /dev/null 2>&1 || {
39 GETTEXT_TOOL=gettextize
40
41 (gettextize --version) < /dev/null > /dev/null 2>&1 || {
42 GETTEXT_TOOL=
43 }
44 }
45}
46
47install() {
48 [ -f configure.in ] && {
49 cp configure.in .tmp-configure.in
50 sed -e 's/^AM_GNU_GETTEXT\(.*\)$/AM_GNU_GETTEXT\1\
51AM_GNU_GETTEXT_VERSION(0.10.40)/' < .tmp-configure.in > configure.in
52 rm .tmp-configure.in
53 }
54
55 [ -f configure.ac ] && {
56 cp configure.ac .tmp-configure.ac
57 sed -e 's/^AM_GNU_GETTEXT\(.*\)$/AM_GNU_GETTEXT\1\
58AM_GNU_GETTEXT_VERSION(0.10.40)/' < .tmp-configure.ac > configure.ac
59 rm .tmp-configure.ac
60 }
61
62 [ -f autogen.sh ] && {
63 cp autogen.sh .tmp-autogen.sh
64 sed -e 's/\(gettextize\|autopoint\) --version/.\/setup-gettext --gettext-tool/1' -e 's/^\(echo.*|[\t ]*\)\?\(gettextize\|autopoint\) -.*$/.\/setup-gettext/1' < .tmp-autogen.sh > autogen.sh
65 rm .tmp-autogen.sh
66 }
67
68 echo 'AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])' >> acinclude.m4
69}
70
71backup_m4() {
72 [ -d m4 ] && mv m4 m4~
73}
74
75restore_m4() {
76 [ -d m4~ ] && {
77 rm -rf m4
78 mv m4~ m4
79 }
80}
81
82restore_files() {
83 [ -f configure.in~ ] && mv -f configure.in~ configure.in
84 [ -f configure.ac~ ] && mv -f configure.ac~ configure.ac
85 [ -f Makefile.am~ ] && mv -f Makefile.am~ Makefile.am
86}
87
88abort() {
89 restore_files
90 restore_m4
91
92 exit 1
93}
94
95# Main code
96
97find_gettext
98
99# See if a version of gettext and its tools are installed.
100if [ x$GETTEXT_TOOL = x ]; then
101 echo
102 echo "You do not have a version of gettext installed."
103 echo "Please download one from your local package repository or"
104 echo "from ftp://ftp.gnu.org/pub/gnu/gettext/"
105 echo
106 exit 1
107fi
108
109parse_gettext_version
110
111NUMVAR=$#
112
113if [ $NUMVAR -gt 0 ]; then
114 if [ $NUMVAR -gt 1 ]; then
115 echo "Only one option at a time!"
116 exit 1
117
118 elif [ $1 = "--gettext-tool" ]; then
119 echo $GETTEXT_TOOL
120 exit 0
121
122 elif [ $1 = "--help" ]; then
123 echo "setup-gettext v$VERSION"
124 echo "Usage:"
125 echo " --gettext-tool Returns gettextize or autopoint, depending"
126 echo " on the version of gettext installed."
127 echo " --gettext-version Returns the version of gettext installed."
128 echo " --gettext-major-version Returns the major version of gettext installed."
129 echo " --gettext-minor-version Returns the minor version of gettext installed."
130 echo " --gettext-micro-version Returns the micro version of gettext installed."
131 echo " --help Displays this help screen."
132 echo
133 exit 0
134
135 elif [ $1 = "--version" ]; then
136 echo $VERSION
137 exit 0
138
139 elif [ $1 = "--gettext-version" ]; then
140 echo $GETTEXT_VERSION
141 exit 0
142
143 elif [ $1 = "--gettext-major-version" ]; then
144 echo $GETTEXT_MAJOR_VERSION
145 exit 0
146
147 elif [ $1 = "--gettext-minor-version" ]; then
148 echo $GETTEXT_MINOR_VERSION
149 exit 0
150
151 elif [ $1 = "--gettext-micro-version" ]; then
152 echo $GETTEXT_MICRO_VERSION
153 exit 0
154
155 elif [ $1 = "--install" ]; then
156 install
157 echo "setup-gettext installed."
158 exit 0
159
160 elif [ $1 = "--happy-url" ]; then
161 echo http://gaim.sf.net/forkgettext.jpg
162 exit 0
163
164 elif [ $1 = "--verbose" ]; then
165 VERBOSE=1
166
167 else
168 echo "Invalid option '$1'"
169 exit 1
170 fi
171fi
172
173# Okay, run the main stuff
174if [ "$GETTEXT_TOOL" = "autopoint" ]; then
175 backup_m4
176 [ $VERBOSE -eq 1 ] && echo " autopoint --force"
177 echo n | autopoint --force || abort
178 restore_m4
179else
180 if [ $GETTEXT_MINOR_VERSION -eq 11 ]; then
181 backup_m4
182
183 # Gettext is pure evil. It DEMANDS that we press Return no matter
184 # what. This gets rid of their happy "feature" of doom.
185 [ $VERBOSE -eq 1 ] && \
186 echo " gettextize --copy --force --intl --no-changelog"
187
188 sed 's:read .*< /dev/tty::' `which gettextize` > .temp-gettextize
189 chmod +x .temp-gettextize
190 echo n | ./.temp-gettextize --copy --force --intl --no-changelog || abort
191 rm .temp-gettextize
192
193 restore_files
194 restore_m4
195
196 [ -f po/Makevars.template ] && mv po/Makevars.template po/Makevars
197 else
198 [ $VERBOSE -eq 1 ] && echo " gettextize --copy --force"
199 echo n | gettextize --copy --force || exit;
200 fi
201fi
202
diff --git a/src/Makefile.am b/src/Makefile.am
index c30c51330..d618606d5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -9,15 +9,18 @@ INCLUDES = \
9 -I$(top_srcdir)/intl \ 9 -I$(top_srcdir)/intl \
10 @evas_cflags@ @edb_cflags@ @ebits_cflags@ @ecore_cflags@ @efsd_cflags@ @ebg_cflags@ $(DEBUGFLAGS) 10 @evas_cflags@ @edb_cflags@ @ebits_cflags@ @ecore_cflags@ @efsd_cflags@ @ebg_cflags@ $(DEBUGFLAGS)
11 11
12bin_PROGRAMS = enlightenment 12bin_PROGRAMS = enlightenment
13 13
14enlightenment_SOURCES = \ 14enlightenment_SOURCES = \
15 actions.h actions.c \ 15 actions.h actions.c \
16 block.c block.h \ 16 block.c block.h \
17 border.h border.c \ 17 border.h border.c \
18 bordermenu.h bordermenu.c \ 18 bordermenu.h bordermenu.c \
19 menu.h menu.c \
20 menubuild.h menubuild.c \
19 config.h config.c \ 21 config.h config.c \
20 cursors.c cursors.h \ 22 cursors.c cursors.h \
23 data.c data.h \
21 debug.c debug.h \ 24 debug.c debug.h \
22 delayed.h delayed.c \ 25 delayed.h delayed.c \
23 desktops.h desktops.c \ 26 desktops.h desktops.c \
@@ -30,14 +33,12 @@ enlightenment_SOURCES = \
30 guides.h guides.c \ 33 guides.h guides.c \
31 globals.h globals.c \ 34 globals.h globals.c \
32 icccm.h icccm.c \ 35 icccm.h icccm.c \
33 iconbar.h iconbar.c\ 36 iconbar.h iconbar.c \
34 icons.h icons.c\ 37 icons.h icons.c \
35 ipc.h ipc.c \ 38 ipc.h ipc.c \
36 keys.h keys.c \ 39 keys.h keys.c \
37 main.c \ 40 main.c \
38 match.c match.h \ 41 match.c match.h \
39 menu.h menu.c \
40 menubuild.h menubuild.c \
41 object.h object.c \ 42 object.h object.c \
42 observer.h observer.c\ 43 observer.h observer.c\
43 pack.c \ 44 pack.c \
@@ -52,7 +53,7 @@ enlightenment_SOURCES = \
52 e_dir.h e_dir.c \ 53 e_dir.h e_dir.c \
53 e_view_machine.h e_view_machine.c \ 54 e_view_machine.h e_view_machine.c \
54 view_layout.h view_layout.c \ 55 view_layout.h view_layout.c \
55 e_view_look.h e_view_look.c \ 56 e_view_look.h e_view_look.c \
56 e.h 57 e.h
57 58
58enlightenment_LDADD = @evas_libs@ @edb_libs@ @ebits_libs@ @ecore_libs@ @efsd_libs@ @ebg_libs@ -lm $(INTLLIBS) 59enlightenment_LDADD = @evas_libs@ @edb_libs@ @ebits_libs@ @ecore_libs@ @efsd_libs@ @ebg_libs@ -lm $(INTLLIBS)
diff --git a/src/actions.c b/src/actions.c
index e390250c4..6bf51d00f 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -6,21 +6,19 @@
6#include "exec.h" 6#include "exec.h"
7#include "icccm.h" 7#include "icccm.h"
8#include "keys.h" 8#include "keys.h"
9#include "view.h"
10#include "e_view_machine.h" 9#include "e_view_machine.h"
11#include "util.h" 10#include "util.h"
12#include "guides.h" 11#include "guides.h"
13#include "bordermenu.h" 12#include "bordermenu.h"
14#include "block.h" 13#include "block.h"
15 14
16static Evas_List action_impls = NULL; 15static Evas_List * action_impls = NULL;
17static Evas_List current_actions = NULL; 16static Evas_List * current_actions = NULL;
18static Evas_List current_timers = NULL; 17static Evas_List * current_timers = NULL;
19 18
20static void e_action_find(char *action, E_Action_Type act, int button, 19static void e_action_find(char *action, E_Action_Type act, int button,
21 char *key, Ecore_Event_Key_Modifiers mods, 20 char *key, Ecore_Event_Key_Modifiers mods,
22 E_Object * object); 21 E_Object * object);
23static void e_action_cleanup(E_Action * a);
24 22
25static void e_act_move_start(E_Object * object, E_Action * a, 23static void e_act_move_start(E_Object * object, E_Action * a,
26 void *data, int x, int y, int rx, int ry); 24 void *data, int x, int y, int rx, int ry);
@@ -91,14 +89,14 @@ static void e_act_exec_start(E_Object * object, E_Action * a,
91 89
92static void e_act_menu_start(E_Object * object, E_Action * a, 90static void e_act_menu_start(E_Object * object, E_Action * a,
93 void *data, int x, int y, int rx, int ry); 91 void *data, int x, int y, int rx, int ry);
94 92#if 0
95static void e_act_exit_start(E_Object * object, E_Action * a, 93static void e_act_exit_start(E_Object * object, E_Action * a,
96 void *data, int x, int y, int rx, int ry); 94 void *data, int x, int y, int rx, int ry);
97 95
98static void e_act_restart_start(E_Object * object, E_Action * a, 96static void e_act_restart_start(E_Object * object, E_Action * a,
99 void *data, int x, int y, int rx, 97 void *data, int x, int y, int rx,
100 int ry); 98 int ry);
101 99#endif
102static void e_act_stick_start(E_Object * object, E_Action * a, 100static void e_act_stick_start(E_Object * object, E_Action * a,
103 void *data, int x, int y, int rx, int ry); 101 void *data, int x, int y, int rx, int ry);
104 102
@@ -133,104 +131,16 @@ static void
133e_action_find(char *action, E_Action_Type act, int button, 131e_action_find(char *action, E_Action_Type act, int button,
134 char *key, Ecore_Event_Key_Modifiers mods, E_Object * object) 132 char *key, Ecore_Event_Key_Modifiers mods, E_Object * object)
135{ 133{
136 char *actions_db; 134 Evas_List *l;
137 E_DB_File *db;
138 int i, num;
139 char *a_name = NULL;
140 char *a_action = NULL;
141 char *a_params = NULL;
142 int a_event = 0;
143 int a_button = 0;
144 char *a_key = NULL;
145 int a_modifiers = 0;
146 Evas_List l;
147 E_Action *a; 135 E_Action *a;
148 static Evas_List actions = NULL;
149
150 E_CFG_FILE(cfg_actions, "actions");
151 136
152 D_ENTER; 137 D_ENTER;
153 138
154 E_CONFIG_CHECK_VALIDITY(cfg_actions, "actions");
155
156 /* if we had a previous list - nuke it */
157
158 /* FIXME: this has potential to segfault if reference
159 * counting is actually used and those actions are
160 * referenced in more than one place --cK.
161 */
162
163 if (actions)
164 {
165 for (l = actions; l; l = l->next)
166 {
167 a = l->data;
168 if (a)
169 e_action_cleanup(a);
170 }
171 actions = evas_list_free(actions);
172 }
173 /* now build the list again */
174 actions_db = e_config_get("actions");
175 db = e_db_open_read(actions_db);
176 if (!db)
177 D_RETURN;
178 if (!e_db_int_get(db, "/actions/count", &num))
179 goto error;
180 for (i = 0; i < num; i++)
181 {
182 char buf[PATH_MAX];
183
184 snprintf(buf, PATH_MAX, "/actions/%i/name", i);
185 a_name = e_db_str_get(db, buf);
186 snprintf(buf, PATH_MAX, "/actions/%i/action", i);
187 a_action = e_db_str_get(db, buf);
188 snprintf(buf, PATH_MAX, "/actions/%i/params", i);
189 a_params = e_db_str_get(db, buf);
190 snprintf(buf, PATH_MAX, "/actions/%i/event", i);
191 e_db_int_get(db, buf, &a_event);
192 snprintf(buf, PATH_MAX, "/actions/%i/button", i);
193 e_db_int_get(db, buf, &a_button);
194 snprintf(buf, PATH_MAX, "/actions/%i/key", i);
195 a_key = e_db_str_get(db, buf);
196 snprintf(buf, PATH_MAX, "/actions/%i/modifiers", i);
197 e_db_int_get(db, buf, &a_modifiers);
198
199 a = NEW(E_Action, 1);
200 ZERO(a, E_Action, 1);
201
202 e_object_init(E_OBJECT(a), (E_Cleanup_Func) e_action_cleanup);
203
204 a->name = a_name;
205 a->action = a_action;
206 a->params = a_params;
207 a->event = a_event;
208 a->button = a_button;
209 a->key = a_key;
210 a->modifiers = a_modifiers;
211 a->action_impl = NULL;
212 a->object = NULL;
213 a->started = 0;
214 actions = evas_list_append(actions, a);
215 /* it's a key? lets grab it! */
216 if ((a->key) && (strlen(a->key) > 0))
217 {
218 if (a->modifiers == -1)
219 e_keys_grab(a->key, ECORE_EVENT_KEY_MODIFIER_NONE, 1);
220 else
221 e_keys_grab(a->key, (Ecore_Event_Key_Modifiers) a->modifiers,
222 0);
223 a->grabbed = 1;
224 }
225 }
226 error:
227 e_db_close(db);
228 E_CONFIG_CHECK_VALIDITY_END;
229 /* run thru our actions list and match event, state and stuff with an */ 139 /* run thru our actions list and match event, state and stuff with an */
230 /* and action for it */ 140 /* and action for it */
231 for (l = actions; l; l = l->next) 141 for (l = config_data->actions; l; l = l->next)
232 { 142 {
233 Evas_List ll; 143 Evas_List * ll;
234 144
235 a = l->data; 145 a = l->data;
236 if (act != a->event) 146 if (act != a->event)
@@ -288,7 +198,7 @@ e_action_find(char *action, E_Action_Type act, int button,
288 D_RETURN; 198 D_RETURN;
289} 199}
290 200
291static void 201void
292e_action_cleanup(E_Action * a) 202e_action_cleanup(E_Action * a)
293{ 203{
294 D_ENTER; 204 D_ENTER;
@@ -335,7 +245,7 @@ e_action_start(char *action, E_Action_Type act, int button,
335 char *key, Ecore_Event_Key_Modifiers mods, 245 char *key, Ecore_Event_Key_Modifiers mods,
336 E_Object * object, void *data, int x, int y, int rx, int ry) 246 E_Object * object, void *data, int x, int y, int rx, int ry)
337{ 247{
338 Evas_List l; 248 Evas_List * l;
339 int started_long_action = 0; 249 int started_long_action = 0;
340 250
341 D_ENTER; 251 D_ENTER;
@@ -375,7 +285,7 @@ e_action_stop(char *action, E_Action_Type act, int button,
375 char *key, Ecore_Event_Key_Modifiers mods, E_Object * object, 285 char *key, Ecore_Event_Key_Modifiers mods, E_Object * object,
376 void *data, int x, int y, int rx, int ry) 286 void *data, int x, int y, int rx, int ry)
377{ 287{
378 Evas_List l; 288 Evas_List * l;
379 289
380 D_ENTER; 290 D_ENTER;
381 291
@@ -435,7 +345,7 @@ e_action_cont(char *action, E_Action_Type act, int button, char *key,
435 Ecore_Event_Key_Modifiers mods, E_Object * object, void *data, 345 Ecore_Event_Key_Modifiers mods, E_Object * object, void *data,
436 int x, int y, int rx, int ry, int dx, int dy) 346 int x, int y, int rx, int ry, int dx, int dy)
437{ 347{
438 Evas_List l; 348 Evas_List * l;
439 349
440 D_ENTER; 350 D_ENTER;
441 351
@@ -461,7 +371,7 @@ void
461e_action_stop_by_object(E_Object * object, void *data, int x, int y, int rx, 371e_action_stop_by_object(E_Object * object, void *data, int x, int y, int rx,
462 int ry) 372 int ry)
463{ 373{
464 Evas_List l; 374 Evas_List * l;
465 375
466 D_ENTER; 376 D_ENTER;
467 377
@@ -493,7 +403,7 @@ e_action_stop_by_object(E_Object * object, void *data, int x, int y, int rx,
493void 403void
494e_action_stop_by_type(char *action) 404e_action_stop_by_type(char *action)
495{ 405{
496 Evas_List l; 406 Evas_List * l;
497 407
498 D_ENTER; 408 D_ENTER;
499 409
@@ -518,6 +428,7 @@ e_action_impl_cleanup(E_Action_Impl * eai)
518{ 428{
519 D_ENTER; 429 D_ENTER;
520 430
431 IF_FREE(eai->action);
521 e_object_cleanup(E_OBJECT(eai)); 432 e_object_cleanup(E_OBJECT(eai));
522 433
523 D_RETURN; 434 D_RETURN;
@@ -548,7 +459,7 @@ e_action_add_impl(char *action, E_Action_Start_Func func_start,
548void 459void
549e_action_del_timer(E_Object * object, char *name) 460e_action_del_timer(E_Object * object, char *name)
550{ 461{
551 Evas_List l; 462 Evas_List * l;
552 463
553 D_ENTER; 464 D_ENTER;
554 465
@@ -592,7 +503,7 @@ e_action_add_timer(E_Object * object, char *name)
592void 503void
593e_action_del_timer_object(E_Object * object) 504e_action_del_timer_object(E_Object * object)
594{ 505{
595 Evas_List l; 506 Evas_List * l;
596 507
597 D_ENTER; 508 D_ENTER;
598 509
@@ -677,23 +588,10 @@ e_act_move_start(E_Object * object, E_Action * a, void *data, int x, int y,
677 double align_y = 0.5; 588 double align_y = 0.5;
678 E_Guides_Location display_loc = E_GUIDES_DISPLAY_LOCATION_WINDOW_MIDDLE; 589 E_Guides_Location display_loc = E_GUIDES_DISPLAY_LOCATION_WINDOW_MIDDLE;
679 590
680 E_CFG_INT(cfg_window_move_mode, "settings", "/window/move/mode",
681 E_GUIDES_BOX);
682 E_CFG_FLOAT(cfg_guides_display_x, "settings", "/guides/display/x", 0.5);
683 E_CFG_FLOAT(cfg_guides_display_y, "settings", "/guides/display/y", 0.5);
684 E_CFG_INT(cfg_guides_display_location, "settings",
685 "/guides/display/location",
686 E_GUIDES_DISPLAY_LOCATION_WINDOW_MIDDLE);
687
688 D_ENTER; 591 D_ENTER;
689 592
690 e_block_start("menus"); 593 e_block_start("menus");
691 594
692 E_CONFIG_INT_GET(cfg_window_move_mode, move_mode);
693 E_CONFIG_FLOAT_GET(cfg_guides_display_x, align_x);
694 E_CONFIG_FLOAT_GET(cfg_guides_display_y, align_y);
695 E_CONFIG_INT_GET(cfg_guides_display_location, display_loc);
696
697 b = (E_Border *) object; 595 b = (E_Border *) object;
698 596
699 if (!b) 597 if (!b)
@@ -705,6 +603,11 @@ e_act_move_start(E_Object * object, E_Action * a, void *data, int x, int y,
705 if (b->client.fixed) 603 if (b->client.fixed)
706 D_RETURN; 604 D_RETURN;
707 605
606 move_mode = config_data->window->move_mode;
607 display_loc = config_data->guides->location;
608 align_x = config_data->guides->x;
609 align_y = config_data->guides->y;
610
708 if (move_mode >= E_GUIDES_BOX) 611 if (move_mode >= E_GUIDES_BOX)
709 b->hold_changes = 1; /* if non opaque */ 612 b->hold_changes = 1; /* if non opaque */
710 b->mode.move = 1; 613 b->mode.move = 1;
@@ -839,22 +742,10 @@ e_act_resize_start(E_Object * object, E_Action * a, void *data, int x, int y,
839 double align_y = 0.5; 742 double align_y = 0.5;
840 E_Guides_Location display_loc = E_GUIDES_DISPLAY_LOCATION_WINDOW_MIDDLE; 743 E_Guides_Location display_loc = E_GUIDES_DISPLAY_LOCATION_WINDOW_MIDDLE;
841 744
842 E_CFG_INT(cfg_window_resize_mode, "settings", "/window/resize/mode",
843 E_GUIDES_BOX);
844 E_CFG_FLOAT(cfg_guides_display_x, "settings", "/guides/display/x", 0.5);
845 E_CFG_FLOAT(cfg_guides_display_y, "settings", "/guides/display/y", 0.5);
846 E_CFG_INT(cfg_guides_display_location, "settings",
847 "/guides/display/location",
848 E_GUIDES_DISPLAY_LOCATION_WINDOW_MIDDLE);
849
850 D_ENTER; 745 D_ENTER;
851 746
852 e_block_start("menus"); 747 e_block_start("menus");
853 748
854 E_CONFIG_INT_GET(cfg_window_resize_mode, resize_mode);
855 E_CONFIG_FLOAT_GET(cfg_guides_display_x, align_x);
856 E_CONFIG_FLOAT_GET(cfg_guides_display_y, align_y);
857 E_CONFIG_INT_GET(cfg_guides_display_location, display_loc);
858 b = (E_Border *) object; 749 b = (E_Border *) object;
859 if (!b) 750 if (!b)
860 b = e_border_current_focused(); 751 b = e_border_current_focused();
@@ -866,6 +757,12 @@ e_act_resize_start(E_Object * object, E_Action * a, void *data, int x, int y,
866 D_RETURN; 757 D_RETURN;
867 if (b->current.shaded != 0) 758 if (b->current.shaded != 0)
868 D_RETURN; 759 D_RETURN;
760
761 resize_mode = config_data->window->resize_mode;
762 display_loc = config_data->guides->location;
763 align_x = config_data->guides->x;
764 align_y = config_data->guides->y;
765
869 if (resize_mode >= E_GUIDES_BOX) 766 if (resize_mode >= E_GUIDES_BOX)
870 b->hold_changes = 1; /* if non opaque */ 767 b->hold_changes = 1; /* if non opaque */
871 ecore_window_gravity_set(b->win.client, StaticGravity); 768 ecore_window_gravity_set(b->win.client, StaticGravity);
@@ -1043,22 +940,10 @@ e_act_resize_h_start(E_Object * object, E_Action * a, void *data, int x, int y,
1043 double align_y = 0.5; 940 double align_y = 0.5;
1044 E_Guides_Location display_loc = E_GUIDES_DISPLAY_LOCATION_WINDOW_MIDDLE; 941 E_Guides_Location display_loc = E_GUIDES_DISPLAY_LOCATION_WINDOW_MIDDLE;
1045 942
1046 E_CFG_INT(cfg_window_resize_mode, "settings", "/window/resize/mode",
1047 E_GUIDES_BOX);
1048 E_CFG_FLOAT(cfg_guides_display_x, "settings", "/guides/display/x", 0.5);
1049 E_CFG_FLOAT(cfg_guides_display_y, "settings", "/guides/display/y", 0.5);
1050 E_CFG_INT(cfg_guides_display_location, "settings",
1051 "/guides/display/location",
1052 E_GUIDES_DISPLAY_LOCATION_WINDOW_MIDDLE);
1053
1054 D_ENTER; 943 D_ENTER;
1055 944
1056 e_block_start("menus"); 945 e_block_start("menus");
1057 946
1058 E_CONFIG_INT_GET(cfg_window_resize_mode, resize_mode);
1059 E_CONFIG_FLOAT_GET(cfg_guides_display_x, align_x);
1060 E_CONFIG_FLOAT_GET(cfg_guides_display_y, align_y);
1061 E_CONFIG_INT_GET(cfg_guides_display_location, display_loc);
1062 b = (E_Border *) object; 947 b = (E_Border *) object;
1063 if (!b) 948 if (!b)
1064 b = e_border_current_focused(); 949 b = e_border_current_focused();
@@ -1068,6 +953,12 @@ e_act_resize_h_start(E_Object * object, E_Action * a, void *data, int x, int y,
1068 D_RETURN; 953 D_RETURN;
1069 if (b->current.shaded != 0) 954 if (b->current.shaded != 0)
1070 D_RETURN; 955 D_RETURN;
956
957 resize_mode = config_data->window->resize_mode;
958 display_loc = config_data->guides->location;
959 align_x = config_data->guides->x;
960 align_y = config_data->guides->y;
961
1071 if (resize_mode >= E_GUIDES_BOX) 962 if (resize_mode >= E_GUIDES_BOX)
1072 b->hold_changes = 1; /* if non opaque */ 963 b->hold_changes = 1; /* if non opaque */
1073 ecore_window_gravity_set(b->win.client, StaticGravity); 964 ecore_window_gravity_set(b->win.client, StaticGravity);
@@ -1205,22 +1096,10 @@ e_act_resize_v_start(E_Object * object, E_Action * a, void *data, int x, int y,
1205 double align_y = 0.5; 1096 double align_y = 0.5;
1206 E_Guides_Location display_loc = E_GUIDES_DISPLAY_LOCATION_WINDOW_MIDDLE; 1097 E_Guides_Location display_loc = E_GUIDES_DISPLAY_LOCATION_WINDOW_MIDDLE;
1207 1098
1208 E_CFG_INT(cfg_window_resize_mode, "settings", "/window/resize/mode",
1209 E_GUIDES_BOX);
1210 E_CFG_FLOAT(cfg_guides_display_x, "settings", "/guides/display/x", 0.5);
1211 E_CFG_FLOAT(cfg_guides_display_y, "settings", "/guides/display/y", 0.5);
1212 E_CFG_INT(cfg_guides_display_location, "settings",
1213 "/guides/display/location",
1214 E_GUIDES_DISPLAY_LOCATION_WINDOW_MIDDLE);
1215
1216 D_ENTER; 1099 D_ENTER;
1217 1100
1218 e_block_start("menus"); 1101 e_block_start("menus");
1219 1102
1220 E_CONFIG_INT_GET(cfg_window_resize_mode, resize_mode);
1221 E_CONFIG_FLOAT_GET(cfg_guides_display_x, align_x);
1222 E_CONFIG_FLOAT_GET(cfg_guides_display_y, align_y);
1223 E_CONFIG_INT_GET(cfg_guides_display_location, display_loc);
1224 b = (E_Border *) object; 1103 b = (E_Border *) object;
1225 if (!b) 1104 if (!b)
1226 b = e_border_current_focused(); 1105 b = e_border_current_focused();
@@ -1230,6 +1109,12 @@ e_act_resize_v_start(E_Object * object, E_Action * a, void *data, int x, int y,
1230 D_RETURN; 1109 D_RETURN;
1231 if (b->current.shaded != 0) 1110 if (b->current.shaded != 0)
1232 D_RETURN; 1111 D_RETURN;
1112
1113 resize_mode = config_data->window->resize_mode;
1114 display_loc = config_data->guides->location;
1115 align_x = config_data->guides->x;
1116 align_y = config_data->guides->y;
1117
1233 if (resize_mode >= E_GUIDES_BOX) 1118 if (resize_mode >= E_GUIDES_BOX)
1234 b->hold_changes = 1; /* if non opaque */ 1119 b->hold_changes = 1; /* if non opaque */
1235 ecore_window_gravity_set(b->win.client, StaticGravity); 1120 ecore_window_gravity_set(b->win.client, StaticGravity);
@@ -1667,7 +1552,7 @@ e_act_menu_start(E_Object * object, E_Action * a, void *data, int x, int y,
1667 UN(ry); 1552 UN(ry);
1668} 1553}
1669 1554
1670static void 1555void
1671e_act_exit_start(E_Object * object, E_Action * a, void *data, int x, int y, 1556e_act_exit_start(E_Object * object, E_Action * a, void *data, int x, int y,
1672 int rx, int ry) 1557 int rx, int ry)
1673{ 1558{
@@ -1692,7 +1577,7 @@ e_act_exit_start(E_Object * object, E_Action * a, void *data, int x, int y,
1692 UN(ry); 1577 UN(ry);
1693} 1578}
1694 1579
1695static void 1580void
1696e_act_restart_start(E_Object * object, E_Action * a, void *data, int x, int y, 1581e_act_restart_start(E_Object * object, E_Action * a, void *data, int x, int y,
1697 int rx, int ry) 1582 int rx, int ry)
1698{ 1583{
@@ -1967,9 +1852,13 @@ static void
1967e_act_raise_next_start(E_Object * object, E_Action * a, void *data, int x, 1852e_act_raise_next_start(E_Object * object, E_Action * a, void *data, int x,
1968 int y, int rx, int ry) 1853 int y, int rx, int ry)
1969{ 1854{
1855 E_Border *current = NULL;
1856
1970 D_ENTER; 1857 D_ENTER;
1971 1858
1972 e_border_raise_next(); 1859 current = e_desktop_raise_next_border();
1860 if (current)
1861 e_border_send_pointer(current);
1973 1862
1974 D_RETURN; 1863 D_RETURN;
1975 UN(object); 1864 UN(object);
diff --git a/src/actions.h b/src/actions.h
index 9ba2833e7..9f565f017 100644
--- a/src/actions.h
+++ b/src/actions.h
@@ -73,6 +73,7 @@ struct _E_Action_Impl
73 * i.e. the way E performs actions. 73 * i.e. the way E performs actions.
74 */ 74 */
75void e_action_init(void); 75void e_action_init(void);
76void e_action_cleanup(E_Action *a);
76 77
77int e_action_start(char *action, E_Action_Type act, int button, 78int e_action_start(char *action, E_Action_Type act, int button,
78 char *key, Ecore_Event_Key_Modifiers mods, 79 char *key, Ecore_Event_Key_Modifiers mods,
@@ -97,4 +98,10 @@ void e_action_del_timer(E_Object * object, char *name);
97void e_action_add_timer(E_Object * object, char *name); 98void e_action_add_timer(E_Object * object, char *name);
98void e_action_del_timer_object(E_Object * object); 99void e_action_del_timer_object(E_Object * object);
99 100
101
102void e_act_exit_start(E_Object * object, E_Action * a, void *data, int x, int y,
103 int rx, int ry);
104void e_act_restart_start(E_Object * object, E_Action * a, void *data, int x, int y,
105 int rx, int ry);
106
100#endif 107#endif
diff --git a/src/background.c b/src/background.c
index dca848fa0..21ced9b7b 100644
--- a/src/background.c
+++ b/src/background.c
@@ -6,7 +6,7 @@
6static void 6static void
7e_background_cleanup(E_Background * bg) 7e_background_cleanup(E_Background * bg)
8{ 8{
9 Evas_List l; 9 Evas_List * l;
10 10
11 D_ENTER; 11 D_ENTER;
12 12
@@ -22,7 +22,7 @@ e_background_cleanup(E_Background * bg)
22 if (bl->file) 22 if (bl->file)
23 FREE(bl->file); 23 FREE(bl->file);
24 if (bl->obj) 24 if (bl->obj)
25 evas_del_object(bg->evas, bl->obj); 25 evas_object_del(bl->obj);
26 FREE(bl); 26 FREE(bl);
27 } 27 }
28 evas_list_free(bg->layers); 28 evas_list_free(bg->layers);
@@ -30,7 +30,7 @@ e_background_cleanup(E_Background * bg)
30 if (bg->file) 30 if (bg->file)
31 FREE(bg->file); 31 FREE(bg->file);
32 if (bg->base_obj) 32 if (bg->base_obj)
33 evas_del_object(bg->evas, bg->base_obj); 33 evas_object_del(bg->base_obj);
34 34
35 e_object_cleanup(E_OBJECT(bg)); 35 e_object_cleanup(E_OBJECT(bg));
36 36
@@ -149,9 +149,9 @@ e_background_load(char *file)
149} 149}
150 150
151void 151void
152e_background_realize(E_Background * bg, Evas evas) 152e_background_realize(E_Background * bg, Evas * evas)
153{ 153{
154 Evas_List l; 154 Evas_List * l;
155 int ww, hh, count; 155 int ww, hh, count;
156 156
157 D_ENTER; 157 D_ENTER;
@@ -168,9 +168,10 @@ e_background_realize(E_Background * bg, Evas evas)
168 bl = l->data; 168 bl = l->data;
169 if (bl->type == E_BACKGROUND_TYPE_IMAGE) 169 if (bl->type == E_BACKGROUND_TYPE_IMAGE)
170 { 170 {
171 bl->obj = evas_add_image_from_file(bg->evas, bl->file); 171 bl->obj = evas_object_image_add(bg->evas);
172 evas_set_layer(bg->evas, bl->obj, 0); 172 evas_object_image_file_set(bl->obj, bl->file, NULL);
173 evas_show(bg->evas, bl->obj); 173 evas_object_layer_set(bl->obj, 0);
174 evas_object_show(bl->obj);
174#if 0 /* dont need this... do we? */ 175#if 0 /* dont need this... do we? */
175 if (evas_get_image_alpha(bg->evas, bl->obj)) 176 if (evas_get_image_alpha(bg->evas, bl->obj))
176 { 177 {
@@ -203,7 +204,7 @@ e_background_realize(E_Background * bg, Evas evas)
203void 204void
204e_background_set_scroll(E_Background * bg, int sx, int sy) 205e_background_set_scroll(E_Background * bg, int sx, int sy)
205{ 206{
206 Evas_List l; 207 Evas_List * l;
207 208
208 D_ENTER; 209 D_ENTER;
209 210
@@ -220,7 +221,7 @@ e_background_set_scroll(E_Background * bg, int sx, int sy)
220 bl = l->data; 221 bl = l->data;
221 if (bl->type == E_BACKGROUND_TYPE_IMAGE) 222 if (bl->type == E_BACKGROUND_TYPE_IMAGE)
222 { 223 {
223 evas_set_image_fill(bg->evas, bl->obj, 224 evas_object_image_fill_set(bl->obj,
224 (double)bg->geom.sx * bl->scroll.x, 225 (double)bg->geom.sx * bl->scroll.x,
225 (double)bg->geom.sy * bl->scroll.y, 226 (double)bg->geom.sy * bl->scroll.y,
226 bl->fw, bl->fh); 227 bl->fw, bl->fh);
@@ -232,7 +233,7 @@ e_background_set_scroll(E_Background * bg, int sx, int sy)
232void 233void
233e_background_set_size(E_Background * bg, int w, int h) 234e_background_set_size(E_Background * bg, int w, int h)
234{ 235{
235 Evas_List l; 236 Evas_List * l;
236 237
237 D_ENTER; 238 D_ENTER;
238 239
@@ -250,7 +251,7 @@ e_background_set_size(E_Background * bg, int w, int h)
250 iw = 0; 251 iw = 0;
251 ih = 0; 252 ih = 0;
252 if (bg->evas) 253 if (bg->evas)
253 evas_get_image_size(bg->evas, bl->obj, &iw, &ih); 254 evas_object_image_size_get(bl->obj, &iw, &ih);
254 w = bl->size.w * (double)bg->geom.w; 255 w = bl->size.w * (double)bg->geom.w;
255 h = bl->size.h * (double)bg->geom.h; 256 h = bl->size.h * (double)bg->geom.h;
256 if (bl->size.orig.w) 257 if (bl->size.orig.w)
@@ -277,18 +278,18 @@ e_background_set_size(E_Background * bg, int w, int h)
277 bl->fh = fh; 278 bl->fh = fh;
278 if (bg->evas) 279 if (bg->evas)
279 { 280 {
280 evas_move(bg->evas, bl->obj, bl->x, bl->y); 281 evas_object_move(bl->obj, bl->x, bl->y);
281 evas_resize(bg->evas, bl->obj, bl->w, bl->h); 282 evas_object_resize(bl->obj, bl->w, bl->h);
282 if (bl->type == E_BACKGROUND_TYPE_IMAGE) 283 if (bl->type == E_BACKGROUND_TYPE_IMAGE)
283 { 284 {
284 evas_set_image_fill(bg->evas, bl->obj, 285 evas_object_image_fill_set(bl->obj,
285 (double)bg->geom.sx * bl->scroll.x, 286 (double)bg->geom.sx * bl->scroll.x,
286 (double)bg->geom.sy * bl->scroll.y, 287 (double)bg->geom.sy * bl->scroll.y,
287 bl->fw, bl->fh); 288 bl->fw, bl->fh);
288 } 289 }
289 else if (bl->type == E_BACKGROUND_TYPE_GRADIENT) 290 else if (bl->type == E_BACKGROUND_TYPE_GRADIENT)
290 { 291 {
291 evas_set_angle(bg->evas, bl->obj, bl->angle); 292 evas_object_angle_set(bl->obj, bl->angle);
292 } 293 }
293 else if (bl->type == E_BACKGROUND_TYPE_SOLID) 294 else if (bl->type == E_BACKGROUND_TYPE_SOLID)
294 { 295 {
@@ -302,7 +303,7 @@ void
302e_background_set_color_class(E_Background * bg, char *cc, int r, int g, int b, 303e_background_set_color_class(E_Background * bg, char *cc, int r, int g, int b,
303 int a) 304 int a)
304{ 305{
305 Evas_List l; 306 Evas_List * l;
306 307
307 D_ENTER; 308 D_ENTER;
308 309
@@ -316,9 +317,9 @@ e_background_set_color_class(E_Background * bg, char *cc, int r, int g, int b,
316 if (bg->evas) 317 if (bg->evas)
317 { 318 {
318 if ((l == bg->layers) && (bg->base_obj)) 319 if ((l == bg->layers) && (bg->base_obj))
319 evas_set_color(bg->evas, bl->obj, r, g, b, 255); 320 evas_object_color_set(bl->obj, r, g, b, 255);
320 else 321 else
321 evas_set_color(bg->evas, bl->obj, r, g, b, a); 322 evas_object_color_set(bl->obj, r, g, b, a);
322 } 323 }
323 } 324 }
324 } 325 }
diff --git a/src/background.h b/src/background.h
index 3b38e1d3b..00ac89040 100644
--- a/src/background.h
+++ b/src/background.h
@@ -18,7 +18,7 @@ struct _E_Background
18{ 18{
19 E_Object o; 19 E_Object o;
20 20
21 Evas evas; 21 Evas * evas;
22 char *file; 22 char *file;
23 23
24 struct 24 struct
@@ -28,9 +28,9 @@ struct _E_Background
28 } 28 }
29 geom; 29 geom;
30 30
31 Evas_List layers; 31 Evas_List * layers;
32 32
33 Evas_Object base_obj; 33 Evas_Object * base_obj;
34}; 34};
35 35
36struct _E_Background_Layer 36struct _E_Background_Layer
@@ -68,13 +68,13 @@ struct _E_Background_Layer
68 68
69 double x, y, w, h, fw, fh; 69 double x, y, w, h, fw, fh;
70 70
71 Evas_Object obj; 71 Evas_Object * obj;
72}; 72};
73 73
74E_Background *e_background_new(void); 74E_Background *e_background_new(void);
75E_Background *e_background_load(char *file); 75E_Background *e_background_load(char *file);
76 76
77void e_background_realize(E_Background * bg, Evas evas); 77void e_background_realize(E_Background * bg, Evas * evas);
78void e_background_set_scroll(E_Background * bg, int sx, int sy); 78void e_background_set_scroll(E_Background * bg, int sx, int sy);
79void e_background_set_size(E_Background * bg, int w, int h); 79void e_background_set_size(E_Background * bg, int w, int h);
80void e_background_set_color_class(E_Background * bg, char *cc, 80void e_background_set_color_class(E_Background * bg, char *cc,
diff --git a/src/block.c b/src/block.c
index f5aac9e48..3730c005b 100644
--- a/src/block.c
+++ b/src/block.c
@@ -10,14 +10,14 @@ struct _e_block
10 int refs; 10 int refs;
11}; 11};
12 12
13static Evas_List blocks = NULL; 13static Evas_List * blocks = NULL;
14 14
15static E_Block *e_block_find(char *name); 15static E_Block *e_block_find(char *name);
16 16
17static E_Block * 17static E_Block *
18e_block_find(char *name) 18e_block_find(char *name)
19{ 19{
20 Evas_List l; 20 Evas_List * l;
21 21
22 D_ENTER; 22 D_ENTER;
23 for (l = blocks; l; l = l->next) 23 for (l = blocks; l; l = l->next)
diff --git a/src/border.c b/src/border.c
index dc4f7fed6..66e967117 100644
--- a/src/border.c
+++ b/src/border.c
@@ -1,5 +1,6 @@
1#include "cursors.h" 1#include "cursors.h"
2#include "border.h" 2#include "border.h"
3#include "bordermenu.h"
3#include "config.h" 4#include "config.h"
4#include "debug.h" 5#include "debug.h"
5#include "actions.h" 6#include "actions.h"
@@ -12,14 +13,14 @@
12#include "place.h" 13#include "place.h"
13#include "match.h" 14#include "match.h"
14#include "focus.h" 15#include "focus.h"
15#include "menu.h"
16#include "exec.h" 16#include "exec.h"
17#include "menu.h"
17 18
18/* Window border rendering, querying, setting & modification code */ 19/* Window border rendering, querying, setting & modification code */
19 20
20/* globals local to window borders */ 21/* globals local to window borders */
21static Evas_List evases = NULL; 22static Evas_List * evases = NULL;
22static Evas_List borders = NULL; 23static Evas_List * borders = NULL;
23 24
24static int mouse_x, mouse_y, mouse_win_x, mouse_win_y; 25static int mouse_x, mouse_y, mouse_win_x, mouse_win_y;
25static int mouse_buttons = 0; 26static int mouse_buttons = 0;
@@ -50,6 +51,7 @@ static void e_mouse_up(Ecore_Event * ev);
50static void e_mouse_in(Ecore_Event * ev); 51static void e_mouse_in(Ecore_Event * ev);
51static void e_mouse_out(Ecore_Event * ev); 52static void e_mouse_out(Ecore_Event * ev);
52static void e_window_expose(Ecore_Event * ev); 53static void e_window_expose(Ecore_Event * ev);
54float e_border_delayed_val();
53 55
54static void e_cb_mouse_in(void *data, Ebits_Object o, char *class, 56static void e_cb_mouse_in(void *data, Ebits_Object o, char *class,
55 int bt, int x, int y, int ox, int oy, int ow, 57 int bt, int x, int y, int ox, int oy, int ow,
@@ -90,9 +92,7 @@ e_border_replay_query(Ecore_Event_Mouse_Down * ev)
90 { 92 {
91 int focus_mode; 93 int focus_mode;
92 94
93 E_CFG_INT(cfg_focus_mode, "settings", "/focus/mode", 0); 95 focus_mode = config_data->window->focus_mode;
94
95 E_CONFIG_INT_GET(cfg_focus_mode, focus_mode);
96 if ((focus_mode == 2) && (ev->mods == ECORE_EVENT_KEY_MODIFIER_NONE)) 96 if ((focus_mode == 2) && (ev->mods == ECORE_EVENT_KEY_MODIFIER_NONE))
97 /* FIXME: also if pass click always set */ 97 /* FIXME: also if pass click always set */
98 D_RETURN_(1); 98 D_RETURN_(1);
@@ -106,7 +106,7 @@ e_border_replay_query(Ecore_Event_Mouse_Down * ev)
106void 106void
107e_border_update_borders(void) 107e_border_update_borders(void)
108{ 108{
109 Evas_List l; 109 Evas_List * l;
110 110
111 D_ENTER; 111 D_ENTER;
112 112
@@ -122,9 +122,10 @@ e_border_update_borders(void)
122 E_Border *b; 122 E_Border *b;
123 123
124 b = l->data; 124 b = l->data;
125 if (b->first_expose) 125
126 if (b->shape_changed)
126 { 127 {
127 evas_render(b->evas); 128 e_border_reshape(b);
128 } 129 }
129 } 130 }
130 e_db_runtime_flush(); 131 e_db_runtime_flush();
@@ -364,6 +365,9 @@ e_destroy(Ecore_Event * ev)
364 { 365 {
365 E_Border *b; 366 E_Border *b;
366 367
368 if (!(e_border_current_focused()))
369 e_icccm_send_focus_to(e_desktop_window(), 1);
370
367 b = e_border_find_by_window(e->win); 371 b = e_border_find_by_window(e->win);
368 if (b) 372 if (b)
369 { 373 {
@@ -508,9 +512,7 @@ e_focus_out(Ecore_Event * ev)
508 { 512 {
509 int focus_mode; 513 int focus_mode;
510 514
511 E_CFG_INT(cfg_focus_mode, "settings", "/focus/mode", 0); 515 focus_mode = config_data->window->focus_mode;
512
513 E_CONFIG_INT_GET(cfg_focus_mode, focus_mode);
514 b->current.selected = 0; 516 b->current.selected = 0;
515 if (e->key_grab) 517 if (e->key_grab)
516 b->current.select_lost_from_grab = 1; 518 b->current.select_lost_from_grab = 1;
@@ -585,9 +587,7 @@ e_mouse_down(Ecore_Event * ev)
585 { 587 {
586 int focus_mode; 588 int focus_mode;
587 589
588 E_CFG_INT(cfg_focus_mode, "settings", "/focus/mode", 0); 590 focus_mode = config_data->window->focus_mode;
589
590 E_CONFIG_INT_GET(cfg_focus_mode, focus_mode);
591 if (focus_mode == 2) 591 if (focus_mode == 2)
592 { 592 {
593 e_focus_set_focus(b); 593 e_focus_set_focus(b);
@@ -598,15 +598,14 @@ e_mouse_down(Ecore_Event * ev)
598 e_cb_border_mouse_down(b, ev); 598 e_cb_border_mouse_down(b, ev);
599 else 599 else
600 { 600 {
601 Evas evas; 601 Evas *evas;
602 int x, y; 602 int x, y;
603 603
604 evas = b->evas; 604 evas = b->evas;
605 ecore_window_get_root_relative_location(evas_get_window(evas), 605 ecore_window_get_root_relative_location(b->win.b, &x, &y);
606 &x, &y);
607 x = e->rx - x; 606 x = e->rx - x;
608 y = e->ry - y; 607 y = e->ry - y;
609 evas_event_button_down(evas, x, y, e->button); 608 evas_event_feed_mouse_down(evas, e->button);
610 } 609 }
611 } 610 }
612 } 611 }
@@ -640,15 +639,14 @@ e_mouse_up(Ecore_Event * ev)
640 e_cb_border_mouse_up(b, ev); 639 e_cb_border_mouse_up(b, ev);
641 else 640 else
642 { 641 {
643 Evas evas; 642 Evas *evas;
644 int x, y; 643 int x, y;
645 644
646 evas = b->evas; 645 evas = b->evas;
647 ecore_window_get_root_relative_location(evas_get_window(evas), 646 ecore_window_get_root_relative_location(b->win.b, &x, &y);
648 &x, &y);
649 x = e->rx - x; 647 x = e->rx - x;
650 y = e->ry - y; 648 y = e->ry - y;
651 evas_event_button_up(evas, x, y, e->button); 649 evas_event_feed_mouse_up(evas, e->button);
652 } 650 }
653 } 651 }
654 } 652 }
@@ -682,15 +680,14 @@ e_mouse_move(Ecore_Event * ev)
682 e_cb_border_mouse_move(b, ev); 680 e_cb_border_mouse_move(b, ev);
683 else 681 else
684 { 682 {
685 Evas evas; 683 Evas *evas;
686 int x, y; 684 int x, y;
687 685
688 evas = b->evas; 686 evas = b->evas;
689 ecore_window_get_root_relative_location(evas_get_window(evas), 687 ecore_window_get_root_relative_location(b->win.b, &x, &y);
690 &x, &y);
691 x = e->rx - x; 688 x = e->rx - x;
692 y = e->ry - y; 689 y = e->ry - y;
693 evas_event_move(evas, x, y); 690 evas_event_feed_mouse_move(evas, x, y);
694 } 691 }
695 } 692 }
696 } 693 }
@@ -716,15 +713,14 @@ e_mouse_in(Ecore_Event * ev)
716 else if (e->win == b->win.input) 713 else if (e->win == b->win.input)
717 { 714 {
718 int x, y; 715 int x, y;
719 Evas evas; 716 Evas *evas;
720 717
721 evas = b->evas; 718 evas = b->evas;
722 ecore_window_get_root_relative_location(evas_get_window(evas), &x, 719 ecore_window_get_root_relative_location(b->win.b, &x, &y);
723 &y);
724 x = e->rx - x; 720 x = e->rx - x;
725 y = e->ry - y; 721 y = e->ry - y;
726 evas_event_move(evas, x, y); 722 evas_event_feed_mouse_in(evas);
727 evas_event_enter(evas); 723 evas_event_feed_mouse_move(evas, x, y);
728 } 724 }
729 } 725 }
730 current_ev = NULL; 726 current_ev = NULL;
@@ -751,7 +747,7 @@ e_mouse_out(Ecore_Event * ev)
751 e_cb_border_mouse_out(b, ev); 747 e_cb_border_mouse_out(b, ev);
752 if (e->win == b->win.input) 748 if (e->win == b->win.input)
753 { 749 {
754 evas_event_leave(b->evas); 750 evas_event_feed_mouse_out(b->evas);
755 } 751 }
756 } 752 }
757 } 753 }
@@ -771,20 +767,13 @@ e_window_expose(Ecore_Event * ev)
771 current_ev = ev; 767 current_ev = ev;
772 e = ev->event; 768 e = ev->event;
773 { 769 {
774 Evas_List l;
775 E_Border *b; 770 E_Border *b;
776 771
777 for (l = evases; l; l = l->next)
778 {
779 Evas evas;
780
781 evas = l->data;
782 if (evas_get_window(evas) == e->win)
783 evas_update_rect(evas, e->x, e->y, e->w, e->h);
784 }
785 b = e_border_find_by_window(e->win); 772 b = e_border_find_by_window(e->win);
786 if (b) 773 if (b)
787 b->first_expose = 1; 774 {
775 e_border_redraw_region(b, e->x, e->y, e->w, e->h);
776 }
788 } 777 }
789 current_ev = NULL; 778 current_ev = NULL;
790 779
@@ -967,10 +956,8 @@ e_cb_border_mouse_in(E_Border * b, Ecore_Event * e)
967 char *class = "Window_Grab"; 956 char *class = "Window_Grab";
968 int focus_mode; 957 int focus_mode;
969 958
970 E_CFG_INT(cfg_focus_mode, "settings", "/focus/mode", 0);
971
972 D_ENTER; 959 D_ENTER;
973 E_CONFIG_INT_GET(cfg_focus_mode, focus_mode); 960 focus_mode = config_data->window->focus_mode;
974 /* pointer focus stuff */ 961 /* pointer focus stuff */
975 if (focus_mode == 0) 962 if (focus_mode == 0)
976 e_focus_set_focus(b); 963 e_focus_set_focus(b);
@@ -1021,11 +1008,9 @@ e_cb_border_mouse_down(E_Border * b, Ecore_Event * e)
1021 char *class = "Window_Grab"; 1008 char *class = "Window_Grab";
1022 int focus_mode; 1009 int focus_mode;
1023 1010
1024 E_CFG_INT(cfg_focus_mode, "settings", "/focus/mode", 0);
1025
1026 D_ENTER; 1011 D_ENTER;
1027 1012
1028 E_CONFIG_INT_GET(cfg_focus_mode, focus_mode); 1013 focus_mode = config_data->window->focus_mode;
1029 ecore_pointer_grab(((Ecore_Event_Mouse_Down *) (e->event))->win, 1014 ecore_pointer_grab(((Ecore_Event_Mouse_Down *) (e->event))->win,
1030 CurrentTime); 1015 CurrentTime);
1031 border_mouse_x = mouse_x; 1016 border_mouse_x = mouse_x;
@@ -1037,36 +1022,6 @@ e_cb_border_mouse_down(E_Border * b, Ecore_Event * e)
1037 y = ((Ecore_Event_Mouse_Down *) (e->event))->y; 1022 y = ((Ecore_Event_Mouse_Down *) (e->event))->y;
1038 bt = ((Ecore_Event_Mouse_Down *) (e->event))->button; 1023 bt = ((Ecore_Event_Mouse_Down *) (e->event))->button;
1039 { 1024 {
1040 Evas_List l;
1041
1042 again:
1043 for (l = b->grabs; l; l = l->next)
1044 {
1045 E_Grab *g;
1046
1047 g = l->data;
1048 /* find a grab that triggered this */
1049 if (((((Ecore_Event_Mouse_Down *) (e->event))->button == g->button)
1050 || (g->button == 0)) && ((g->any_mod)
1051 ||
1052 (((Ecore_Event_Mouse_Down *) (e->
1053 event))->
1054 mods == g->mods)))
1055 {
1056 if (g->remove_after)
1057 {
1058 ecore_button_ungrab(b->win.main, g->button, g->mods,
1059 g->any_mod);
1060 ecore_window_button_grab_auto_replay_set(b->win.main,
1061 NULL);
1062 FREE(g);
1063 b->grabs = evas_list_remove(b->grabs, g);
1064 goto again;
1065 }
1066 }
1067 }
1068 }
1069 {
1070 E_Action_Type act; 1025 E_Action_Type act;
1071 Ecore_Event_Key_Modifiers mods; 1026 Ecore_Event_Key_Modifiers mods;
1072 1027
@@ -1181,25 +1136,29 @@ e_border_poll(int val, void *data)
1181} 1136}
1182 1137
1183static void 1138static void
1184e_border_cleanup(E_Border * b) 1139e_border_cleanup_window_list(Evas_List *windows)
1185{ 1140{
1186 Evas_List l; 1141 Window temp;
1142
1143 /* Free the old set of pixmaps */
1144 while (windows)
1145 {
1146 temp = (Window) windows->data;
1147 windows = evas_list_remove(windows, (void *)temp);
1148 ecore_window_destroy(temp);
1149 }
1150}
1187 1151
1152static void
1153e_border_cleanup(E_Border * b)
1154{
1188 D_ENTER; 1155 D_ENTER;
1189 1156
1190 e_match_save_props(b); 1157 e_match_save_props(b);
1191 D("before notify\n"); 1158 D("before notify\n");
1192 e_observee_notify_observers(E_OBSERVEE(b), E_EVENT_BORDER_DELETE, NULL); 1159 e_observee_notify_observers(E_OBSERVEE(b), E_EVENT_BORDER_DELETE, NULL);
1193 D("after notify\n"); 1160 D("after notify\n");
1194 while (b->menus) 1161 e_bordermenu_hide();
1195 {
1196 E_Menu *m;
1197
1198 m = b->menus->data;
1199 e_menu_hide(m);
1200 e_object_unref(E_OBJECT(m));
1201 b->menus = evas_list_remove(b->menus, m);
1202 }
1203 e_desktops_del_border(b->desk, b); 1162 e_desktops_del_border(b->desk, b);
1204 if (b->bits.b) 1163 if (b->bits.b)
1205 ebits_free(b->bits.b); 1164 ebits_free(b->bits.b);
@@ -1207,8 +1166,14 @@ e_border_cleanup(E_Border * b)
1207 if (b->obj.title) 1166 if (b->obj.title)
1208 e_text_free(b->obj.title); 1167 e_text_free(b->obj.title);
1209 1168
1169 if (b->obj.title_clip)
1170 evas_object_del(b->obj.title_clip);
1171
1172 e_border_cleanup_window_list(b->windows);
1210 evases = evas_list_remove(evases, b->evas); 1173 evases = evas_list_remove(evases, b->evas);
1211 evas_free(b->evas); 1174 evas_free(b->evas);
1175
1176 ecore_window_destroy(b->win.b);
1212 ecore_window_destroy(b->win.container); 1177 ecore_window_destroy(b->win.container);
1213 ecore_window_destroy(b->win.input); 1178 ecore_window_destroy(b->win.input);
1214 ecore_window_destroy(b->win.main); 1179 ecore_window_destroy(b->win.main);
@@ -1223,17 +1188,8 @@ e_border_cleanup(E_Border * b)
1223 IF_FREE(b->border_style); 1188 IF_FREE(b->border_style);
1224 IF_FREE(b->border_file); 1189 IF_FREE(b->border_file);
1225 1190
1226 if (b->grabs)
1227 {
1228 for (l = b->grabs; l; l = l->next)
1229 {
1230 FREE(l->data);
1231 }
1232 evas_list_free(b->grabs);
1233 }
1234
1235 /* Cleanup superclass. */ 1191 /* Cleanup superclass. */
1236 e_object_cleanup(E_OBJECT(b)); 1192 e_observee_cleanup(E_OBSERVEE(b));
1237 1193
1238 D_RETURN; 1194 D_RETURN;
1239} 1195}
@@ -1263,7 +1219,10 @@ e_border_apply_border(E_Border * b)
1263 if ((b->current.shaded > 0) && (b->current.shaded == b->client.h)) 1219 if ((b->current.shaded > 0) && (b->current.shaded == b->client.h))
1264 prop_shaded = 1; 1220 prop_shaded = 1;
1265 if (b->client.sticky) 1221 if (b->client.sticky)
1266 prop_sticky = 1; 1222 {
1223 prop_sticky = 1;
1224 e_desktops_add_sticky(b);
1225 }
1267 1226
1268 snprintf(border, PATH_MAX, "selected-%i.sticky-%i.shaded-%i.bits.db", 1227 snprintf(border, PATH_MAX, "selected-%i.sticky-%i.shaded-%i.bits.db",
1269 prop_selected, prop_sticky, prop_shaded); 1228 prop_selected, prop_sticky, prop_shaded);
@@ -1292,7 +1251,6 @@ void
1292e_border_reshape(E_Border * b) 1251e_border_reshape(E_Border * b)
1293{ 1252{
1294 static Window shape_win = 0; 1253 static Window shape_win = 0;
1295 static Evas e = NULL;
1296 int pl, pr, pt, pb; 1254 int pl, pr, pt, pb;
1297 1255
1298 D_ENTER; 1256 D_ENTER;
@@ -1315,12 +1273,6 @@ e_border_reshape(E_Border * b)
1315 D_RETURN; 1273 D_RETURN;
1316 } 1274 }
1317 1275
1318 if (!e)
1319 {
1320 e = evas_new();
1321 evas_set_output_method(e, RENDER_METHOD_IMAGE);
1322 }
1323
1324 ecore_window_resize(shape_win, b->current.w, b->current.h); 1276 ecore_window_resize(shape_win, b->current.w, b->current.h);
1325 1277
1326 if ((b->current.shaped_client) && (!b->current.has_shape)) 1278 if ((b->current.shaped_client) && (!b->current.has_shape))
@@ -1358,75 +1310,45 @@ e_border_reshape(E_Border * b)
1358 } 1310 }
1359 else 1311 else
1360 { 1312 {
1313 Display *disp;
1314 Evas_List *windows;
1315
1361 if ((!b->current.shaped_client) && (b->current.has_shape)) 1316 if ((!b->current.shaped_client) && (b->current.has_shape))
1362 { 1317 {
1363
1364 ecore_window_set_shape_rectangle(shape_win, pl, 1318 ecore_window_set_shape_rectangle(shape_win, pl,
1365 pt - b->current.shaded, 1319 pt - b->current.shaded,
1366 b->current.w - pl - pr, 1320 b->current.w - pl - pr,
1367 b->current.h - pt - pb); 1321 b->current.h - pt - pb);
1368
1369 } 1322 }
1370 else 1323 else
1371 { 1324 {
1372
1373 ecore_window_set_shape_window(shape_win, b->win.client, pl, 1325 ecore_window_set_shape_window(shape_win, b->win.client, pl,
1374 pt - b->current.shaded); 1326 pt - b->current.shaded);
1375 ecore_window_clip_shape_by_rectangle(shape_win, pl, pt, 1327 ecore_window_clip_shape_by_rectangle(shape_win, pl, pt,
1376 b->current.w - pl - pr, 1328 b->current.w - pl - pr,
1377 b->current.h - pt - pb); 1329 b->current.h - pt - pb);
1378
1379 } 1330 }
1380 1331
1381 if (b->bits.file) 1332 D("SHAPE update for border %p bit %s\n", b, b->border_file);
1333
1334 e_border_update_render(b);
1335
1336 windows = b->windows;
1337 disp = ecore_display_get();
1338
1339 while (windows)
1382 { 1340 {
1383 Imlib_Image im; 1341 int x, y, w, h;
1384 Ebits_Object bit; 1342 Window window;
1385 Pixmap pmap, mask; 1343
1386 1344 window = (Window) windows->data;
1387 printf("SHAPE update for border %s\n", b->bits.file); 1345 ecore_window_get_geometry(window, &x, &y, &w, &h);
1388 pmap = ecore_pixmap_new(shape_win, b->current.w, b->current.h, 0); 1346 ecore_window_add_shape_window(shape_win, window, x, y);
1389 mask = ecore_pixmap_new(shape_win, b->current.w, b->current.h, 1); 1347
1390 1348 windows = windows->next;
1391 im = imlib_create_image(b->current.w, b->current.h);
1392 imlib_context_set_image(im);
1393 imlib_image_set_has_alpha(1);
1394 imlib_image_clear();
1395
1396 evas_set_output_image(e, im);
1397 evas_set_output_size(e, b->current.w, b->current.h);
1398 evas_set_output_viewport(e, 0, 0, b->current.w, b->current.h);
1399
1400 bit = ebits_load(b->bits.file);
1401 ebits_add_to_evas(bit, e);
1402 ebits_move(bit, 0, 0);
1403 ebits_resize(bit, b->current.w, b->current.h);
1404 ebits_show(bit);
1405
1406 evas_update_rect(e, 0, 0, b->current.w, b->current.h);
1407 evas_render(e);
1408
1409 ebits_hide(bit);
1410 ebits_free(bit);
1411
1412 imlib_context_set_image(im);
1413 imlib_context_set_dither_mask(1);
1414 imlib_context_set_dither(1);
1415 imlib_context_set_drawable(pmap);
1416 imlib_context_set_mask(mask);
1417 imlib_context_set_blend(0);
1418 imlib_context_set_color_modifier(NULL);
1419 imlib_render_image_on_drawable(0, 0);
1420 imlib_free_image();
1421
1422 ecore_window_set_background_pixmap(shape_win, pmap);
1423 ecore_window_add_shape_mask(shape_win, mask);
1424 ecore_window_clear(shape_win);
1425
1426 ecore_pixmap_free(pmap);
1427 ecore_pixmap_free(mask);
1428 } 1349 }
1429 1350
1351 ecore_window_clear(shape_win);
1430 } 1352 }
1431 1353
1432 ecore_window_set_shape_window(b->win.main, shape_win, 0, 0); 1354 ecore_window_set_shape_window(b->win.main, shape_win, 0, 0);
@@ -1447,6 +1369,7 @@ e_border_release(E_Border * b)
1447 ecore_window_reparent(b->win.client, 0, b->current.x + pl, 1369 ecore_window_reparent(b->win.client, 0, b->current.x + pl,
1448 b->current.y + pt); 1370 b->current.y + pt);
1449 e_icccm_release(b->win.client); 1371 e_icccm_release(b->win.client);
1372 e_desktop_raise_next_border();
1450 1373
1451 D_RETURN; 1374 D_RETURN;
1452} 1375}
@@ -1466,7 +1389,7 @@ e_border_adopt(Window win, int use_client_pos)
1466 ecore_window_set_events(win, 1389 ecore_window_set_events(win,
1467 XEV_VISIBILITY | 1390 XEV_VISIBILITY |
1468 ResizeRedirectMask | 1391 ResizeRedirectMask |
1469 XEV_CONFIGURE | 1392 XEV_CONFIGURE | XEV_MOUSE_MOVE |
1470 XEV_FOCUS | XEV_PROPERTY | XEV_COLORMAP); 1393 XEV_FOCUS | XEV_PROPERTY | XEV_COLORMAP);
1471 ecore_window_select_shape_events(win); 1394 ecore_window_select_shape_events(win);
1472 /* parent of the client window listens for these */ 1395 /* parent of the client window listens for these */
@@ -1596,7 +1519,8 @@ e_border_adopt(Window win, int use_client_pos)
1596 } 1519 }
1597 else 1520 else
1598 { 1521 {
1599 show = e_place_border(b, b->desk, &x, &y, E_PLACE_SMART); 1522 show = e_place_border(b, b->desk, &x, &y,
1523 config_data->window->place_mode);
1600 x += pl; 1524 x += pl;
1601 y += pt; 1525 y += pt;
1602 } 1526 }
@@ -1612,6 +1536,8 @@ e_border_adopt(Window win, int use_client_pos)
1612 b->current.requested.h = b->current.h; 1536 b->current.requested.h = b->current.h;
1613 b->current.requested.w = b->current.w; 1537 b->current.requested.w = b->current.w;
1614 e_border_raise(b); 1538 e_border_raise(b);
1539 e_border_update(b);
1540 e_border_reshape(b);
1615 ecore_window_show(win); 1541 ecore_window_show(win);
1616 1542
1617 if (b->client.e.launch_id) 1543 if (b->client.e.launch_id)
@@ -1625,9 +1551,6 @@ e_border_new(void)
1625{ 1551{
1626 /* FIXME: need to set an upper limit on the frame size */ 1552 /* FIXME: need to set an upper limit on the frame size */
1627 E_Border *b; 1553 E_Border *b;
1628 int max_colors = 216;
1629 int font_cache = 1024 * 1024;
1630 int image_cache = 8192 * 1024;
1631 char *font_dir; 1554 char *font_dir;
1632 E_Desktop *desk; 1555 E_Desktop *desk;
1633 1556
@@ -1661,9 +1584,10 @@ e_border_new(void)
1661 b->client.titlebar = 1; 1584 b->client.titlebar = 1;
1662 b->client.takes_focus = 1; 1585 b->client.takes_focus = 1;
1663 1586
1664 desk = e_desktops_get(0); 1587 desk = e_desktops_get(e_desktops_get_current());
1665 e_desktops_add_border(desk, b); 1588 e_desktops_add_border(desk, b);
1666 b->win.main = ecore_window_override_new(desk->win.container, 0, 0, 1, 1); 1589 /* b->win.main = ecore_window_override_new(desk->win.main, 0, 0, 1, 1); */
1590 b->win.main = ecore_window_override_new(0, 0, 0, 1, 1);
1667 b->win.input = ecore_window_input_new(b->win.main, 0, 0, 1, 1); 1591 b->win.input = ecore_window_input_new(b->win.main, 0, 0, 1, 1);
1668 b->win.container = ecore_window_override_new(b->win.main, 0, 0, 1, 1); 1592 b->win.container = ecore_window_override_new(b->win.main, 0, 0, 1, 1);
1669 e_cursors_display_in_window(b->win.container, "Application"); 1593 e_cursors_display_in_window(b->win.container, "Application");
@@ -1674,19 +1598,17 @@ e_border_new(void)
1674 ecore_window_show(b->win.input); 1598 ecore_window_show(b->win.input);
1675 ecore_window_show(b->win.container); 1599 ecore_window_show(b->win.container);
1676 1600
1677 b->evas = evas_new_all(ecore_display_get(), 1601 b->evas = e_evas_new_all(ecore_display_get(),
1678 b->win.main, 1602 b->win.main,
1679 0, 0, 1, 1, 1603 0, 0, 1, 1, font_dir);
1680 RENDER_METHOD_ALPHA_SOFTWARE, 1604 b->win.b = e_evas_get_window(b->evas);
1681 max_colors, font_cache, image_cache, font_dir);
1682 b->win.b = evas_get_window(b->evas);
1683 e_cursors_display_in_window(b->win.b, "Default"); 1605 e_cursors_display_in_window(b->win.b, "Default");
1684 1606
1685 b->obj.title = e_text_new(b->evas, "", "title"); 1607 b->obj.title = e_text_new(b->evas, "", "title");
1686 b->obj.title_clip = evas_add_rectangle(b->evas); 1608 b->obj.title_clip = evas_object_rectangle_add(b->evas);
1687 evas_set_color(b->evas, b->obj.title_clip, 255, 255, 255, 255); 1609 evas_object_color_set(b->obj.title_clip, 255, 255, 255, 255);
1688 e_text_show(b->obj.title); 1610 e_text_show(b->obj.title);
1689 evas_show(b->evas, b->obj.title_clip); 1611 evas_object_show(b->obj.title_clip);
1690 e_text_set_clip(b->obj.title, b->obj.title_clip); 1612 e_text_set_clip(b->obj.title, b->obj.title_clip);
1691 1613
1692 ecore_window_raise(b->win.input); 1614 ecore_window_raise(b->win.input);
@@ -1738,22 +1660,25 @@ e_border_uniconify(E_Border * b)
1738void 1660void
1739e_border_remove_mouse_grabs(E_Border * b) 1661e_border_remove_mouse_grabs(E_Border * b)
1740{ 1662{
1741 Evas_List l; 1663 Evas_List * l;
1742 1664
1743 D_ENTER; 1665 D_ENTER;
1744 1666
1745 if (b->grabs) 1667 if (config_data->grabs)
1746 { 1668 {
1747 for (l = b->grabs; l; l = l->next) 1669 for (l = config_data->grabs; l; l = l->next)
1748 { 1670 {
1749 E_Grab *g; 1671 E_Grab *g;
1750 1672
1751 g = l->data; 1673 g = l->data;
1752 ecore_button_ungrab(b->win.main, g->button, g->mods, g->any_mod); 1674 ecore_button_ungrab(b->win.main, g->button, g->mods, g->any_mod);
1753 FREE(g);
1754 } 1675 }
1755 evas_list_free(b->grabs); 1676 }
1756 b->grabs = NULL; 1677 if (b->click_grab)
1678 {
1679 ecore_button_ungrab(b->win.main, b->click_grab->button,
1680 b->click_grab->mods, b->click_grab->any_mod);
1681 FREE(b->click_grab);
1757 } 1682 }
1758 b->click_grab = NULL; 1683 b->click_grab = NULL;
1759 1684
@@ -1782,18 +1707,13 @@ e_border_remove_click_grab(E_Border * b)
1782void 1707void
1783e_border_attach_mouse_grabs(E_Border * b) 1708e_border_attach_mouse_grabs(E_Border * b)
1784{ 1709{
1785 char *grabs_db;
1786 E_DB_File *db;
1787 int focus_mode; 1710 int focus_mode;
1788 char buf[PATH_MAX]; 1711 Evas_List *l;
1789
1790 E_CFG_INT(cfg_focus_mode, "settings", "/focus/mode", 0);
1791 1712
1792 D_ENTER; 1713 D_ENTER;
1793 1714
1794 E_CONFIG_INT_GET(cfg_focus_mode, focus_mode); 1715 focus_mode = config_data->window->focus_mode;
1795 1716
1796 grabs_db = e_config_get("grabs");
1797 /* settings - click to focus would affect grabs */ 1717 /* settings - click to focus would affect grabs */
1798 if ((!b->current.selected) && (focus_mode == 2)) 1718 if ((!b->current.selected) && (focus_mode == 2))
1799 { 1719 {
@@ -1812,52 +1732,12 @@ e_border_attach_mouse_grabs(E_Border * b)
1812 b->click_grab = g; 1732 b->click_grab = g;
1813 } 1733 }
1814 1734
1815 /* other grabs - liek alt+left to move */ 1735 for (l = config_data->grabs; l; l = l->next)
1816 db = e_db_open_read(grabs_db);
1817 if (db)
1818 { 1736 {
1819 int i, num; 1737 E_Grab *g;
1820 1738
1821 snprintf(buf, PATH_MAX, "/grabs/count"); 1739 g = l->data;
1822 if (!e_db_int_get(db, buf, &num)) 1740 ecore_button_grab(b->win.main, g->button, XEV_BUTTON_PRESS, g->mods, 0);
1823 {
1824 e_db_close(db);
1825 D_RETURN;
1826 }
1827 for (i = 0; i < num; i++)
1828 {
1829 int button, any_mod, mod;
1830 Ecore_Event_Key_Modifiers mods;
1831
1832 button = -1;
1833 mods = ECORE_EVENT_KEY_MODIFIER_NONE;
1834 any_mod = 0;
1835 snprintf(buf, PATH_MAX, "/grabs/%i/button", i);
1836 if (!e_db_int_get(db, buf, &button))
1837 continue;
1838 snprintf(buf, PATH_MAX, "/grabs/%i/modifiers", i);
1839 if (!e_db_int_get(db, buf, &mod))
1840 continue;
1841 if (mod == -1)
1842 any_mod = 1;
1843 mods = (Ecore_Event_Key_Modifiers) mod;
1844
1845 if (button >= 0)
1846 {
1847 E_Grab *g;
1848
1849 g = NEW(E_Grab, 1);
1850 ZERO(g, E_Grab, 1);
1851 g->button = button;
1852 g->mods = mods;
1853 g->any_mod = any_mod;
1854 g->remove_after = 0;
1855 b->grabs = evas_list_append(b->grabs, g);
1856 ecore_button_grab(b->win.main, button, XEV_BUTTON_PRESS, mods,
1857 0);
1858 }
1859 }
1860 e_db_close(db);
1861 } 1741 }
1862 1742
1863 D_RETURN; 1743 D_RETURN;
@@ -1866,7 +1746,7 @@ e_border_attach_mouse_grabs(E_Border * b)
1866void 1746void
1867e_border_remove_all_mouse_grabs(void) 1747e_border_remove_all_mouse_grabs(void)
1868{ 1748{
1869 Evas_List l; 1749 Evas_List * l;
1870 1750
1871 D_ENTER; 1751 D_ENTER;
1872 1752
@@ -1879,7 +1759,7 @@ e_border_remove_all_mouse_grabs(void)
1879void 1759void
1880e_border_attach_all_mouse_grabs(void) 1760e_border_attach_all_mouse_grabs(void)
1881{ 1761{
1882 Evas_List l; 1762 Evas_List * l;
1883 1763
1884 D_ENTER; 1764 D_ENTER;
1885 1765
@@ -1898,7 +1778,7 @@ e_border_redo_grabs(void)
1898 static time_t mod_date_settings = 0; 1778 static time_t mod_date_settings = 0;
1899 time_t mod; 1779 time_t mod;
1900 int changed = 0; 1780 int changed = 0;
1901 Evas_List l; 1781 Evas_List * l;
1902 1782
1903 D_ENTER; 1783 D_ENTER;
1904 1784
@@ -1932,10 +1812,12 @@ e_border_redo_grabs(void)
1932E_Border * 1812E_Border *
1933e_border_find_by_window(Window win) 1813e_border_find_by_window(Window win)
1934{ 1814{
1935 Evas_List l; 1815 Window pwin;
1816 Evas_List * l;
1936 1817
1937 D_ENTER; 1818 D_ENTER;
1938 1819
1820 pwin = ecore_window_get_parent(win);
1939 for (l = borders; l; l = l->next) 1821 for (l = borders; l; l = l->next)
1940 { 1822 {
1941 E_Border *b; 1823 E_Border *b;
@@ -1945,7 +1827,9 @@ e_border_find_by_window(Window win)
1945 if ((win == b->win.main) || 1827 if ((win == b->win.main) ||
1946 (win == b->win.client) || 1828 (win == b->win.client) ||
1947 (win == b->win.container) || 1829 (win == b->win.container) ||
1948 (win == b->win.input) || (win == b->win.b)) 1830 (win == b->win.input) ||
1831 (win == b->win.b) ||
1832 (pwin == b->win.main))
1949 D_RETURN_(b); 1833 D_RETURN_(b);
1950 } 1834 }
1951 1835
@@ -1967,12 +1851,8 @@ e_border_set_bits(E_Border * b, char *file)
1967 1851
1968 if (b->bits.b) 1852 if (b->bits.b)
1969 ebits_free(b->bits.b); 1853 ebits_free(b->bits.b);
1970 if (b->bits.file)
1971 free(b->bits.file);
1972 1854
1973 b->bits.b = ebits_load(file); 1855 b->bits.b = ebits_load(file);
1974 if (b->bits.b)
1975 b->bits.file = strdup(file);
1976 b->bits.new = 1; 1856 b->bits.new = 1;
1977 b->changed = 1; 1857 b->changed = 1;
1978 1858
@@ -1993,11 +1873,11 @@ e_border_set_bits(E_Border * b, char *file)
1993 e_border_set_color_class(b, "Title BG", 100, 200, 255, 255); 1873 e_border_set_color_class(b, "Title BG", 100, 200, 255, 255);
1994 1874
1995#define HOOK_CB(_class) \ 1875#define HOOK_CB(_class) \
1996ebits_set_classed_bit_callback(b->bits.b, _class, CALLBACK_MOUSE_IN, e_cb_mouse_in, b); \ 1876ebits_set_classed_bit_callback(b->bits.b, _class, EVAS_CALLBACK_MOUSE_IN, e_cb_mouse_in, b); \
1997ebits_set_classed_bit_callback(b->bits.b, _class, CALLBACK_MOUSE_OUT, e_cb_mouse_out, b); \ 1877ebits_set_classed_bit_callback(b->bits.b, _class, EVAS_CALLBACK_MOUSE_OUT, e_cb_mouse_out, b); \
1998ebits_set_classed_bit_callback(b->bits.b, _class, CALLBACK_MOUSE_DOWN, e_cb_mouse_down, b); \ 1878ebits_set_classed_bit_callback(b->bits.b, _class, EVAS_CALLBACK_MOUSE_DOWN, e_cb_mouse_down, b); \
1999ebits_set_classed_bit_callback(b->bits.b, _class, CALLBACK_MOUSE_UP, e_cb_mouse_up, b); \ 1879ebits_set_classed_bit_callback(b->bits.b, _class, EVAS_CALLBACK_MOUSE_UP, e_cb_mouse_up, b); \
2000ebits_set_classed_bit_callback(b->bits.b, _class, CALLBACK_MOUSE_MOVE, e_cb_mouse_move, b); 1880ebits_set_classed_bit_callback(b->bits.b, _class, EVAS_CALLBACK_MOUSE_MOVE, e_cb_mouse_move, b);
2001 HOOK_CB("Title_Bar"); 1881 HOOK_CB("Title_Bar");
2002 HOOK_CB("Resize"); 1882 HOOK_CB("Resize");
2003 HOOK_CB("Resize_Horizontal"); 1883 HOOK_CB("Resize_Horizontal");
@@ -2156,11 +2036,176 @@ e_border_adjust_limits(E_Border * b)
2156} 2036}
2157 2037
2158void 2038void
2039e_border_redraw_region(E_Border * b, int x, int y, int w, int h)
2040{
2041 GC gc;
2042 Evas_List *windows;
2043
2044 gc = ecore_gc_new(b->win.b);
2045
2046 windows = b->windows;
2047
2048 while (windows)
2049 {
2050 int xx, yy, ww, hh;
2051 Window window;
2052
2053 window = (Window) windows->data;
2054 ecore_window_get_geometry(window, &xx, &yy, &ww, &hh);
2055
2056 if (INTERSECTS(x, y, w, h, xx, yy, ww, hh))
2057 {
2058 int rw, rh;
2059
2060 rw = MIN(w, ww);
2061 rh = MIN(h, hh);
2062 ecore_window_clear_area(window, x, y, rw, rh);
2063 }
2064
2065 windows = windows->next;
2066 }
2067
2068 ecore_gc_free(gc);
2069}
2070
2071void
2072e_border_update_render(E_Border * b)
2073{
2074 GC gc1, gc2;
2075 Evas_List *up, *hp, *owin, *nwin = NULL;
2076 Window window;
2077 Pixmap pmap, mask, temp;
2078 int pl, pr, pt, pb;
2079 Evas_Engine_Info_Software_X11 *info;
2080
2081 pmap = ecore_pixmap_new(b->win.b, b->current.w, b->current.h, 0);
2082 mask = ecore_pixmap_new(b->win.b, b->current.w, b->current.h, 1);
2083
2084 gc1 = ecore_gc_new(pmap);
2085 gc2 = ecore_gc_new(mask);
2086
2087 info = (Evas_Engine_Info_Software_X11 *) evas_engine_info_get(b->evas);
2088 info->info.drawable = pmap;
2089 info->info.mask = mask;
2090 evas_engine_info_set(b->evas, (Evas_Engine_Info *) info);
2091
2092 /*
2093 * Hide the bits and render to clear the old appearance from generating
2094 * damage rectangles.
2095 */
2096 if (b->bits.b)
2097 {
2098 ebits_hide(b->bits.b);
2099 }
2100
2101 if (b->obj.title)
2102 {
2103 evas_object_hide(b->obj.title_clip);
2104 }
2105
2106 evas_render(b->evas);
2107
2108 /*
2109 * Position and then show the bits so we only get damage rectangles for the
2110 * area we want shown.
2111 */
2112 if (b->bits.b)
2113 {
2114 ebits_move(b->bits.b, 0, 0);
2115 ebits_resize(b->bits.b, b->current.w, b->current.h);
2116 ebits_get_insets(b->bits.b, &pl, &pr, &pt, &pb);
2117 ebits_show(b->bits.b);
2118 }
2119
2120 if (b->obj.title)
2121 {
2122 double tx, ty, tw, th;
2123
2124 ebits_get_named_bit_geometry(b->bits.b, "Title_Area", &tx, &ty, &tw,
2125 &th);
2126 e_text_move(b->obj.title, tx, ty);
2127 e_text_set_layer(b->obj.title, 1);
2128
2129 evas_object_move(b->obj.title_clip, tx, ty);
2130 evas_object_resize(b->obj.title_clip, tw, th);
2131 evas_object_show(b->obj.title_clip);
2132 }
2133
2134 hp = up = evas_render_updates(b->evas);
2135
2136 owin = b->windows;
2137 b->windows = NULL;
2138
2139 D("Rendering %d rectangles for border %p { w = %d, h = %d }\n",
2140 (up ? up->count : 0), b, b->current.w, b->current.h);
2141 while (up)
2142 {
2143 Evas_Rectangle *u;
2144
2145 u = up->data;
2146
2147 D("\tRectangle { x = %d, y = %d, w = %d, h = %d }\n",
2148 u->x, u->y, u->w, u->h);
2149
2150 /* Copy the large pixmap to a series of small pixmaps. */
2151 temp = ecore_pixmap_new(b->win.b, u->w, u->h, 0);
2152 ecore_gc_set_fg(gc1, 0);
2153 ecore_fill_rectangle(temp, gc1, 0, 0, u->w, u->h);
2154 ecore_gc_set_fg(gc1, 1);
2155 ecore_area_copy(pmap, temp, gc1, u->x, u->y, u->w, u->h, 0, 0);
2156
2157 /* Setup small windows for borders, with the pixmaps as backgrounds */
2158 window = ecore_window_override_new(b->win.main, u->x, u->y, u->w, u->h);
2159 ecore_window_set_events_propagate(window, 1);
2160 ecore_window_set_events(window, XEV_IN_OUT | XEV_MOUSE_MOVE |
2161 XEV_BUTTON);
2162 ecore_window_set_background_pixmap(window, temp);
2163 ecore_pixmap_free(temp);
2164
2165 /* Copy the large mask to a series of small masks. */
2166 temp = ecore_pixmap_new(b->win.b, u->w, u->h, 1);
2167 ecore_gc_set_fg(gc2, 0);
2168 ecore_fill_rectangle(temp, gc2, 0, 0, u->w, u->h);
2169 ecore_gc_set_fg(gc2, 1);
2170 ecore_area_copy(mask, temp, gc2, u->x, u->y, u->w, u->h, 0, 0);
2171
2172 ecore_window_set_shape_mask(window, temp);
2173 ecore_pixmap_free(temp);
2174
2175 nwin = evas_list_append(nwin, (void *)window);
2176 up = up->next;
2177 }
2178
2179 evas_render_updates_free(hp);
2180
2181 ecore_gc_free(gc1);
2182 ecore_gc_free(gc2);
2183
2184 ecore_pixmap_free(pmap);
2185 ecore_pixmap_free(mask);
2186
2187 /* Update the display all at once. */
2188 b->windows = nwin;
2189 while (nwin)
2190 {
2191 window = (Window)nwin->data;
2192 ecore_window_raise(window);
2193 ecore_window_show(window);
2194 nwin = nwin->next;
2195 }
2196
2197 /* Order is important here to have a smooth update */
2198 e_border_redraw_region(b, 0, 0, b->current.w, b->current.h);
2199 e_border_cleanup_window_list(owin);
2200
2201 D("Finished rendering update\n");
2202}
2203
2204void
2159e_border_update(E_Border * b) 2205e_border_update(E_Border * b)
2160{ 2206{
2161 int location_changed = 0; 2207 int location_changed = 0;
2162 int size_changed = 0; 2208 int size_changed = 0;
2163 int shape_changed = 0;
2164 int border_changed = 0; 2209 int border_changed = 0;
2165 int visibility_changed = 0; 2210 int visibility_changed = 0;
2166 int state_changed = 0; 2211 int state_changed = 0;
@@ -2179,7 +2224,7 @@ e_border_update(E_Border * b)
2179 if ((b->current.w != b->previous.w) || (b->current.h != b->previous.h)) 2224 if ((b->current.w != b->previous.w) || (b->current.h != b->previous.h))
2180 size_changed = 1; 2225 size_changed = 1;
2181 if ((size_changed) && (b->current.has_shape)) 2226 if ((size_changed) && (b->current.has_shape))
2182 shape_changed = 1; 2227 b->shape_changed = 1;
2183 if (b->current.selected != b->previous.selected) 2228 if (b->current.selected != b->previous.selected)
2184 state_changed = 1; 2229 state_changed = 1;
2185 if (state_changed) 2230 if (state_changed)
@@ -2198,7 +2243,7 @@ e_border_update(E_Border * b)
2198 border_changed = 1; 2243 border_changed = 1;
2199 } 2244 }
2200 if ((border_changed) && (b->current.has_shape)) 2245 if ((border_changed) && (b->current.has_shape))
2201 shape_changed = 1; 2246 b->shape_changed = 1;
2202 if (b->current.visible != b->previous.visible) 2247 if (b->current.visible != b->previous.visible)
2203 visibility_changed = 1; 2248 visibility_changed = 1;
2204 2249
@@ -2217,7 +2262,7 @@ e_border_update(E_Border * b)
2217 } 2262 }
2218 else if (size_changed) 2263 else if (size_changed)
2219 { 2264 {
2220 int pl, pr, pt, pb, x, y, w, h; 2265 int pl, pr, pt, pb, w, h;
2221 int smaller; 2266 int smaller;
2222 2267
2223 if ((b->current.shaped_client) || (b->previous.shaped_client) || 2268 if ((b->current.shaped_client) || (b->previous.shaped_client) ||
@@ -2232,88 +2277,38 @@ e_border_update(E_Border * b)
2232 ebits_get_insets(b->bits.b, &pl, &pr, &pt, &pb); 2277 ebits_get_insets(b->bits.b, &pl, &pr, &pt, &pb);
2233 ecore_window_move_resize(b->win.input, 2278 ecore_window_move_resize(b->win.input,
2234 0, 0, b->current.w, b->current.h); 2279 0, 0, b->current.w, b->current.h);
2235 if (smaller) 2280 ecore_window_move_resize(b->win.main,
2281 b->current.x, b->current.y,
2282 b->current.w, b->current.h);
2283 w = b->current.w, h = b->current.h;
2284 if ((w < 1) || (h < 1))
2285 ecore_window_hide(b->win.b);
2286 else
2236 { 2287 {
2237 if (b->current.shaded == b->client.h) 2288 ecore_window_show(b->win.b);
2238 { 2289 ecore_window_move_resize(b->win.b, 0, 0, w, h);
2239 ecore_window_move_resize(b->win.client, 2290 evas_output_size_set(b->evas, w, h);
2240 0, -b->current.shaded, 2291 evas_output_viewport_set(b->evas, 0, 0, w, h);
2241 b->client.w, b->client.h); 2292 }
2242 ecore_window_move_resize(b->win.container,
2243 b->current.w + 1,
2244 b->current.h + 1, 320, 320);
2245 }
2246 else
2247 {
2248 ecore_window_move_resize(b->win.client,
2249 0, -b->current.shaded,
2250 b->client.w, b->client.h);
2251 ecore_window_move_resize(b->win.container,
2252 pl,
2253 pt,
2254 b->current.w - pl - pr,
2255 b->current.h - pt - pb);
2256 }
2257 ecore_window_move_resize(b->win.main,
2258 b->current.x, b->current.y,
2259 b->current.w, b->current.h);
2260 2293
2261 x = 0, y = 0, w = b->current.w, h = b->current.h; 2294 if (b->current.shaded == b->client.h)
2262 if ((w < 1) || (h < 1)) 2295 {
2263 ecore_window_hide(b->win.b); 2296 ecore_window_move_resize(b->win.container,
2264 else 2297 b->current.w + 1,
2265 { 2298 b->current.h + 1, 320, 320);
2266 ecore_window_show(b->win.b);
2267 ecore_window_move_resize(b->win.b, x, y, w, h);
2268 evas_set_output_size(b->evas, w, h);
2269 evas_set_output_viewport(b->evas, x, y, w, h);
2270 }
2271 } 2299 }
2272 else 2300 else
2273 { 2301 {
2274 ecore_window_move_resize(b->win.main, 2302 ecore_window_move_resize(b->win.container,
2275 b->current.x, b->current.y, 2303 pl,
2276 b->current.w, b->current.h); 2304 pt,
2277 x = 0, y = 0, w = b->current.w, h = b->current.h; 2305 b->current.w - pl - pr,
2278 if ((w < 1) || (h < 1)) 2306 b->current.h - pt - pb);
2279 ecore_window_hide(b->win.b);
2280 else
2281 {
2282 ecore_window_show(b->win.b);
2283 ecore_window_move_resize(b->win.b, x, y, w, h);
2284 evas_set_output_size(b->evas, w, h);
2285 evas_set_output_viewport(b->evas, x, y, w, h);
2286 }
2287
2288 if (b->current.shaded == b->client.h)
2289 {
2290 ecore_window_move_resize(b->win.container,
2291 b->current.w + 1,
2292 b->current.h + 1, 320, 320);
2293 ecore_window_move_resize(b->win.client,
2294 0, -b->current.shaded,
2295 b->client.w, b->client.h);
2296 }
2297 else
2298 {
2299 ecore_window_move_resize(b->win.container,
2300 pl,
2301 pt,
2302 b->current.w - pl - pr,
2303 b->current.h - pt - pb);
2304 ecore_window_move_resize(b->win.client,
2305 0, -b->current.shaded,
2306 b->client.w, b->client.h);
2307 }
2308 } 2307 }
2309 2308
2310 if (b->bits.b) 2309 ecore_window_move_resize(b->win.client,
2311 { 2310 0, -b->current.shaded,
2312 ebits_resize(b->bits.b, b->current.w, b->current.h); 2311 b->client.w, b->client.h);
2313 evas_clear_obscured_rects(b->evas);
2314 evas_add_obscured_rect(b->evas, pl, pt, b->current.w - pl - pr,
2315 b->current.h - pt - pb);
2316 }
2317 2312
2318 e_icccm_move_resize(b->win.client, 2313 e_icccm_move_resize(b->win.client,
2319 b->current.x + pl, 2314 b->current.x + pl,
@@ -2323,27 +2318,19 @@ e_border_update(E_Border * b)
2323 } 2318 }
2324 if ((b->client.title) && (b->bits.b)) 2319 if ((b->client.title) && (b->bits.b))
2325 { 2320 {
2326 double tx, ty, tw, th;
2327
2328 ebits_get_named_bit_geometry(b->bits.b, "Title_Area", &tx, &ty, &tw,
2329 &th);
2330
2331 if (b->obj.title) 2321 if (b->obj.title)
2332 { 2322 {
2333 e_text_set_text(b->obj.title, b->client.title); 2323 if (strcmp(b->client.title, b->obj.title->text))
2334 e_text_move(b->obj.title, tx, ty); 2324 {
2325 e_text_set_text(b->obj.title, b->client.title);
2326 b->shape_changed = 1;
2327 }
2335 if (b->current.selected) 2328 if (b->current.selected)
2336 e_text_set_state(b->obj.title, "selected"); 2329 e_text_set_state(b->obj.title, "selected");
2337 else 2330 else
2338 e_text_set_state(b->obj.title, "normal"); 2331 e_text_set_state(b->obj.title, "normal");
2339 } 2332 }
2340 evas_move(b->evas, b->obj.title_clip, tx, ty);
2341 evas_resize(b->evas, b->obj.title_clip, tw, th);
2342
2343 if (b->obj.title)
2344 e_text_set_layer(b->obj.title, 1);
2345 } 2333 }
2346 e_border_reshape(b);
2347 if (visibility_changed) 2334 if (visibility_changed)
2348 { 2335 {
2349 if (b->current.visible) 2336 if (b->current.visible)
@@ -2386,11 +2373,9 @@ e_border_raise_delayed(int val, void *b)
2386{ 2373{
2387 int auto_raise = 0; 2374 int auto_raise = 0;
2388 2375
2389 E_CFG_INT(cfg_auto_raise, "settings", "/window/raise/auto", 0);
2390
2391 D_ENTER; 2376 D_ENTER;
2392 2377
2393 E_CONFIG_INT_GET(cfg_auto_raise, auto_raise); 2378 auto_raise = config_data->window->auto_raise;
2394 if (auto_raise) 2379 if (auto_raise)
2395 e_border_raise((E_Border *) b); 2380 e_border_raise((E_Border *) b);
2396 2381
@@ -2398,38 +2383,60 @@ e_border_raise_delayed(int val, void *b)
2398 UN(val); 2383 UN(val);
2399} 2384}
2400 2385
2386float
2387e_border_delayed_val()
2388{
2389 return config_data->window->raise_delay;
2390}
2391
2401void 2392void
2402e_border_raise(E_Border * b) 2393e_border_raise(E_Border * b)
2403{ 2394{
2404 Evas_List l; 2395 Evas_List *l;
2396 Evas_List **windows;
2405 E_Border *rel; 2397 E_Border *rel;
2406 2398
2407 D_ENTER; 2399 D_ENTER;
2408 2400
2409 if (!b->desk->windows) 2401 /* Sticky windows are not on a particular desktop, but we need the current
2402 * desktop window list to raise the window correctly. */
2403 if (b->client.sticky)
2410 { 2404 {
2411 b->desk->windows = evas_list_append(b->desk->windows, b); 2405 E_Desktop *desk;
2412 b->desk->changed = 1; 2406
2407 desk = e_desktops_get(e_desktops_get_current());
2408 windows = &desk->windows;
2409 }
2410 else
2411 windows = &b->desk->windows;
2412
2413 if (!(*windows))
2414 {
2415 *windows = evas_list_append(*windows, b);
2413 ecore_window_raise(b->win.main); 2416 ecore_window_raise(b->win.main);
2414 D_RETURN; 2417 D_RETURN;
2415 } 2418 }
2416 for (l = b->desk->windows; l; l = l->next) 2419 for (l = *windows; l; l = l->next)
2417 { 2420 {
2418 rel = l->data; 2421 rel = l->data;
2419 if (rel->client.layer > b->client.layer) 2422 if (rel->client.layer > b->client.layer)
2420 { 2423 {
2421 b->desk->windows = evas_list_remove(b->desk->windows, b); 2424 if (!b->client.sticky)
2422 b->desk->windows = 2425 {
2423 evas_list_prepend_relative(b->desk->windows, b, rel); 2426 *windows = evas_list_remove(*windows, b);
2424 b->desk->changed = 1; 2427 *windows = evas_list_prepend_relative(*windows, b, rel);
2428 }
2429
2425 ecore_window_stack_below(b->win.main, rel->win.main); 2430 ecore_window_stack_below(b->win.main, rel->win.main);
2426 D_RETURN; 2431 D_RETURN;
2427 } 2432 }
2428 if ((!l->next) && (l->data != b)) 2433 if ((!l->next) && (l->data != b))
2429 { 2434 {
2430 b->desk->windows = evas_list_remove(b->desk->windows, b); 2435 if (!b->client.sticky)
2431 b->desk->windows = evas_list_append(b->desk->windows, b); 2436 {
2432 b->desk->changed = 1; 2437 *windows = evas_list_remove(*windows, b);
2438 *windows = evas_list_append(*windows, b);
2439 }
2433 ecore_window_raise(b->win.main); 2440 ecore_window_raise(b->win.main);
2434 D_RETURN; 2441 D_RETURN;
2435 } 2442 }
@@ -2441,29 +2448,39 @@ e_border_raise(E_Border * b)
2441void 2448void
2442e_border_lower(E_Border * b) 2449e_border_lower(E_Border * b)
2443{ 2450{
2444 Evas_List l; 2451 Evas_List *l;
2452 Evas_List **windows;
2445 E_Border *rel; 2453 E_Border *rel;
2446 2454
2447 D_ENTER; 2455 D_ENTER;
2448 2456
2449 if (!b->desk->windows) 2457 /* Sticky windows are not on a particular desktop, but we need the current
2458 * desktop window list to raise the window correctly. */
2459 if (b->client.sticky)
2450 { 2460 {
2451 b->desk->windows = evas_list_append(b->desk->windows, b); 2461 E_Desktop *desk;
2452 b->desk->changed = 1; 2462
2463 desk = e_desktops_get(e_desktops_get_current());
2464 windows = &desk->windows;
2465 }
2466 else
2467 windows = &b->desk->windows;
2468
2469 if (!(*windows))
2470 {
2471 *windows = evas_list_append(*windows, b);
2453 ecore_window_raise(b->win.main); 2472 ecore_window_raise(b->win.main);
2454 D_RETURN; 2473 D_RETURN;
2455 } 2474 }
2456 for (l = b->desk->windows; l; l = l->next) 2475 for (l = *windows; l; l = l->next)
2457 { 2476 {
2458 rel = l->data; 2477 rel = l->data;
2459 if (rel->client.layer == b->client.layer) 2478 if (rel->client.layer == b->client.layer)
2460 { 2479 {
2461 if (b == rel) 2480 if (b == rel)
2462 D_RETURN; 2481 D_RETURN;
2463 b->desk->windows = evas_list_remove(b->desk->windows, b); 2482 *windows = evas_list_remove(*windows, b);
2464 b->desk->windows = 2483 *windows = evas_list_prepend_relative(*windows, b, rel);
2465 evas_list_prepend_relative(b->desk->windows, b, rel);
2466 b->desk->changed = 1;
2467 ecore_window_stack_below(b->win.main, rel->win.main); 2484 ecore_window_stack_below(b->win.main, rel->win.main);
2468 D_RETURN; 2485 D_RETURN;
2469 } 2486 }
@@ -2475,22 +2492,34 @@ e_border_lower(E_Border * b)
2475void 2492void
2476e_border_raise_above(E_Border * b, E_Border * above) 2493e_border_raise_above(E_Border * b, E_Border * above)
2477{ 2494{
2495 Evas_List **windows;
2496
2478 D_ENTER; 2497 D_ENTER;
2479 2498
2480 if (!b->desk->windows) 2499 /* Sticky windows are not on a particular desktop, but we need the current
2500 * desktop window list to raise the window correctly. */
2501 if (b->client.sticky)
2502 {
2503 E_Desktop *desk;
2504
2505 desk = e_desktops_get(e_desktops_get_current());
2506 windows = &desk->windows;
2507 }
2508 else
2509 windows = &b->desk->windows;
2510
2511 if (!(*windows))
2481 { 2512 {
2482 b->desk->windows = evas_list_append(b->desk->windows, b); 2513 *windows = evas_list_append(*windows, b);
2483 b->desk->changed = 1;
2484 ecore_window_raise(b->win.main); 2514 ecore_window_raise(b->win.main);
2485 D_RETURN; 2515 D_RETURN;
2486 } 2516 }
2487 if (!evas_list_find(b->desk->windows, above)) 2517 if (!evas_list_find(*windows, above))
2488 D_RETURN; 2518 D_RETURN;
2489 if (b->client.layer < above->client.layer) 2519 if (b->client.layer < above->client.layer)
2490 b->client.layer = above->client.layer; 2520 b->client.layer = above->client.layer;
2491 b->desk->windows = evas_list_remove(b->desk->windows, b); 2521 *windows = evas_list_remove(*windows, b);
2492 b->desk->windows = evas_list_append_relative(b->desk->windows, b, above); 2522 *windows = evas_list_append_relative(*windows, b, above);
2493 b->desk->changed = 1;
2494 ecore_window_stack_above(b->win.main, above->win.main); 2523 ecore_window_stack_above(b->win.main, above->win.main);
2495 2524
2496 D_RETURN; 2525 D_RETURN;
@@ -2499,21 +2528,33 @@ e_border_raise_above(E_Border * b, E_Border * above)
2499void 2528void
2500e_border_lower_below(E_Border * b, E_Border * below) 2529e_border_lower_below(E_Border * b, E_Border * below)
2501{ 2530{
2531 Evas_List **windows;
2532
2502 D_ENTER; 2533 D_ENTER;
2503 2534
2504 if (!b->desk->windows) 2535 /* Sticky windows are not on a particular desktop, but we need the current
2536 * desktop window list to raise the window correctly. */
2537 if (b->client.sticky)
2505 { 2538 {
2506 b->desk->windows = evas_list_append(b->desk->windows, b); 2539 E_Desktop *desk;
2507 b->desk->changed = 1; 2540
2541 desk = e_desktops_get(e_desktops_get_current());
2542 windows = &desk->windows;
2543 }
2544 else
2545 windows = &b->desk->windows;
2546
2547 if (!(*windows))
2548 {
2549 *windows = evas_list_append(*windows, b);
2508 D_RETURN; 2550 D_RETURN;
2509 } 2551 }
2510 if (!evas_list_find(b->desk->windows, below)) 2552 if (!evas_list_find(*windows, below))
2511 D_RETURN; 2553 D_RETURN;
2512 if (b->client.layer > below->client.layer) 2554 if (b->client.layer > below->client.layer)
2513 b->client.layer = below->client.layer; 2555 b->client.layer = below->client.layer;
2514 b->desk->windows = evas_list_remove(b->desk->windows, b); 2556 *windows = evas_list_remove(*windows, b);
2515 b->desk->windows = evas_list_prepend_relative(b->desk->windows, b, below); 2557 *windows = evas_list_prepend_relative(*windows, b, below);
2516 b->desk->changed = 1;
2517 ecore_window_stack_below(b->win.main, below->win.main); 2558 ecore_window_stack_below(b->win.main, below->win.main);
2518 2559
2519 D_RETURN; 2560 D_RETURN;
@@ -2522,14 +2563,8 @@ e_border_lower_below(E_Border * b, E_Border * below)
2522void 2563void
2523e_border_init(void) 2564e_border_init(void)
2524{ 2565{
2525 double raise_delay = 0.5;
2526
2527 E_CFG_FLOAT(cfg_raise_delay, "settings", "/window/raise/delay", 0.5);
2528
2529 D_ENTER; 2566 D_ENTER;
2530 2567
2531 E_CONFIG_FLOAT_GET(cfg_raise_delay, raise_delay);
2532
2533 ecore_event_filter_handler_add(ECORE_EVENT_MOUSE_DOWN, e_mouse_down); 2568 ecore_event_filter_handler_add(ECORE_EVENT_MOUSE_DOWN, e_mouse_down);
2534 ecore_event_filter_handler_add(ECORE_EVENT_MOUSE_UP, e_mouse_up); 2569 ecore_event_filter_handler_add(ECORE_EVENT_MOUSE_UP, e_mouse_up);
2535 ecore_event_filter_handler_add(ECORE_EVENT_MOUSE_MOVE, e_mouse_move); 2570 ecore_event_filter_handler_add(ECORE_EVENT_MOUSE_MOVE, e_mouse_move);
@@ -2555,7 +2590,7 @@ e_border_init(void)
2555 2590
2556 delayed_window_raise = 2591 delayed_window_raise =
2557 e_delayed_action_new(E_EVENT_BORDER_FOCUS_IN, 2592 e_delayed_action_new(E_EVENT_BORDER_FOCUS_IN,
2558 raise_delay, e_border_raise_delayed); 2593 e_border_delayed_val, e_border_raise_delayed);
2559 2594
2560 ecore_add_event_timer("e_border_poll()", 1.00, e_border_poll, 0, NULL); 2595 ecore_add_event_timer("e_border_poll()", 1.00, e_border_poll, 0, NULL);
2561 2596
@@ -2603,7 +2638,7 @@ e_border_adopt_children(Window win)
2603E_Border * 2638E_Border *
2604e_border_current_focused(void) 2639e_border_current_focused(void)
2605{ 2640{
2606 Evas_List l; 2641 Evas_List * l;
2607 2642
2608 D_ENTER; 2643 D_ENTER;
2609 for (l = borders; l; l = l->next) 2644 for (l = borders; l; l = l->next)
@@ -2629,7 +2664,7 @@ e_border_current_focused(void)
2629void 2664void
2630e_border_focus_grab_ended(void) 2665e_border_focus_grab_ended(void)
2631{ 2666{
2632 Evas_List l; 2667 Evas_List * l;
2633 2668
2634 D_ENTER; 2669 D_ENTER;
2635 2670
@@ -2651,7 +2686,7 @@ e_border_viewable(E_Border * b)
2651{ 2686{
2652 D_ENTER; 2687 D_ENTER;
2653 2688
2654 if (b->desk != e_desktops_get(0)) 2689 if (b->desk != e_desktops_get(e_desktops_get_current()))
2655 D_RETURN_(0); 2690 D_RETURN_(0);
2656 2691
2657 if (b->current.x + b->current.w <= 0) 2692 if (b->current.x + b->current.w <= 0)
@@ -2677,47 +2712,8 @@ e_border_send_pointer(E_Border * b)
2677{ 2712{
2678 D_ENTER; 2713 D_ENTER;
2679 2714
2680 XWarpPointer(ecore_display_get(), None, b->win.main, 0, 0, 0, 0, 2715 ecore_pointer_warp_to(b->current.x + b->current.w / 2,
2681 b->current.w / 2, b->current.h / 2); 2716 b->current.y + b->current.h / 2);
2682
2683 D_RETURN;
2684}
2685
2686void
2687e_border_raise_next(void)
2688{
2689 Evas_List next;
2690 E_Border *current;
2691
2692 D_ENTER;
2693
2694 if (!borders)
2695 D_RETURN;
2696
2697 current = e_border_current_focused();
2698
2699 /* Find the current border on the list of borders */
2700 for (next = borders; next && next->data != current; next = next->next);
2701
2702 /* Step to the next border, wrap around the queue if the end is reached */
2703 if (next && next->next)
2704 next = next->next;
2705 else
2706 next = borders;
2707
2708 /* Now find the next viewable border on the same desktop */
2709 current = (E_Border *) next->data;
2710 while (next && (!e_border_viewable(current) || current->client.is_desktop))
2711 {
2712 next = next->next;
2713 if (!next)
2714 next = borders;
2715
2716 current = (E_Border *) next->data;
2717 }
2718
2719 e_border_raise(current);
2720 e_border_send_pointer(current);
2721 2717
2722 D_RETURN; 2718 D_RETURN;
2723} 2719}
@@ -2766,9 +2762,35 @@ e_border_set_gravity(E_Border * b, int gravity)
2766 D_RETURN; 2762 D_RETURN;
2767} 2763}
2768 2764
2769Evas_List 2765Evas_List *
2770e_border_get_borders_list() 2766e_border_get_borders_list()
2771{ 2767{
2772 D_ENTER; 2768 D_ENTER;
2773 D_RETURN_(borders); 2769 D_RETURN_(borders);
2774} 2770}
2771
2772void
2773e_borders_scroll_list(Evas_List *borders, int dx, int dy)
2774{
2775 Evas_List *l;
2776
2777 for (l = borders; l; l = l->next)
2778 {
2779 E_Border *b;
2780
2781 b = l->data;
2782 ecore_window_gravity_reset(b->win.main);
2783 if ((!b->client.is_desktop) && (!b->mode.move))
2784 {
2785 b->previous.requested.x = b->current.requested.x;
2786 b->previous.requested.y = b->current.requested.y;
2787 b->previous.x = b->current.x;
2788 b->previous.y = b->current.y;
2789 b->current.requested.x += dx;
2790 b->current.requested.y += dy;
2791 b->current.x = b->current.requested.x;
2792 b->current.y = b->current.requested.y;
2793 b->changed = 1;
2794 }
2795 }
2796}
diff --git a/src/border.h b/src/border.h
index 8c7afe951..b0a287b4d 100644
--- a/src/border.h
+++ b/src/border.h
@@ -36,18 +36,17 @@ struct _E_Border
36 Window client; 36 Window client;
37 } 37 }
38 win; 38 win;
39 Evas evas; 39 Evas *evas;
40 struct 40 struct
41 { 41 {
42 E_Text *title; 42 E_Text *title;
43 Evas_Object title_clip; 43 Evas_Object *title_clip;
44 } 44 }
45 obj; 45 obj;
46 Pixmap pixmap; 46 Evas_List *windows;
47 struct 47 struct
48 { 48 {
49 int new; 49 int new;
50 char *file;
51 Ebits_Object b; 50 Ebits_Object b;
52 } 51 }
53 bits; 52 bits;
@@ -198,7 +197,6 @@ struct _E_Border
198 int shape_changed; 197 int shape_changed;
199 int placed; 198 int placed;
200 199
201 Evas_List grabs;
202 E_Grab *click_grab; 200 E_Grab *click_grab;
203 E_Desktop *desk; 201 E_Desktop *desk;
204 202
@@ -209,8 +207,6 @@ struct _E_Border
209 207
210 int hold_changes; 208 int hold_changes;
211 209
212 Evas_List menus;
213
214 int changed; 210 int changed;
215}; 211};
216 212
@@ -225,6 +221,9 @@ void e_border_init(void);
225E_Border *e_border_new(void); 221E_Border *e_border_new(void);
226 222
227void e_border_update_borders(void); 223void e_border_update_borders(void);
224void e_border_redraw_region(E_Border *b, int x, int y,
225 int w, int h);
226void e_border_update_render(E_Border * b);
228void e_border_apply_border(E_Border * b); 227void e_border_apply_border(E_Border * b);
229void e_border_reshape(E_Border * b); 228void e_border_reshape(E_Border * b);
230void e_border_release(E_Border * b); 229void e_border_release(E_Border * b);
@@ -251,11 +250,12 @@ void e_border_raise_above(E_Border * b, E_Border * above);
251void e_border_lower_below(E_Border * b, E_Border * below); 250void e_border_lower_below(E_Border * b, E_Border * below);
252E_Border *e_border_current_focused(void); 251E_Border *e_border_current_focused(void);
253void e_border_focus_grab_ended(void); 252void e_border_focus_grab_ended(void);
254void e_border_raise_next(void);
255void e_border_send_pointer(E_Border * b); 253void e_border_send_pointer(E_Border * b);
256int e_border_viewable(E_Border * b); 254int e_border_viewable(E_Border * b);
257void e_border_print_pos(char *buf, E_Border * b); 255void e_border_print_pos(char *buf, E_Border * b);
258void e_border_print_size(char *buf, E_Border * b); 256void e_border_print_size(char *buf, E_Border * b);
259void e_border_set_gravity(E_Border * b, int gravity); 257void e_border_set_gravity(E_Border * b, int gravity);
260Evas_List e_border_get_borders_list(); 258Evas_List *e_border_get_borders_list();
259void e_borders_scroll_list(Evas_List *borders,
260 int dx, int dy);
261#endif 261#endif
diff --git a/src/bordermenu.c b/src/bordermenu.c
index 0e3923437..17bfefd23 100644
--- a/src/bordermenu.c
+++ b/src/bordermenu.c
@@ -6,6 +6,8 @@
6#include "icccm.h" 6#include "icccm.h"
7#include "bordermenu.h" 7#include "bordermenu.h"
8 8
9static E_Menu *bordermenu = NULL;
10
9static void e_bordermenu_cb_close(E_Menu * m, E_Menu_Item * mi, 11static void e_bordermenu_cb_close(E_Menu * m, E_Menu_Item * mi,
10 void *data); 12 void *data);
11static void e_bordermenu_cb_kill(E_Menu * m, E_Menu_Item * mi, 13static void e_bordermenu_cb_kill(E_Menu * m, E_Menu_Item * mi,
@@ -37,7 +39,8 @@ static void e_bordermenu_cb_remember_prog_location_ignore(E_Menu * m,
37 E_Menu_Item * 39 E_Menu_Item *
38 mi, 40 mi,
39 void *data); 41 void *data);
40static void e_bordermenu_cb_menu_hide(E_Menu * m, void *data); 42static void e_bordermenu_cb_to_desktop(E_Menu * m, E_Menu_Item * mi,
43 void *data);
41 44
42static void 45static void
43e_bordermenu_cb_close(E_Menu * m, E_Menu_Item * mi, void *data) 46e_bordermenu_cb_close(E_Menu * m, E_Menu_Item * mi, void *data)
@@ -331,20 +334,32 @@ e_bordermenu_cb_remember_prog_location_ignore(E_Menu * m, E_Menu_Item * mi,
331} 334}
332 335
333static void 336static void
334e_bordermenu_cb_menu_hide(E_Menu * m, void *data) 337e_bordermenu_cb_to_desktop(E_Menu * m, E_Menu_Item * mi, void *data)
335{ 338{
339 int d = 0;
336 E_Border *b; 340 E_Border *b;
341 E_Desktop *desk;
337 342
338 D_ENTER; 343 D_ENTER;
339 344
340 b = data; 345 b = data;
346 if (b->client.sticky)
347 D_RETURN;
341 348
342 while (b->menus) 349 e_desktops_del_border(b->desk, b);
343 { 350
344 m = b->menus->data; 351 sscanf(mi->str, "Desktop %d", &d);
345 m->delete_me = 1; 352 desk = e_desktops_get(d);
346 b->menus = evas_list_remove(b->menus, m); 353 if (!desk)
347 } 354 desk = e_desktops_get(e_desktops_get_current());
355 D("Sending border %p to desk %d\n", b, d);
356
357 e_desktops_add_border(desk, b);
358 b->client.desk = d;
359
360 b->current.requested.visible = 0;
361 b->changed = 1;
362 e_border_update_borders();
348 363
349 D_RETURN; 364 D_RETURN;
350 UN(m); 365 UN(m);
@@ -353,18 +368,19 @@ e_bordermenu_cb_menu_hide(E_Menu * m, void *data)
353void 368void
354e_bordermenu_do(E_Border * b) 369e_bordermenu_do(E_Border * b)
355{ 370{
371 int i;
372 char label[PATH_MAX];
356 E_Menu *menu; 373 E_Menu *menu;
374 E_Menu *menu2;
357 E_Menu_Item *menuitem; 375 E_Menu_Item *menuitem;
358 376
359 D_ENTER; 377 D_ENTER;
360 378
361 if (!b->menus) 379 if (!bordermenu)
362 { 380 {
363 menu = e_menu_new(); 381 menu = e_menu_new();
364 b->menus = evas_list_append(b->menus, menu);
365 e_menu_set_padding_icon(menu, 2); 382 e_menu_set_padding_icon(menu, 2);
366 e_menu_set_padding_state(menu, 2); 383 e_menu_set_padding_state(menu, 2);
367 e_menu_hide_callback(menu, e_bordermenu_cb_menu_hide, b);
368 384
369 menuitem = e_menu_item_new("Close"); 385 menuitem = e_menu_item_new("Close");
370 /* e_menu_item_set_icon(menuitem, icon); */ 386 /* e_menu_item_set_icon(menuitem, icon); */
@@ -451,6 +467,24 @@ e_bordermenu_do(E_Border * b)
451 b); 467 b);
452 e_menu_add_item(menu, menuitem); 468 e_menu_add_item(menu, menuitem);
453 e_menu_set_state(menu, menuitem); 469 e_menu_set_state(menu, menuitem);
470
471 menu2 = e_menu_new();
472 e_menu_set_padding_icon(menu2, 2);
473 e_menu_set_padding_state(menu2, 2);
474
475 for (i = 0; i < e_desktops_get_num(); i++)
476 {
477 snprintf(label, PATH_MAX, "Desktop %d", i);
478 menuitem = e_menu_item_new(label);
479 e_menu_item_set_callback(menuitem, e_bordermenu_cb_to_desktop, b);
480 e_menu_add_item(menu2, menuitem);
481 }
482
483 menuitem = e_menu_item_new("Goto Desktop...");
484 e_menu_item_set_submenu(menuitem, menu2);
485 e_menu_add_item(menu, menuitem);
486
487 bordermenu = menu;
454 } 488 }
455 489
456 { 490 {
@@ -458,7 +492,7 @@ e_bordermenu_do(E_Border * b)
458 int crx, cry, crw, crh; 492 int crx, cry, crw, crh;
459 int mx, my; 493 int mx, my;
460 494
461 menu = b->menus->data; 495 menu = bordermenu;
462 pl = pr = pt = pb = 0; 496 pl = pr = pt = pb = 0;
463 if (b->bits.b) 497 if (b->bits.b)
464 ebits_get_insets(b->bits.b, &pl, &pr, &pt, &pb); 498 ebits_get_insets(b->bits.b, &pl, &pr, &pt, &pb);
@@ -480,3 +514,10 @@ e_bordermenu_do(E_Border * b)
480 514
481 D_RETURN; 515 D_RETURN;
482} 516}
517
518void
519e_bordermenu_hide(void)
520{
521 if (bordermenu)
522 e_menu_hide(bordermenu);
523}
diff --git a/src/bordermenu.h b/src/bordermenu.h
index fb864db6c..738bcb1f8 100644
--- a/src/bordermenu.h
+++ b/src/bordermenu.h
@@ -4,5 +4,6 @@
4#include "e.h" 4#include "e.h"
5 5
6void e_bordermenu_do(E_Border * b); 6void e_bordermenu_do(E_Border * b);
7void e_bordermenu_hide(void);
7 8
8#endif 9#endif
diff --git a/src/config.c b/src/config.c
index 4b48d81e1..92488ad5a 100644
--- a/src/config.c
+++ b/src/config.c
@@ -1,6 +1,12 @@
1#include "debug.h" 1#include "debug.h"
2#include "actions.h"
3#include "border.h"
2#include "config.h" 4#include "config.h"
5#include "data.h"
6#include "e_dir.h"
3#include "file.h" 7#include "file.h"
8#include "keys.h"
9#include "observer.h"
4#include "util.h" 10#include "util.h"
5 11
6static char cfg_root[] = ""; 12static char cfg_root[] = "";
@@ -24,6 +30,24 @@ static char cfg_fonts_dir[PATH_MAX] = "";
24static char cfg_epplets_dir[PATH_MAX] = ""; 30static char cfg_epplets_dir[PATH_MAX] = "";
25static char cfg_layout_dir[PATH_MAX] = ""; 31static char cfg_layout_dir[PATH_MAX] = "";
26 32
33static E_Observer *behavior_dir = NULL;
34E_Config *config_data;
35
36E_Data_Base_Type *cfg_actions = NULL;
37E_Data_Base_Type *cfg_config = NULL;
38E_Data_Base_Type *cfg_desktops = NULL;
39E_Data_Base_Type *cfg_grabs = NULL;
40E_Data_Base_Type *cfg_guides = NULL;
41E_Data_Base_Type *cfg_match = NULL;
42E_Data_Base_Type *cfg_menu = NULL;
43E_Data_Base_Type *cfg_move = NULL;
44E_Data_Base_Type *cfg_window = NULL;
45
46void e_config_behavior_changed(E_Observer * observer,
47 E_Observee * observee,
48 E_Event_Type event, void *data);
49void e_config_settings_reload(char *buf);
50
27char * 51char *
28e_config_get(char *type) 52e_config_get(char *type)
29{ 53{
@@ -74,25 +98,159 @@ e_config_get(char *type)
74 E_CONF("images", cfg_images_dir, PACKAGE_DATA_DIR "/data/images/"); 98 E_CONF("images", cfg_images_dir, PACKAGE_DATA_DIR "/data/images/");
75 E_CONF("cursors", cfg_cursors_dir, PACKAGE_DATA_DIR "/data/cursors/"); 99 E_CONF("cursors", cfg_cursors_dir, PACKAGE_DATA_DIR "/data/cursors/");
76 E_CONF("backgrounds", cfg_backgrounds_dir, 100 E_CONF("backgrounds", cfg_backgrounds_dir,
77 PACKAGE_DATA_DIR"/data/backgrounds/"); 101 PACKAGE_DATA_DIR "/data/backgrounds/");
78 E_CONF("fonts", cfg_fonts_dir, 102 E_CONF("fonts", cfg_fonts_dir, PACKAGE_DATA_DIR "/data/fonts/");
79 PACKAGE_DATA_DIR"/data/fonts/"); 103 E_CONF("epplets", cfg_epplets_dir, PACKAGE_DATA_DIR "/data/epplets/");
80 E_CONF("epplets", cfg_epplets_dir, 104 E_CONF("layout", cfg_layout_dir, PACKAGE_DATA_DIR "/data/layout/");
81 PACKAGE_DATA_DIR"/data/epplets/");
82 E_CONF("layout", cfg_layout_dir,
83 PACKAGE_DATA_DIR"/data/layout/");
84 105
85 D_RETURN_(""); 106 D_RETURN_("");
86} 107}
87 108
88void 109void
110e_config_actions_init()
111{
112 D_ENTER;
113
114 /*
115 * Define the data type for the E_Actions struct.
116 */
117 cfg_actions = e_data_type_new();
118 E_DATA_NODE(cfg_actions, "name", E_DATA_TYPE_STR, NULL, E_Action, name,
119 (E_Data_Value) "");
120 E_DATA_NODE(cfg_actions, "action", E_DATA_TYPE_STR, NULL, E_Action, action,
121 (E_Data_Value) "");
122 E_DATA_NODE(cfg_actions, "params", E_DATA_TYPE_STR, NULL, E_Action,
123 params, (E_Data_Value) "");
124 E_DATA_NODE(cfg_actions, "event", E_DATA_TYPE_INT, NULL, E_Action, event,
125 (E_Data_Value) 0);
126 E_DATA_NODE(cfg_actions, "button", E_DATA_TYPE_INT, NULL, E_Action, button,
127 (E_Data_Value) 0);
128 E_DATA_NODE(cfg_actions, "key", E_DATA_TYPE_STR, NULL, E_Action, key,
129 (E_Data_Value) 0);
130 E_DATA_NODE(cfg_actions, "modifiers", E_DATA_TYPE_INT, NULL, E_Action,
131 modifiers, (E_Data_Value) 0);
132
133 D_RETURN;
134}
135
136void
137e_config_desktops_init()
138{
139 cfg_desktops = e_data_type_new();
140 E_DATA_NODE(cfg_desktops, "count", E_DATA_TYPE_INT, NULL, E_Config_Desktops,
141 count, (E_Data_Value) 8);
142 E_DATA_NODE(cfg_desktops, "scroll", E_DATA_TYPE_INT, NULL, E_Config_Desktops,
143 scroll, (E_Data_Value) 1);
144 E_DATA_NODE(cfg_desktops, "scroll_sticky", E_DATA_TYPE_INT, NULL, E_Config_Desktops,
145 scroll_sticky, (E_Data_Value) 1);
146 E_DATA_NODE(cfg_desktops, "resist", E_DATA_TYPE_INT, NULL, E_Config_Desktops,
147 resist, (E_Data_Value) 5);
148 E_DATA_NODE(cfg_desktops, "speed", E_DATA_TYPE_INT, NULL, E_Config_Desktops,
149 speed, (E_Data_Value) 30);
150 E_DATA_NODE(cfg_desktops, "width", E_DATA_TYPE_INT, NULL, E_Config_Desktops,
151 width, (E_Data_Value) 1);
152 E_DATA_NODE(cfg_desktops, "height", E_DATA_TYPE_INT, NULL, E_Config_Desktops,
153 height, (E_Data_Value) 1);
154}
155
156void
157e_config_grabs_init()
158{
159 cfg_grabs = e_data_type_new();
160 E_DATA_NODE(cfg_grabs, "button", E_DATA_TYPE_INT, NULL, E_Grab, button,
161 (E_Data_Value) 0);
162 E_DATA_NODE(cfg_grabs, "modifiers", E_DATA_TYPE_INT, NULL, E_Grab, mods,
163 (E_Data_Value) 0);
164}
165
166void
167e_config_guides_init()
168{
169 cfg_guides = e_data_type_new();
170 E_DATA_NODE(cfg_guides, "display/location", E_DATA_TYPE_INT, NULL,
171 E_Config_Guides, location, (E_Data_Value) 0);
172 E_DATA_NODE(cfg_guides, "display/x", E_DATA_TYPE_FLOAT, NULL,
173 E_Config_Guides, x, (E_Data_Value) 0);
174 E_DATA_NODE(cfg_guides, "display/y", E_DATA_TYPE_FLOAT, NULL,
175 E_Config_Guides, y, (E_Data_Value) 0);
176}
177
178void
179e_config_menu_init()
180{
181 cfg_menu = e_data_type_new();
182 E_DATA_NODE(cfg_menu, "scroll/resist", E_DATA_TYPE_INT, NULL,
183 E_Config_Menu, resist, (E_Data_Value) 5);
184 E_DATA_NODE(cfg_menu, "scroll/speed", E_DATA_TYPE_INT, NULL,
185 E_Config_Menu, speed, (E_Data_Value) 12);
186}
187
188void
189e_config_move_init()
190{
191 cfg_move = e_data_type_new();
192 E_DATA_NODE(cfg_move, "resist", E_DATA_TYPE_INT, NULL,
193 E_Config_Move, resist, (E_Data_Value) 0);
194 E_DATA_NODE(cfg_move, "resist/win", E_DATA_TYPE_INT, NULL,
195 E_Config_Move, win_resist, (E_Data_Value) 0);
196 E_DATA_NODE(cfg_move, "resist/desk", E_DATA_TYPE_INT, NULL,
197 E_Config_Move, desk_resist, (E_Data_Value) 0);
198}
199
200void
201e_config_window_init()
202{
203 cfg_window = e_data_type_new();
204 E_DATA_NODE(cfg_window, "resize/mode", E_DATA_TYPE_INT, NULL,
205 E_Config_Window, resize_mode, (E_Data_Value) 0);
206 E_DATA_NODE(cfg_window, "move/mode", E_DATA_TYPE_INT, NULL,
207 E_Config_Window, move_mode, (E_Data_Value) 0);
208 E_DATA_NODE(cfg_window, "focus/mode", E_DATA_TYPE_INT, NULL, E_Config_Window,
209 focus_mode, (E_Data_Value) 0);
210 E_DATA_NODE(cfg_window, "raise/auto", E_DATA_TYPE_INT, NULL,
211 E_Config_Window, auto_raise, (E_Data_Value) 0);
212 E_DATA_NODE(cfg_window, "raise/delay", E_DATA_TYPE_FLOAT, NULL,
213 E_Config_Window, raise_delay, (E_Data_Value) (float)0.6);
214 E_DATA_NODE(cfg_window, "place/mode", E_DATA_TYPE_INT, NULL,
215 E_Config_Window, place_mode, (E_Data_Value) 0);
216}
217
218void
89e_config_init(void) 219e_config_init(void)
90{ 220{
91 char buf[PATH_MAX]; 221 char buf[PATH_MAX];
222 E_Dir *dir;
92 223
93 D_ENTER; 224 D_ENTER;
94 225
95#if 1 /* for now don't do this. i think a cp -r will be needed later anyway */ 226 /* Start by initializing the data loading structures */
227 e_config_actions_init();
228 e_config_desktops_init();
229 e_config_grabs_init();
230 e_config_guides_init();
231 e_config_menu_init();
232 e_config_move_init();
233 e_config_window_init();
234
235 /* Then place the data structures within the config description */
236 cfg_config = e_data_type_new();
237 E_DATA_NODE(cfg_config, "actions", E_DATA_TYPE_LIST, cfg_actions,
238 E_Config, actions, (E_Data_Value) 0);
239 E_DATA_NODE(cfg_config, "grabs", E_DATA_TYPE_LIST, cfg_grabs,
240 E_Config, grabs, (E_Data_Value) 0);
241
242 E_DATA_NODE(cfg_config, "desktops", E_DATA_TYPE_PTR, cfg_desktops,
243 E_Config, desktops, (E_Data_Value) 0);
244 E_DATA_NODE(cfg_config, "guides", E_DATA_TYPE_PTR, cfg_guides,
245 E_Config, guides, (E_Data_Value) 0);
246 E_DATA_NODE(cfg_config, "menu", E_DATA_TYPE_PTR, cfg_menu,
247 E_Config, menu, (E_Data_Value) 0);
248 E_DATA_NODE(cfg_config, "move", E_DATA_TYPE_PTR, cfg_move,
249 E_Config, move, (E_Data_Value) 0);
250 E_DATA_NODE(cfg_config, "window", E_DATA_TYPE_PTR, cfg_window,
251 E_Config, window, (E_Data_Value) 0);
252
253 /* Create directories as needed */
96 if (!e_file_is_dir(e_config_user_dir())) 254 if (!e_file_is_dir(e_config_user_dir()))
97 e_file_mkdir(e_config_user_dir()); 255 e_file_mkdir(e_config_user_dir());
98 snprintf(buf, PATH_MAX, "%sappearance", e_config_user_dir()); 256 snprintf(buf, PATH_MAX, "%sappearance", e_config_user_dir());
@@ -104,6 +262,8 @@ e_config_init(void)
104 snprintf(buf, PATH_MAX, "%sbehavior", e_config_user_dir()); 262 snprintf(buf, PATH_MAX, "%sbehavior", e_config_user_dir());
105 if (!e_file_is_dir(buf)) 263 if (!e_file_is_dir(buf))
106 e_file_mkdir(buf); 264 e_file_mkdir(buf);
265
266 /* With the directories created, create files if needed and load config */
107 snprintf(buf, PATH_MAX, "%sbehavior/grabs.db", e_config_user_dir()); 267 snprintf(buf, PATH_MAX, "%sbehavior/grabs.db", e_config_user_dir());
108 if (!e_file_exists(buf)) 268 if (!e_file_exists(buf))
109 e_file_cp(PACKAGE_DATA_DIR "/data/config/behavior/default/grabs.db", buf); 269 e_file_cp(PACKAGE_DATA_DIR "/data/config/behavior/default/grabs.db", buf);
@@ -119,22 +279,74 @@ e_config_init(void)
119 if (!e_file_exists(buf)) 279 if (!e_file_exists(buf))
120 e_file_cp(PACKAGE_DATA_DIR "/data/config/behavior/default/apps_menu.db", 280 e_file_cp(PACKAGE_DATA_DIR "/data/config/behavior/default/apps_menu.db",
121 buf); 281 buf);
122 snprintf(buf, PATH_MAX, "%sappearance/borders/border.bits.db", 282 snprintf(buf, PATH_MAX, "%sbehavior/behavior.db", e_config_user_dir());
123 e_config_user_dir()); 283 if (!e_file_exists(buf))
124#endif 284 e_file_cp(PACKAGE_DATA_DIR "/data/config/behavior/default/behavior.db",
125#if 0 285 buf);
126 ts(); 286
127#endif 287 /* Load config data and begin monitoring it with efsd */
288 e_config_behavior_changed(NULL, NULL, 0, NULL);
289
290 snprintf(buf, PATH_MAX, "%sbehavior", e_config_user_dir());
291 dir = e_dir_new();
292 e_dir_set_dir(dir, buf);
293
294 behavior_dir = NEW(E_Observer, 1);
295 ZERO(behavior_dir, sizeof(E_Observer), 1);
296 e_observer_init(behavior_dir, E_EVENT_FILE_CHANGE,
297 e_config_behavior_changed, free);
298 e_observer_register_observee(behavior_dir, E_OBSERVEE(dir));
128 299
129 D_RETURN; 300 D_RETURN;
130} 301}
131 302
132void 303void
304e_config_behavior_changed(E_Observer * observer, E_Observee * observee,
305 E_Event_Type event, void *data)
306{
307 char buf[PATH_MAX];
308 Evas_List *l;
309
310 if (config_data)
311 {
312 e_data_free(cfg_config, (char *)config_data);
313 FREE(config_data);
314 }
315
316 snprintf(buf, PATH_MAX, "%sbehavior/behavior.db", e_config_user_dir());
317 config_data = e_data_load(buf, "", cfg_config);
318
319 /* FIXME: this should probably be a function in actions.c */
320 for (l = config_data->actions; l; l = l->next)
321 {
322 E_Action *a;
323
324 a = l->data;
325 e_object_init(E_OBJECT(a), (E_Cleanup_Func) e_action_cleanup);
326 if ((a->key) && (strlen(a->key) > 0))
327 {
328 if (a->modifiers == -1)
329 e_keys_grab(a->key, ECORE_EVENT_KEY_MODIFIER_NONE, 1);
330 else
331 e_keys_grab(a->key, (Ecore_Event_Key_Modifiers) a->modifiers,
332 0);
333 a->grabbed = 1;
334 }
335 }
336
337 return;
338 UN(observer);
339 UN(observee);
340 UN(event);
341 UN(data);
342}
343
344void
133e_config_set_user_dir(char *dir) 345e_config_set_user_dir(char *dir)
134{ 346{
135 D_ENTER; 347 D_ENTER;
136 348
137 strcpy(cfg_root, dir); 349 STRNCPY(cfg_root, dir, PATH_MAX);
138 /* reset the cached dir paths */ 350 /* reset the cached dir paths */
139 cfg_grabs_db[0] = 0; 351 cfg_grabs_db[0] = 0;
140 cfg_settings_db[0] = 0; 352 cfg_settings_db[0] = 0;
@@ -163,272 +375,11 @@ e_config_user_dir(void)
163{ 375{
164 D_ENTER; 376 D_ENTER;
165 377
378 /* We copy the config files to the user's home dir, no need to fall back */
166 if (cfg_user_dir[0]) 379 if (cfg_user_dir[0])
167 D_RETURN_(cfg_user_dir); 380 D_RETURN_(cfg_user_dir);
168 if (cfg_root[0]) 381
169 D_RETURN_(cfg_root);
170#if 1 /* disabled for now - use system ones only */
171 snprintf(cfg_user_dir, PATH_MAX, "%s/.e/", e_util_get_user_home()); 382 snprintf(cfg_user_dir, PATH_MAX, "%s/.e/", e_util_get_user_home());
172#else
173 snprintf(cfg_user_dir, PATH_MAX, PACKAGE_DATA_DIR "/data/config/");
174#endif
175 383
176 D_RETURN_(cfg_user_dir); 384 D_RETURN_(cfg_user_dir);
177} 385}
178
179typedef struct _e_config_file_entry E_Config_File_Entry;
180
181struct _e_config_file_entry
182{
183 char *name;
184 struct
185 {
186 char *path;
187 time_t last_mod;
188 }
189 user , system;
190 Evas_List hash[256];
191};
192
193void
194e_config_add_change_cb(char *file, void (*func) (void *_data), void *data)
195{
196}
197
198void
199e_config_del_change_cb(char *file, void (*func) (void *_data))
200{
201}
202
203int
204e_config_val_int_get(char *file, char *key, int def)
205{
206}
207
208float
209e_config_val_float_get(char *file, char *key, float def)
210{
211}
212
213char *
214e_config_val_str_get(char *file, char *key, char *def)
215{
216}
217
218char *
219e_config_val_key_get(char *file, char *key, char *def)
220{
221}
222
223void
224e_config_type_add_node(E_Config_Base_Type * base, char *prefix,
225 E_Config_Datatype type, E_Config_Base_Type * list_type,
226 int offset, int def_int, float def_float, char *def_str)
227{
228 E_Config_Node *cfg_node;
229
230 D_ENTER;
231
232 cfg_node = NEW(E_Config_Node, 1);
233 ZERO(cfg_node, E_Config_Node, 1);
234
235 cfg_node->prefix = strdup(prefix);
236 cfg_node->type = type;
237 cfg_node->sub_type = list_type;
238 cfg_node->offset = offset;
239 cfg_node->def_int = def_int;
240 cfg_node->def_float = def_float;
241 if (cfg_node->def_str)
242 {
243 e_strdup(cfg_node->def_str, def_str);
244 }
245 base->nodes = evas_list_append(base->nodes, cfg_node);
246
247 D_RETURN;
248}
249
250E_Config_Base_Type *
251e_config_type_new(void)
252{
253 E_Config_Base_Type *t;
254
255 D_ENTER;
256
257 t = NEW(E_Config_Base_Type, 1);
258 ZERO(t, E_Config_Base_Type, 1);
259
260 D_RETURN_(t);
261}
262
263void *
264e_config_load(char *file, char *prefix, E_Config_Base_Type * type)
265{
266 E_DB_File *db;
267 char buf[PATH_MAX];
268 Evas_List l;
269 char *data;
270
271 D_ENTER;
272
273 if (!e_file_exists(file))
274 D_RETURN_(NULL);
275 db = e_db_open_read(file);
276
277 if (!db)
278 D_RETURN_(NULL);
279
280 data = NEW(char, type->size);
281 ZERO(data, char, type->size);
282
283 for (l = type->nodes; l; l = l->next)
284 {
285 E_Config_Node *node;
286
287 node = l->data;
288
289 switch (node->type)
290 {
291 case E_CFG_TYPE_INT:
292 {
293 int val;
294
295 val = 0;
296 snprintf(buf, PATH_MAX, "%s/%s", prefix, node->prefix);
297 if (e_db_int_get(db, buf, &val))
298 (*((int *)(&(data[node->offset])))) = val;
299 else
300 (*((int *)(&(data[node->offset])))) = node->def_int;
301 }
302 break;
303 case E_CFG_TYPE_STR:
304 {
305 char *val;
306
307 snprintf(buf, PATH_MAX, "%s/%s", prefix, node->prefix);
308 if ((val = e_db_str_get(db, buf)))
309 (*((char **)(&(data[node->offset])))) = val;
310 else
311 e_strdup((*((char **)(&(data[node->offset])))),
312 node->def_str);
313 }
314 break;
315 case E_CFG_TYPE_FLOAT:
316 {
317 float val;
318
319 val = 0;
320 snprintf(buf, PATH_MAX, "%s/%s", prefix, node->prefix);
321 if (e_db_float_get(db, buf, &val))
322 (*((float *)(&(data[node->offset])))) = val;
323 else
324 (*((float *)(&(data[node->offset])))) = node->def_float;
325 }
326 break;
327 case E_CFG_TYPE_LIST:
328 {
329 Evas_List l2;
330 int i, count;
331
332 l2 = NULL;
333 snprintf(buf, PATH_MAX, "%s/%s/count", prefix, node->prefix);
334 count = 0;
335 e_db_int_get(db, buf, &count);
336 for (i = 0; i < count; i++)
337 {
338 void *data2;
339
340 snprintf(buf, PATH_MAX, "%s/%s/%i", prefix, node->prefix,
341 i);
342 data2 = e_config_load(file, buf, node->sub_type);
343 l2 = evas_list_append(l2, data2);
344 }
345 (*((Evas_List *) (&(data[node->offset])))) = l2;
346 }
347 break;
348 case E_CFG_TYPE_KEY:
349 {
350 snprintf(buf, PATH_MAX, "%s/%s", prefix, node->prefix);
351 (*((char **)(&(data[node->offset])))) = strdup(buf);
352 }
353 break;
354 default:
355 break;
356 }
357 }
358 e_db_close(db);
359
360 D_RETURN_(data);
361}
362
363#if 0
364typedef struct _list_base List_Base;
365typedef struct _list_element List_Element;
366
367struct _list_base
368{
369 Evas_List elements;
370};
371
372struct _list_element
373{
374 char *name;
375 int size;
376 float perc;
377};
378
379/* eg: */
380void
381ts(void)
382{
383 /* define the different config types and structs to the config engine */
384 E_Config_Base_Type *cf_list;
385 E_Config_Base_Type *cf_element;
386
387 D_ENTER;
388
389 cf_element = e_config_type_new();
390 E_CONFIG_NODE(cf_element, "name", E_CFG_TYPE_STR, NULL, List_Element, name,
391 0, 0, "DEFAULT_NAME");
392 E_CONFIG_NODE(cf_element, "size", E_CFG_TYPE_INT, NULL, List_Element, size,
393 777, 0, NULL);
394 E_CONFIG_NODE(cf_element, "perc", E_CFG_TYPE_FLOAT, NULL, List_Element, perc,
395 0, 3.1415, NULL);
396
397 cf_list = e_config_type_new();
398 E_CONFIG_NODE(cf_list, "list", E_CFG_TYPE_LIST, cf_element, List_Base,
399 elements, 0, 0, NULL);
400
401 /* now test it */
402 {
403 List_Base *cfg_data;
404
405 /* load the base data type from the base of the test db file */
406 cfg_data = e_config_load("test.db", "", cf_list);
407 /* no data file? */
408 if (!cfg_data)
409 {
410 D("no load!\n");
411 }
412 /* got data */
413 else
414 {
415 Evas_List l;
416
417 for (l = cfg_data->elements; l; l = l->next)
418 {
419 List_Element *cfg_element;
420
421 D("element\n");
422 cfg_element = l->data;
423 D("... name %s\n", cfg_element->name);
424 D("... size %i\n", cfg_element->size);
425 D("... perc %3.3f\n", cfg_element->perc);
426 }
427 }
428 exit(0);
429 }
430
431 D_RETURN;
432}
433
434#endif
diff --git a/src/config.h b/src/config.h
index f2a166fed..519e2d56b 100644
--- a/src/config.h
+++ b/src/config.h
@@ -3,218 +3,75 @@
3 3
4#include "e.h" 4#include "e.h"
5 5
6typedef struct _E_Config_File E_Config_File; 6/*
7typedef struct _E_Config_Element E_Config_Element; 7 * Define small subsets of the whole config for defining data types for
8 8 * loading from the databases.
9/* something to check validity of config files where we get data from */ 9 */
10/* for now its just a 5 second timout so it will only invalidate */ 10typedef struct _E_Config_Desktops E_Config_Desktops;
11/* if we havent looked for 5 seconds... BUT later when efsd is more solid */ 11struct _E_Config_Desktops
12/* we should use that to tell us when its invalid */
13struct _E_Config_File
14{ 12{
15 char *src; 13 int count;
16 double last_fetch; 14 int scroll;
15 int scroll_sticky;
16 int resist;
17 int speed;
18 int width;
19 int height;
17}; 20};
18 21
19struct _E_Config_Element 22typedef struct _E_Config_Guides E_Config_Guides;
23struct _E_Config_Guides
20{ 24{
21 char *src; 25 float x;
22 char *key; 26 float y;
23 double last_fetch; 27 int location;
24 int type;
25 int def_int_val;
26 float def_float_val;
27 char *def_str_val;
28 void *def_data_val;
29 int def_data_val_size;
30 int cur_int_val;
31 float cur_float_val;
32 char *cur_str_val;
33 void *cur_data_val;
34 int cur_data_val_size;
35}; 28};
36 29
37#define E_CFG_FILE(_var, _src) \ 30typedef struct _E_Config_Menu E_Config_Menu;
38static E_Config_File _var = {_src, 0.0} 31struct _E_Config_Menu
39#define E_CONFIG_CHECK_VALIDITY(_var, _src) \
40{ \
41double __time; \
42__time = ecore_get_time(); \
43if (_var.last_fetch < (__time - 5.0)) { \
44_var.last_fetch = __time;
45#define E_CONFIG_CHECK_VALIDITY_END \
46} \
47}
48
49typedef enum e_config_type
50{ 32{
51 E_CFG_INT_T, 33 int resist;
52 E_CFG_FLOAT_T, 34 int speed;
53 E_CFG_STR_T, 35};
54 E_CFG_DATA_T,
55}
56E_Config_Type;
57
58#define E_CFG_INT(_var, _src, _key, _default) \
59static E_Config_Element _var = { _src, _key, 0.0, E_CFG_INT_T, \
60_default, 0.0, NULL, NULL, 0, \
610, 0.0, NULL, NULL, 0, \
62}
63
64#define E_CFG_FLOAT(_var, _src, _key, _default) \
65static E_Config_Element _var = { _src, _key, 0.0, E_CFG_FLOAT_T, \
660, _default, NULL, NULL, 0, \
670, 0.0, NULL, NULL, 0, \
68}
69
70#define E_CFG_STR(_var, _src, _key, _default) \
71static E_Config_Element _var = { _src, _key, 0.0, E_CFG_STR_T, \
720, 0.0, _default, NULL, 0, \
730, 0.0, NULL, NULL, 0, \
74}
75
76#define E_CFG_DATA(_var, _src, _key, _default, _default_size) \
77static E_Config_Element _var = { _src, _key, 0.0, E_CFG_DATAT_T, \
780, 0.0, NULL, _default, _default_size, \
790, 0.0, NULL, NULL, 0, \
80}
81
82/* yes for now it only fetches them every 5 seconds - in the end i need a */
83/* validity flag for the database file to know if it changed and only then */
84/* get the value again. this is waiting for efsd to become more solid */
85#define E_CFG_VALIDITY_CHECK(_var) \
86{ \
87double __time; \
88__time = ecore_get_time(); \
89if (_var.last_fetch < (__time - 5.0)) { \
90int __cfg_ok = 0; \
91_var.last_fetch = __time;
92
93#define E_CFG_END_VALIDITY_CHECK \
94} \
95}
96
97#define E_CONFIG_INT_GET(_var, _val) \
98{{ \
99E_CFG_VALIDITY_CHECK(_var) \
100E_DB_INT_GET(e_config_get(_var.src), _var.key, _var.cur_int_val, __cfg_ok); \
101if (!__cfg_ok) _var.cur_int_val = _var.def_int_val; \
102E_CFG_END_VALIDITY_CHECK \
103} \
104_val = _var.cur_int_val;}
105
106#define E_CONFIG_FLOAT_GET(_var, _val) \
107{{ \
108E_CFG_VALIDITY_CHECK(_var) \
109E_DB_FLOAT_GET(e_config_get(_var.src), _var.key, _var.cur_float_val, __cfg_ok); \
110if (!__cfg_ok) _var.cur_float_val = _var.def_float_val; \
111E_CFG_END_VALIDITY_CHECK \
112} \
113_val = _var.cur_float_val;}
114
115#define E_CONFIG_STR_GET(_var, _val) \
116{{ \
117E_CFG_VALIDITY_CHECK(_var) \
118if (_var.cur_str_val) free(_var.cur_str_val); \
119_var.cur_str_val = NULL; \
120E_DB_STR_GET(e_config_get(_var.src), _var.key, _var.cur_str_val, __cfg_ok); \
121if (!__cfg_ok) _var.cur_str_val = _var.def_str_val \
122E_CFG_END_VALIDITY_CHECK \
123} \
124_val = _var.cur_str_val;}
125
126#define E_CONFIG_DATA_GET(_var, _val, _size) \
127{{ \
128E_CFG_VALIDITY_CHECK(_var) \
129if (_var.cur_data_val) free(_var.cur_data_val); \
130_var.cur_data_val = NULL; \
131_var.cur_data_size = 0; \
132{ E_DB_File *__db; \
133__db = e_db_open_read(e_config_get(_var.src)); \
134if (__db) { \
135_var.cur_data_val = e_db_data_get(__db, _var.key, &(_var.cur_data_size)); \
136if (_var.cur_data_val) __cfg_ok = 1; \
137e_db_close(__db); \
138} \
139} \