>>>>> "Stephen" == Stephen J Turnbull <stephen(a)xemacs.org> writes:
>>>>> "Jan" == Jan Rychter <jan(a)rychter.com> writes:
>>>>> "APA" == Adrian Aichner <adrian(a)xemacs.org> writes:
APA> Jan Rychter <jan(a)rychter.com> writes:
> Is the window handle (HWND) of the current XEmacs frame (on Win32
> platforms) accessible in any way from Lisp level?
APA> Hi Jan, what would you do with a HWND on the lisp level, if you
APA> had one?
APA> Do you need functionality like raise-frame lower-frame
APA> frame-selected-window get-buffer-window etc?
APA> Please give examples.
Jan> Actually, none of the above. What I need to do with the handle is
Jan> pass it to another program, running under Windows.
Stephen> This facility is available under X, for the same reason.
Stephen> Cf. `x-window-id'. I see no reason why the handle information
Stephen> shouldn't be available to Windows.
Following up on that discussion, here is a patch. I am ashamed to admit
that I don't actually have an environment where I could build
XEmacs/Win32. So, please treat this extremely carefully. It definitely
needs a very close look from someone knowledgeable.
I have assumed that the window-id property would be internal. That could
be wrong, as I don't really understand what an "internal" property
means.
--J.
ChangeLog entries:
2004-08-18 Jan Rychter <jwr(a)xemacs.org>
* src/frame-msw.c (Fmswindows_window_id): added.
(mswindows_frame_properties): added the window-id property.
(mswindows_frame_property): ditto.
(mswindows_internal_frame_property_p): added the window-id
property as internal.
Index: frame-msw.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/frame-msw.c,v
retrieving revision 1.53
diff -u -3 -p -r1.53 frame-msw.c
--- frame-msw.c 2003/09/30 15:26:47 1.53
+++ frame-msw.c 2004/08/18 06:22:28
@@ -562,6 +562,19 @@ mswindows_set_title_from_ibyte (struct f
}
}
+
+DEFUN ("mswindows-window-id", Fmswindows_window_id, 0, 1, 0, /*
+Get the ID (HWND handle) of the MS Windows window corresponding to a
+particular frame. This gives us a chance to manipulate the Emacs window
+from a different program. Note that we are breaking abstractions here:
+we are assuming that HWND fits into our int.
+*/
+ (frame))
+{
+ return make_int (FRAME_MSWINDOWS_HANDLE (XFRAME (frame)));
+}
+
+
static Lisp_Object
mswindows_frame_property (struct frame *f, Lisp_Object property)
{
@@ -570,7 +583,10 @@ mswindows_frame_property (struct frame *
RECT rc;
GetWindowRect (FRAME_MSWINDOWS_HANDLE (f), &rc);
return make_int (EQ (Qtop, property) ? rc.top : rc.left);
- }
+ }
+ if (EQ (Qwindow_id, property)) {
+ return Fmswindows_window_id (wrap_frame (f));
+ }
return Qunbound;
}
@@ -578,7 +594,7 @@ static int
mswindows_internal_frame_property_p (struct frame *f, Lisp_Object property)
{
return EQ (property, Qleft)
- || EQ (property, Qtop);
+ || EQ (property, Qtop) || EQ (property, Qwindow_id);
/* #### frame-x.c has also this. Why?
|| STRINGP (property);
*/
@@ -593,6 +609,7 @@ mswindows_frame_properties (struct frame
props = cons3 (Qtop, make_int (rc.top), props);
props = cons3 (Qleft, make_int (rc.left), props);
+ props = cons3 (Qwindow_id, Fmswindows_window_id (wrap_frame (f)), props);
return props;
}
--=-=-=--