APPROVE COMMIT
Norbert!
This is good to go.
NOTE: This patch has been committed.
xwem patch:
ChangeLog files diff command: cvs -q diff -U 0
Files affected: ChangeLog
Source files diff command: cvs -q diff -uN
Files affected: man/xwem.texi man/xwem-version.texi
lisp/xwem-xfig.el lisp/xwem-worklog.el lisp/xwem-win.el lisp/xwem-weather.el
lisp/xwem-transient.el lisp/xwem-theme.el lisp/xwem-tabbing.el
lisp/xwem-strokes.el lisp/xwem-special.el lisp/xwem-sound.el
lisp/xwem-selections.el lisp/xwem-rooticon.el lisp/xwem-root.el
lisp/xwem-register.el lisp/xwem-pager.el lisp/xwem-osd.el lisp/xwem-netwm.el
lisp/xwem-mouse.el lisp/xwem-modes.el lisp/xwem-minibuffer.el
lisp/xwem-manage.el lisp/xwem-main.el lisp/xwem-load.el lisp/xwem-keytt.el
lisp/xwem-keymacro.el lisp/xwem-keydefs.el lisp/xwem-keyboard.el
lisp/xwem-interactive.el lisp/xwem-icons.el lisp/xwem-holer.el
lisp/xwem-help.el lisp/xwem-frametrans.el lisp/xwem-framei.el
lisp/xwem-frame.el lisp/xwem-focus.el lisp/xwem-faces.el lisp/xwem-events.el
lisp/xwem-edprops.el lisp/xwem-edmacro.el lisp/xwem-diagram.el
lisp/xwem-desktop.el lisp/xwem-compat.el lisp/xwem-clswi.el
lisp/xwem-clients.el lisp/xwem-clgen.el lisp/xwem-battery.el
lisp/xwem-appcollect.el lisp/ixwem.el icons/mini-xv.xpm icons/mini-graph.xpm
icons/mini-display.xpm icons/README package-info.in Makefile ChangeLog.upstream
Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/xwem/ChangeLog,v
retrieving revision 1.74
diff -u -U0 -r1.74 ChangeLog
--- ChangeLog 16 Dec 2004 08:07:47 -0000 1.74
+++ ChangeLog 1 Jan 2005 04:41:39 -0000
@@ -0,0 +1,8 @@
+2005-01-01 Steve Youngs <steve@xxxxxxxxxxxxx>
+
+ * Makefile (AUTHOR_VERSION): Bump.
+ (REQUIRES): Add elib, ilisp, and mail-lib.
+
+ This is the version 2.0 release. For details see
+ ChangeLog.upstream.
+
Index: ChangeLog.upstream
===================================================================
RCS file: ChangeLog.upstream
diff -N ChangeLog.upstream
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ChangeLog.upstream 1 Jan 2005 04:41:09 -0000
@@ -0,0 +1,730 @@
+# do not edit -- automatically generated by arch changelog
+# non-id: automatic-ChangeLog--lg@xxxxxxxxxxxxxx/xwem--main--2.0
+#
+
+2005-01-01 02:30:16 GMT Zajcev Evgeny <lg@xxxxxxxx> version-0
+
+ Summary:
+ Version 2.0 is released
+ Revision:
+ xwem--main--2.0--version-0
+
+
+ new files:
+ .arch-ids/README.id README
+
+
+2004-12-29 22:32:15 GMT Zajcev Evgeny <lg@xxxxxxxx> patch-19
+
+ Summary:
+ xparent problem kind of fix, dedicated problem kind of fix
+ Revision:
+ xwem--main--2.0--patch-19
+
+ * lisp/xwem-clgen.el (on-kill): [fix?] Do not do XDestroyWindow
+
+ * lisp/xwem-clients.el (xwem-clded-disassociate-frame): [fix] check
+ xwem-cl-win for validity before operating on it.
+
+
+
+ modified files:
+ lisp/xwem-clgen.el lisp/xwem-clients.el
+
+
+2004-12-23 22:26:45 GMT Zajcev Evgeny <lg@xxxxxxxx> patch-18
+
+ Summary:
+ very tiny fixes
+ Revision:
+ xwem--main--2.0--patch-18
+
+ * lisp/xwem-icons.el (xwem-icons-list): [fix] Removed redundant .*
+
+ * lisp/xwem-keymacro.el (xwem-misc): [addon] Require xwem-misc
+
+ * lisp/xwem-manage.el (xwem-applications-alist): [fix] xemacs to match
+ GNU Emacs, XEmacs and SXEmacs.
+
+
+
+
+ modified files:
+ lisp/xwem-icons.el lisp/xwem-keymacro.el lisp/xwem-manage.el
+
+
+2004-12-20 21:03:40 GMT Zajcev Evgeny <lg@xxxxxxxx> patch-17
+
+ Summary:
+ Merged with 2004-w
+ Revision:
+ xwem--main--2.0--patch-17
+
+ Patches applied:
+
+ * dev@xxxxxxxxxxxxxxxx/xwem--dev--2.0--patch-3
+ Merged with main, some fixes
+
+
+ modified files:
+ Makefile lisp/xwem-keymacro.el lisp/xwem-minibuffer.el
+ lisp/xwem-misc.el man/Makefile
+
+ new patches:
+ dev@xxxxxxxxxxxxxxxx/xwem--dev--2.0--patch-3
+
+
+2004-12-19 22:45:44 GMT Zajcev Evgeny <lg@xxxxxxxx> patch-16
+
+ Summary:
+ xwem tray fixes to support dockapp's map/unmap, osd fix
+ Revision:
+ xwem--main--2.0--patch-16
+
+ * lisp/xwem-keyboard.el (xwem-kbd-quit): [typo]
+
+ * lisp/xwem-tray.el (xwem-tray-remove-dapp): [fix] check dapp state.
+
+ * lisp/xwem-tray.el (xwem-tray-hide-dapp): [new]
+
+ * lisp/xwem-tray.el (xwem-tray-show-dapp): [new]
+
+ * lisp/xwem-tray.el (xwem-tray-get-proper-position): [fix] check dapp's
+ state.
+
+ * lisp/xwem-tray.el (xwem-tray-new-dapp): [fix] change dapp's state after
+ XMapWindow.
+
+ * lisp/xwem-tray.el (xwem-tray-init): [fix] Handle MapNotify/UnmapNotify
+ events.
+
+ * lisp/xwem-tray.el (xwem-tray-handle-xevent): [fix] Handle
+ MapNotify/UnmapNotify events.
+
+ * utils/xwem-osd.el (xwem-osd-rect-add): [Sem] Optional FILL-P argument
+ added.
+
+ modified files:
+ lisp/xwem-keyboard.el lisp/xwem-tray.el utils/xwem-osd.el
+
+
+2004-12-19 01:40:32 GMT Zajcev Evgeny <lg@xxxxxxxx> patch-15
+
+ Summary:
+ compile custom-load.el
+ Revision:
+ xwem--main--2.0--patch-15
+
+ * Makefile (EXTRA_OBJ): [addon] custom-load.elc
+
+ * Makefile (distclean): [addon] remove .elc files expilicitely.
+
+ modified files:
+ Makefile
+
+
+2004-
+
+ modified files:
+ Makefile lisp/xwem-frame.el lisp/xwem-minibuffer.el
+ lisp/xwem-misc.el lisp/xwem-tabbing.el lisp/xwem-theme.el
+ lisp/xwem-win.el lpath.el man/Makefile
+
+
+2004-12-11 21:22:18 GMT Evgeny Zajcev <lg@xxxxxxxx> patch-5
+
+ Summary:
+ hot fix
+ Revision:
+ xwem--main--2.0--patch-5
+
+
+ modified files:
+ Makefile lisp/xwem-clients.el lisp/xwem-main.el
+ lisp/xwem-minibuffer.el lisp/xwem-root.el
+
+
+2004-12-11 20:33:02 GMT Evgeny Zajcev <lg@xxxxxxxx> patch-4
+
+ Summary:
+ Sync with CVS, some fixes.
+ Revision:
+ xwem--main--2.0--patch-4
+
+ lisp/xwem-clgen.el (xwem-withdraw-generic): [rem] Evil things removed to
+ avoid BadWindow X errors.
+
+ lisp/xwem-keyboard.el (modifiers): [sch] Modifiers handling changed. Alt
+ key should work, however not checked.
+
+ lisp/xwem-clients.el (xwem-client-apply-state): [fix] Handle change to
+ withdrawn state specially to avoid BadWindow X errors.
+
+ lisp/xwem-root.el (xwem-root-events-handler): [addon] X-MappingNotify
+ handler added.
+
+ lisp/xwem-events.el (xwem-ev-reconfig): [fix] Do things more safely,
+ should fix opera issue.
+
+ lisp/xwem-win.el (xwem-frame-set-win-config-frame-params): [fix] use
+ `xwem-frame-apply-xgeom-1'.
+
+
+ modified files:
+ lisp/xwem-clgen.el lisp/xwem-clients.el lisp/xwem-events.el
+ lisp/xwem-keyboard.el lisp/xwem-main.el lisp/xwem-root.el
+ lisp/xwem-win.el
+
+
+2004-12-10 23:29:27 GMT Evgeny Zajcev <lg@xxxxxxxx> patch-3
+
+ Summary:
+ merge from steve (build cleanup)
+ Revision:
+ xwem--main--2.0--patch-3
+
+ Patches applied:
+
+ * steve@xxxxxxxxxxxxxx/xwem--steve--2.0--patch-4
+ sync to lg
+
+ * steve@xxxxxxxxxxxxxx/xwem--steve--2.0--patch-5
+ fix some function foo not known to be defined warnings
+
+
+ modified files:
+ lpath.el
+
+ new patches:
+ steve@xxxxxxxxxxxxxx/xwem--steve--2.0--patch-4
+ steve@xxxxxxxxxxxxxx/xwem--steve--2.0--patch-5
+
+
+2004-12-10 22:46:33 GMT Evgeny Zajcev <lg@xxxxxxxx> patch-2
+
+ Summary:
+ makefile changes
+ Revision:
+ xwem--main--2.0--patch-2
+
+
+ modified files:
+ Makefile
+
+
+2004-12-10 21:51:10 GMT Evgeny Zajcev <lg@xxxxxxxx> patch-1
+
+ Summary:
+ merge from steve
+ Revision:
+ xwem--main--2.0--patch-1
+
+ Patches applied:
+
+ * steve@xxxxxxxxxxxxxx/xwem--steve--2.0--base-0
+ tag of lg@xxxxxxxxxxxxxx/xwem--main--2.0--base-0
+
+ * steve@xxxxxxxxxxxxxx/xwem--steve--2.0--patch-1
+ Add some missing files to the repo
+
+ * steve@xxxxxxxxxxxxxx/xwem--steve--2.0--patch-2
+ Introduce a tla-stlye version string, clean up the build
+
+ * steve@xxxxxxxxxxxxxx/xwem--steve--2.0--patch-3
+ emergancy build fix
+
+
+ new files:
+ .arch-ids/Makefile.id .arch-ids/xwem-loaddefs-gen.el.id
+ Makefile battery/.arch-ids/=id battery/.arch-ids/Makefile.id
+ battery/.arch-ids/battery.c.id battery/Makefile
+ battery/battery.c dockapp/.arch-ids/.arch-inventory.id
+ dockapp/.arch-ids/=id dockapp/.arch-ids/xwem-battery.el.id
+ dockapp/.arch-ids/xwem-framei.el.id
+ dockapp/.arch-ids/xwem-pager.el.id
+ dockapp/.arch-ids/xwem-time.el.id
+ dockapp/.arch-ids/xwem-weather.el.id dockapp/.arch-inventory
+ dockapp/xwem-battery.el dockapp/xwem-framei.el
+ dockapp/xwem-pager.el dockapp/xwem-time.el
+ dockapp/xwem-weather.el extra/.arch-ids/.arch-inventory.id
+ extra/.arch-ids/=id extra/.arch-ids/ixwem.el.id
+ extra/.arch-ids/xwem-edprops.el.id
+ extra/.arch-ids/xwem-frametrans.el.id
+ extra/.arch-ids/xwem-recover.el.id
+ extra/.arch-ids/xwem-smartmods.el.id
+ extra/.arch-ids/xwem-vert.el.id extra/.arch-inventory
+ extra/ixwem.el extra/xwem-edprops.el extra/xwem-frametrans.el
+ extra/xwem-recover.el extra/xwem-smartmods.el
+ extra/xwem-vert.el icons/.arch-ids/=id
+ icons/.arch-ids/README.id icons/.arch-ids/mini-acroread.xpm.id
+ icon
+ icons/mini-xchat1.xpm icons/mini-xdvi.xpm
+ icons/mini-xemacs.xpm icons/mini-xemacs1.xpm
+ icons/mini-xemacsC.xpm icons/mini-xemacsgnus.xpm
+ icons/mini-xemacsinfo.xpm icons/mini-xemacspy.xpm
+ icons/mini-xemacstex.xpm icons/mini-xfig.xpm
+ icons/mini-xkeycaps.xpm icons/mini-xterm.xpm
+ icons/mini-xterm1.xpm icons/mini-xv.xpm icons/mini-xv1.xpm
+ icons/mini-xwem.xpm icons/mini-zoom.xpm
+ icons/mini32x32-help.xpm icons/root-icon.xpm
+ lisp/.arch-ids/.arch-inventory.id lisp/.arch-ids/=id
+ lisp/.arch-ids/xwem-clgen.el.id
+ lisp/.arch-ids/xwem-clients.el.id
+ lisp/.arch-ids/xwem-clswi.el.id
+ lisp/.arch-ids/xwem-compat.el.id
+ lisp/.arch-ids/xwem-desktop.el.id
+ lisp/.arch-ids/xwem-edmacro.el.id
+ lisp/.arch-ids/xwem-events.el.id
+ lisp/.arch-ids/xwem-faces.el.id
+ lisp/.arch-ids/xwem-focus.el.id
+ lisp/.arch-ids/xwem-frame.el.id
+ lisp/.arch-ids/xwem-gamma.el.id lisp/.arch-ids/xwem-help.el.id
+ lisp/.arch-ids/xwem-icons.el.id
+ lisp/.arch-ids/xwem-interactive.el.id
+ lisp/.arch-ids/xwem-keyboard.el.id
+ lisp/.arch-ids/xwem-keydefs.el.id
+ lisp/.arch-ids/xwem-keymacro.el.id
+ lisp/.arch-ids/xwem-launcher.el.id
+ lisp/.arch-ids/xwem-load.el.id lisp/.arch-ids/xwem-main.el.id
+ lisp/.arch-ids/xwem-manage.el.id
+ lisp/.arch-ids/xwem-minibuffer.el.id
+ lisp/.arch-ids/xwem-misc.el.id lisp/.arch-ids/xwem-modes.el.id
+ lisp/.arch-ids/xwem-mouse.el.id
+ lisp/.arch-ids/xwem-netwm.el.id
+ lisp/.arch-ids/xwem-ratanot.el.id
+ lisp/.arch-ids/xwem-register.el.id
+ lisp/.arch-ids/xwem-report.el.id
+ lisp/.arch-ids/xwem-root.el.id
+ lisp/.arch-ids/xwem-rooter.el.id
+ lisp/.arch-ids/xwem-rooticon.el.id
+ lisp/.arch-ids/xwem-selections.el.id
+ lisp/.arch-ids/xwem-sound.el.id
+ lisp/.arch-ids/xwem-special.el.id
+ lisp/.arch-ids/xwem-strokes.el.id
+ lisp/.arch-ids/xwem-struct.el.id
+ lisp/.arch-ids/xwem-tabbing.el.id
+ lisp/.arch-ids/xwem-theme.el.id
+ lisp/.arch-ids/xwem-transient.el.id
+ lisp/.arch-ids/xwem-tray.el.id lisp/.arch-ids/xwem-win.el.id
+ lisp/.arch-inventory lisp/xwem-clgen.el lisp/xwem-clients.el
+ lisp/xwem-clswi.el lisp/xwem-compat.el lisp/xwem-desktop.el
+ lisp/xwem-edmacro.el lisp/xwem-events.el lisp/xwem-faces.el
+ lisp/xwem-focus.el lisp/xwem-frame.el lisp/xwem-gamma.el
+ lisp/xwem-help.el lisp/xwem-icons.el lisp/xwem-interactive.el
+ lisp/xwem-keyboard.el lisp/xwem-keydefs.el
+ lisp/xwem-keymacro.el lisp/xwem-launcher.el lisp/xwem-load.el
+ lisp/xwem-main.el lisp/xwem-manage.el lisp/xwem-minibuffer.el
+ lisp/xwem-misc.el lisp/xwem-modes.el lisp/xwem-mouse.el
+ lisp/xwem-netwm.el lisp/xwem-ratanot.el lisp/xwem-register.el
+ lisp/xwem-report.el lisp/xwem-root.el lisp/xwem-rooter.el
+ lisp/xwem-rooticon.el lisp/xwem-selections.el
+ lisp/xwem-sound.el lisp/xwem-special.el lisp/xwem-strokes.el
+ lisp/xwem-struct.el lisp/xwem-tabbing.el lisp/xwem-theme.el
+ lisp/xwem-transient.el lisp/xwem-tray.el lisp/xwem-win.el
+ man/.arch-ids/.arch-inventory.id man/.arch-ids/=id
+ man/.arch-ids/Makefile.id man/.arch-ids/addons.texi.id
+ man/.arch-ids/client.texi.id man/.arch-ids/frame.texi.id
+ man/.arch-ids/help.texi.id man/.arch-ids/hooking.texi.id
+ man/.arch-ids/logging.texi.id man/.arch-ids/manda.texi.id
+ man/.arch-ids/minibuf.texi.id man/.arch-ids/overview.texi.id
+ man/.arch-ids/primitives.texi.id man/.arch-ids/start.texi.id
+ man/.arch-ids/subsystems.texi.id
+ man/.arch-ids/textspec.texi.id man/.arch-ids/tray.texi.id
+ man/.arch-ids/win.texi.id man/.arch-ids/xwem.texi.id
+ man/.arch-inventory man/Makefile man/addons.texi
+ man/client.texi man/frame.texi man/help.texi man/hooking.texi
+ man/logging.texi man/manda.texi man/minibuf.texi
+ man/overview.texi man/primitives.texi man/start.texi
+ man/subsystems.texi man/textspec.texi man/tray.texi
+ man/win.texi man/xwem.texi utils/.arch-ids/.arch-inventory.id
+ utils/.arch-ids/=id utils/.arch-ids/xwem-appcollect.el.id
+ utils/.arch-ids/xwem-diagram.el.id
+ utils/.arch-ids/xwem-holer.el.id
+ utils/.arch-ids/xwem-osd.el.id
+ utils/.arch-ids/xwem-worklog.el.id
+ utils/.arch-ids/xwem-xfig.el.id utils/.arch-inventory
+ utils/xwem-appcollect.el utils/xwem-diagram.el
+ utils/xwem-holer.el utils/xwem-osd.el utils/xwem-worklog.el
+ utils/xwem-xfig.el xwem-loaddefs-gen.el
+
+ modified files:
+ lpath.el package-info.in
+
+ renamed files:
+ .arch-ids/Makefile.id
+ ==> .arch-ids/Makfile.CVS.id
+ Makefile
+ ==> Makfile.CVS
+
+ new directories:
+ battery battery/.arch-ids dockapp dockapp/.arch-ids extra
+ extra/.arch-ids icons icons/.arch-ids lisp lisp/.arch-ids man
+ man/.arch-ids utils utils/.arch-ids
+
+ new patches:
+ steve@xxxxxxxxxxxxxx/xwem--steve--2.0--base-0
+ steve@xxxxxxxxxxxxxx/xwem--steve--2.0--patch-1
+ steve@xxxxxxxxxxxxxx/xwem--steve--2.0--patch-2
+ steve@xxxxxxxxxxxxxx/xwem--steve--2.0--patch-3
+
+
+2004-12-08 19:22:14 GMT Evgeny Zajcev <lg@xxxxxxxx> base-0
+
+ Summary:
+ Initial import of xwem sources.
+ Revision:
+ xwem--main--2.0--base-0
+
+
+ new files:
+ ChangeLog.CVS Makefile TODO logo.xpm lpath.el package-info.in
+
+
Index: Makefile
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/xwem/Makefile,v
retrieving revision 1.29
diff -u -u -r1.29 Makefile
--- Makefile 16 Dec 2004 08:07:47 -0000 1.29
+++ Makefile 1 Jan 2005 04:41:09 -0000
@@ -18,11 +18,12 @@
# Boston, MA 02111-1307, USA.
VERSION = 1.18
-AUTHOR_VERSION = 0.2
+AUTHOR_VERSION = lg@xxxxxxxxxxxxxx/xwem--main--2.0--version-0
MAINTAINER = Zajcev Evgeny <zevlg@xxxxxxxxx>
PACKAGE = xwem
PKG_TYPE = regular
-REQUIRES = xwem xemacs-base xlib strokes edit-utils text-modes time slider
+REQUIRES = xwem xemacs-base xlib strokes edit-utils text-modes time slider \
+ elib ilisp mail-lib
CATEGORY = standard
DONTCOMPILE = lisp/_pkg.el lisp/auto-autoloads.el lisp/custom-load.el
Index: package-info.in
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/xwem/package-info.in,v
retrieving revision 1.4
diff -u -u -r1.4 package-info.in
--- package-info.in 16 Dec 2004 08:07:48 -0000 1.4
+++ package-info.in 1 Jan 2005 04:41:09 -0000
@@ -13,17 +13,21 @@
filename FILENAME
md5sum MD5SUM
size SIZE
- provides (xwem-clients xwem-compat xwem-events xwem-faces
- xwem-focus xwem-frame xwem-help xwem-icons
- xwem-interactive xwem-keyboard xwem-keydefs
- xwem-keymacro xwem-launcher xwem-load xwem-macros
- xwem-main xwem-manage xwem-minibuffer xwem-misc
- xwem-mouse xwem-root xwem-sound xwem-special
- xwem-strokes xwem-tabbing xwem-tray xwem-win
- xwem-clswi xwem-diagram xwem-edmacro xwem-framei
- xwem-gamma xwem-holer xwem-osd xwem-register
- xwem-rooter xwem-smartmods xwem-time xwem-worklog
- xwem-xfig xwem-keytt)
+ provides (ixwem xwem-appcollect xwem-battery xwem-clgen
+ xwem-clients xwem-clswi xwem-compat xwem-desktop
+ xwem-diagram xwem-edmacro xwem-edprops xwem-events
+ xwem-faces xwem-focus xwem-frame xwem-framei
+ xwem-frametrans xwem-gamma xwem-help xwem-holer
+ xwem-icons xwem-interactive xwem-keyboard xwem-keydefs
+ xwem-keymacro xwem-keytt xwem-launcher xwem-load
+ xwem-loaddefs xwem-macros xwem-main xwem-manage
+ xwem-minibuffer xwem-misc xwem-modes xwem-mouse
+ xwem-netwm xwem-osd xwem-pager xwem-ratanot xwem-recover
+ xwem-register xwem-report xwem-root xwem-rooter
+ xwem-rooticon xwem-selections xwem-smartmods xwem-sound
+ xwem-special xwem-strokes xwem-struct xwem-tabbing
+ xwem-theme xwem-time xwem-transient xwem-tray xwem-version
+ xwem-vert xwem-weather xwem-win xwem-worklog xwem-xfig)
requires (REQUIRES)
type regular
))
Index: icons/README
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/xwem/icons/README,v
retrieving revision 1.3
diff -u -u -r1.3 README
--- icons/README 16 Dec 2004 08:07:58 -0000 1.3
+++ icons/README 1 Jan 2005 04:41:09 -0000
@@ -37,6 +37,10 @@
* "};" must be on its own line at the end of file.
* ' ' must be used for None color.
+
+ * Do not use ',' character to denote color.
+
+ * No trailing spaces in any line.
Recommended, but not required:
Index: icons/mini-display.xpm
===================================================================
RCS file:
/pack/xemacscvs/XEmacs/packages/xemacs-packages/xwem/icons/mini-display.xpm,v
retrieving revision 1.3
diff -u -u -r1.3 mini-display.xpm
--- icons/mini-display.xpm 16 Dec 2004 08:07:58 -0000 1.3
+++ icons/mini-display.xpm 1 Jan 2005 04:41:09 -0000
@@ -1,28 +1,27 @@
/* XPM */
static char *mini_display_xpm[] = {
/* columns rows colors chars-per-pixel */
-"16 16 6 1",
+"16 16 5 1",
" c None",
". c gray50",
"X c white",
"o c black",
"O c blue",
-"+ c gray85",
/* pixels */
-" ",
-" ............ ",
-" .XXXXXXXXXXXXo ",
-" .Xooooooooo.Xo ",
-" .XoOOOOOOOO.Xo ",
-" .XoOXOOOOOO.Xo ",
-" .XoOOOOOOOO.Xo ",
-" .XoOOOOOOOO.Xo ",
-" .XoOOOOOOOO.Xo ",
-" .XoOOOOOOOO.Xo ",
-" .Xo.........Xo ",
-" .XXXXXXXXXXXXo ",
-" oooooooooooo ",
-" .XXXX+.o ",
-" oooooooooooo ",
-" "
+" ",
+" ............ ",
+" .XXXXXXXXXXXXo ",
+" .Xooooooooo.Xo ",
+" .XoOOOOOOOO.Xo ",
+" .XoOXXOOOOO.Xo ",
+" .XoOOOOOOOO.Xo ",
+" .XoOOOOOOOO.Xo ",
+" .XoOOOOOOOO.Xo ",
+" .XoOOOOOOOO.Xo ",
+" .Xo.........Xo ",
+" .XXXXXXXXXXXXo ",
+" oooooooooooo ",
+" .XXXX..o ",
+" oooooooooooo ",
+" "
};
Index: icons/mini-graph.xpm
===================================================================
RCS file:
/pack/xemacscvs/XEmacs/packages/xemacs-packages/xwem/icons/mini-graph.xpm,v
retrieving revision 1.3
diff -u -u -r1.3 mini-graph.xpm
--- icons/mini-graph.xpm 16 Dec 2004 08:07:58 -0000 1.3
+++ icons/mini-graph.xpm 1 Jan 2005 04:41:09 -0000
@@ -10,6 +10,7 @@
"r c red",
"@ c #808080",
/* pixels */
+" ",
" ### ",
" mm# ",
" mm# ",
@@ -24,8 +25,5 @@
" gg# bb# mm# rr#",
" gg# bb# mm# rr#",
"################",
-" @@@@@@@@@@@@@@@",
-" "
-};
-
-
\ No newline at end of file
+" @@@@@@@@@@@@@@@"
+};
Index: icons/mini-xv.xpm
===================================================================
RCS file:
/pack/xemacscvs/XEmacs/packages/xemacs-packages/xwem/icons/mini-xv.xpm,v
retrieving revision 1.3
diff -u -u -r1.3 mini-xv.xpm
--- icons/mini-xv.xpm 16 Dec 2004 08:07:58 -0000 1.3
+++ icons/mini-xv.xpm 1 Jan 2005 04:41:09 -0000
@@ -3,9 +3,9 @@
/* width height num_colors chars_per_pixel */
"16 16 4 1",
" c None",
-"# c black",
-"r c red",
-". c white",
+"# c black s xblack",
+"r c red s xred",
+". c white s xwhite",
/* pixels */
" ",
" ",
Index: lisp/ixwem.el
===================================================================
RCS file: lisp/ixwem.el
diff -N lisp/ixwem.el
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lisp/ixwem.el 1 Jan 2005 04:41:09 -0000
@@ -0,0 +1,150 @@
+;;; ixwem.el ---
+
+;; Copyright (C) 2004 by Free Software Foundation, Inc.
+
+;; Author: Zajcev Evgeny <zevlg@xxxxxxxxx>
+;; Created: Sat Sep 11 21:38:13 GMT 2004
+;; Keywords: xwem
+;; X-CVS: $Id: ixwem.el,v 1.2 2004/12/05 05:52:26 youngs Exp $
+
+;; This file is part of XWEM.
+
+;; XWEM is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; XWEM is distributed in the hope that it will be useful, but WITHOUT
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+;; License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with XEmacs; see the file COPYING. If not, write to the Free
+;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+;; 02111-1307, USA.
+
+;;; Synched up with: Not in FSF
+
+;;; Commentary:
+
+;;
+
+;;; Code:
+
+
+;; Highlighting.
+;; TODO:
+;; - font lock faces
+;; -
+(require 'xwem-load)
+
+(defgroup ixwem nil
+ "Group to customize IXWEM."
+ :prefix "ixwem-"
+ :group 'xwem)
+
+(defcustom ixwem-name-length 32
+ "*Maximum length of xwem client name to display."
+ :type 'number
+ :group 'ixwem)
+
+;;; Internal variables
+
+(defvar ixwem-header-line
+ (concat " IMD Manda Client Size Frame Uptime\n"
+ " --- ----- ------ ---- -----
------\n"))
+
+(defvar ixwem-local-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map ?q 'ixwem-quit)
+ map)
+ "Keymap used when in ixwem mode.")
+
+
+(defun ixwem-client-format (cl)
+ (format (format " %%.%ds\n" ixwem-name-length)
+ (xwem-client-name cl)))
+
+(defun ixwem-draw-tree (buf)
+ "Draw clients tree in buffer BUF."
+ (with-current-buffer buf
+ (erase-buffer buf)
+
+ (insert (concat " Name" (make-string (- ixwem-name-length 3) ?\x20)
+ "Size " "Uptime " "Recency\n"))
+ (insert (concat " ----" (make-string (- ixwem-name-length 3) ?\x20)
+ "---- " "------ " "-------\n"))
+ (mapc (lambda (ma)
+ (insert (format "[%S]\n" (xwem-manda-name ma)))
+ (cond ((eq (xwem-manda-name ma) 'generic)
+ (mapc (lambda (fr)
+ (insert (format " {F%d: %s}\n"
+ (xwem-frame-num fr) (xwem-frame-name
fr)))
+ (mapc (lambda (cl)
+ (when (and (eq (xwem-cl-frame cl) fr)
+ (eq (xwem-cl-manda cl) ma))
+ (insert (ixwem-client-format cl))))
+ xwem-clients))
+ xwem-frames-list))
+ (t (mapc (lambda (cl)
+ (when (eq (xwem-cl-manda cl) ma)
+ (insert (ixwem-client-format cl))))
+ xwem-clients))))
+ xwem-manda-list)
+ ))
+
+(defun ixwem-list-clients (buf)
+ "List xwem clients in BUF buffer."
+ (with-current-buffer buf
+ (erase-buffer)
+
+ ;; Display header
+ (insert ixwem-header-line)
+
+ ;; Display clients tree
+ (mapcar (lambda (cl)
+ (let ((bstr (make-string 40 ?\x20)))
+ (insert
+ (format " *# %.9s %.24s %.8s %.8s %.20s\n"
+ (concat (symbol-name (xwem-manda-name (xwem-cl-manda
cl))) bstr)
+ (concat (xwem-client-name cl) bstr)
+ (concat (let ((gg (xwem-cl-get-usize cl)))
+ (format "%dx%d" (car gg) (cdr gg)))
+ bstr)
+ (if (xwem-cl-frame cl)
+ (concat (xwem-frame-name (xwem-cl-frame cl)) bstr)
+ bstr)
+ (concat (xwem-cl-get-uptime cl) bstr)))))
+ xwem-clients)
+ ))
+
+(defun ixwem-mode ()
+ "Enter ixwem mode."
+ (setq major-mode 'ixwem)
+ (setq mode-name "IXWEM")
+ (use-local-map ixwem-local-map)
+ )
+
+;;;###autoload(autoload 'ixwem "ixwem" "" t)
+(define-xwem-command ixwem ()
+ "Interactive xwem clients browsing."
+ (xwem-interactive)
+
+ (let ((buf (get-buffer-create "*ixwem*")))
+ (switch-to-buffer buf)
+ (ixwem-draw-tree buf)
+; (ixwem-list-clients buf)
+ (ixwem-mode)
+ ))
+
+(defun ixwem-quit ()
+ "Quit IXWEM."
+ (interactive)
+
+ (bury-buffer))
+
+
+(provide 'ixwem)
+
+;;; ixwem.el ends here
Index: lisp/xwem-appcollect.el
===================================================================
RCS file: lisp/xwem-appcollect.el
diff -N lisp/xwem-appcollect.el
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lisp/xwem-appcollect.el 1 Jan 2005 04:41:09 -0000
@@ -0,0 +1,105 @@
+;;; xwem-appcollect.el ---
+
+;; Copyright (C) 2004 by Free Software Foundation, Inc.
+
+;; Author: Zajcev Evgeny <zevlg@xxxxxxxxx>
+;; Created: Fri Oct 29 04:35:18 MSD 2004
+;; Keywords: xwem
+;; X-CVS: $Id: xwem-appcollect.el,v 1.1 2004/11/29 20:42:25 lg Exp $
+
+;; This file is part of XWEM.
+
+;; XWEM is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; XWEM is distributed in the hope that it will be useful, but WITHOUT
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+;; License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with XEmacs; see the file COPYING. If not, write to the Free
+;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+;; 02111-1307, USA.
+
+;;; Synched up with: Not in FSF
+
+;;; Commentary:
+
+;; Helpfull util to create `xwem-applications-alist'.
+;; Usage:
+;;
+;; (xwem-appcollect '("xterm" "mozilla"))
+
+;; (xwem-appcollect '("xterm" "mozilla") '(name class) 'or)
+
+;; (xwem-appcollect '("xterm" "mozilla") '(command) 'or)
+
+;;; Code:
+
+(require 'xwem-load)
+(require 'xwem-manage)
+(require 'xwem-launcher)
+
+(define-xwem-method manage appcollect (cl)
+ "Manage method when collecting info about applications."
+ (declare (special xwem-app-collection))
+ (declare (special xwem-app-collect-wait))
+
+ (let ((app-name (xwem-cl-get-prop cl 'xwem-appcollect-app-name))
+ (op (xwem-cl-get-prop cl 'xwem-appcollect-op))
+ (params (xwem-cl-get-prop cl 'xwem-appcollect-params))
+ mspec)
+
+ (setq mspec (list op))
+ (mapc (lambda (par)
+ (cond ((eq par 'class)
+ (push `(and (class-inst ,(concat "^" (car
(xwem-hints-wm-class (xwem-cl-hints cl))) "$"))
+ (class-name ,(concat "^" (cdr
(xwem-hints-wm-class (xwem-cl-hints cl))) "$")))
+ mspec))
+ ((eq par 'name)
+ (push `(name ,(concat "^" (xwem-hints-wm-name
(xwem-cl-hints cl)) "$"))
+ mspec))
+ ((eq par 'command)
+ (push `(command ,(concat "^" (xwem-hints-wm-command
(xwem-cl-hints cl)) "$"))
+ mspec))))
+ params)
+ (setq mspec (nreverse mspec))
+
+ (setq xwem-app-collection (put-alist app-name (list mspec)
xwem-app-collection))
+ (xwem-client-kill cl t)
+ (setq xwem-app-collect-wait nil)))
+
+;;;###xwem-autoload(autoload 'xwem-appcollect "xwem-appcollect" nil nil)
+(defun xwem-appcollect (app-names &optional params operation)
+ "Collect and return applications manage specs.
+APP-NAMES is a list of applications to collect.
+
+PARAMS is a list of elements where each element is one of:
+ `class' - Include class-inst/class-name into mspec.
+ `name' - Include app name into mspec.
+ `command' - Include command into mspec."
+ (let ((xwem-app-collection nil))
+ (declare (special xwem-app-collection))
+
+ (mapc (lambda (app)
+ (let ((cmd (xwem-launcher-normalize-cmd app))
+ (xwem-app-collect-wait t))
+ (declare (special xwem-app-collect-wait))
+ (xwem-manda-add-expectance
+ `(appcollect (xwem-appcollect-op ,(or operation 'and)
xwem-appcollect-params ,(or params '(class))
+ xwem-appcollect-app-name ,app)
+ (eval t)) 120)
+ (xwem-execute-program cmd)
+ (while xwem-app-collect-wait
+ (dispatch-event (next-event)))))
+ app-names)
+
+ (nreverse xwem-app-collection)))
+
+
+(provide 'xwem-appcollect)
+
+;;; xwem-appcollect.el ends here
Index: lisp/xwem-battery.el
===================================================================
RCS file: lisp/xwem-battery.el
diff -N lisp/xwem-battery.el
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lisp/xwem-battery.el 1 Jan 2005 04:41:09 -0000
@@ -0,0 +1,292 @@
+;;; xwem-battery.el --- Dockapp APM battery monitor for XWEM.
+
+;; Copyright (C) 2004 by Free Software Foundation, Inc.
+
+;; Author: Zajcev Evgeny <zevlg@xxxxxxxxx>
+;; Steve Youngs <steve@xxxxxxxxxxxxx>
+;; Created: Thu Sep 2 01:14:36 GMT 2004
+;; Keywords: xwem
+;; X
+ X-ButtonPress X-ButtonRelease))
+
+ (xwem-XTrayInit (xwem-dpy) bxwin dockip dockgroup dockalign)
+
+ (X-Win-put-prop bxwin 'xwem-batt-timer
+ (start-itimer "xwem-batt"
+ `(lambda () (xwem-batt-win-update ,bxwin))
+ xwem-batt-update-interval
xwem-batt-update-interval))
+ 'started))
+
+
+;;;; In case there is no battery.ell
+(unless (fboundp 'apm-battery)
+ (defvar apm-program "apm")
+ (defvar apm-state-percent-arguments "-bl")
+ (defvar apm-status-alist
+ '((0 . high) (1 . low) (2 . critical) (3 . charging)))
+
+ (defun apm-battery ()
+ "Return battery status."
+ (let (state percents)
+ (with-temp-buffer
+ (call-process apm-program nil (current-buffer)
+ nil apm-state-percent-arguments)
+ (goto-char (point-min))
+ (setq state (cdr (assq (string-to-int
+ (buffer-substring (point-at-bol)
+ (point-at-eol)))
+ apm-status-alist)))
+ (forward-line)
+ (setq percents (string-to-int
+ (buffer-substring (point-at-bol)
+ (point-at-eol)))))
+ (list (eq state 'charging) state percents))))
+
+
+(provide 'xwem-battery)
+
+;;; xwem-battery.el ends here
Index: lisp/xwem-clgen.el
===================================================================
RCS file: lisp/xwem-clgen.el
diff -N lisp/xwem-clgen.el
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lisp/xwem-clgen.el 1 Jan 2005 04:41:10 -0000
@@ -0,0 +1,408 @@
+;;; xwem-clgen.el --- Generic model to manage clients.
+
+;; Copyright (C) 2004 by Free Software Foundation, Inc.
+
+;; Author: Zajcev Evgeny <zevlg@xxxxxxxxx>
+;; Steve Youngs <steve@xxxxxxxxxxxxx>
+;; Created: Sat Aug 28 14:31:39 MSD 2004
+;; Keywords: xwem
+;; X-CVS: $Id: xwem-clgen.el,v 1.3 2004/12/05 22:37:32 lg Exp $
+
+;; This file is part of XWEM.
+
+;; XWEM is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; XWEM is distributed in the hope that it will be useful, but WITHOUT
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+;; License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with XEmacs; see the file COPYING. If not, write to the Free
+;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+;; 02111-1307, USA.
+
+;;; Synched up with: Not in FSF
+
+;;; Commentary:
+
+;; Generic managing model.
+
+;;; Code:
+
+(require 'xwem-load)
+(require 'xwem-manage)
+
+;;; Customisation
+(defgroup xwem-clgen nil
+ "Group to customise management of generic clients."
+ :prefix "xwem-clgen-"
+ :group 'xwem-modes)
+
+(defcustom xwem-clgen-other-strategy 'samewin
+ "*Strategy used when searching for other client in window.
+Possible values are:
+
+ `samewin' - Search for client managed in window.
+
+ `sameframe-nonactive' - Search for nonactive client managed
+ in window's frame.
+
+ `sameframe-any' - Search for any client managed in window's
+ frame.
+
+ `samemanda-nonactive' - Search for any nonactive client with same
+ manage entry as other client.
+
+ `any-nonactive' - Search for any nonactive client."
+ :type '(choice (const :tag "Same Window" samewin)
+ (const :tag "Inactive in same frame" sameframe-nonactive)
+ (const :tag "Any in same frame" sameframe-any)
+ (const :tag "Inactive with same manda" samemanda-nonactive)
+ (const :tag "Any inactive" any-nonactive))
+ :group 'xwem-clgen)
+
+(defcustom xwem-clgen-other-on-split t
+ "*Non-nil mean activate c
+;;; xwem-clgen.el ends here
Index: lisp/xwem-clients.el
===================================================================
RCS file:
/pack/xemacscvs/XEmacs/packages/xemacs-packages/xwem/lisp/xwem-clients.el,v
retrieving revision 1.13
diff -u -u -r1.13 xwem-clients.el
--- lisp/xwem-clients.el 16 Dec 2004 08:08:04 -0000 1.13
+++ lisp/xwem-clients.el 1 Jan 2005 04:41:10 -0000
@@ -3,9 +3,11 @@
;; Copyright (C) 2003 by Free Software Foundation, Inc.
;; Author: Zajcev Evgeny <zevlg@xxxxxxxxx>
+;; Steve Youngs <steve@xxxxxxxxxxxxx>
+;; Richard Klinda <ignotus@xxxxxxxxxxx>
;; Created: 2 Mar 2003
;; Keywords: xlib, xwem
-;; X-CVS: $Id: xwem-clients.el,v 1.13 2004/12/16 08:08:04 youngs Exp $
+;; X-CVS: $Id: xwem-clients.el,v 1.12 2004/12/05 22:37:32 lg Exp $
;; This file is part of XWEM.
@@ -32,15 +34,11 @@
;;
;; Client state(`xwem-cl-state') is one of:
;;
-;; 'managed - Client has `xwem-cl-win' and in WIN's clients list, but
-;; not current in WIN.
+;; 'active - Client managed and activated.
;;
-;; 'managed-current - As 'managed, but CL aslo current in WIN.
+;; 'inactive - CL managed, but not viewable.
;;
-;; 'demanaged - CL may have valid `xwem-cl-win', but not in WIN's
-;; clients list and not current in any window.
-;;
-;; 'iconified - Same as 'demanaged
+;; 'iconified - CL iconified, not viewable.
;;
;; 'destroyed - CL's x window destroyed.
;;
@@ -56,23 +54,32 @@
;; `xwem-cl-state-change-hook' - Called when CL changes state to one
;; described above.
;;
-;; `xwem-cl-manage-hook' - Called when CL just managed in some
-;; window.
+;; `xwem-cl-manage-hook' - Called when CL just managed.
+;;
+;; `xwem-cl-activate-hook' - Called when CL is activated in its context.
;;
-;; `xwem-cl-demanage-hook' - Called when CL just demanaged from some
-;; window.
+;; `xwem-cl-deactivate-hook' - Called when CL is deactivated in its context.
+;;
+;; `xwem-cl-withdraw-hook' - Called when CL is about to move to withdrawn
state.
;;
-;; `xwem-cl-mark-hook' - Called when CL marked or unmarked.
+
+;;
+;; Supported client properties:
+;;
+;; `noselect' - Non-nil to make client non-selectable.
+
;;; Code:
(eval-when-compile
;; Shutup compiler
- (require 'xlib-xwin)
- (require 'xwem-macros)
- (require 'iswitchb)
+ (autoload 'subtract-time "time-date")
+ (defvar xwem-frame-ev-mask)
)
-(require 'xwem-frame)
+
+(require 'xwem-load)
+(require 'xwem-manage)
+(require 'xwem-misc)
;;; Variables
(defgroup xwem-cl nil
@@ -80,12 +87,28 @@
:prefix "xwem-cl-"
:group 'xwem)
+(defgroup xwem-modes nil
+ "Group to customize XWEM managing modes."
+ :prefix "xwem-"
+ :group 'xwem)
+
(defcustom xwem-cl-use-parent-xwin t
"*Non-nil mean that CL will use some X window, where it(CL) lowered.
-This is need to fullish some X applications, which accuire clients in such
evil manner."
+This is need to fullish some X applications, which accuire clients in
+such evil manner."
:type 'boolean
:group 'xwem-cl)
+(defcustom xwem-cl-noname-name "<noname>"
+ "*Name for clients which does not have name."
+ :type 'string
+ :group 'xwem-cl)
+
+(defcustom xwem-cl-noicon-name "<noname>"
+ "*Icon name for clients which does not have their own."
+ :type 'string
+ :group 'xwem-cl)
+
(defcustom xwem-cl-other-strategy 'samewin
"*Strategy to be used to select other CL.
One of 'any 'samewin 'sameframe.
@@ -95,21 +118,74 @@
(const :tag "Any" any))
:group 'xwem-cl)
-(defcustom xwem-cl-other-on-split t
- "Non-nil mean manage other client when split occurs in new window.
-Minor mode."
+(defcustom xwem-frame-iresize-mode 'normal
+ "*Default type of drawing outlines when resizing frame interactively.
+It is not recommeded to use 'opaque resize mode."
+ :type '(choice (const :tag "Normal border" normal)
+ (const :tag "Contiguous borders" contiguous)
+ (const :tag "Outline Corners" corners)
+
- :type 'hook
- :group 'xwem-hooks)
-
-(defcustom xwem-cl-wmname-change-hooks nil
- "Hooks to be called when WM_NAME changes."
+;;;###autoload
+(defcustom xwem-client-select-hook nil
+ "*Hooks called when new client just selected.
+It is pretty guarantied that `xwem-selected-client' is valid xwem-cl
+structure at time of hook execution."
:type 'hook
:group 'xwem-hooks)
-(defcustom xwem-cl-wmcommand-chage-hooks nil
- "Hooks to be called when WM_COMMAND changes."
+;;;###autoload
+(defcustom xwem-client-deselect-hook nil
+ "Hooks called with one arg - cl, when cl deselected.
+It is pretty guarantied that `xwem-selected-client' is valid xwem-cl
+structure at time of hook execution."
:type 'hook
:group 'xwem-hooks)
-(defcustom xwem-cl-wmclass-change-hooks nil
- "Hooks to be called when WM_CLASS changes."
- :type 'hook
- :group 'xwem-hooks)
+;;; Internal variables
-(defcustom xwem-cl-wmh-change-hooks nil
- "Hooks to be called when WM_HINTS changes."
- :type 'hook
- :group 'xwem-hooks)
+
+(defconst xwem-client-ev-mask
+ (Xmask-or XM-ColormapChange XM-PropertyChange
+ XM-FocusChange XM-EnterWindow XM-LeaveWindow
+ XM-StructureNotify XM-ResizeRedirect)
+ "Event mask for xwem's client.")
-;;;###autoload
-(defvar xwem-clients nil "Clients Windows list")
+;;;###xwem-autoload
+(defvar xwem-clients nil
+ "List of all managed clients.")
+
+;;;###xwem-autoload
+(defvar xwem-current-cl nil
+ "Internal variable.
+Use `xwem-cl-selected' to get selected client.")
+
+;;;###xwem-autoload
+(defvar xwem-last-cl nil
+ "Last selected client.
+Use `(xwem-last-client)' to get last selected client.")
;;;###autoload
(defvar xwem-cl-mark-ring nil
"The list of marked clients.")
-;;;###autoload
-(defstruct xwem-hints
- ;; TODO: add more
- wm-normal-hints
- wm-hints
- wm-class
- wm-command
- wm-name
- wm-transient-for
- wm-protocols)
-
-(defconst xwem-client-ev-mask (Xmask-or XM-ColormapChange XM-PropertyChange
- XM-FocusChange XM-EnterWindow
XM-LeaveWindow
- XM-StructureNotify XM-ResizeRedirect)
- "Event mask for xwem's client.")
+;;;###xwem-autoload
+(defmacro xwem-cl-marked-p (cl)
+ "Return non-nil if client CL is marked, i.e. in `xwem-cl-mark-ring' list."
+ `(memq ,cl xwem-cl-mark-ring))
-;;;###autoload
-(defstruct (xwem-cl (:predicate xwem-iscl-p))
- xwin ; X-Win
- saved-name ; saved WM_NAME
- xgeom ; X-Geom etry for cl
- xattrs ; X-Attr ibutes
+;;; Client properties
+;;;###xwem-autoload
+(defvar xwem-supported-client-properties nil
+ "List of supported client's properties definitions.
+Property definition is list in form:
+\(NAME . (MANAGE-TYPE (KEYWORD VAL ...) ...)).
+
+Valid KEYWORD are:
+
+ `:type' - Same as for `defcustom'. eval composite type added.
+
+ `:set' - Function to call when setting this property. Default is
+ `xwem-cl-put-prop'. Function called with three
+ arguments - CL PROP VAL.
+
+ `:get' - Function to call in order to fetch property value. Default
+ is `xwem-cl-get-prop'. Function called with two
+ arguments - CL PROP.
+")
+
+;;;###xwem-autoload
+(defmacro define-xwem-client-property (name manage-type doc &rest keys-vals)
+ "Define new xwem client property NAME."
+ `(xwem-support-cl-property (quote ,name) (quote ,manage-type)
+ (list :doc ,doc ,@keys-vals)))
+
+;;;###xwem-autoload
+(defun xwem-property-supported-p (prop)
+ "Return non-nil if client property PROP is supported."
+ (assq prop xwem-supported-client-properties))
+
+;;;###xwem-autoload
+(defun xwem-support-cl-property (prop-name manage-type keys-val)
+ "Add supported client property."
+ (let ((pdef (assq prop-name xwem-supported-client-properties)))
+ (unless pdef
+ (setq pdef (cons prop-name nil))
+ (setq xwem-supported-client-properties
+ (cons pdef xwem-supported-client-properties)))
+
+ (setcdr pdef (plist-put (cdr pdef) manage-type keys-val))))
+
+;;;###xwem-autoload
+(defun xwem-unsupport-cl-property (prop-name manage-type)
+ "Remove PROP-NAME from supported property for MANAGE-TYPE."
+ (let ((pdef (assq prop-name xwem-supported-client-properties)))
+ (when pdef
+ (setcdr pdef (plist-remprop (cdr pdef) manage-type))
+ (when (null (cdr pdef))
+ (setq xwem-supported-client-properties
+ (delq pdef xwem-supported-client-properties))))))
+
+(defun xwem-clprop-get-keyword (cl prop keyword &optional default)
+ "Return CL's property KEYWORD value.
+If no KEYWORD for such CL, return default KEYWORD value.
+Return DEFAULT if KEYWORD not found."
+ (let ((prop-def (assq prop xwem-supported-client-properties)))
+ (or (plist-get (plist-get (cdr prop-def) (xwem-cl-manage-type cl)) keyword)
+ (plist-get (plist-get (cdr prop-def) nil) keyword default))))
- win ; xwem-win dow
- hints ; xwem-hints
- manda ; xwem-manda entry
- transient-for ; non-nil if client is
transient for window
- (ev-mask xwem-client-ev-mask) ; event mask for certain client
-
- (state 'unknown) ; state of client, 'managed,
'iconified, 'unknown, etc
- start-time ; start-time
- recency ; last time when CL was active
- translist ; list of transient-for windows for
this client
+;;;###xwem-autoload
+(defun xwem-client-set-property (cl prop val)
+ "Set client property."
+ (funcall (xwem-clprop-get-keyword cl prop :set 'xwem-cl-put-prop)
+ cl prop val))
+
+;;;###xwem-autoload
+(defun xwem-client-property (cl prop)
+ "Return CL's property PROP."
+ (funcall (xwem-clprop-get-keyword cl prop :get 'xwem-cl-get-prop)
+ cl prop))
+
+(defun xwem-client-properties (cl)
+ "Return CL's properties list."
+ (let ((cplist (xwem-cl-plist cl))
+ (rplist nil))
+ (while cplist
+ (when (xwem-property-supported-p (car cplist))
+ (setq rplist (plist-put rplist (car cplist) (cadr cplist))))
+ (setq cplist (cddr cplist)))
+ rplist))
- plist ; user defined plist
- )
+(define-xwem-client-property x-border-width nil
+ "CL's xwin border width."
+ :type 'number
+ :set 'xwem-client-set-x-border-width)
+
+(define-xwem-client-property x-border-color nil
+ "CL's xwin border color."
+ :type 'color
+ :set 'xwem-client-set-x-border-color)
+
+(define-xwem-client-property noselect nil
+ "Non-nil mean CL can't be selected."
+ :type 'boolean)
+
+(define-xwem-client-property skip-deselect nil
+ "CL skips deselecting."
+ :type 'boolean)
+
+(define-xwem-client-property override-skip-deselect nil
+ "CL overrides skip-deselect property of selected client."
+ :type 'boolean)
+
+(define-xwem-client-property skip-initial-state nil
+ "Non-nil mean skip CL's initial state hint."
+ :type 'boolean)
;;; Functions
-;;;###autoload
-(defun xwem-cl-p (cl &optional sig)
- "Returns t if CL is XWEM client window."
- (let ((iscl (xwem-iscl-p cl)))
- (if (and (not iscl) sig)
- (signal 'wrong-type-argument (list sig 'xwem-cl-p cl))
- iscl)))
+(defun xwem-client-set-x-border-width (cl bprop width)
+ "Change CL's border with to WIDTH.
+Default WIDTH is 0."
+ (xwem-cl-put-prop cl bprop width) ; save it in props
+
+ (unless (numberp width)
+ (setq width 0)) ; XXX
+
+ (setf (xwem-cl-new-xgeom cl) (make-X-Geom :border-width width))
+ (xwem-refit cl))
+
+(defun xwem-client-set-x-border-color (cl bprop col)
+ "Change CL's border color to COL."
+ (xwem-cl-put-prop cl bprop col) ; save it in props
+
+ (unless col
+ (setq col "black")) ; XXX
+
+ (XSetWindowBorder (xwem-dpy) (xwem-cl-xwin cl)
+ (XAllocColor (xwem-dpy) (XDefaultColormap (xwem-dpy))
+ (xwem-make-color col))))
+
+(defun xwem-cl-focus-selected ()
+ "If CL is selected, set focus on it.
+Used in `xwem-post-deffering-hook'."
+ (xwem-focus-set (xwem-cl-selected)))
+
+;;;###xwem-autoload
+(defun xwem-cl-select (cl)
+ "Set CL to be current cl."
+ (xwem-client-local-variables-import (xwem-cl-selected))
+
+ ;; Set CL to be current client
+ (setf (xwem-last-client) (xwem-cl-selected))
+ (setf (xwem-cl-selected) cl)
+
+ (xwem-client-local-vari
+ (t t)))))))))))
+
+;;;###xwem-autoload
+(defun xwem-cl-other (cl &optional clients-list also-active no-sort)
+ "Return xwem client other then CL selecting from CLIENTS-LIST.
+Default CLIENTS-LIST is what is returned by `xwem-clients-list'.
+Deactivated clients are preferred to activated, unless ALSO-ACTIVE
is non-nil. Special clients excluded.
-If CL is not actually xwem client, nil returned."
- (if (xwem-cl-p cl)
- (let ((cll (cond ((eq xwem-cl-other-strategy 'any) xwem-clients)
-
- ((eq xwem-cl-other-strategy 'samewin)
- (xwem-win-make-cl-list-sort-by-recency (xwem-cl-win
cl)))
-
- ((eq xwem-cl-other-strategy 'sameframe)
- (xwem-frame-make-cl-list (xwem-cl-frame cl)))
-
- (t xwem-clients)))
- (rcl nil)
- (notgoodcl nil)) ;not so good candidate as rcl
-
- (while cll
- (when (not (eq (car cll) cl)) ;skip ourself
- (if (and (not (xwem-cl-exclude-p (car cll)))
- (or visible (not (xwem-win-cl-current-p (car cll)))))
- (progn
- (setq rcl (car cll))
- (setq cll nil))
-
- (when (and visible (null notgoodcl))
- (setq notgoodcl (car cll)))))
- (setq cll (cdr cll)))
+Use `(xwem-cl-other cl nil t)' form to fetch most recent
+client, other then CL.
+
+CLIENTS-LIST is sorted by recency unless NO-SORT is non-nil."
+ (unless clients-list
+ (setq clients-list (xwem-clients-list)))
+
+ (unless no-sort
+ (setq clients-list
+ (xwem-cl-list-sort-by-recency clients-list)))
+
+ (let ((rcl nil)
+ (notgoodcl nil)) ;not so good candidate as rcl
+
+ (while clients-list
+ (when (and (xwem-cl-p (car clients-list)) ; skip non-clients
+ (not (eq (car clients-list) cl)) ; skip ourself
+ (not (eq (xwem-cl-state (car clients-list)) 'iconified))) ;
skip iconified
+ (if (or also-active (not (eq (xwem-cl-state (car clients-list))
'active)))
+ ;; Found pretty good candidate
+ (setq rcl (car clients-list)
+ clients-list nil)
+
+ (when (and also-active (null notgoodcl))
+ (setq notgoodcl (car clients-list)))))
+ (setq clients-list (cdr clients-list)))
- (or rcl notgoodcl))
+ ;; Return
+ (or rcl notgoodcl)))
- ;; [else] invalid CL
- nil))
+;;;###xwem-autoload
+(defun xwem-select-some-client ()
+ (unless (and (xwem-cl-alive-p (xwem-cl-selected))
+ (eq (xwem-cl-state (xwem-cl-selected)) 'active))
+ (xwem-select-client nil)))
+
+;;;###xwem-autoload
+(defun xwem-select-last-or-other-client (cl &optional force allow-dummy)
+ "Select last or other client according to CL.
+New client selected only if CL is current selected or FORCE is non-nil
+or dummy client currently selected.
-(defun xwem-cl-bury (cl)
- "Put CL to the and of clients list.
-Maybe used in `xwem-cl-manage-hook' or `xwem-cl-demanage-hook'."
- (setq xwem-clients
- (nconc (delete cl xwem-clients) (list cl)))
- nil) ; continue hooks processing
+`xwem-select-last-or-other-client' tries to avoid selecting dummy
+clients, unless ALLOW-DUMMY is non-nil."
+ (when (or force
+ (xwem-cl-selected-p cl)
+ (xwem-cl-selected-p (xwem-dummy-client)))
+ (if (and (xwem-cl-alive-p (xwem-last-client))
+ (not (eq (xwem-last-client) cl))
+ (or allow-dummy
+ (not (xwem-dummy-client-p (xwem-last-client)))))
+ (xwem-select-client (xwem-last-client))
+ (xwem-select-client (xwem-cl-other cl nil t)))))
-;;; Manda functions begin
-;;;###autoload
+;;;###xwem-autoload
(defun xwem-cl-correct-size-for-size (cl new-geom &optional x-type y-type)
"Make CL's geometry as close to NEW-GEOM as possible.
X-TYPE is one of 'center 'left or 'right, default is 'center.
Y-TYPE is one of 'center 'top or 'bottom, default is 'center."
- (let* ((hthi (X-Geom-border-width new-geom))
+ (let* ((hthi (or (X-Geom-border-width new-geom) 0))
+ (he (X-Geom-height new-geom))
+ (wi (X-Geom-width new-geom))
(clgmt (xwem-cl-xgeom cl))
+ (wmnh (xwem-hints-wm-normal-h
+When used with prefix ARG, then focus to that other window."
(xwem-interactive "cXWEM-CL Other: \nP")
- (let ((wn (xwem-win-next (xwem-win-selected)))
- (xwem-cl-manage-hook nil)) ; skip setup hooks
-
- (when cl
- (when (xwem-win-only-one-p (xwem-win-selected))
- (xwem-frame-split-vert nil)
- (setq wn (xwem-win-next (xwem-win-selected))))
-
- (when wn
- (xwem-manda-manage cl wn)
-
- (when arg
- (xwem-window-select wn)))
- )))
+ (let (nwin)
+ (when (xwem-win-only-one-p (xwem-win-selected))
+ (xwem-window-split-vertically nil)) ; XXX
+ (setq nwin (xwem-win-next (xwem-win-selected)))
+
+ (xwem-win-set-cl nwin cl)
+ (when arg
+ (xwem-select-window nwin))))
;;;###autoload(autoload 'xwem-cl-switch-other-frame "xwem-clients" "" t)
(define-xwem-command xwem-cl-switch-other-frame (cl &optional arg)
"Switch to CL in other XWEM frame.
When used with prefix ARG, then create embedded frame, if creation is
needed at all."
- (xwem-interactive "cXWEM-CL Other frame: \nP")
+ (xwem-interactive
+ (list (xwem-read-client
+ "XWEM-CL Other frame: "
+ (xwem-cl-list-sort-by-recency
+ (xwem-clients-list
+ (lambda (cl)
+ (xwem-manage-property (xwem-cl-manage-type cl) 'win-support)))))
+ xwem-prefix-arg))
(let ((ofr (or (xwem-frame-other (xwem-frame-selected))
- (xwem-make-frame-1 arg nil nil t))))
+ (xwem-make-frame-1 (or (and arg 'embedded) 'desktop)
+ :noselect t))))
- (xwem-manda-manage cl (xwem-frame-selwin ofr))
- (xwem-frame-select ofr))
- )
+ (xwem-cl-change-window cl (xwem-frame-selwin ofr))
+ (xwem-select-client cl)))
;;;###autoload(autoload 'xwem-cl-switch-to-other "xwem-clients" "" t)
-(define-xwem-command xwem-cl-switch-to-other (n &optional window)
- "Switch to other client."
- (xwem-interactive "p")
+(define-xwem-command xwem-cl-switch-to-other (cl &optional n)
+ "Switch to xwem client other then CL.
+Default CL is selected client.
+If prefix argument N is specified, switch to N's other client."
+ (xwem-interactive (list (xwem-cl-selected)
+ (prefix-numeric-value xwem-prefix-arg)))
+
+ (while (> n 0)
+ (setq cl (xwem-method-other-client cl))
+ (decf n))
- (let* ((win (or window (xwem-win-selected)))
- (ocl (xwem-win-cl win)))
- (while (> n 0)
- (setq ocl (xwem-cl-other ocl))
- (setq n (- n 1)))
- (if (xwem-cl-p ocl)
- (xwem-manda-manage ocl win)
- (xwem-message 'note "No other client available."))))
+ (unless (xwem-cl-alive-p cl)
+ (error 'xwem-error "No other client available"))
+
+ (xwem-select-client cl))
;;;###autoload(autoload 'xwem-cl-switch-to-other-in-other-win "xwem-clients"
"" t)
(define-xwem-command xwem-cl-switch-to-other-in-other-win (n)
- "Like `xwem-cl-switch-to-other', but in other window."
+ "Switch to other client in other window then selected,"
(xwem-interactive "p")
- (xwem-cl-switch-to-other n (xwem-window-other 1)))
+ (when (xwem-win-only-one-p)
+ (error 'xwem-error "Only one window"))
+
+ (let* ((win (xwem-window-other 1))
+ (cl (xwem-win-cl win)))
+ (while (> n 0)
+ (setq cl (xwem-cl-other cl (xwem-win-clients win)))
+ (decf n))
+
+ (unless (xwem-cl-alive-p cl)
+ (error 'xwem-error "Invalid client"))
+
+ (xwem-activate cl)))
;;;###autoload(autoload 'xwem-kill-cl-and-window "xwem-clients" "" t)
-(define-xwem-command xwem-kill-cl-and-window (arg)
- "Kill selected client and window.
+(define-xwem-command xwem-kill-cl-and-window (window &optional arg)
+ "Kill WINDOW an client currently activated in it.
If used with prefix ARG then kill client in other window and other
window (not implemented)."
- (xwem-interactive "P")
+ (xwem-interactive (list (xwem-win-selected)
+ xwem-prefix-arg))
- (let* ((win (if arg (xwem-window-other 1) (xwem-win-selected)))
+ (let* ((win (if arg (xwem-window-other 1 window) window))
(cl (xwem-win-cl win)))
+ ;; kill client
(when (xwem-cl-p cl)
- ;; Deassociate CL from WIN so no client will be managed when we
- ;; kill CL.
- (setf (xwem-cl-win cl) nil)
- (setf (xwem-win-cl win) nil)
- (xwem-client-kill t cl)
-
- ;; Make sure CL is removed from clients list
- (xwem-remove-client cl))
-
- (xwem-window-delete win)
- (xwem-frame-redraw (xwem-win-frame win))
- ))
+ (xwem-client-kill cl))
+
+ ;; kill window
+ (xwem-window-delete win)))
;;;###autoload(autoload 'xwem-cl-transpose "xwem-clients" "" t)
-(define-xwem-command xwem-cl-transpose (arg &optional cl)
+(define-xwem-command xwem-cl-transpose (cl &optional arg)
"Transpose CL with client at right in CL's WIN.
If ARG is non-nil transpose with left client.
If CL is ommited than selected client will be used."
- (xwem-interactive "P")
-
- (let* ((cl (or cl (xwem-cl-selected)))
- (sw (xwem-cl-win cl))
- (tai (cadr (member cl (funcall (if arg 'reverse 'identity)
(xwem-win-make-cl-list sw))))))
- (when (not (xwem-cl-p tai))
- (setq tai (cadr (member cl (funcall (if arg 'identity 'reverse)
(xwem-win-make-cl-list sw))))))
-
- (when (and (xwem-cl-p cl) (xwem-cl-p tai))
- (xwem-list-exchange-els xwem-clients cl tai)
+ (xwem-interactive (list (xwem-cl-selected)
+ xwem-prefix-arg))
- (run-hook-with-args 'xwem-win-clients-change-hook sw))
- ))
-
-(defun xwem-client-rearrange-top (cl)
- "Move CL on top of `xwem-clients'."
- (when (xwem-win-selected-p (xwem-cl-win cl))
- (setq xwem-clients (cons cl (delete cl xwem-clients))))
-
- nil) ;continue hooks processing
+ (when (xwem-cl-p cl)
+ (let* ((sw (xwem-cl-win cl))
+ (tai (cadr (memq cl (funcall (if arg 'reverse 'identity)
+ (xwem-win-clients sw))))))
+ (unless (xwem-cl-p tai)
+ (setq tai (cadr (memq cl (funcall (if arg 'identity 'reverse)
+ (xwem-win-clients sw))))))
+
+ (when (xwem-cl-p tai)
+ (xwem-list-exchange-els (xwem-win-clients sw) cl tai)
+ (run-hook-with-args 'xwem-win-clients-change-hook sw))
+ )))
+(put 'xwem-cl-transpose 'xwem-frame-command t)
-;;;###autoload
-(defun xwem-init-clients ()
+(defun xwem-clients-init ()
"Clients part initializer"
- (xwem-message 'msg "Initializing clients ... wait")
+ (xwem-message 'init "Initializing clients ...")
(setq xwem-clients nil)
- ;; Gentle handling of window splitting
- (add-hook 'xwem-win-after-split-hook 'xwem-cl-other-on-split)
+ ;; Add default select/deselect hooks
+ (add-hook 'xwem-client-select-hook 'xwem-client-default-select-hook t)
+ (add-hook 'xwem-client-deselect-hook 'xwem-client-default-deselect-hook t)
- (when xwem-cl-use-set-focus
- (add-hook 'xwem-cl-manage-hook 'xwem-client-focus))
+ ;; Initialise dummy client
+ (xwem-dummy-client-init)
- (when xwem-cl-use-recent-cl-on-top
- (add-hook 'xwem-cl-manage-hook 'xwem-client-rearrange-top))
-; (add-hook 'xwem-cl-demanage-hook 'xwem-cl-bury))
-
- ;; Setup
- (when xwem-cl-use-parent-xwin
- (add-hook 'xwem-cl-create-hook 'xwem-cl-parent-on-creation)
- (add-hook 'xwem-cl-destroy-hook 'xwem-cl-parent-on-destroy)
- (add-hook 'xwem-cl-state-change-hook 'xwem-cl-parent-on-change-state))
- )
+ (xwem-message 'init "Initializing clients ... done"))
-;;;###autoload
+;;;###xwem-autoload
(defun xwem-client-sendmsg-atom (cl atom &optional time)
"Send Client message to client CL."
(XSendEvent (xwem-dpy) (xwem-cl-xwin cl) nil 0
- (X-Create-message
- (list [1 X-ClientMessage] ;type
- [1 32] ;format
- [2 1000] ;XXX seq
- [4 (X-Win-id (xwem-cl-xwin cl))] ; window
- [4 (X-Atom-id (X-Atom-find-by-name (xwem-dpy)
"WM_PROTOCOLS"))]
- [4 (X-Atom-id atom)]
- [4 (or time X-CurrentTime)]
- [4 nil]))))
+ (X-Create-message
+ (list [1 X-ClientMessage] ; type
+ [1 X-format-32] ; format
+ [2 1000] ; XXX seq
+ [4 (X-Win-id (xwem-cl-xwin cl))] ; wind
- (xwem-frame-selwin fr)))
- xwem-frames-list)))
-
- ;; Setup focus mode
- (xwem-focus-mode-set new-cl xwem-default-focus-mode)
-
- ;; Run new client hook
- (run-hook-with-args 'xwem-cl-create-hook new-cl)
-
- ;; Finnally manage new client
- (if (xwem-win-p dwin)
- (xwem-manda-manage new-cl dwin)
- (xwem-manda-manage new-cl)))
- )))
- ))
+ (setf (xwem-cl-initial-xattrs new-cl)
+ (XGetWindowAttributes (xwem-dpy) xwin))
+ (setf (xwem-cl-initial-xgeom new-cl)
+ (XGetGeometry (xwem-dpy) xwin))
+ (setf (xwem-cl-xgeom new-cl)
+ (copy-X-Geom (xwem-cl-initial-xgeom new-cl)))
+ (setf (xwem-cl-start-time new-cl)
+ (current-time))
+
+ ;; Apply properties
+ (xwem-cl-apply-plist new-cl props)
+
+ new-cl)))
+
+(defun xwem-unmake-client (cl)
+ "Unmake client CL."
+ ;; If unmaking selected client, then select dummy client
+ (when (xwem-cl-selected-p cl)
+ (xwem-select-client nil))
+
+ (X-Win-rem-prop (xwem-cl-xwin cl) 'xwem-cl)
+ (X-Win-EventHandler-rem (xwem-cl-xwin cl) 'xwem-cl-events-handler)
+
+ ;; Make sure CL not in xwem-clients
+ (setq xwem-clients (delq cl xwem-clients))
+
+ (X-invalidate-cl-struct cl))
+
+(defun xwem-client-first-manage (cl)
+ "Manage client CL for the first time.
+Return non-nil if CL successfully managed."
+ ;; Find match spec for CL
+ (let ((mspec (xwem-manda-find-match cl)))
+ (when mspec
+ ;; Add CL to clients list
+ (pushnew cl xwem-clients :test 'eq)
+
+ ;; Apply plist before setting managing model, becase seting
+ ;; properties may depend on it and will fail because client is
+ ;; not yet managed by this managing model.
+
+ ;; On the other hand not seting managing model before applying
+ ;; properties may cause seting property to fail, for example
+ ;; 'expect-win property, which only set for 'generic managing
+ ;; model.
+ (setf (xwem-cl-manage-spec cl) mspec)
+ (xwem-cl-apply-plist cl (cadr mspec))
+
+ (xwem-debug 'xwem-cl "Managing model: %S selected" '(xwem-cl-manage-type
cl))
+
+ ;; Setup focus mode if not already setuped
+ (unless (xwem-client-property cl 'xwem-focus-mode)
+ (xwem-focus-mode-set cl))
+
+ (xwem-debug 'xwem-cl "Focus model: %S selected"
+ '(xwem-client-property cl 'xwem-focus-mode))
+
+ ;; Run manage method
+ (xwem-manage cl)
+
+ ;; Unmark CL as it was expected in case `xwem-manda-find-match'
+ ;; marked it.
+ (xwem-cl-was-expected cl nil)
+
+ ;; Run new client hook
+ (when (xwem-cl-alive-p cl)
+ (run-hook-with-args 'xwem-cl-create-hook cl))
+ cl)))
+
+;;;###xwem-autoload
+(defun xwem-xwin-try-to-manage (xwin)
+ "Try to manage X window XWIN.
+Return managed client, or nil if client wasnt managed."
+ (unless (xwem-xwin-cl xwin)
+ (let ((cl (xwem-make-client xwin xwem-client-default-properties)))
+ (when (xwem-cl-p cl)
+ (unless (xwem-client-first-manage cl)
+ (xwem-unmake-client cl)))
+ (and (xwem-cl-p cl) cl))))
+
+;;;###xwem-autoload
+(defun xwem-cl-destroy (cl)
+ "Tottally destroy CL."
+ (setf (xwem-cl-state cl) 'destroyed)
+
+ (xwem-method-on-kill cl)
+ (run-hook-with-args 'xwem-cl-destroy-hook cl)
+
+ (xwem-select-some-client)
+ (xwem-deffered-funcall 'xwem-unmake-client cl))
+
+;;;###xwem-autoload
+(defun xwem-cl-apply-plist (cl nplist)
+ "Set plist's properties in CL."
+ (while nplist
+ (unless (eq (cadr nplist) (xwem-client-property cl (car nplist)))
+ (xwem-client-set-property cl (car nplist) (cadr nplist)))
+ (setq nplist (cdr (cdr nplist)))))
+
+;;;###xwem-autoload
+(defun xwem-cl-apply-new-xgeom (cl &optional correct-including-border
hold-size)
+ "Apply entries in `xwem-cl-new-xgeom' to CL's x geometry.
+When CORRECT-INCLUDING-BORDER is non-nil, then
+`xwem-cl-correct-size-for-size' will correct size reguarding new
+border
+(define-xwem-command xwem-client-run-copy (cl &optional arg)
"Run the same command as selected CL.
-With prefix arg run it in other window.
-With double prefix arg run in other window and select.
-With numeric prefix arg run ARG copies."
- (xwem-interactive "P")
+Prefix ARG specifies how many copies to run."
+ (xwem-interactive (list (xwem-cl-selected)
+ (prefix-numeric-value xwem-prefix-arg)))
- (let* ((cl (or cl (xwem-cl-selected)))
- (nw (and (xwem-cl-p cl) (xwem-cl-win cl))))
-
- (if (not (xwem-cl-p cl))
- (xwem-message 'warn "No client selected to copy.")
+ (unless (xwem-cl-alive-p cl)
+ (error 'xwem-error "Invalid client"))
- (let ((cmd (xwem-hints-wm-command (xwem-cl-hints cl)))
- (cnt (if (numberp arg) arg 1)) ;how many clients to start
- (i 0))
- (if (or (not (stringp cmd)) (string= cmd ""))
- (xwem-message 'warn "Invalid cmd: \"%s\"" cmd)
-
- (when (and (listp arg) (not (null arg)))
- (setq nw (xwem-win-next nw))
- (when (not (xwem-win-p nw))
- ;; Create window
- (xwem-frame-split-vert nil)
- (setq nw (xwem-win-next (xwem-win-selected))))
-
- (when (xwem-win-p nw)
- (when (= (prefix-numeric-value arg) 4)
- (xwem-win-expt-inc nw cmd cnt))
-
- (when (= (prefix-numeric-value arg) 16)
- (xwem-window-select-maybe-redraw nw))))
-
- (when (xwem-win-p nw)
- (while (< i cnt)
- (xwem-execute-program cmd)
- (setq i (1+ i))))
- )))))
+ (let* ((cmd (xwem-hints-wm-command (xwem-cl-hints cl)))
+ (mspec (xwem-cl-manage-spec cl))
+ (mtype (car mspec))
+ (mplist (copy-list (cadr mspec))))
+
+ ;; Check command for validity
+ (when (or (not (stringp cmd)) (string= cmd ""))
+ (error 'xwem-error "Invalid command: " cmd))
+
+ ;; XXX Adjust plist
+ (setq mplist (plist-put mplist 'expect-win (xwem-cl-win cl)))
+
+ (setq mspec (list mtype mplist (list 'command cmd)))
+ ;; Execute copies using expectances
+ (while (> arg 0)
+
+q (xwem-manda-add-expectance mspec)
+ (xwem-execute-program cmd)
+ (setq arg (1- arg)))))
;;;###autoload(autoload 'xwem-client-run-copy-other-win "xwem-clients" "" t)
(define-xwem-command xwem-client-run-copy-other-win (arg &optional cl)
@@ -1131,11 +1331,10 @@
(xwem-interactive "P")
(let ((cl (or cl (xwem-cl-selected)))
- (xwem-win-after-split-hook nil) ; prevent hooks
cmd own)
(when (or (not (xwem-cl-p cl))
(not (xwem-win-p (xwem-cl-win cl))))
- (error "Can't run copy of invalid client"))
+ (error 'xwem-error "Can't run copy of invalid client"))
(setq cmd (xwem-hints-wm-command (xwem-cl-hints cl)))
(setq own (xwem-window-other 1 (xwem-cl-win cl)))
@@ -1144,12 +1343,13 @@
;; Check is there split needed
(when (eq own (xwem-win-selected))
(if arg
- (xwem-frame-split-horiz 0)
- (xwem-frame-split-vert 0))
+ (xwem-window-split-horizontally 0)
+ (xwem-window-split-vertically 0))
(setq own (xwem-win-next (xwem-win-selected))))
- ;; Install expectance
- (xwem-win-expt-inc own cmd)
+ ;; Install expectance in hope it will be managed by generic
+ ;; manage type, or some other type that suppors expectances.
+ (xwem-manda-add-expectance `(nil (expect-win ,own) (command ,cmd)))
;; Finnaly run command
(xwem-execute-program cmd))
@@ -1167,56 +1367,68 @@
(when (or (not (xwem-cl-p cl))
(not (xwem-frame-p (xwem-cl-frame cl))))
- (error "Can't run copy of invalide client"))
+ (error 'xwem-error "Can't run copy of invalid client"))
(setq cmd (xwem-hints-wm-command (xwem-cl-hints cl)))
(setq ofr (xwem-frame-other (xwem-cl-frame cl)))
(when cmd
(unless (xwem-frame-p ofr)
- (setq ofr (xwem-make-frame-1 arg nil nil t)))
+ (setq ofr (xwem-make-frame-1 (or (and arg 'embedded) 'desktop)
+ :noselect t)))
;; Setup expectance
- (xwem-win-expt-inc (xwem-frame-selwin ofr) cmd)
-
- (
+ (setf (xwem-cl-state cl) 'unknown))
(setq xwem-clients (cdr xwem-clients))))
-;;;###autoload
-(defun xwem-client-hide (cl &optional new-state)
- "Hide CL's window. Optionally you may specify NEW-STATE."
- ;; Just move off the screen
- (XMoveWindow (xwem-dpy) (xwem-cl-xwin cl)
- (X-Geom-width (xwem-rootgeom))
- (X-Geom-height (xwem-rootgeom)))
-
- (XUnmapWindow (xwem-dpy) (xwem-cl-xwin cl))
- (xwem-client-change-state cl (or new-state 'iconified))
- )
-
-;;;###autoload
-(defun xwem-client-show (cl &optional new-state)
- "Show xwem client CL."
- ;; Make sure CL's frame is CL's parent
- (XReparentWindow (xwem-dpy) (xwem-cl-xwin cl)
- (xwem-frame-xwin (xwem-cl-frame cl))
- (X-Geom-width (xwem-rootgeom)) (X-Geom-height
(xwem-rootgeom)))
-
- (if (xwem-cl-transient-for cl)
- (XRaiseWindow (xwem-dpy) (xwem-cl-xwin cl))
-
- ;; Must be lowered
- (XLowerWindow (xwem-dpy) (xwem-cl-xwin cl)))
-
- (XMoveWindow (xwem-dpy) (xwem-cl-xwin cl)
- (X-Geom-x (xwem-cl-xgeom cl))
- (X-Geom-y (xwem-cl-xgeom cl)))
-
- (XMapWindow (xwem-dpy) (xwem-cl-xwin cl))
- (xwem-client-change-state cl (or new-state 'managed-current))
- )
-
;;; Events handling for client windows
(defun xwem-cl-hproperty (cl xev)
@@ -1452,150 +1646,670 @@
rhook)
;; Some CL's property changed
- (X-Dpy-log (xwem-dpy) "CLIENT .. PropertyNotify: Atom-id = %d\n" 'atom-id)
+ (xwem-debug 'xwem-cl "CLIENT .. PropertyNotify: Atom-id = %d" 'atom-id)
- (cond
- ((and (= atom-id (X-Atom-id XA-wm-normal-hints)) (= state
X-PropertyNewValue))
- (setf (xwem-hints-wm-normal-hints (xwem-cl-hints cl)) (XGetWMNormalHints
(xwem-dpy) xwin))
- (setq rhook 'xwem-cl-wmnh-change-hooks))
-
- ((and (= atom-id (X-Atom-id XA-wm-hints)) (= state X-PropertyNewValue))
- (setf (xwem-hints-wm-hints (xwem-cl-hints cl)) (XGetWMHints (xwem-dpy)
xwin))
- (setq rhook 'xwem-cl-wmh-change-hooks))
-
- ((and (= atom-id (X-Atom-id XA-wm-class)) (= state X-PropertyNewValue))
- (setf (xwem-hints-wm-class (xwem-cl-hints cl)) (XGetWMClass (xwem-dpy)
xwin))
- (setq rhook 'xwem-cl-wmclass-change-hooks))
-
- ((and (= atom-id (X-Atom-id XA-wm-command)) (= state X-PropertyNewValue))
- (setf (xwem-hints-wm-command (xwem-cl-hints cl)) (XGetWMCommand
(xwem-dpy) xwin))
- (setq rhook 'xwem-cl-wmcommand-chage-hooks))
-
- ((and (= atom-id (X-Atom-id XA-wm-name)) (= state X-PropertyNewValue))
- (setf (xwem-hints-wm-name (xwem-cl-hints cl)) (XGetWMName (xwem-dpy)
xwin))
- (unless (equal (xwem-hints-wm-name (xwem-cl-hints cl))
(xwem-cl-saved-name cl))
- (setf (xwem-cl-saved-name cl) (xwem-hints-wm-name (xwem-cl-hints cl)))
- (setq rhook 'xwem-cl-wmname-change-hooks)))
- )
+ (cond ((and (= atom-id (X-Atom-id XA-wm-normal-hints))
+ (= state X-PropertyNewValue))
+ ;; WM_NORMAL_HINTS changed
+ (setf (xwem-cl-wm-normal-hints cl)
+ (XGetWMNormalHints (xwem-dpy) xwin))
+ (setq rhook t))
+
+ ((and (= atom-id (X-Atom-id XA-wm-hints))
+ (= state X-PropertyNewValue))
+ ;; WM_HINTS changed
+ (setf (xwem-cl-wm-hints cl) (XGetWMHints (xwem-dpy) xwin))
+ (setq rhook t))
+
+ ((and (= atom-id (X-Atom-id XA-wm-class))
+ (= state X-PropertyNewValue))
+ ;; WM_CLASS changed
+ (multiple-value-bind (ci cn)
+ (values-list (XGetWMClass (xwem-dpy) xwin))
+ (setf (xwem-cl-wm-class cl) (cons ci cn)))
+ (setq rhook t))
+
+ ((and (= atom-id (X-Atom-id XA-wm-command))
+ (= state X-PropertyNewValue))
+ ;; WM_COMMAND changed
+ (setf (xwem-cl-wm-command cl) (XGetWMCommand (xwem-dpy) xwin))
+ (setq rhook t))
+
+ ((and (= atom-id (X-Atom-id XA-wm-name))
+ (= state X-PropertyNewValue))
+ ;; WM_NAME changed
+ (setf (xwem-cl-wm-name cl) (XG
+
+ `deactivate' - Client must be deactivate.
+
+ `deselect' - Client is deselecting.
+
+Default TYPE is `deactivate'."
+ (unless type
+ (setq type 'deactivate))
+
+ (cond ((eq type 'deselect)
+ (xwem-method-deactivate cl type))
+
+ ((eq (xwem-cl-state cl) 'active)
+ (xwem-client-change-state cl 'inactive)
+ (xwem-method-deactivate cl type)
+ (xwem-select-some-client))
+
+ ((not (eq (xwem-cl-state cl) 'inactive))
+ (xwem-method-deactivate cl type)
+ (xwem-select-some-client))))
+
+;;;###xwem-autoload
+(defun xwem-iconify (cl)
+ "Function to iconify client CL.
+ARGS - arguments."
+ (unless (eq (xwem-cl-state cl) 'iconified)
+ (xwem-client-change-state cl 'iconified)
+ (xwem-method-iconify cl))
+
+ (xwem-select-some-client))
+
+;;;###xwem-autoload
+(defun xwem-refit (cl)
+ "Function to refit client CL.
+ARGS - arguments."
+ ;; Reguard border width change
+ (when (and (xwem-cl-new-xgeom cl)
+ (xwem-manage-property (xwem-cl-manage-type cl)
'reguard-x-border-width)
+ (X-Geom-border-width (xwem-cl-new-xgeom cl)))
+ (setf (X-Geom-border-width (xwem-cl-xgeom cl))
+ (X-Geom-border-width (xwem-cl-new-xgeom cl))))
+
+ (xwem-method-refit cl)
+
+ ;; Apply (new) CL geometry to life
+ (xwem-cl-apply-xgeom cl)
+
+ ;; Finally run hooks
+ (run-hook-with-args 'xwem-cl-refit-hook cl))
+
+;;;###xwem-autoload
+(defun xwem-withdraw (cl)
+ "Withdraw client CL."
+ (xwem-client-change-state cl 'withdrawn)
+ (xwem-method-withdraw cl)
+
+ (xwem-select-some-client)
+ (run-hook-with-args 'xwem-cl-withdraw-hook cl))
+
+;;;; ---- Default manage methods ----
+
+(define-xwem-deffered xwem-default-apply-state (cl)
+ "Apply CL's state to life."
+ (cond ((eq (xwem-cl-state cl) 'active)
+ (XMapWindow (xwem-dpy) (xwem-cl-xwin cl)))
+ ((memq (xwem-cl-state cl) '(inactive iconified))
+ (XUnmapWindow (xwem-dpy) (xwem-cl-xwin cl)))))
+
+(define-xwem-method activate default (cl &optional type)
+ "Default method to activate client CL."
+ (cond ((eq type 'select)
+ (xwem-deffered-funcall 'XRaiseWindow (xwem-dpy) (xwem-cl-xwin cl)))
+ ((eq type 'activate)
+ (xwem-default-apply-state cl))))
+
+(define-xwem-method deactivate default (cl &optional type)
+ "Default method to deactivate client CL."
+ (cond ((eq type 'deactivate)
+ (xwem-default-apply-state cl))))
+
+(define-xwem-method iconify default (cl)
+ "Default method to iconify CL."
+ (xwem-default-apply-state cl))
+
+(define-xwem-method refit default (cl)
+ "Default method to refit CL."
+ (xwem-cl-apply-new-xgeom cl)
+ (xwem-cl-apply-xgeom cl))
+
+;; New method to select other client
+(defun xwem-method-other-client (cl)
+ "Return xwem client other then CL."
+ (xwem-execute-method 'other-client (xwem-cl-manage-type cl) cl))
+
+(define-xwem-method other-client default (cl)
+ "Default other-client method."
+ (xwem-cl-other cl nil t))
+
+
+;;; Dummy client, used, when selecting `nil' client.
+(defvar xwem-dummy-client nil
+ "Internal variable.")
+
+(define-xwem-client-property dummy-client-p nil
+ "Non-nil for dummy clients."
+ :type 'boolean)
+
+;;;###xwem-autoload
+(defun xwem-dummy-client-p (cl)
+ "Return non-nil if CL is dummy client."
+ (xwem-client-property cl 'dummy-client-p))
+
+;;;###xwem-autoload
+(defun xwem-non-dummy-client-p (cl)
+ "Opposit to `xwem-dummy-client-p'."
+ (not (xwem-dummy-client-p cl)))
+
+;;;###xwem-autoload
+(defun xwem-dummy-client ()
+ "Return dummy client."
+ (or xwem-dummy-client
+ (progn (xwem-dummy-client-init) xwem-dummy-client)))
+
+(defun xwem-dummy-client-init ()
+ "Create dummy client"
+ (unless xwem-dummy-client
+ (setq xwem-dummy-client
+ (xwem-make-client (XCreateWindow (xwem-dpy) nil 0 0 1 1 0 nil nil nil
+ (make-X-Attr :override-redirect t))
+ '(dummy-client-p t ignore-has-input-p t)))
+
+ (XSelectInput (xwem-dpy) (xwem-cl-xwin xwem-dummy-client)
+ (Xmask-or X
+
+;;;###xwem-autoload
+(defun xwem-client-local-variable-value (client variable)
+ "Return CLINEN's local VARIABLE value.
+Or global VARIABLE value if CLIENT does not have local value."
+ (let ((lval (assq variable (xwem-cl-local-variables client))))
+ (if lval
+ (cdr lval)
+ (get variable 'xwem-default-value))))
+
+(defun xwem-client-local-variables-import (cl)
+ "Set client local variables in CL."
+ (when (xwem-cl-p cl)
+ (setf (xwem-cl-local-variables cl)
+ (mapcar (lambda (var)
+ (cons var (symbol-value var)))
+ xwem-client-local-variables))))
+
+(defun xwem-client-local-variables-export (cl)
+ "Set variables using CL's client local variables."
+ (when (xwem-cl-p cl)
+ (mapc (lambda (var)
+ (let ((val (assq var (xwem-cl-local-variables cl))))
+ (if val
+ (set var (cdr val))
+ (set var (get var 'xwem-default-value)))))
+ xwem-client-local-variables)))
+
+;;; Clients configurations
+(defun xwem-client-configuration ()
+ "Return current clients configuration."
+ )
-(defun xwem-cl-parent-on-destroy (cl)
- "CL is about to be destroyed."
- (let ((pwin (xwem-cl-get-prop cl 'parent-xwin)))
- (when (X-Win-p pwin)
- (XDestroyWindow (xwem-dpy) pwin))))
+(defun xwem-set-client-configuration (config)
+ "Set client configuration to CONFIG."
+ )
(provide 'xwem-clients)
+
+;;;; On-load actions:
+;; Define dummy manage type
+(define-xwem-manage-model dummy
+ "Managing model for dummy clients.
+Dummy client is client which can't do anything."
+ :match-spec '(function (lambda (cl) (xwem-client-property cl
'dummy-client-p))))
+
+(if xwem-started
+ (xwem-clients-init)
+ (add-hook 'xwem-before-init-wins-hook 'xwem-clients-init))
;;; xwem-clients.el ends here
Index: lisp/xwem-clswi.el
===================================================================
RCS file:
/pack/xemacscvs/XEmacs/packages/xemacs-packages/xwem/lisp/xwem-clswi.el,v
retrieving revision 1.6
diff -u -u -r1.6 xwem-clswi.el
--- lisp/xwem-clswi.el 16 Dec 2004 08:08:04 -0000 1.6
+++ lisp/xwem-clswi.el 1 Jan 2005 04:41:10 -0000
@@ -1,10 +1,11 @@
-;;; xwem-clswi.el --- Client switching package.
+;;; xwem-clswi.el --- Simple clients switching.
;; Copyright (C) 2003 by Free Software Foundation, Inc.
;; Author: Zajcev Evgeny <zevlg@xxxxxxxxx>
+;; Steve Youngs <steve@xxxxxxxxxxxxx>
;; Keywords: xwem
-;; X-CVS: $Id: xwem-clswi.el,v 1.6 2004/12/16 08:08:04 youngs Exp $
+;; X-CVS: $Id: xwem-clswi.el,v 1.5 2004/12/05 22:37:33 lg Exp $
;; This file is NOT part of XEmacs.
@@ -27,106 +28,121 @@
;;; Commentary:
-;; To use this package add something like:
-;;
-;; (autoload 'xwem-clswi-enable "xwem-clswi" "Enable client switching." t)
-;; (add-hook 'xwem-load-hook 'xwem-clswi-enable)
-;;
-;; to your xwemrc.el. It will install new bindings `H-]' for
-;; switching to next client and `H-[' for switching to previous
-;; client.
+;; Included as default bindings, `H-[', `H-]', `H-{', `H-}'.
+
+;; If current client supports windowing, than next/prev client in its
+;; window is selected. If client does not support windowing (for
+;; example fullscreen client) next/prev client of same manage type is
+;; selected.
;;; Code:
+(require 'xwem-clients)
+
(defgroup xwem-clswi nil
"Group to customize clients switcher."
:prefix "xwem-clswi-"
:group 'xwem)
-(defcustom xwem-clswi-beep-on-error nil
+(defcustom xwem-clswi-beep-on-error t
"*Non-nil mean beep on any error."
:type 'boolean
:group 'xwem-clswi)
(defcustom xwem-clswi-show-info nil
- "*Non-nil mean show info about client in xwem minibuffer after switch."
- :type 'boolean
+ "*Non-nil mean show info about client in xwem minibuffer after switch.
+It also can be a function which accepts one argument - client and
+return non-nil to show info."
+ :type '(restricted-sexp :match-alternatives (functionp boolean-p))
:group 'xwem-clswi)
-(defvar xwem-clswi-enabled nil
- "Non-nil means that xwem-clswi is enabled.
-Do not ch
+ (xwem-interactive (list (xwem-cl-selected)
+ (prefix-numeric-value xwem-prefix-arg)))
- (xwem-message (if xwem-clswi-beep-on-error 'warn 'warn-nobeep)
- "No clients to switch."))))
+ (xwem-clswi-next cl (- arg)))
-(define-xwem-command xwem-clswi-prev (arg &optional win)
- "Switch to ARG previous client in WIN.
-If WIN is ommited then in selected window."
+;;;###autoload(autoload 'xwem-clswi-next-other-window "xwem-clswi" nil t)
+(define-xwem-command xwem-clswi-next-other-window (arg)
+ "Switch next ARG client in other window."
(xwem-interactive "p")
- (xwem-clswi-next (- arg) win))
+ (let ((win (xwem-window-other 1 (xwem-win-selected))))
+ (when (and (xwem-win-p win)
+ (not (eq win (xwem-win-selected))))
+ (xwem-clswi-next (xwem-win-cl win) arg))))
+
+;;;###autoload(autoload 'xwem-clswi-prev-other-window "xwem-clswi" nil t)
+(define-xwem-command xwem-clswi-prev-other-window (arg)
+ "Switch previous ARG client in other window."
+ (xwem-interactive "p")
+ (xwem-clswi-next-other-window (- arg)))
(provide 'xwem-clswi)
Index: lisp/xwem-compat.el
===================================================================
RCS file:
/pack/xemacscvs/XEmacs/packages/xemacs-packages/xwem/lisp/xwem-compat.el,v
retrieving revision 1.5
diff -u -u -r1.5 xwem-compat.el
--- lisp/xwem-compat.el 16 Dec 2004 08:08:04 -0000 1.5
+++ lisp/xwem-compat.el 1 Jan 2005 04:41:10 -0000
@@ -5,7 +5,7 @@
;; Author: Zajcev Evgeny <zevlg@xxxxxxxxx>
;; Created: Fri Dec 12 15:51:10 MSK 2003
;; Keywords: xwem, xlib
-;; X-CVS: $Id: xwem-compat.el,v 1.5 2004/12/16 08:08:04 youngs Exp $
+;; X-CVS: $Id: xwem-compat.el,v 1.4 2004/11/29 20:41:47 lg Exp $
;; This file is part of XWEM.
@@ -33,11 +33,10 @@
;;; Code:
-;;;###autoload
+
(defvar xwem-gnuemacs-p (string-match "GNU Emacs" emacs-version)
"Non-nil when running under GNU Emacs.")
-;;;###autoload
(defun xwem-define-prefix-command (name &optional mapvar)
"Compat version for `define-prefix-command'."
(if xwem-gnuemacs-p
Index: lisp/xwem-desktop.el
===================================================================
RCS file: lisp/xwem-desktop.el
diff -N lisp/xwem-desktop.el
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lisp/xwem-desktop.el 1 Jan 2005 04:41:10 -0000
@@ -0,0 +1,160 @@
+;;; xwem-desktop.el ---
+
+;; Copyright (C) 2004 by Free Software Foundation, Inc.
+
+;; Author: Zajcev Evgeny <zevlg@xxxxxxxxx>
+;; Steve Youngs <steve@xxxxxxxxxxxxx>
+;; Created: Wed Jul 14 10:16:20 MSD 2004
+;; Keywords: xwem, desktop
+;; X-CVS: $Id: xwem-desktop.el,v 1.4 2004/12/05 22:37:33 lg Exp $
+
+;; This file is part of XWEM.
+
+;; XWEM is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; XWEM is distributed in the hope that it will be useful, but WITHOUT
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+;; License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with XEmacs; see the file COPYING. If not, write to the Free
+;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+;; 02111-1307, USA.
+
+;;; Synched up with: Not in FSF
+
+;;; Commentary:
+
+;; To start using, add something like:
+
+;; (add-hook 'xwem-exit-hook 'xwem-desktop-save)
+;; (xwem-desktop-load)
+
+;; to your xwemrc.
+
+;;; TODO:
+
+;; * Save registers betwean sessions, maybe by using expectances.
+
+;;; Code:
+
+(require 'xwem-load)
+(require 'xwem-frame)
+
+;;; Customisation
+(defgroup xwem-desktop nil
+ "Group to customize xwem desktop."
+ :prefix "xwem-desktop-"
+ :group 'xwem)
+
+(defcustom xwem-desktop-goals
+ '(frames-config
+ (keymap . xwem-user-macros-prefix)
+ (xwem-launcher-history . 100)
+ (xwem-read-expression-history . 100))
+ "*List of variables to save.
+Each element is eather symbol or cons cell in form.
+\(symbol . maxsize\)."
+ :type '(repeat (choice (const :tag "Frames configuration" frames-config)
+ (cons :tag "Keymap goal"
+ (const :tag "Keymap" keymap)
+ (symbol :tag "Keymap prefix"))
+ (cons :tag "History"
+ (choice (const :tag "Launcher history"
xwem-launcher-history)
+ (const :tag "Expression history"
xwem-read-expression-history)
+ (symbol :tag "Custom history"))
+ (number :tag "Max Size"))))
+ :group 'xwem-desktop)
+
+;;; Internal variables
+
+(defun xwem-desktop-save-element (el &optional buffer)
+ "Save element EL.
+EL is one of that occurs in `xwem-desktop-goals'."
+ (unless buffer
+ (setq buffer (current-buffer)))
+ (cond ((eq el 'frames-config)
+ ;; Store frames configuration here
+ (xwem-frame-config-dump1 (xwem-frame-configuration) buffer t))
+
+ ((symbolp el)
+ (princ "\n;; Symbol value\n" buffer)
+ (princ (concat "(setq " (symbol-name el) " "
+ (if (listp (symbol-value el))
+ (concat "(quote " (prin1-to-string (symbol-value
el)) ")")
+ (prin1-to-string (symbol-value el)))
+ ")\n")
+ buffer))
+
+ ((and (consp el) (numberp (cdr el)))
+ (princ "\n;; List\n" buffer)
+ (let ((result nil)
+ (clist (symbol-value (car el)))
+ (limit (cdr el)))
+ (while (and clist (> limit 0))
+ (unless (member (car clist) result)
+ (setq result (cons (car clist) result))
+ (decf limit))
+ (setq clist (cdr clist)))
+ (setq result (nreverse result))
+ (princ (concat "(setq " (symbol-name (car el)) " "
+ "(quote " (prin1-to-string result) ")"
+ ")\n")
+ buffer)))
+
+ ((and (consp el) (eq (car el) 'keymap))
+ (let* ((kmap (xwem-kbd-fixup-keymap (cdr el)))
+ (kmap-name (keymap-name kmap)))
+ (princ (format "\n;; Keymap (%s)\n" kmap-name) buffer)
+ (map-keymap (lambda (kseq fbind)
+ (princ (concat "(define-key (quote " (prin1-to-string
kmap-name) ") "
+ "(quote " (prin1-to-string kseq) ") "
+ "(quote " (prin1-to-string fbind) ")"
+ ")\n")
+ buffer))
+ kmap)))
+
+ (t (xwem-message 'warning "Strange el: `%S', skiping .." el))))
+
+;;;###autoload(autoload 'xwem-desktop-save "xwem-desktop" nil t)
+(define-xwem-command xwem-desktop-save (&optional file)
+ "Save things described in `xwem-desktop-goals' into FILE.
+Defaultly FILE is ~/.xwem/xwem-desktop.el"
+ (xwem-interactive "FSave xwem desktop to: ")
+ (unless file
+ (setq file (expand-file-name "xwem-desktop.el" xwem-dir)))
+
+ (with-temp-buffer
+ (erase-buffer)
+ (insert
+ (format ";;; %s --- Desktop configuration for XWEM.\n"
+ (file-name-nondirectory file))
+ "\n;; NOTE: This file is automatically generated by xwem-desktop\n\n")
+
+ ;; Set print-XX to nil to make full printing of objects
+ (let ((print-length nil)
+ (print-level nil))
+ (mapc 'xwem-desktop-save-element xwem-desktop-goals))
+
+ (insert (format "\n;;; %s ends here\n" (file-name-nondirectory file)))
+ (write-region (point-min) (point-max) file)))
+
+;;;###autoload(autoload 'xwem-desktop-load "xwem-desktop" nil t)
+(define-xwem-command xwem-desktop-load (&optional file)
+ "Load saved desktop from FILE.
+Default FILE is ~/.xwem/xwem-desktop.el."
+ (xwem-interactive "FLoad xwem desktop from: ")
+
+ (unless file
+ (setq file (expand-file-name "xwem-desktop.el" xwem-dir)))
+
+ (load-file file))
+
+
+(provide 'xwem-desktop)
+
+;;; xwem-desktop.el ends here
Index: lisp/xwem-diagram.el
===================================================================
RCS file:
/pack/xemacscvs/XEmacs/packages/xemacs-packages/xwem/lisp/xwem-diagram.el,v
retrieving revision 1.4
diff -u -u -r1.4 xwem-diagram.el
--- lisp/xwem-diagram.el 16 Dec 2004 08:08:05 -0000 1.4
+++ lisp/xwem-diagram.el 1 Jan 2005 04:41:11 -0000
@@ -5,7 +5,7 @@
;; Author: Zajcev Evgeny <zevlg@xxxxxxxxx>
;; Created: Sat Mar 6 17:09:58 MSK 2004
;; Keywords: xwem
-;; X-CVS: $Id: xwem-diagram.el,v 1.4 2004/12/16 08:08:05 youngs Exp $
+;; X-CVS: $Id: xwem-diagram.el,v 1.3 2004/12/03 19:43:36 lg Exp $
;; This file is part of XWEM.
@@ -39,6 +39,11 @@
;;; Code:
+(require 'xlib-xlib)
+
+(require 'xwem-faces)
+
+
(defun xwem-diag-dot-distance (dot1 dot2)
"Return distance betwean DOT1 and DOT2."
(let ((w (abs (- (X-Point-x dot1) (X-Point-x dot2))))
@@ -351,7 +356,6 @@
(list d1 dd1 dd2 dd3 d3 d4 d1 d2 d3 d2 dd2))
))
-;;;###autoload
(defun xwem-diag-draw-percentage (type spec d edge-gc x y width height
&optional sector-width label-factor label-font)
"Draw percentage sector of TYPE.
TYPE is one of 'plain or '3d.
@@ -378,10 +382,10 @@
;; Validate spec
; (when (> (apply '+ (mapcar (lambda (el) (aref el 0)) spec)) 100)
-; (error "Invalid spec" spec))
+; (error "XWEM Invalid spec" spec))
(let ((draw-sector (lambda (sel angbeg angle)
- (xwem-face-set-foreground temp-fill-face (aref sel 2))
+ (xwem-set-face-foreground temp-fill-face (aref sel 2))
(let ((xint-off 0)
(yint-off 0))
@@ -411,7 +415,8 @@
(gc edge-gc)
(text (if (stringp (aref sel 1)) (aref sel
1) (format "%d%%" (aref sel 0)))))
(XDrawString xdpy d gc
- (- (X-Point-x (nth 2 cd)) (/
(X-Text-width xdpy (X-Gc-font gc) text) 2))
+ (- (X-Point-x (nth 2 cd))
+ (/ (X-Text-width xdpy
(X-Gc-font gc) text) 2))
(+ (/ (X-Text-height xdpy
(X-Gc-font gc) text) 2)
(X-Point-y (nth 2 cd)))
text)))
@@ -463,7 +468,6 @@
)))
-;;;###autoload
(defun xwem-diag-plot-coordinates (d gc x y w h x-step y-step &rest params)
"Draw coordinates system."
(let ((notch-len (or (plist-get params :notch-len) 4))
@@ -483,12 +487,18 @@
(setq noff (% center-x x-step))
(while (< noff w)
- (setq x-notches (cons (cons (cons (+ x noff) (- y center-y)) (cons (+ x
noff) (- y center-y notch-len))) x-notches))
+ (setq x-notches (cons (cons (cons (+ x noff)
+ (- y center-y))
+ (cons (+ x noff) (- y center-y notch-len)))
+ x-notches))
(setq noff (+ noff x-step)))
(setq noff (% center-y y-step))
(while (< noff h)
- (setq y-notches (cons (cons (cons (+ x center-x) (- y noff)) (cons (+ x
center-x notch-len) (- y noff))) y-notches))
+ (setq y-notches (cons (cons (cons (+ x center-x)
+ (- y noff))
+ (cons (+ x center-x notch-len) (- y noff)))
+ y-notches))
(setq noff (+ noff y-step)))
;; Set dashes
@@ -496,19 +506,21 @@
(setq sls (X-Gc-line-style gc))
(setf (X-Gc-line-style gc) X-LineOnOffDash)
(XChangeGC xdpy gc)
- (XSetDashes xdpy gc 0 (list grid-dash-even grid-dash-odd grid-dash-even
grid-dash-odd))
+ (XSetDashes xdpy gc 0 (list grid-dash-even grid-dash-odd
+ grid-dash-even grid-dash-odd))
(unwind-protect
(progn
- (XDrawSegments xdpy d gc (mapcar (lam
+ (apply 'nconc (mapcar* (lambda (d dn)
+ (if dn
+ (list d (cons (X-Point-x
d) (X-Point-y dn)))
+ (list d)))
+ dots (nconc (cdr dots) (list
nil))))))
((eq type 'histeps)
;; TODO: write me
@@ -625,7 +652,6 @@
))
))
-;;;###autoload
(defun xwem-diag-read-data-file (file &optional using x-scale y-scale)
"Read data FILE and return list of dots lists.
USING is cons cell that specifies which columns to use.
Index: lisp/xwem-edmacro.el
===================================================================
RCS file:
/pack/xemacscvs/XEmacs/packages/xemacs-packages/xwem/lisp/xwem-edmacro.el,v
retrieving revision 1.7
diff -u -u -r1.7 xwem-edmacro.el
--- lisp/xwem-edmacro.el 16 Dec 2004 08:08:05 -0000 1.7
+++ lisp/xwem-edmacro.el 1 Jan 2005 04:41:11 -0000
@@ -3,9 +3,10 @@
;; Copyright (C) 2003 by Free Software Foundation, Inc.
;; Author: Zajcev Evgeny <zevlg@xxxxxxxxx>
+;; Steve Youngs <steve@xxxxxxxxxxxxx>
;; Created: Fri Dec 12 11:19:50 MSK 2003
;; Keywords: xwem, xlib
-;; X-CVS: $Id: xwem-edmacro.el,v 1.7 2004/12/16 08:08:05 youngs Exp $
+;; X-CVS: $Id: xwem-edmacro.el,v 1.6 2004/12/05 22:37:33 lg Exp $
;; This file is part of XWEM.
@@ -37,11 +38,12 @@
;;; Code:
-
(eval-and-compile
- (require 'xwem-macros)
(require 'edmacro))
+(require 'xwem-load)
+
+;;; Customization
(defgroup xwem-edmacro nil
"Group to customize `xwem-edmacro' addon."
:prefix "xwem-edmacro-"
@@ -59,6 +61,8 @@
:type 'boolean
:group 'xwem-edmacro)
+;;; Internal variables
+
;; Variables
(defvar xwem-edmacro-prefix-arg nil
"Value of prefix argument.
@@ -81,8 +85,17 @@
;; redefine key in user macros map
(define-key xwem-global-map xwem-edmacro-store-place mac)))
- (setq xwem-edmacro-store-place nil)
- )
+ (setq xwem-edmacro-store-place nil))
+
+(defun xwem-edmacro-finish (frame)
+ "Called when edmacro finishes.
+FRAME is special emacs frame where macro editing occurs.
+Keep selected buffer to be selected even after FRAME deleted."
+ (let ((buf (current-buffer)))
+ (if (frame-live-p frame)
+ (delete-frame frame t)
+ (xwem-special-revert-focus nil))
+ (set-buffer buf)))
;;;###autoload(autoload 'xwem-edmacro-edit-kbd-macro "xwem-edmacro" "" t)
(define-xwem-command xwem-edmacro-edit-kbd-macro (xwem-keys &optional arg)
@@ -92,18 +105,18 @@
(list
(xwem-read-key-sequence
(substitute-command-keys
- (concat "Enter \\<xwem-global-map>\\[xwem-keymacro-play-last] "
- "or one of \\<xwem-global-map>\\[xwem-user-keymacros-prefix] XXX:
")))
+ (concat "Enter `\\<xwem-global-map>\\[xwem-keymacro-play-last]' "
+ "or one of `\\<xwem-global-map>\\[xwem-user-macros-prefix] XXX':
")))
(prefix-numeric-value xwem-prefix-arg)))
(xwem-kbd-stop-grabbing)
- (let ((xwem-cmd (xwem-kbd-key-binding xwem-keys))
- xwem-evs)
+ (let ((xwem-cmd (xwem-kbd-get-binding xwem-keys))
+ xwem-evs frame)
(setq xwem-evs (cond ((eq xwem-cmd 'xwem-keymacro-play-last)
(setq xwem-edmacro-store-place
'xwem-keymacro-last-kbd-macro)
- xwem-keymacro-last-kbd-macro)
+ (or xwem-keymacro-last-kbd-macro []))
((vectorp xwem-cmd)
(setq xwem-edmacro-store-place xwem-keys)
@@ -120,19 +133,19 @@
(t nil)))
(if (null xwem-evs)
- (cond ((and (null xwem-edmacro-can-edit-unbinded) (null xwem-cmd))
- (xwem-message 'warn (concat "Dissalowed to edit unbinded key "
- (key-description xwem-keys)
- " by
`xwem-edmacro-can-edit-unbinded'")))
- ((null xwem-edmacro-can-edit-nonmacro)
- (xwem-message 'warn (concat "Dissalowed to edit non-macro key "
- (key-description xwem-keys)
- " by
`xwem-edmacro-can-edit-nonmacro'.")))
- (t (xwem-message 'warn "Invalid keyboard macro given.")))
+ (cond ((and (not xwem-edmacro-can-edit-unbinded) (null xwem-cmd))
+ (xwem-message 'warning (concat "Dissalowed to edit unbinded key "
+ (key-description xwem-keys)
+ " by
`xwem-edmacro-can-edit-unbinded'")))
+ ((not xwem-edmacro-can-edit-nonmacro)
+ (xwem-message 'warning (concat "Dissalowed to edit non-macro key
"
+ (key-description xwem-keys)
+ " by
`xwem-edmacro-can-edit-nonmacro'.")))
+ (t (xwem-message 'warning "Invalid keyboard macro given.")))
;; XXX
(when xwem-edmacro-store-place
- (xwem-special-popup-frame (get-buffer-create "*Edit Macro*") t)
+ (setq frame (xwem-special-popup-frame (get-buffer-create "*Edit
Macro*") t))
;; Add some info in *Edit Macro* buffer
(let ((edmacro-format-hook
@@ -159,7 +172,10 @@
(mapvector (lambda (k) (if (and (listp k) (= (length k) 1))
(car k) k))
xwem-evs))
- (edit-kbd-macro xwem-evs arg 'xwem-special-revert-focus
'xwem-edmacro-store)))
+ ;; Start edmacro
+ (edit-kbd-macro xwem-evs arg
+ `(lambda () (xwem-edmacro-finish ,frame))
+ 'xwem-edmacro-store)))
)))
Index: lisp/xwem-edprops.el
===================================================================
RCS file: lisp/xwem-edprops.el
diff -N lisp/xwem-edprops.el
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lisp/xwem-edprops.el 1 Jan 2005 04:41:11 -0000
@@ -0,0 +1,154 @@
+;;; xwem-edprops.el --- Interactively edit xwem client's properties.
+
+;; Copyright (C) 2004 by Free Software Foundation, Inc.
+
+;; Author: Zajcev Evgeny <zevlg@xxxxxxxxx>
+;; Created: Wed Oct 27 11:15:39 MSD 2004
+;; Keywords: xwem, edit
+;; X-CVS: $Id: xwem-edprops.el,v 1.1 2004/11/29 20:41:30 lg Exp $
+
+;; This file is part of XWEM.
+
+;; XWEM is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; XWEM is distributed in the hope that it will be useful, but WITHOUT
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+;; License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with XEmacs; see the file COPYING. If not, write to the Free
+;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+;; 02111-1307, USA.
+
+;;; Synched up with: Not in FSF
+
+;;; Commentary:
+
+;; Mode to edit xwem client's properties.
+
+;;; Code:
+(require 'xwem-load)
+
+
+;; Various stuff
+(defvar xwem-edprops-mode-hook nil
+ "*Hooks to call when entering xwem edprops mode.")
+
+(defvar xwem-edprops-client nil)
+(make-variable-buffer-local 'xwem-client-edprops-client)
+
+(defvar xwem-edprops-mode nil
+ "Non-nil mean xwem edprops mode is enabled.")
+(make-variable-buffer-local 'xwem-edprops-mode)
+(set-default 'xwem-edprops-mode nil)
+
+(defvar xwem-edprops-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map "\C-c\C-c" 'xwem-edprops-finish)
+ (define-key map "\C-c\C-q" 'xwem-edprops-quit)
+ map)
+ "Keymap when editing client properties.")
+
+(or (assq 'xwem-edprops-mode minor-mode-alist)
+ (setq minor-mode-alist
+ (cons (list 'xwem-edprops-mode
+ " XWEM-edprops")
+ minor-mode-alist)))
+
+(or (assq 'xwem-edprops-mode minor-mode-map-alist)
+ (setq minor-mode-map-alist
+ (cons (cons 'xwem-edprops-mode
+ xwem-edprops-map)
+ minor-mode-map-alist)))
+
+
+(defun xwem-edprops-quit (cl)
+ "Quit editing properties for CL discarding changes."
+ (interactive (list xwem-edprops-client))
+
+ (set-buffer-modified-p nil)
+ (kill-buffer (current-buffer)))
+
+(defun xwem-edprops-finish (cl)
+ "Finish editing properties for CL, saving changes."
+ (interactive (list xwem-edprops-client))
+
+ (set-buffer-modified-p nil)
+ (let ((nplist (read (buffer-string)))
+ (oplist (xwem-cl-plist cl)))
+ (kill-buffer (current-buffer))
+
+ ;; Remove all supported properties that not in NPLIST
+ (while oplist
+ (when (and (xwem-property-supported-p (car oplist))
+ (not (plist-get nplist (car oplist))))
+ (xwem-message 'info "Removing property %S ..\n" (car oplist))
+ (xwem-client-set-property cl (car oplist) nil))
+ (setq oplist (cddr oplist)))
+
+ (xwem-cl-apply-plist cl nplist)))
+
+(defun xwem-edprops-mode ()
+ "Enable xwem-edprops mode in current buffer."
+ (setq xwem-edprops-mode t)
+
+ (run-hooks 'xwem-edprops-mode-hook))
+
+;;;###autoload(autoload 'xwem-edit-client-properties "xwem-edprops"
"Interactively edit client's properties." t)
+(define-xwem-command xwem-edit-client-properties (cl)
+ "Interactive edit CL's properties."
+ (xwem-interactive (list (xwem-cl-selected)))
+
+ (when (eq cl (xwem-dummy-client))
+ (error "XWEM Can't edit properties for dummy client"))
+
+ (with-current-buffer (get-buffer-create " *CL-PROPS*")
+ (kill-all-local-variables)
+ (setq xwem-edprops-client cl)
+
+ (emacs-lisp-mode)
+ (setq xwem-edprops-mode t) ; enable edprops mode
+
+ (erase-buffer)
+ (insert ";; Bindings:\n")
+ (insert ";; ") (where-is 'xwem-edprops-finish t) (insert "\n")
+ (insert ";; ") (where-is 'xwem-edprops-quit t) (insert "\n")
+
+ (insert
+ "\n"
+ ";; XWEM Client\n\n"
+ (format ";; Manage mode: %s\n" (upcase (symbol-name
(xwem-cl-manage-type cl))))
+ (format ";; Name: %s\n" (xwem-client-name cl))
+ (format ";; Class: %S\n" (xwem-hints-wm-class (xwem-cl-hints cl)))
+ (format ";; Command: %S\n" (xwem-hints-wm-command (xwem-cl-hints cl)))
+ "(\n\n")
+ (save-excursion
+ (mapc (lambda (kv)
+ (when (or (numberp (cdr kv))
+ (symbolp (cdr kv))
+ (stringp (cdr kv)))
+ (insert (format "%S %S\n" (car kv) (cdr kv)))))
+ (plist-to-alist (xwem-cl-plist cl)))
+
+ (insert "\n\n;;; Supported properties:\n")
+ (let ((print-level 4)) ; Restrict huge output
+ (mapc (lambda (sp)
+ (unless (memq (car sp) (xwem-cl-plist cl))
+ (insert (format "; %S %S\n" (car sp) (xwem-client-property
cl (car sp))))))
+ xwem-supported-client-properties))
+ (insert "\n)"))
+
+ ;; Enter editing properties mode
+ (xwem-edprops-mode)
+
+ (xwem-special-popup-frame (current-buffer))
+ ))
+
+
+(provide 'xwem-edprops)
+
+;;; xwem-edprops.el ends here
Index: lisp/xwem-events.el
===================================================================
RCS file:
/pack/xemacscvs/XEmacs/packages/xemacs-packages/xwem/lisp/xwem-events.el,v
retrieving revision 1.9
diff -u -u -r1.9 xwem-events.el
--- lisp/xwem-events.el 16 Dec 2004 08:08:05 -0000 1.9
+++ lisp/xwem-events.el 1 Jan 2005 04:41:11 -0000
@@ -3,9 +3,10 @@
;; Copyright (C) 2003 by Free Software Foundation, Inc.
;; Author: Zajcev Evgeny <zevlg@xxxxxxxxx>
+;; Steve Youngs <steve@xxxxxxxxxxxxx>
;; Created: 21 Mar 2003
;; Keywords: xlib, xwem
-;; X-CVS: $Id: xwem-events.el,v 1.9 2004/12/16 08:08:05 youngs Exp $
+;; X-CVS: $Id: xwem-events.el,v 1.6 2004/12/05 22:37:33 lg Exp $
;; This file is part of XWEM.
@@ -33,199 +34,239 @@
;;
;;; Code
-(eval-when-compile
- (require 'xlib-xwin))
-
-(defun xwem-ev-defhnd (xdpy win xev)
- "Default X-Events handler."
-
- (X-Event-CASE xev
-; (:X-ClientMessage (xwem-ev-clnmsg xdpy win xev))
-; (:X-PropertyNotify (xwem-ev-property xdpy win xev))
- (:X-ConfigureRequest (xwem-ev-reconfig xdpy win xev))
- (:X-MapRequest (xwem-ev-remap xdpy win xev))
- (:X-DestroyNotify (xwem-ev-destroy xdpy win xev))
- (:X-ResizeRequest (xwem-ev-reresize xdpy win xev)))
- )
+(require 'xwem-load)
+;;;###xwem-autoload
(defun xwem-ev-reconfig (xdpy win xev)
"Common ConfigureRequest handler."
(let* ((win (X-Event-xconfigurerequest-wind
+ ;; Remember some information about command invocation
+ (setq xwem-last-xevent x-ev
+ xwem-event-client (xwem-event-client x-ev)
+ xwem-last-event e-ev
+ xwem-this-command-keys (vconcat (and (not
(xwem-kbd-global-map-current-p))
+ xwem-this-command-keys)
+ (vector e-ev))))
+
+
+;;;###xwem-autoload
+(defun xwem-next-command-event (&optional prompt)
+ "Return next command event.
+Actually return cons cell where car is Emacs event and cdr is X Event."
+ (let (eev cev xev)
+ ;; Normal
+ (when prompt
+ (xwem-message 'prompt prompt))
+
+ ;; Process while interesting event occur
+ (while (and (setq eev (next-event))
+ (not (cond ((and (eval-event-p eev)
+ (X-Event-p (setq xev (event-object eev)))
+ (memq (X-Event-type xev)
+ (list X-KeyPress X-ButtonPress
+ X-ButtonRelease X-MotionNotify))
+ (setq cev (car (xwem-xevents->emacs-events
(list xev) t))))
+ (X-Event-put-property xev 'emacs-event cev)
+ 'break)
+
+ ((and (eval-event-p eev)
+ (eventp (setq cev (event-object eev)))
+ (eq (event-function eev)
'xwem-dispatch-command-event))
+ ;; Unread command event
+ (setq xev nil)
+ 'break))))
+ (dispatch-event eev))
+
+ (when prompt
+ (xwem-clear-message))
+
+ (xwem-event-as-command cev xev)
+ (cons cev xev)))
+
+;;;###xwem-autoload
+(defun xwem-dispatch-command-event (eev &optional xev)
+ "Dispatch command Emacs event EEV."
+ (let* ((ecl (xwem-event-client xev))
+ (bind (or (xwem-lookup-key ecl (vector eev))
+ ;; Then check for quit key
+ (and (equal xwem-quit-key (events-to-keys (vector eev)))
+ xwem-quit-command)
+ ;; Then accept even default bindings
+ (xwem-lookup-key ecl (vector eev) t))))
+ ;; If some button press/release does not have binding - ignore it
+ (unless (and (null bind) (button-event-p eev))
+ (xwem-event-as-command eev xev)
+ (xwem-kbd-dispatch-binding bind))))
+
+;;;###xwem-autoload
+(defun xwem-dispatch-command-xevent (xev)
+ "Dispatch command event XEV."
+ ;; If we are grabbing keyboard now and modifier pressed do nothing.
+ (unless (or (= (X-Event-type xev) X-KeyRelease)
+ (and (= (X-Event-type xev) X-KeyPress)
+ (xwem-kbd-kcode-modifier-p (X-Event-xkey-keycode xev))))
+ (setf (xwem-xevent-emacs-event xev)
+ (car (xwem-xevents->emacs-events (list xev) t)))
+ (xwem-dispatch-command-event
+ (xwem-xevent-emacs-event xev) xev)))
+
+;;; Unread command events support
+;;;###xwem-autoload
+(defun xwem-unread-command-event (eev-or-xev)
+ "Make event EV to be readed by `xwem-next-command-event' later,
+or to be executed by `xwem-dispatch-command-event'.
+Event EV can be either Emacs event, or X-Event."
+ (enqueue-eval-event (if (X-Event-p eev-or-xev)
+ 'xwem-dispatch-command-xevent
+ 'xwem-dispatch-command-event)
+ eev-or-xev))
+
+
(provide 'xwem-events)
;;; xwem-events.el ends here
Index: lisp/xwem-faces.el
===================================================================
RCS file:
/pack/xemacscvs/XEmacs/packages/xemacs-packages/xwem/lisp/xwem-faces.el,v
retrieving revision 1.10
diff -u -u -r1.10 xwem-faces.el
--- lisp/xwem-faces.el 16 Dec 2004 08:08:05 -0000 1.10
+++ lisp/xwem-faces.el 1 Jan 2005 04:41:11 -0000
@@ -3,9 +3,10 @@
;; Copyright (C) 2003 by Free Software Foundation, Inc.
;; Author: Zajcev Evgeny <zevlg@xxxxxxxxx>
+;; Steve Youngs <steve@xxxxxxxxxxxxx>
;; Created: Mon Dec 29 12:04:19 MSK 2003
;; Keywords: xwem
-;; X-CVS: $Id: xwem-faces.el,v 1.10 2004/12/16 08:08:05
+ (setq spec (specifier-spec-list spec nil tag-set t))
+ (cdr (car (cdr (car spec)))))))
+
+;; Getters
+(defsubst xwem-face-foreground (face &optional tag-set domain)
+ "Return FACE foreground color in TAG-SET."
+ (or (xwem-face-generic-specifier face 'foreground tag-set domain)
+ (xwem-face-generic-specifier face 'foreground)
+ (face-foreground-name face)))
+(defsubst xwem-face-background (face &optional tag-set domain)
+ "Return FACE background color in TAG-SET."
+ (or (xwem-face-generic-specifier face 'background tag-set domain)
+ (xwem-face-generic-specifier face 'background)
+ (face-background-name face)))
+(defsubst xwem-face-font (face &optional tag-set domain)
+ "Return FACE font in TAG-SET."
+ (or (xwem-face-generic-specifier face 'font tag-set domain)
+ (xwem-face-generic-specifier face 'font)
+ (face-font-name face)))
+(defsubst xwem-face-line-style (face &optional tag-set domain)
+ "Return FACE's line style in TAG-SET."
+ (or (xwem-face-generic-specifier face 'line-style tag-set domain)
+ (xwem-face-generic-specifier face 'line-style)))
+(defsubst xwem-face-line-width (face &optional tag-set domain)
+ "Return FACE's line width TAG-SET."
+ (or (xwem-face-generic-specifier face 'line-width tag-set domain)
+ (xwem-face-generic-specifier face 'line-width)))
+(defsubst xwem-face-cap-style (face &optional tag-set domain)
+ "Return FACE's cap style in TAG-SET."
+ (or (xwem-face-generic-specifier face 'cap-style tag-set domain)
+ (xwem-face-generic-specifier face 'cap-style)))
+(defsubst xwem-face-join-style (face &optional tag-set domain)
+ "Return FACE's join style in TAG-SET."
+ (or (xwem-face-generic-specifier face 'join-style tag-set domain)
+ (xwem-face-generic-specifier face 'join-style)))
+(defsubst xwem-face-function (face &optional tag-set domain)
+ "Return FACE's function in TAG-SET."
+ (or (xwem-face-generic-specifier face 'function tag-set domain)
+ (xwem-face-generic-specifier face 'function)))
+(defsubst xwem-face-subwindow-mode (face &optional tag-set domain)
+ "Return FACE's cap style in TAG-SET."
+ (or (xwem-face-generic-specifier face 'subwindow-mode tag-set domain)
+ (xwem-face-generic-specifier face 'subwindow-mode)))
+(defsubst xwem-face-graphics-exposures (face &optional tag-set domain)
+ "Return FACE's graphics exposures in TAG-SET."
+ (or (xwem-face-generic-specifier face 'graphics-exposures tag-set domain)
+ (xwem-face-generic-specifier face 'graphics-exposures)
+ X-False))
+
+(defsubst xwem-face-x-gc (face &optional tag-set domain)
+ "Return FACE's X-Gc in TAG-SET."
+ (or (face-property face (xwem-face-generic-specifier face 'x-gc tag-set
domain))
+ (face-property face 'xwem-x-gc)))
+
+;; Setters
+(defun xwem-face-set-domain-face (face &optional domain)
+ (cond ((null domain) (xwem-face-get-domain-face face))
+ ((xwem-cl-p domain)
+ (or (cdr (assq face (xwem-cl-get-sys-prop domain 'domain-faces)))
+ (let ((nface (intern (symbol-name (gensym
"xwem-cl-domain-face")))))
+ (xwem-cl-put-sys-prop domain 'domain-faces
+ (cons (cons face (xwem-copy-face face nface))
+ (xwem-cl-get-sys-prop domain 'domain-faces)))
+ nface)))
+ ((xwem-win-p domain)
+ (or (cdr (assq face (xwem-win-get-prop domain 'domain-faces)))
+ (let ((nface (intern (symbol-name (gensym
"xwem-win-domain-face")))))
+ (xwem-win-put-prop domain 'domain-faces
+ (cons (cons face (xwem-copy-face face nface))
+ (xwem-win-get-prop domain 'domain-faces)))
+ nface)))
+ ((xwem-frame-p domain)
+ (or (cdr (assq face (xwem-frame-get-prop domain 'domain-faces)))
+ (let ((nface (intern (symbol-name (gensym
"xwem-frame-domain-face")))))
+ (xwem-frame-put-prop domain 'domain-faces
+ (cons (cons face (xwem-copy-face face nface))
+ (xwem-frame-get-prop domain 'domain-faces)))
+
+ (XDefaultRootWindow xdpy))
+ (make-X-Gc :dpy xdpy :id (X-Dpy-get-id xdpy)
+ :line-style (xwem-face-line-style face tag-set
'nodomain)
+ :line-width (xwem-face-line-width face tag-set
'nodomain)
+ :cap-style (xwem-face-cap-style face tag-set
'nodomain)
+ :join-style (xwem-face-join-style face tag-set
'nodomain)
+ :function (xwem-face-function face tag-set
'nodomain)
+ :subwindow-mode (xwem-face-subwindow-mode face
tag-set 'nodomain)
+ :graphics-exposures (xwem-face-graphics-exposures
face tag-set 'nodomain)
+ :foreground (let ((fc (xwem-face-foreground face
tag-set 'nodomain)))
+ (if (stringp fc)
+ (XAllocColor xdpy cmap
(xwem-make-color fc))
+ fc))
+ :background (let ((bc (xwem-face-background face
tag-set 'nodomain)))
+ (if (stringp bc)
+ (XAllocColor xdpy cmap
(xwem-make-color bc))
+ bc))
+ :font (X-Font-get xdpy (xwem-face-font face
tag-set 'nodomain))))))
+ (xwem-set-face-x-gc face gc tag-set 'nodomain)
+ gc)))
- (let ((xdpy (xwem-dpy))
- (gc (xwem-face-get-gc face))
- (fgcol (xwem-misc-colorspec->rgb-vector-safe (face-foreground-name
face) [0 0 0])))
- (setf (X-Gc-foreground gc) (XAllocColor xdpy (XDefaultColormap xdpy)
- (make-X-Color :red (aref fgcol 0)
- :green (aref fgcol 1)
- :blue (aref fgcol
2))))
- (XChangeGC xdpy gc)))
+(put 'xwem-face-get-gc 'lisp-indent-function 1)
(provide 'xwem-faces)
Index: lisp/xwem-focus.el
===================================================================
RCS file:
/pack/xemacscvs/XEmacs/packages/xemacs-packages/xwem/lisp/xwem-focus.el,v
retrieving revision 1.8
diff -u -u -r1.8 xwem-focus.el
--- lisp/xwem-focus.el 16 Dec 2004 08:08:06 -0000 1.8
+++ lisp/xwem-focus.el 1 Jan 2005 04:41:11 -0000
@@ -3,9 +3,10 @@
;; Copyright (C) 2003 by Free Software Foundation, Inc.
;; Author: Zajcev Evgeny <zevlg@xxxxxxxxx>
+;; Steve Youngs <steve@xxxxxxxxxxxxx>
;; Created: Fri Dec 19 13:25:30 MSK 2003
;; Keywords: xwem, xlib
-;; X-CVS: $Id: xwem-focus.el,v 1.8 2004/12/16 08:08:06 youngs Exp $
+;; X-CVS: $Id: xwem-focus.el,v 1.7 2004/12/05 22:37:33 lg Exp $
;; This file is part of XWEM.
@@ -32,174 +33,246 @@
;;; Code:
-(eval-when-compile
- (require 'xlib-xwin)
- (require 'xwem-clients))
+(require 'xwem-load)
;;;###autoload
+(defcustom xwem-default-focus-mode 'generic
+ "*Default CL's focus mode."
+ :type '(choice (const :tag "Generic mode" generic)
+ (const :tag "Click to focus" click-focus)
+ (const :tag "Follow mouse" follow-mouse))
+ :group 'xwem)
+
+;;; Internal variables
+
(defvar xwem-focus-stack nil
"Last thing that has focus.
Internal variable, do not modify.")
-;;;###autoload
+;;;###xwem-autoload
(defun xwem-focus-xcurrent ()
"Return current focus."
(let ((cf (XGetInputFocus (xwem-dpy))))
cf))
-;;;###autoload
(defun xwem-focus-push (&optional xwin)
"Push current focus or XWIN to `xwem-focus-stack'."
(push (or xwin (xwem-focus-xcurrent)) xwem-focus-stack))
-;;;###autoload
+;;;###xwem-autoload
(defun xwem-focus-pop ()
"Pop value from `xwem-focus-stack'."
(pop xwem-focus-stack))
-;;;###autoload
(defun xwem-focus-push-set (xwin)
"Push current focus to `xwem-focus-stack' and set focus to XWIN."
(xwem-focus-push)
(XSetInputFocus (xwem-dpy) xwin X-RevertToParent))
-;;;###autoload
(defun xwem-focus-pop-set ()
"Pop from `xwem-focus-stack' and s
+(define-xwem-client-property xwem-focus-mode nil
+ "Client focus model."
+ :type '(eval (list 'choice xwem-focus-mode-names))
+ :set 'xwem-focus-set-focus-mode)
+
+(defun xwem-focus-set-focus-mode (cl prop mode)
+ "Set CL focus mode property PROP to MODE."
+ (xwem-focus-mode-invoke cl 'before-mode-change)
+ (xwem-cl-put-prop cl prop (or mode xwem-default-focus-mode))
+ (xwem-focus-mode-invoke cl 'after-mode-change))
-(defun xwem-focus-mode-define (name fun)
+(defmacro define-xwem-focus-mode (name args &optional docstring &rest body)
"Define new focus mode named by NAME.
FUN specifies function to call when focus changes."
- (add-to-list 'xwem-focus-modes (cons name fun))
- (put name 'xwem-focus-mode fun))
+ (let ((fun (or (and (functionp args) `(function ,args))
+ `(lambda ,args
+ ,docstring
+ ,@body))))
+ `(progn
+ (put (quote ,name) 'xwem-focus-mode ,fun)
+ (add-to-list 'xwem-focus-mode-names
+ (cons (list 'const :tag ,docstring (quote ,name)) (quote
,fun))))))
+(put 'define-xwem-focus-mode 'lisp-indent-function 'defun)
-;;;###autoload
+;;;###xwem-autoload
(defun xwem-focus-mode-invoke (cl &rest args)
- "Invoke CL's focus mode function with ARGS."
+ "Invoke CL's focus mode function with ARGS.
+Invoke focus mode, car of ARGS normally type of invocation.
+Built-in invocation types are:
+
+ 'before-mode-change - Called before focus mode changed.
+ 'after-mode-change - Called after focus mode has been changed.
+ 'focus-in - When CL receives focus.
+ 'focus-out - When CL looses focus.
+ 'enter - When CL enters.
+ 'leave - When CL leaves.
+ 'before-keymap-change - Before CL's local map changed.
+ 'after-keymap-change - After CL's local map changed.
+"
(when (xwem-cl-p cl)
- (let* ((mode (xwem-cl-get-prop cl 'xwem-focus-mode))
+ (let* ((mode (xwem-client-property cl 'xwem-focus-mode))
(fun (get mode 'xwem-focus-mode)))
(when fun
(apply fun cl args)))))
-;;;###autoload
-(defun xwem-focus-mode-set (cl mode)
- "For CL window set focus mode to MODE."
- (unless (eq (xwem-cl-get-prop cl 'xwem-focus-mode) mode)
- (xwem-focus-mode-invoke cl 'before-mode-change)
- (xwem-cl-put-prop cl 'xwem-focus-mode mode)
- (xwem-focus-mode-invoke cl 'after-mode-change)))
+;;;###xwem-autoload
+(defun xwem-focus-mode-set (cl &optional mode)
+ "For CL window set focus mode to MODE.
+If MODE is ommited, `xwem-default-focus-mode' is used."
+ (xwem-focus-set-focus-mode cl 'xwem-focus-mode mode))
;; Some built-in focus modes
-(xwem-focus-mode-define 'generic
- (lambda (cl action &optional xev)
- nil))
-
-(xwem-focus-mode-define 'follow-mouse
- (lambda (cl action &optional xev)
- (cond ((and (eq action 'enter)
- (eq (X-Event-xcrossing-mode xev) X-NotifyNormal))
- (xwem-cl-pop-to-client cl))
- )))
+(define-xwem-focus-mode generic ignore "Generic mode")
+(define-xwem-focus-mode follow-mouse (cl action &optional xev)
+ "Focus follow mouse"
+ (cond ((and (eq action 'enter)
+ (eq (X-Event-xcrossing-mode xev) X-NotifyNormal))
+ (xwem-select-client cl))
+ ))
+
+;;; Click to focus model
+(defvar xwem-focus-click-to-focus-map
+ (let ((map (make-sparse-k |