annotate man/external-widget.texi @ 788:026c5bf9c134

[xemacs-hg @ 2002-03-21 07:29:57 by ben] chartab.c: Fix bugs in implementation and doc strings. config.h.in: Add foo_checking_assert_at_line() macros. Not clear whether these are actually useful, though; I'll take them out if not. symsinit.h, emacs.c: Some improvements to the timeline. Rearrange a bit the init calls. Add call for reinit_vars_of_object_mswindows() and declare in symsinit.h. event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, event-tty.c, events.c, events.h: Introduce new event methods for printing, comparing, and hashing magic events, to avoid event-type-specific stuff that had crept into events.c. (And was crashing, since the channel in MS Windows magic events may be nil.) Implement the methods in event-{tty,gtk,Xt,mswindows}.c. Make wrapping functions event_stream_{compare,hash,format}_magic_event() to check if everything's OK and call the actual callback. Fix events.c to use the new methods. Add a new event-stream-operation EVENT_STREAM_NOTHING -- event stream not actually required to be able to do anything, just be open. (#### This event-stream-operation stuff needs to be rethought.) Fixed describe_event() in event-Xt.c to print its output to a stream, not always to stderr, so it can be used elsewhere. (e.g. in print-event when a magic event is encountered?) lisp.h, lrecord.h: Define new assert_at_line(), for use in asserts inside of inline functions. The assert will report the line and file of the inline function, which is almost certainly not what you want as it's useless. what you want to see is where the pseudo-macro was called from. So, when error-checking is on, we pass in the line and file into the macros, for accurate printout using assert_at_line(). Happens only when error-checking is defined so doesn't slow down non-error-checking builds. Fix XCHAR, XINT, XCHAR_OR_INT, XFOO, and wrap_foo() in this fashion. lstream.c, lstream.h: Add resizing_buffer_to_lisp_string(). objects-gtk.c: Fix typo. objects-msw.c: Implement a smarter way of determining whether a font matches a charset. Formerly we just looked at the "script" element of the font spec, converted it to a code page, and compared it with the code page derived from the charset. Now, as well as doing this, we ask the font for the list of unicode ranges it supports, see what range the charset falls into (#### bogus! need to do this char-by-char), and see if any of the font's supported ranges include the charset's range. also do some caching in Vfont_signature_data of previous inquiries. charset.h, text.c, mule-charset.c: New fun; extracted out of Fmake_char() and declare prototype in charset.h. text.h: introduce assert_by_line() to make REP_BYTES_BY_FIRST_BYTE report the file and line more accurately in an assertion failure. unicode.c: make non-static (used in objects-msw.c), declare in charset.h. mule\mule-category.el: Start implementing a category API compatible with FSF. Not there yet. We need improvements to char-tables. mule\mule-charset.el: Copy translation table code from FSF 21.1 and fix up. Eventually we'll have them in XEmacs. (used in ccl) Not here quite yet, and we need some improvements to char-tables. mule\cyril-util.el, mule\cyrillic.el, mule\devan-util.el, mule\ethio-util.el, mule\korea-util.el, mule\mule-tty-init.el, mule\tibet-util.el, mule\viet-util.el, mule\vietnamese.el: Fix numerous compilation warnings. Fix up code related to translation tables and other types of char-tables. menubar-items.el: Move the frame commands from the View menu to the File menu, to be consistent with how most other programs do things. Move less-used revert/recover items to a submenu. Make "recover" not prompt for a file, but recover the current buffer. TODO.ben-mule-21-5: Create bug list for latest problems.
author ben
date Thu, 21 Mar 2002 07:31:30 +0000
parents da44ff90109f
children 42375619fa45
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 \input texinfo @c -*-texinfo-*-
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 @setfilename ../info/external-widget.info
675
bb2ecf4a4a16 [xemacs-hg @ 2001-11-27 18:53:47 by adrian]
adrian
parents: 428
diff changeset
3 @settitle The External Client Widget
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 @ifinfo
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6 @dircategory XEmacs Editor
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 @direntry
721
f72a191f8ecf [xemacs-hg @ 2002-01-02 20:56:32 by adrian]
adrian
parents: 675
diff changeset
8 * External Widget: (external-widget). External Client Widget.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 @end direntry
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 @end ifinfo
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 @node Top, Using an External Client Widget,, (dir)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 An @dfn{external client widget} is a widget that is part of another program
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 but functions as an Emacs frame. This is intended to be a more
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 powerful replacement for standard text widgets.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 @menu
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 * Using an External Client Widget::
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 * External Client Widget Resource Settings::
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 * Motif-Specific Info About the External Client Widget::
750
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
22 * Example Program Using the External Client Widget::
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 @end menu
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 @node Using an External Client Widget, External Client Widget Resource Settings, Top, Top
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 @chapter Using an External Client Widget
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 There are three different implementations of the external client widget.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 One is designed for use in Motif applications and is linked with the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 option @code{-lextcli_Xm}. Another is designed for non-Motif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 applications that still use the X toolkit; it is linked with the option
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 @code{-lextcli_Xt}. The third is designed for applications that do not
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 use the X toolkit; it is linked with the option @code{-lextcli_Xlib}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 In order to use an external client widget in a client program that uses
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 the X toolkit (i.e. either of the first two options described above),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 simply create an instance of widget type ExternalClient and link your
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 program with the appropriate library. The corresponding header file is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 called @file{ExternalClient.h}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 Documentation still needs to be provided for using the raw Xlib
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 version of the external client widget.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 The external client widget will not do anything until an instance of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 Emacs is told about this particular widget. To do that, call the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 function @code{make-frame}, specifying a value for the frame parameter
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 @code{window-id}. This value should be a string containing the decimal
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 representation of the widget's X window ID number (this can be obtained
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 by the Xt function @code{XtWindow()}). In order for the client program
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 to communicate this information to Emacs, a method such as sending a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 ToolTalk message needs to be used.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 Once @code{make-frame} has been called, Emacs will create a frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 that occupies the client widget's window. This frame can be used just
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 like any other frame in Emacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 @node External Client Widget Resource Settings, Motif-Specific Info About the External Client Widget, Using an External Client Widget, Top
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 @chapter External Client Widget Resource Settings
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 The external client widget is a subclass of the Motif widget XmPrimitive
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 and thus inherits all its resources. In addition, the following new
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 resources are defined:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 @table @samp
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 @item deadShell (class DeadShell)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 A boolean resource indicating whether the last request to the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 ExternalShell widget that contains the frame corresponding to this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 widget timed out. If true, no further requests will be made (all
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 requests will automatically fail) until a response to the last
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 request is received. This resource should normally not be set by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 user.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 @item shellTimeout (class ShellTimeout)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 A value specifying how long (in milliseconds) the client should wait
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 for a response when making a request to the corresponding ExternalShell
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 widget. If this timeout is exceeded, the client will assume that the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 shell is dead and will fail the request and all subsequent requests
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 until a response to the request is received. Default value is 5000,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 or 5 seconds.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 @end table
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 The shell that contains the frame corresponding to an external client
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 widget is of type ExternalShell, as opposed to standard frames, whose
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 shell is of type TopLevelShell. The ExternalShell widget is a direct
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 subclass of Shell and thus inherits its resources. In addition, the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 following new resources are defined:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 @table @samp
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 @item window (class Window)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 The X window ID of the widget to use for this Emacs frame. This is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 normally set by the call to @code{x-create-frame} and should not be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 modified by the user.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 @item deadClient (class DeadClient)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 A boolean resource indicating whether the last request to the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 corresponding ExternalClient widget timed out. If true, no further
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 requests will be made (all requests will automatically fail) until a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 response to the last request is received. This resource should
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 normally not be set by the user.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 @item ClientTimeout (class ClientTimeout)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 A value specifying how long (in milliseconds) the shell should wait
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 for a response when making a request to the corresponding ExternalClient
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 widget. If this timeout is exceeded, the shell will assume that the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 client is dead and will fail the request and all subsequent requests
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 until a response to the request is received. Default value is 5000,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 or 5 seconds.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 @end table
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 Note that the requests that are made between the client and the shell
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 are primarily for handling query-geometry and geometry-manager requests
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 made by parent or child widgets.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115
750
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
116 @node Motif-Specific Info About the External Client Widget, Example Program Using the External Client Widget, External Client Widget Resource Settings, Top
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 @chapter Motif-Specific Info About the External Client Widget
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 By default, the external client widget has navigation type
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 @samp{XmTAB_GROUP}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 The widget traversal keystrokes are modified slightly from the standard
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 XmPrimitive keystrokes. In particular, @kbd{@key{TAB}} alone does not
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 traverse to the next widget (@kbd{Ctrl-@key{TAB}} must be used instead),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 but functions like a normal @key{TAB} in Emacs. This follows the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 semantics of the Motif text widget. The traversal keystrokes
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 @kbd{Ctrl-@key{TAB}} and @kbd{Shift-@key{TAB}} are silently filtered by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 the external client widget and are not seen by Emacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129
750
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
130
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
131 @node Example Program Using the External Client Widget, , Motif-Specific Info About the External Client Widget, Top
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
132 @chapter Example Program Using the External Client Widget
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
133
753
41528f633ff7 [xemacs-hg @ 2002-02-13 15:28:56 by stephent]
stephent
parents: 750
diff changeset
134 This is a very simple program. It has some issues with exiting.
41528f633ff7 [xemacs-hg @ 2002-02-13 15:28:56 by stephent]
stephent
parents: 750
diff changeset
135 Be careful to destroy the Emacs frame in the client window before
41528f633ff7 [xemacs-hg @ 2002-02-13 15:28:56 by stephent]
stephent
parents: 750
diff changeset
136 exiting the client program.
750
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
137
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
138 @example
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
139 /*
753
41528f633ff7 [xemacs-hg @ 2002-02-13 15:28:56 by stephent]
stephent
parents: 750
diff changeset
140 XEmacsInside.c
41528f633ff7 [xemacs-hg @ 2002-02-13 15:28:56 by stephent]
stephent
parents: 750
diff changeset
141
750
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
142 Copyright (C) 2002 Free Software Foundation
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
143
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
144 This program is part of XEmacs. XEmacs is free software. See the
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
145 file COPYING that came with XEmacs for conditions on redistribution.
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
146
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
147 This is an example of the XEmacs external widget facility.
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
148
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
149 It uses libextcli-Xt.a to interface to the X Toolkit Intrinsics.
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
150
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
151 Compile with
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
152
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
153 gcc -I/path/to/XEmacs/source/src -L/path/to/XEmacs/build/src -static \
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
154 -lextcli_Xt -lXt -lX11 -lSM -lICE \
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
155 -o XEmacsInside XEmacsInside.c
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
156
753
41528f633ff7 [xemacs-hg @ 2002-02-13 15:28:56 by stephent]
stephent
parents: 750
diff changeset
157 Run it with the resource "*input: True" and a reasonable geometry spec.
41528f633ff7 [xemacs-hg @ 2002-02-13 15:28:56 by stephent]
stephent
parents: 750
diff changeset
158 It pops up a window, and prints a Lisp form on stdout. Eval the form
41528f633ff7 [xemacs-hg @ 2002-02-13 15:28:56 by stephent]
stephent
parents: 750
diff changeset
159 in an XEmacs configured with --external-widget.
750
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
160
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
161 Written by Stephen J. Turnbull <stephen@@xemacs.org>
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
162
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
163 Based on simple_text.c from _The Motif Programming Manual_ by Heller
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
164 and Ferguson, O'Reilly.
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
165 */
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
166
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
167 #include <stdio.h>
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
168
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
169 #include <X11/Intrinsic.h>
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
170 #include <X11/StringDefs.h>
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
171 #include <X11/Shell.h>
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
172
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
173 #include "ExternalClient.h"
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
174
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
175 main (int argc, char *argv[])
755
da44ff90109f [xemacs-hg @ 2002-02-16 07:25:39 by stephent]
stephent
parents: 753
diff changeset
176 @{
750
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
177 Widget toplevel, emacs;
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
178 XtAppContext app;
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
179
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
180 XtSetLanguageProc (NULL, NULL, NULL);
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
181
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
182 toplevel = XtVaOpenApplication (&app, "Demo",
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
183 NULL, 0, &argc, argv,
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
184 NULL, sessionShellWidgetClass,
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
185 NULL);
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
186
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
187 emacs = XtVaCreateManagedWidget ("externalWidget", externalClientWidgetClass,
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
188 toplevel,
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
189 NULL);
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
190
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
191 XtRealizeWidget (toplevel);
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
192
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
193 printf ("(make-frame '(window-id \"%d\"))\n", XtWindow(emacs));
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
194
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
195 XtAppMainLoop (app);
755
da44ff90109f [xemacs-hg @ 2002-02-16 07:25:39 by stephent]
stephent
parents: 753
diff changeset
196 @}
750
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
197
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
198 /* This function doesn't belong here but somehow it's not getting resolved
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
199 from the library. */
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
200 void
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
201 fatal (char *msg)
755
da44ff90109f [xemacs-hg @ 2002-02-16 07:25:39 by stephent]
stephent
parents: 753
diff changeset
202 @{
750
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
203 fprintf (stderr, "%s", msg);
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
204 exit (1);
755
da44ff90109f [xemacs-hg @ 2002-02-16 07:25:39 by stephent]
stephent
parents: 753
diff changeset
205 @}
750
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
206 @end example
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
207
f929ab5ec903 [xemacs-hg @ 2002-02-13 12:52:03 by stephent]
stephent
parents: 721
diff changeset
208
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 @summarycontents
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 @contents
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 @bye