John Paul Wallington <jpw(a)gnu.org> writes:
How about the following builtin which does the same as Emacs'
`w32-send-sys-command' ?
Hi John, your patch applied and built fine today (I promised to test
this out).
I even made an attempt to add some basic test coverage.
When running attached file via the XEmacs test harness, it crashes
temacs as follows when sending maximize #xf030 (the first test
executed).
I didn't expect it to work, but it should not crash so badly either.
Can you please take a look?
The file needs to go into
$(SRCROOT)\tests\automated\mswindows-send-sys-command-test.el
See $(SRCROOT)\nt\xemacs.mak.
Then run
cd $(SRCROOT)\nt\
nmake /f xemacs.mak check-temacs
BTW,
nmake /f xemacs.mak check
fails in the same way.
Running the test defun from a running xemacs basically works.
I haven't yet invested any work into comparing frame-configurations.
I have no idea how one would programmatically determine pass or fail
of commands
menubar #xf100
screen-saver #xf140
start-menu #xf130
althoug I saw them work fine on my PC.
Any ideas?
Best regards,
Adrian
Testing
c:\Hacking\cvs.xemacs.org\XEmacs\xemacs-21.5-clean\tests\automated\mswindows-send-sys-command-test.el...
Fatal error: assertion failed, file
c:\Hacking\cvs.xemacs.org\XEmacs\xemacs-21.5-clean\src\frame-impl.h, line 223, EQ
(FRAME_TYPE (f), sym)
Fatal error.
Your files have been auto-saved.
Use `M-x recover-session' to recover them.
Your version of XEmacs was distributed with a PROBLEMS file that may describe
your crash, and with luck a workaround. Please check it first, but do report
the crash anyway.
Please report this bug by invoking M-x report-emacs-bug, or by selecting
`Send Bug Report' from the Help menu. If that won't work, send ordinary
email to `crashes(a)xemacs.org'. *MAKE SURE* to include this entire output
from this crash, especially including the Lisp backtrace, as well as the
XEmacs configuration from M-x describe-installation (or equivalently, the
file `Installation' in the top of the build tree).
If you are fortunate enough to have some sort of debugging aid installed
on your system, for example Visual C++, and you can get a C stack backtrace,
*please* include it, as it will make our life far easier.
Lisp backtrace follows:
# (unwind-protect ...)
# (unwind-protect ...)
# (unwind-protect ...)
# (unwind-protect ...)
# (unwind-protect ...)
# (unwind-protect ...)
# (unwind-protect ...)
mswindows-send-sys-command(61488)
# bind (start-menu-frame-config screen-saver-frame-config menubar-frame-config
restore2-frame-config restore1-frame-config minimize-frame-config maximize-frame-config
original-frame-config)
(let (original-frame-config maximize-frame-config minimize-frame-config
restore1-frame-config restore2-frame-config menubar-frame-config screen-saver-frame-config
start-menu-frame-config) (setq original-frame-config (current-frame-configuration))
(mswindows-send-sys-command (plist-get mswindows-send-sys-command-command-plist (quote
maximize))) (sit-for 3) (setq maximize-frame-config (current-frame-configuration))
(mswindows-send-sys-command (plist-get mswindows-send-sys-command-command-plist (quote
restore))) (sit-for 3) (setq restore1-frame-config (current-frame-configuration))
(mswindows-send-sys-command (plist-get mswindows-send-sys-command-command-plist (quote
minimize))) (sit-for 3) (setq minimize-frame-config (current-frame-configuration))
(mswindows-send-sys-command (plist-get mswindows-send-sys-command-command-plist (quote
restore))) (sit-for 3) (setq restore2-frame-config (current-frame-configuration)) (mapc
(lambda (var) (message "%s is %s" (symbol-name var) (symbol-value var))) (quote
(original-frame-config maximize-frame-config minimize-frame-config restore1-frame-config
restore2-frame-config menubar-frame-config screen-saver-frame-config
start-menu-frame-config))))
mswindows-send-sys-command-test()
2005-05-02 John Paul Wallington <jpw(a)pobox.com>
* frame-msw.c (Fmswindows_send_sys_command): New builtin.
(syms_of_frame_mswindows): Defsubr it.
diff -c c:\build\xemacs-21.5\src\frame-msw.c~ c:\build\xemacs-21.5\src\frame-msw.c
*** c:\build\xemacs-21.5\src\frame-msw.c~ 2005-05-02 13:57:06.046875000 +0100
--- c:\build\xemacs-21.5\src\frame-msw.c 2005-05-02 13:57:06.078125000 +0100
***************
*** 792,797 ****
--- 792,821 ----
return IsZoomed (FRAME_MSWINDOWS_HANDLE (f));
}
+ DEFUN ("mswindows-send-sys-command", Fmswindows_send_sys_command, 1, 2, 0,
/*
+ Send FRAME a Windows WM_SYSCOMMAND message of type COMMAND.
+ Some useful values for COMMAND are #xf030 to maximize frame and #xf020
+ to minimize it, #xf120 to restore frame to original size, and #xf100
+ to activate the menubar for keyboard access. #xf140 activates the
+ screen saver if defined. #xf130 activates the Start Menu.
+
+ If FRAME is not specified, the selected frame will be used.
+ */
+ (command, frame))
+ {
+ if (NILP (frame))
+ frame = Fselected_frame (Qnil);
+ CHECK_LIVE_FRAME (frame);
+ CHECK_INT (command);
+
+ qxePostMessage (FRAME_MSWINDOWS_HANDLE (XFRAME (frame)), WM_SYSCOMMAND,
+ XINT (command), 0);
+
+ return Qnil;
+ }
+
+
+
/*---------------------------------------------------------------------*/
/*----- PRINTER FRAME -----*/
/*---------------------------------------------------------------------*/
***************
*** 1158,1163 ****
--- 1182,1188 ----
void
syms_of_frame_mswindows (void)
{
+ DEFSUBR (Fmswindows_send_sys_command);
}
void
--
Adrian Aichner
mailto:adrian@xemacs.org
http://www.xemacs.org/