annotate etc/tests/external-widget/test-ew-motif.c @ 4903:70089046adef

fix compile problems in intl-encap* under VS6 -------------------- ChangeLog entries follow: -------------------- lib-src/ChangeLog addition: 2010-01-30 Ben Wing <ben@xemacs.org> * make-mswin-unicode.pl: Make it possible to specify an overridden prototype in cases where either Cygwin or Visual Studio has errors in their headers that can be corrected by falling back to a less qualified type (typically without const). src/ChangeLog addition: 2010-01-30 Ben Wing <ben@xemacs.org> * intl-auto-encap-win32.c: * intl-auto-encap-win32.c (qxeExtractAssociatedIcon): * intl-auto-encap-win32.c (qxeExtractIconEx): * intl-auto-encap-win32.c (qxeCreateMDIWindow): * intl-auto-encap-win32.c (qxeCreateWindowStation): * intl-auto-encap-win32.c (qxeDdeCreateStringHandle): * intl-auto-encap-win32.c (qxeAbortSystemShutdown): * intl-auto-encap-win32.c (qxeRegConnectRegistry): * intl-auto-encap-win32.c (qxeGetICMProfile): * intl-auto-encap-win32.h: Rebuild. * intl-encap-win32.c: * intl-encap-win32.c (qxeUpdateICMRegKey): Delete manual definitions of functions with former errors in Cygwin headers but no longer. Use "override" with some functions where Cygwin or VS6 accidentally omits a const declaration or includes an extra one. Use "no" on SendMessageTimeout, which has an error in the VS6 prototype (you could manually fix this with an ifdef to split the Cygwin vs. VS6 calls, if we ever actually used this function).
author Ben Wing <ben@xemacs.org>
date Sat, 30 Jan 2010 20:34:23 -0600
parents 03ab78e48ef6
children ba07c880114a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4894
03ab78e48ef6 Add copyright and license information based on Ben's recollections.
Jerry James <james@xemacs.org>
parents: 2
diff changeset
1 /* Test external widget code in Motif.
03ab78e48ef6 Add copyright and license information based on Ben's recollections.
Jerry James <james@xemacs.org>
parents: 2
diff changeset
2 Copyright (C) 1993 Ben Wing.
03ab78e48ef6 Add copyright and license information based on Ben's recollections.
Jerry James <james@xemacs.org>
parents: 2
diff changeset
3
03ab78e48ef6 Add copyright and license information based on Ben's recollections.
Jerry James <james@xemacs.org>
parents: 2
diff changeset
4 This file is part of XEmacs.
03ab78e48ef6 Add copyright and license information based on Ben's recollections.
Jerry James <james@xemacs.org>
parents: 2
diff changeset
5
03ab78e48ef6 Add copyright and license information based on Ben's recollections.
Jerry James <james@xemacs.org>
parents: 2
diff changeset
6 XEmacs is free software; you can redistribute it and/or modify it
03ab78e48ef6 Add copyright and license information based on Ben's recollections.
Jerry James <james@xemacs.org>
parents: 2
diff changeset
7 under the terms of the GNU General Public License as published by the
03ab78e48ef6 Add copyright and license information based on Ben's recollections.
Jerry James <james@xemacs.org>
parents: 2
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any
03ab78e48ef6 Add copyright and license information based on Ben's recollections.
Jerry James <james@xemacs.org>
parents: 2
diff changeset
9 later version.
03ab78e48ef6 Add copyright and license information based on Ben's recollections.
Jerry James <james@xemacs.org>
parents: 2
diff changeset
10
03ab78e48ef6 Add copyright and license information based on Ben's recollections.
Jerry James <james@xemacs.org>
parents: 2
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
03ab78e48ef6 Add copyright and license information based on Ben's recollections.
Jerry James <james@xemacs.org>
parents: 2
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
03ab78e48ef6 Add copyright and license information based on Ben's recollections.
Jerry James <james@xemacs.org>
parents: 2
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
03ab78e48ef6 Add copyright and license information based on Ben's recollections.
Jerry James <james@xemacs.org>
parents: 2
diff changeset
14 for more details.
03ab78e48ef6 Add copyright and license information based on Ben's recollections.
Jerry James <james@xemacs.org>
parents: 2
diff changeset
15
03ab78e48ef6 Add copyright and license information based on Ben's recollections.
Jerry James <james@xemacs.org>
parents: 2
diff changeset
16 You should have received a copy of the GNU General Public License
03ab78e48ef6 Add copyright and license information based on Ben's recollections.
Jerry James <james@xemacs.org>
parents: 2
diff changeset
17 along with XEmacs; see the file COPYING. If not, write to
03ab78e48ef6 Add copyright and license information based on Ben's recollections.
Jerry James <james@xemacs.org>
parents: 2
diff changeset
18 the Free Software Foundation, Inc., 51 Franklin St - Fifth Floor,
03ab78e48ef6 Add copyright and license information based on Ben's recollections.
Jerry James <james@xemacs.org>
parents: 2
diff changeset
19 Boston, MA 02110-1301, USA. */
03ab78e48ef6 Add copyright and license information based on Ben's recollections.
Jerry James <james@xemacs.org>
parents: 2
diff changeset
20
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
21 #include <Xm/Xm.h>
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
22 #include <Xm/RowColumn.h>
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
23 #include <Xm/Scale.h>
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
24 #include <Xm/PushB.h>
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
25 #include <Xm/Label.h>
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
26 #include <Xm/Text.h>
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
27 #include <Xm/PanedW.h>
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
28 #include "ExternalClient.h"
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
29
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
30 #ifdef TOOLTALK
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
31 #include <desktop/tt_c.h>
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
32 char *HxProcID;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
33 #endif
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
34
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
35 XtAppContext xt_app_con;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
36
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
37 void ScaleValueChangedCB(Widget scale, XtPointer app_data, XtPointer widget_data)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
38 {
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
39 XmScaleCallbackStruct *xms = (XmScaleCallbackStruct *) widget_data;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
40 Widget label = (Widget) app_data;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
41 char labelarr[10];
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
42 XmString labelstr;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
43 #if 0
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
44 sprintf(labelarr, "%d", xms->value);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
45 labelstr = XmStringCreateLocalized(labelarr);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
46 XtVaSetValues(label, XmNlabelString, labelstr, NULL);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
47 XmStringFree(labelstr);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
48 #endif
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
49 }
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
50
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
51 #ifdef TOOLTALK
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
52 static void
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
53 handle_tt_input(XtPointer client_data, int *source, XtInputId *id)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
54 {
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
55 Tt_message m = tt_message_receive();
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
56
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
57 if (m && !(tt_ptr_error(m))) {
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
58 tt_message_destroy(m);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
59 }
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
60 }
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
61
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
62 Tt_status
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
63 HxInitializeToolTalk()
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
64 {
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
65 static Boolean initialized = FALSE;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
66
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
67 if (!initialized) {
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
68 int fd;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
69 Tt_status status;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
70
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
71 HxProcID = tt_open();
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
72 fd = tt_fd();
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
73 if (TT_OK != (status = tt_session_join( tt_default_session() )))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
74 return status;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
75 (void)XtAppAddInput(xt_app_con, fd, (void *)XtInputReadMask, handle_tt_input, NULL);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
76 initialized = TRUE;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
77 }
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
78
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
79 return TT_OK;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
80 }
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
81 #endif
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
82
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
83 main(int argc, char **argv)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
84 {
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
85 Widget shell, rowcolumn, scale, pushbutton, label1, label2, text;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
86 Widget paned, text2;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
87 int n, i;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
88 Widget widlist[100];
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
89 Widget emacscli[100];
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
90 Arg args[100];
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
91 int no_ews = 1;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
92 char buf[100];
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
93
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
94 if (argc > 1)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
95 no_ews = atoi (argv[1]);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
96
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
97 shell = XtAppInitialize(&xt_app_con, "Testmotif", NULL, 0,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
98 &argc, argv, NULL, NULL, 0);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
99
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
100 #ifdef TOOLTALK
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
101 HxInitializeToolTalk();
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
102 #endif
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
103
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
104 rowcolumn = XmCreateRowColumn(shell, "rowcolumn", NULL, 0);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
105 XtManageChild(rowcolumn);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
106
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
107 n = 0;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
108 XtSetArg(args[n], XmNtraversalOn, TRUE); n++;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
109 #if 0
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
110 label1 = XmCreateLabel(rowcolumn, "label1", args, n);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
111 #endif
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
112 label1 = XtVaCreateWidget("label1", xmLabelWidgetClass, rowcolumn,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
113 XmNwidth, 50, XmNheight, 30,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
114 XmNtraversalOn, TRUE, NULL);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
115 label2 = XmCreateLabel(rowcolumn, "label2", NULL, 0);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
116 scale = XmCreateScale(rowcolumn, "scale", NULL, 0);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
117 XtAddCallback(scale, XmNvalueChangedCallback, ScaleValueChangedCB, label1);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
118 paned = XmCreatePanedWindow(rowcolumn, "paned", NULL, 0);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
119 n = 0;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
120 widlist[n++] = label1;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
121 widlist[n++] = label2;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
122 widlist[n++] = scale;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
123 widlist[n++] = paned;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
124 XtManageChildren(widlist, n);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
125
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
126 pushbutton = XmCreatePushButton(paned, "pushbutton", NULL, 0);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
127 text = XmCreateText(paned, "text", NULL, 0);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
128 for (i=0; i<no_ews; i++) {
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
129 sprintf (buf, "extcli%d", i);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
130 emacscli[i] = XtVaCreateWidget(buf, externalClientWidgetClass, paned,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
131 XmNwidth, 500, XmNheight, 200,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
132 XmNtraversalOn, TRUE,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
133 #ifdef TOOLTALK
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
134 XtNuseToolTalk, TRUE,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
135 #endif
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
136 NULL);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
137 }
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
138 text2 = XmCreateText(paned, "text2", NULL, 0);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
139 n = 0;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
140 widlist[n++] = pushbutton;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
141 widlist[n++] = text;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
142 for (i=0; i<no_ews; i++)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
143 widlist[n++] = emacscli[i];
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
144 widlist[n++] = text2;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
145 XtManageChildren(widlist, n);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
146
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
147 XtRealizeWidget(shell);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
148
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
149 {
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
150 XmString lab;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
151 char labarr[1000];
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
152 char tmpbuf[50];
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
153
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
154 strcpy (labarr, "window:");
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
155 for (i=0; i<no_ews; i++) {
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
156 sprintf (tmpbuf, " %d", XtWindow(emacscli[i]));
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
157 strcat (labarr, tmpbuf);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
158 }
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
159 lab = XmStringCreateLocalized(labarr);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
160 XtVaSetValues(label2, XmNlabelString, lab, NULL);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
161 XmStringFree(lab);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
162 }
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
163
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
164 XtAppMainLoop(xt_app_con);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
165 }