i'm going to veto this. it's a bad idea to create such highly
system-specific interfaces for something general like minimizing,
maximizing, etc. a frame. we want instead an interface that works the same
on *all* window systems (at least, X and MSW). i would suggest functions
like minimize-frame/maximize-frame/restore-frame, maybe an activate-menubar
function (note, i'm almost positive there is something equivalent already in
the lwlib-menubar interface) and a separate function like
`send-window-system-control' for doing random things like activating the
screen saver, start menu, etc. (which takes a device, not a frame, and takes
a symbol like `activate-screen-saver', `active-start-menu' etc. and not a
number).
it would also probably be OK to create a *general* interface for sending any
kind of event (or as general as you can reasonably implement it); this
should not be restricted to WM_SYSCOMMAND messages, should probably allow
symbols as well as numbers, and should *not* be advertised as the primary
way to do things like maximizing a frame.
ben
On 5/19/06, John Paul Wallington <jpw(a)pobox.com> wrote:
I think that the previous patch had an error. The
if (NILP (frame))
frame = Fselected_frame (Qnil);
and
CHECK_LIVE_FRAME (frame);
lines were in the wrong order. Sigh.
2006-05-18 John Paul Wallington <jpw(a)pobox.com>
René Kyllingstad <listmailxemacs(a)kyllingstad.com>
* frame-msw.c (Fmswindows_send_sys_command): New builtin.
(syms_of_frame_mswindows): Defsubr it.
--- frame-msw.c 25 Nov 2005 01:42:02 +0000 1.59
+++ frame-msw.c 18 May 2006 23:15:16 +0100
@@ -836,6 +836,33 @@
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.
+If FRAME is not a Win32 GUI frame then do nothing.
+*/
+ (command, frame))
+{
+ CHECK_INT (command);
+
+ if (NILP (frame))
+ frame = Fselected_frame (Qnil);
+
+ CHECK_LIVE_FRAME (frame);
+
+ if (FRAME_TYPE_P (XFRAME (frame), mswindows))
+ qxePostMessage (FRAME_MSWINDOWS_HANDLE (XFRAME (frame)),
WM_SYSCOMMAND,
+ XINT (command), 0);
+
+ return Qnil;
+}
+
+
/*---------------------------------------------------------------------*/
/*----- PRINTER FRAME -----*/
/*---------------------------------------------------------------------*/
@@ -1205,6 +1232,7 @@
#ifdef NEW_GC
INIT_LRECORD_IMPLEMENTATION (mswindows_frame);
#endif /* NEW_GC */
+ DEFSUBR (Fmswindows_send_sys_command);
}
void