annotate src/ExternalClient.c @ 5602:c9e5612f5424

Support the MP library on recent FreeBSD, have it pass relevant tests. src/ChangeLog addition: 2011-11-26 Aidan Kehoe <kehoea@parhasard.net> * number-mp.c (bignum_to_string): Don't overwrite the accumulator we've just set up for this function. * number-mp.c (BIGNUM_TO_TYPE): mp_itom() doesn't necessarily do what this code used to think with negative numbers, it can treat them as unsigned ints. Subtract numbers from bignum_zero instead of multiplying them by -1 to convert them to their negative equivalents. * number-mp.c (bignum_to_int): * number-mp.c (bignum_to_uint): * number-mp.c (bignum_to_long): * number-mp.c (bignum_to_ulong): * number-mp.c (bignum_to_double): Use the changed BIGNUM_TO_TYPE() in these functions. * number-mp.c (bignum_ceil): * number-mp.c (bignum_floor): In these functions, be more careful about rounding to positive and negative infinity, respectively. Don't use the sign of QUOTIENT when working out out whether to add or subtract one, rather use the sign QUOTIENT would have if arbitrary-precision division were done. * number-mp.h: * number-mp.h (MP_GCD): Wrap #include <mp.h> in BEGIN_C_DECLS/END_C_DECLS. * number.c (Fbigfloat_get_precision): * number.c (Fbigfloat_set_precision): Don't attempt to call XBIGFLOAT_GET_PREC if this build doesn't support big floats.
author Aidan Kehoe <kehoea@parhasard.net>
date Sat, 26 Nov 2011 17:59:14 +0000
parents 2aa9cd456ae7
children
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 /* External client widget.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1993, 1994 Sun Microsystems, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3
5405
2aa9cd456ae7 Move src/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents: 3025
diff changeset
4 This library is free software: you can redistribute it and/or modify it
2aa9cd456ae7 Move src/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents: 3025
diff changeset
5 under the terms of the GNU General Public License as published by the
2aa9cd456ae7 Move src/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents: 3025
diff changeset
6 Free Software Foundation, either version 3 of the License, or (at your
2aa9cd456ae7 Move src/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents: 3025
diff changeset
7 option) any later version.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8
5405
2aa9cd456ae7 Move src/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents: 3025
diff changeset
9 This library is distributed in the hope that it will be useful, but WITHOUT
2aa9cd456ae7 Move src/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents: 3025
diff changeset
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2aa9cd456ae7 Move src/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents: 3025
diff changeset
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2aa9cd456ae7 Move src/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents: 3025
diff changeset
12 for more details.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13
5405
2aa9cd456ae7 Move src/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents: 3025
diff changeset
14 You should have received a copy of the GNU General Public License
2aa9cd456ae7 Move src/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents: 3025
diff changeset
15 along with this library. If not, see <http://www.gnu.org/licenses/>. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 /* Synched up with: Not in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 /* Written by Ben Wing, September 1993. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 #ifdef emacs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 #include <config.h>
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 #ifndef EXTERNAL_WIDGET
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 ERROR! This ought not be getting compiled if EXTERNAL_WIDGET is undefined
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 #endif
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 #endif /* emacs */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 #include <stdio.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 #include <string.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 #include <stdlib.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 #ifdef EXTW_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 # include <Xm/XmP.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 # include <Xm/PrimitiveP.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 # include <X11/keysym.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 # include "xintrinsicp.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 # include <X11/StringDefs.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42
2299
a640f9c13696 [xemacs-hg @ 2004-09-22 03:04:35 by james]
james
parents: 2286
diff changeset
43 #include "compiler.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 #include "ExternalClientP.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 #include "extw-Xt.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 #ifdef TOOLTALK
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
48 #include TT_C_H_FILE
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 /* This is the client widget, used to communicate with an ExternalShell
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 widget. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 #define NOTIFY(w, type, l0, l1, l2) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 extw_send_notify_3(XtDisplay((Widget)(w)), XtWindow((Widget)(w)),\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 type, l0, l1, l2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57
3025
facf3239ba30 [xemacs-hg @ 2005-10-25 11:16:19 by ben]
ben
parents: 2299
diff changeset
58 static void externalClientInitialize (Widget req, Widget new_, ArgList args,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 Cardinal *num_args);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 static void externalClientRealize (Widget widget, XtValueMask *mask,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 XSetWindowAttributes *attrs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 static void Destroy (Widget w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 static void EventHandler (Widget wid, XtPointer closure, XEvent *event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 Boolean *continue_to_dispatch);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 static void MaskableEventHandler (Widget wid, XtPointer closure, XEvent *event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 Boolean *continue_to_dispatch);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 static XtGeometryResult QueryGeometry(Widget, XtWidgetGeometry *,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 XtWidgetGeometry *);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 static void ExternalClientFocusIn (Widget, XEvent *, String *, Cardinal *);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 static void ExternalClientFocusOut (Widget, XEvent *, String *, Cardinal *);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 static void ExternalClientEnter (Widget, XEvent *, String *, Cardinal *);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 static void ExternalClientLeave (Widget, XEvent *, String *, Cardinal *);
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 static int my_error_handler(Display *display, XErrorEvent *xev);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 static int (*error_old_handler)(Display *, XErrorEvent *);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 static XtResource resources[] = {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 #define offset(field) XtOffset(ExternalClientWidget, externalClient.field)
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
79 { XtNshellTimeout, XtCShellTimeout,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
80 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
81 offset(shell_timeout), XtRImmediate,(XtPointer)DEFAULT_WM_TIMEOUT },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
82 { XtNdeadShell, XtCDeadShell,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
83 XtRBoolean, sizeof (Boolean),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
84 offset(dead_shell), XtRImmediate, (XtPointer)False },
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 #ifdef EXTW_USES_MOTIF
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
86 { XmNnavigationType, XmCNavigationType,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
87 XmRNavigationType, sizeof (XmNavigationType),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
88 XtOffset (ExternalClientWidget, primitive.navigation_type),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
89 XtRImmediate, (XtPointer)XmTAB_GROUP },
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 #endif
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
91 { XtNemacsProcID, XtCEmacsProcID,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
92 XtRString, sizeof (String),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
93 offset(emacs_procid), XtRImmediate, (XtPointer)NULL },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
94 { XtNshellReadyCallback, XtCCallback,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
95 XtRCallback, sizeof (XtCallbackList),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
96 offset(shell_ready_callback), XtRImmediate, (XtPointer)NULL },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
97 { XtNshellName, XtCShellName,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
98 XtRString, sizeof (String),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
99 offset(shell_name), XtRImmediate, (XtPointer)NULL },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
100 { XtNuseToolTalk, XtCUseToolTalk,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
101 XtRBoolean, sizeof (Boolean),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
102 offset(use_tooltalk), XtRImmediate, (XtPointer)False }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 static XtActionsRec actions[] = {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 {"focusIn", ExternalClientFocusIn},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 {"focusOut", ExternalClientFocusOut},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 {"enter", ExternalClientEnter},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 {"leave", ExternalClientLeave},
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 ExternalClientClassRec externalClientClassRec = {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 { /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 * core_class fields
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 #ifdef EXTW_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 /* superclass */ (WidgetClass) &xmPrimitiveClassRec,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 /* superclass */ (WidgetClass) &coreClassRec,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 /* class_name */ "ExternalClient",
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
122 /* size */ sizeof (ExternalClientRec),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 /* Class Initializer */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 /* class_part_initialize*/ NULL, /* XtInheritClassPartInitialize, */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 /* Class init'ed ? */ FALSE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 /* initialize */ externalClientInitialize,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 /* initialize_notify */ NULL,
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
128 /* realize */ externalClientRealize,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 /* actions */ actions,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 /* num_actions */ XtNumber (actions),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 /* resources */ resources,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 /* resource_count */ XtNumber (resources),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 /* xrm_class */ NULLQUARK,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 /* compress_motion */ FALSE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 /* compress_exposure */ TRUE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 /* compress_enterleave*/ FALSE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 /* visible_interest */ TRUE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 /* destroy */ Destroy, /* XtInheritDestroy, */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 /* resize */ XtInheritResize,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 /* expose */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 /* set_values */ NULL, /* XtInheritSetValues, */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
142 /* set_values_hook */ NULL,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
143 /* set_values_almost */ XtInheritSetValuesAlmost,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
144 /* get_values_hook */ NULL,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 /* accept_focus */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 /* intrinsics version */ XtVersion,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 /* callback offsets */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 /* tm_table */ "", /* MUST NOT BE NULL or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 XtInheritTranslations in Motif!!!!!
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150 Otherwise keyboard focus translations
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151 will not work. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 /* query_geometry */ QueryGeometry,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 /* display_accelerator*/ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 /* extension */ NULL
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156 #ifdef EXTW_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 XmInheritBorderHighlight,/* Primitive border_highlight */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 XmInheritBorderHighlight,/* Primitive border_unhighlight */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 XtInheritTranslations, /* translations */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 NULL, /* arm_and_activate */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 NULL, /* get resources */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 0, /* num get_resources */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 NULL, /* extension */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 WidgetClass externalClientWidgetClass = (WidgetClass) &externalClientClassRec;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 static void
3025
facf3239ba30 [xemacs-hg @ 2005-10-25 11:16:19 by ben]
ben
parents: 2299
diff changeset
175 externalClientInitialize (Widget UNUSED (req), Widget new_,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
176 ArgList UNUSED (args), Cardinal *UNUSED (num_args))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 {
3025
facf3239ba30 [xemacs-hg @ 2005-10-25 11:16:19 by ben]
ben
parents: 2299
diff changeset
178 ExternalClientWidget ecw = (ExternalClientWidget) new_;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 static int error_handler_added = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180
3025
facf3239ba30 [xemacs-hg @ 2005-10-25 11:16:19 by ben]
ben
parents: 2299
diff changeset
181 extw_initialize_atoms (XtDisplay (new_));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 extw_which_side = extw_client_send;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 #ifdef EXTW_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 /* yes I know this is horrible. However, the XmPrimitive class adds
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 the Tab translation in its initialization routine, so we have to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 override it here. This is all the fault of Xt, which doesn't
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 provide a proper inheritance mechanism for translations.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191 -- BPW
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
194
3025
facf3239ba30 [xemacs-hg @ 2005-10-25 11:16:19 by ben]
ben
parents: 2299
diff changeset
195 XtOverrideTranslations (new_,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 XtParseTranslationTable ("None<Key>Tab:\n"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 "<FocusIn>:focusIn()\n"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 "<FocusOut>:focusOut()\n"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 "<Enter>:enter()\n"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 "<Leave>:leave()\n"));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 #endif
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
203
3025
facf3239ba30 [xemacs-hg @ 2005-10-25 11:16:19 by ben]
ben
parents: 2299
diff changeset
204 XtAddEventHandler (new_, 0, TRUE, EventHandler, (XtPointer) NULL);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 ecw->externalClient.shell_ready = False;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 ecw->externalClient.has_focus = False;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 if (!error_handler_added)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 error_handler_added = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 error_old_handler = XSetErrorHandler (my_error_handler);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 #ifdef TOOLTALK
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 static Tt_callback_action
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
219 tt_callback(Tt_message m, Tt_pattern UNUSED (p))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 ExternalClientWidget ecw = (ExternalClientWidget)tt_message_user (m, 0);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
222
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 switch (tt_message_state(m))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 case TT_FAILED:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 /* handle errors here */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 case TT_HANDLED:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 ecw->externalClient.shell_name = tt_message_arg_val (m, 2);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 XtCallCallbackList ((Widget) ecw,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 ecw->externalClient.shell_ready_callback, NULL);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 }
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
234
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 tt_message_destroy (m);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 return TT_CALLBACK_PROCESSED;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 send_tooltalk_handshake (ExternalClientWidget ecw, Window win, char *name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 Tt_message m = tt_message_create ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 tt_message_op_set (m, "emacs-make-client-screen");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 tt_message_scope_set (m, TT_SESSION);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 tt_message_class_set (m, TT_REQUEST);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 tt_message_arg_add (m, TT_IN, "string", name);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 tt_message_iarg_add (m, TT_IN, "int", win);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
249 tt_message_arg_add (m, TT_OUT, "string", NULL);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 tt_message_user_set (m, 0, (void *)ecw);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 tt_message_callback_add (m, tt_callback);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 if (ecw->externalClient.emacs_procid)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 tt_message_address_set (m, TT_HANDLER);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 tt_message_handler_set (m, ecw->externalClient.emacs_procid);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 tt_message_address_set (m, TT_PROCEDURE);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 tt_message_send (m);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266 externalClientRealize (Widget w, XtValueMask *vm, XSetWindowAttributes *attrs)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 {
1094
4f4c898836ab [xemacs-hg @ 2002-11-11 15:34:11 by stephent]
stephent
parents: 442
diff changeset
268 #ifdef TOOLTALK
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269 ExternalClientWidget ecw = (ExternalClientWidget)w;
1094
4f4c898836ab [xemacs-hg @ 2002-11-11 15:34:11 by stephent]
stephent
parents: 442
diff changeset
270 #endif
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
271
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
272 #ifdef EXTW_USES_MOTIF
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273 (*xmPrimitiveWidgetClass->core_class.realize) (w, vm, attrs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 (*coreWidgetClass->core_class.realize) (w, vm, attrs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 #ifdef TOOLTALK
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 /* Make sure that the server actually knows about this window id before
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280 * telling Emacs about it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282 if (ecw->externalClient.use_tooltalk)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284 XSync (XtDisplay (w), False);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285 send_tooltalk_handshake (ecw, XtWindow (w), XtName (w));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286 }
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
287 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291 /***********************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 /* window-to-widget list. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295 struct ww_list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 Window win;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 Widget wid;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 struct ww_list *next;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302 struct ww_list ww_list[1];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305 add_ww (Window win, Widget wid)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307 struct ww_list *ww = (struct ww_list *) malloc (sizeof (struct
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 ww_list));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 if (!ww)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311 ww->win = win;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312 ww->wid = wid;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313 ww->next = ww_list->next;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314 ww_list->next = ww;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318 static Widget
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319 remove_ww (Window win)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321 struct ww_list *w1, *w2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 Widget wid = 0;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
323
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324 for (w1=ww_list, w2=w1->next; w2; w1=w2, w2=w2->next)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325 if (w2->win == win)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327 w1->next = w2->next;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328 wid = w2->wid;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329 free (w2);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332 return wid;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335 /***********************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337 /* stolen outright from Intrinsic.c */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338
2108
8de911beca70 [xemacs-hg @ 2004-06-02 09:16:14 by didierv]
didierv
parents: 1094
diff changeset
339 static void
8de911beca70 [xemacs-hg @ 2004-06-02 09:16:14 by didierv]
didierv
parents: 1094
diff changeset
340 ComputeWindowAttributes (Widget widget, XtValueMask *value_mask,
8de911beca70 [xemacs-hg @ 2004-06-02 09:16:14 by didierv]
didierv
parents: 1094
diff changeset
341 XSetWindowAttributes *values)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
343 *value_mask = CWEventMask | CWColormap;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
344 (*values).event_mask = XtBuildEventMask(widget);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
345 (*values).colormap = widget->core.colormap;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
346 if (widget->core.background_pixmap != XtUnspecifiedPixmap) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347 *value_mask |= CWBackPixmap;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348 (*values).background_pixmap = widget->core.background_pixmap;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349 } else {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
350 *value_mask |= CWBackPixel;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351 (*values).background_pixel = widget->core.background_pixel;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
352 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
353 if (widget->core.border_pixmap != XtUnspecifiedPixmap) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354 *value_mask |= CWBorderPixmap;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355 (*values).border_pixmap = widget->core.border_pixmap;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356 } else {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357 *value_mask |= CWBorderPixel;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358 (*values).border_pixel = widget->core.border_pixel;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
359 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
360 if (widget->core.widget_class->core_class.expose == (XtExposeProc) NULL) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
361 /* Try to avoid redisplay upon resize by making bit_gravity the same
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
362 as the default win_gravity */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363 *value_mask |= CWBitGravity;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
364 (*values).bit_gravity = NorthWestGravity;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
365 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
366 } /* ComputeWindowAttributes */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
367
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
368 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
369 end_connection (ExternalClientWidget w)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
370 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
371 XSetWindowAttributes xswa;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
372 XtValueMask mask;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
373 Widget wid = (Widget) w;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
374
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
375 w->externalClient.shell_ready = False;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
376 XtRemoveEventHandler (wid, w->externalClient.event_mask,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
377 FALSE, MaskableEventHandler, (XtPointer) NULL);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
378 ComputeWindowAttributes (wid, &mask, &xswa);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
379 XChangeWindowAttributes (XtDisplay (wid), XtWindow (wid), mask, &xswa);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380 XClearArea (XtDisplay (wid), XtWindow (wid), 0, 0, 0, 0, True);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
381 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
382
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
383 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
384 my_error_handler (Display *display, XErrorEvent *xev)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
385 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
386 Widget wid;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
387
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
388 if (xev->error_code != BadWindow)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
389 goto call_old;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
390 wid = remove_ww (xev->resourceid);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
391 if (wid)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
392 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 end_connection ((ExternalClientWidget) wid);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395 }
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
396
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 call_old:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398 return error_old_handler (display, xev);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
402 MaskableEventHandler (Widget wid, XtPointer UNUSED (closure), XEvent *event,
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
403 Boolean *UNUSED (continue_to_dispatch))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
404 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
405 ExternalClientWidget w = (ExternalClientWidget) wid;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
406
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407 if (w->externalClient.shell_ready)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 if (event->type == KeyPress || event->type == KeyRelease ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410 event->type == ButtonPress || event->type == ButtonRelease ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411 event->type == MotionNotify)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412 event->xkey.subwindow = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
413 #ifdef EXTW_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414 /* hackkkkkkkkkkkkkk! Suppress CTRL-TAB, SHIFT-TAB, etc. so that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415 Emacs doesn't attempt to interpret focus-change keystrokes. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416 if (event->type == KeyPress &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417 XLookupKeysym ((XKeyEvent *) event, 0) == XK_Tab &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418 (event->xkey.state & ControlMask ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
419 event->xkey.state & ShiftMask))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
422 event->xany.window = w->core.window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
423 XSendEvent (XtDisplay (wid), w->externalClient.event_window, FALSE, 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
424 event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
425 XSync (XtDisplay (wid), 0); /* make sure that any BadWindow errors
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
426 (meaning the server died) get handled
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
427 before XSendEvent is called again. */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
428
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
429 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
430 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
431
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
433 EventHandler (Widget wid, XtPointer UNUSED (closure), XEvent *event,
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
434 Boolean *UNUSED (continue_to_dispatch))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
435 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
436 ExternalClientWidget w = (ExternalClientWidget) wid;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
437
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
438 if (w->core.window != event->xany.window)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
439 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
440 XtAppErrorMsg (XtWidgetToApplicationContext (wid),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
441 "invalidWindow","eventHandler",XtCXtToolkitError,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
442 "Event with wrong window",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
443 (String *)NULL, (Cardinal *)NULL);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
444 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
445 }
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
446
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
447 if (event->type == ClientMessage &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
448 event->xclient.message_type == a_EXTW_NOTIFY &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
449 event->xclient.data.l[0] == extw_shell_send)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450 switch (event->xclient.data.l[1])
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
451 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
452
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
453 case extw_notify_qg:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
454 /* shell is alive again. */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
455
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
456 w->externalClient.dead_shell = False;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
457 break;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
458
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
459 case extw_notify_gm:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
460 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
461 XtWidgetGeometry xwg, xwg_return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
462 XtGeometryResult result;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
463
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
464 extw_get_geometry_value (XtDisplay (wid), XtWindow (wid),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
465 a_EXTW_GEOMETRY_MANAGER, &xwg);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
466 result = XtMakeGeometryRequest (wid, &xwg, &xwg_return);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
467
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
468 extw_send_geometry_value (XtDisplay (wid), XtWindow (wid),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
469 a_EXTW_GEOMETRY_MANAGER, extw_notify_gm,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
470 result == XtGeometryAlmost ? &xwg_return :
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
471 NULL, result);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
472 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
473 }
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
474
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
475 case extw_notify_init:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
476 w->externalClient.shell_ready = True;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
477 w->externalClient.event_window = event->xclient.data.l[2];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
478 w->externalClient.event_mask = event->xclient.data.l[3];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479 add_ww (w->externalClient.event_window, (Widget) w);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
480
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481 XtAddEventHandler (wid, w->externalClient.event_mask,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
482 FALSE, MaskableEventHandler, (XtPointer) NULL);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483 #ifdef EXTW_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484 NOTIFY (w, extw_notify_init,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
485 EXTW_TYPE_MOTIF,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
486 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
488 NOTIFY (w, extw_notify_init,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
489 EXTW_TYPE_XT,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
490 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
491 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
492 break;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
493
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
494 case extw_notify_end:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
495 end_connection (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
496 remove_ww (w->externalClient.event_window);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
497 break;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
498
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
499 case extw_notify_set_focus:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
500 #ifdef EXTW_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
501 XmProcessTraversal (wid, XmTRAVERSE_CURRENT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
502 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
503 XtSetKeyboardFocus (wid, None);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
504 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
505 break;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
506
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
507 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
508 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
509
2108
8de911beca70 [xemacs-hg @ 2004-06-02 09:16:14 by didierv]
didierv
parents: 1094
diff changeset
510 static void Destroy (Widget wid)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
511 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
512 ExternalClientWidget w = (ExternalClientWidget)wid;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
513
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
514 NOTIFY(w, extw_notify_end, 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
515 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
516
2108
8de911beca70 [xemacs-hg @ 2004-06-02 09:16:14 by didierv]
didierv
parents: 1094
diff changeset
517 static XtGeometryResult
8de911beca70 [xemacs-hg @ 2004-06-02 09:16:14 by didierv]
didierv
parents: 1094
diff changeset
518 QueryGeometry (Widget gw, XtWidgetGeometry *request, XtWidgetGeometry *reply)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
519 {
2108
8de911beca70 [xemacs-hg @ 2004-06-02 09:16:14 by didierv]
didierv
parents: 1094
diff changeset
520 ExternalClientWidget w = (ExternalClientWidget) gw;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
521 XEvent event;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
522 unsigned long request_num;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
523 Display *display = XtDisplay(gw);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
524 XtWidgetGeometry req = *request; /* don't modify caller's structure */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
525
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
526 if (!XtIsRealized((Widget)w) || !w->externalClient.shell_ready)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
527 return XtGeometryYes;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
528
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
529 if (w->externalClient.dead_shell == TRUE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
530 /* The shell is sick. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
531 return XtGeometryNo;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
532
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
533 req.sibling = None;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
534 req.request_mode &= ~CWSibling;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
535 request_num = NextRequest(display);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
536 extw_send_geometry_value(XtDisplay(gw), XtWindow(gw), a_EXTW_QUERY_GEOMETRY,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
537 extw_notify_qg, &req, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
538
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
539 if (extw_wait_for_response(gw, &event, request_num, extw_notify_qg,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
540 w->externalClient.shell_timeout)) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
541 XtGeometryResult result = (XtGeometryResult) event.xclient.data.l[0];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
542
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
543 if (result == XtGeometryAlmost) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
544 extw_get_geometry_value(XtDisplay(gw), XtWindow(gw),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
545 a_EXTW_QUERY_GEOMETRY, reply);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
546 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
547 return result;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
548 } else {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
549 w->externalClient.dead_shell = TRUE; /* timed out; must be broken */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
550 return XtGeometryNo;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
551 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
552 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
553
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
554 #ifdef EXTW_USES_MOTIF
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
555 # define USED_IF_MOTIF(decl) decl
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
556 #else
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
557 # define USED_IF_MOTIF(decl) UNUSED (decl)
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
558 #endif
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
559
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
560 static void ExternalClientFocusIn (Widget w, XEvent *event,
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
561 String *USED_IF_MOTIF (params),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
562 Cardinal *USED_IF_MOTIF (num_params))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
563 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
564 ExternalClientWidget ecw = (ExternalClientWidget) w;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
565
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
566 if (event->xfocus.send_event && !ecw->externalClient.has_focus) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
567 ecw->externalClient.has_focus = True;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
568 NOTIFY(ecw, extw_notify_focus_in, 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
569 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
570 #ifdef EXTW_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
571 _XmPrimitiveFocusIn (w, event, params, num_params);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
572 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
573 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
574
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
575 static void ExternalClientFocusOut (Widget w, XEvent *event,
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
576 String *USED_IF_MOTIF (params),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
577 Cardinal *USED_IF_MOTIF (num_params))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
578 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
579 ExternalClientWidget ecw = (ExternalClientWidget) w;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
580
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
581 if (event->xfocus.send_event && ecw->externalClient.has_focus) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
582 ecw->externalClient.has_focus = False;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
583 NOTIFY(ecw, extw_notify_focus_out, 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
584 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
585 #ifdef EXTW_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
586 _XmPrimitiveFocusOut(w, event, params, num_params);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
587 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
588 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
589
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
590 static void ExternalClientEnter (Widget w, XEvent *event,
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
591 String *USED_IF_MOTIF (params),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
592 Cardinal *USED_IF_MOTIF (num_params))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
593 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
594 ExternalClientWidget ecw = (ExternalClientWidget) w;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
595
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
596 if (
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
597 #ifdef EXTW_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
598 _XmGetFocusPolicy (w) != XmEXPLICIT &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
599 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
600 !ecw->externalClient.has_focus &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
601 event->xcrossing.focus && event->xcrossing.detail != NotifyInferior) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
602 ecw->externalClient.has_focus = True;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
603 NOTIFY(ecw, extw_notify_focus_in, 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
604 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
605 #ifdef EXTW_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
606 _XmPrimitiveEnter (w, event, params, num_params);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
607 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
608 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
609
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
610 static void ExternalClientLeave (Widget w, XEvent *event,
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
611 String *USED_IF_MOTIF (params),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 2108
diff changeset
612 Cardinal *USED_IF_MOTIF (num_params))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
613 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
614 ExternalClientWidget ecw = (ExternalClientWidget) w;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
615
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
616 if (
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
617 #ifdef EXTW_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
618 _XmGetFocusPolicy (w) != XmEXPLICIT &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
619 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
620 ecw->externalClient.has_focus &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
621 event->xcrossing.focus && event->xcrossing.detail != NotifyInferior) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
622 ecw->externalClient.has_focus = False;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
623 NOTIFY(ecw, extw_notify_focus_out, 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
624 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
625 #ifdef EXTW_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
626 _XmPrimitiveLeave (w, event, params, num_params);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
627 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
628 }