annotate etc/tests/external-widget/test-ew-motif.c @ 800:a5954632b187

[xemacs-hg @ 2002-03-31 08:27:14 by ben] more fixes, first crack at finishing behavior implementation TODO.ben-mule-21-5: Update. configure.in: Fix for new error-checking types. make-mswin-unicode.pl: Don't be fucked up by CRLF. Output code to force errors when nonintercepted Windows calls issued. behavior.el, dumped-lisp.el, menubar-items.el: Add support for saving using custom. Load into a dumped XEmacs. Correct :title to :short-doc in accordance with behavior-defs.el. Add a submenu under Options for turning on/off behaviors. cl-macs.el: Properly document `loop'. Fix a minor bug in keymap iteration and add support for bit-vector iteration. lisp-mode.el: Rearrange and add items for macro expanding. menubar-items.el: Document connection between these two functions. window.el: Port stuff from GNU 21.1. config.inc.samp, xemacs.mak: Separate out and add new variable for controlling error-checking. s/windowsnt.h: Use new ERROR_CHECK_ALL; not related to DEBUG_XEMACS. alloc.c, backtrace.h, buffer.c, buffer.h, bytecode.c, callproc.c, casetab.c, charset.h, chartab.c, cmdloop.c, config.h.in, console-msw.c, console-stream.c, console-tty.c, console.c, console.h, data.c, device-msw.c, device.c, device.h, dired-msw.c, dired.c, dumper.c, editfns.c, eldap.c, elhash.c, emacs.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, events.c, extents.c, faces.c, file-coding.c, file-coding.h, fileio.c, frame-msw.c, frame.c, frame.h, glyphs-gtk.c, glyphs-msw.c, glyphs-shared.c, glyphs-widget.c, glyphs-x.c, glyphs.c, glyphs.h, insdel.c, intl-auto-encap-win32.c, intl-auto-encap-win32.h, intl-encap-win32.c, intl-win32.c, keymap.c, lisp-union.h, lisp.h, lread.c, lrecord.h, lstream.c, lstream.h, macros.c, marker.c, md5.c, menubar-x.c, menubar.c, mule-coding.c, ntproc.c, objects-gtk.c, objects-msw.c, objects-x.c, objects.c, opaque.c, print.c, process-nt.c, process-unix.c, process.c, rangetab.c, redisplay-msw.c, redisplay-output.c, redisplay.c, regex.c, scrollbar-msw.c, select-msw.c, signal.c, specifier.c, specifier.h, symbols.c, sysdep.c, syswindows.h, text.c, text.h, toolbar-msw.c, tooltalk.c, ui-gtk.c, unicode.c, window.c: Redo error-checking macros: ERROR_CHECK_TYPECHECK -> ERROR_CHECK_TYPES, ERROR_CHECK_CHARBPOS -> ERROR_CHECK_TEXT, add ERROR_CHECK_DISPLAY, ERROR_CHECK_STRUCTURES. Document these in config.h.in. Fix code to follow docs. Fix *_checking_assert() in accordance with new names. Attempt to fix periodic redisplay crash freeing display line structures. Add first implementation of sledgehammer redisplay check. Redo print_*() to use write_fmt_string(), write_fmt_string_lisp(). Fix bug in md5 handling. Rename character-to-unicode to char-to-unicode; same for unicode-to-char{acter}. Move chartab documentation to `make-char-table'. Some header cleanup. Clean up remaining places where nonintercepted Windows calls are being used. automated/mule-tests.el: Fix for new Unicode support.
author ben
date Sun, 31 Mar 2002 08:30:17 +0000 (2002-03-31)
parents ac2d302a0011
children 03ab78e48ef6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
1 #include <Xm/Xm.h>
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
2 #include <Xm/RowColumn.h>
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
3 #include <Xm/Scale.h>
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
4 #include <Xm/PushB.h>
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
5 #include <Xm/Label.h>
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
6 #include <Xm/Text.h>
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
7 #include <Xm/PanedW.h>
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
8 #include "ExternalClient.h"
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
9
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
10 #ifdef TOOLTALK
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
11 #include <desktop/tt_c.h>
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
12 char *HxProcID;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
13 #endif
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
14
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
15 XtAppContext xt_app_con;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
16
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
17 void ScaleValueChangedCB(Widget scale, XtPointer app_data, XtPointer widget_data)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
18 {
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
19 XmScaleCallbackStruct *xms = (XmScaleCallbackStruct *) widget_data;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
20 Widget label = (Widget) app_data;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
21 char labelarr[10];
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
22 XmString labelstr;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
23 #if 0
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
24 sprintf(labelarr, "%d", xms->value);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
25 labelstr = XmStringCreateLocalized(labelarr);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
26 XtVaSetValues(label, XmNlabelString, labelstr, NULL);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
27 XmStringFree(labelstr);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
28 #endif
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
29 }
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
30
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
31 #ifdef TOOLTALK
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
32 static void
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
33 handle_tt_input(XtPointer client_data, int *source, XtInputId *id)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
34 {
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
35 Tt_message m = tt_message_receive();
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
36
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
37 if (m && !(tt_ptr_error(m))) {
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
38 tt_message_destroy(m);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
39 }
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
40 }
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
41
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
42 Tt_status
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
43 HxInitializeToolTalk()
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
44 {
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
45 static Boolean initialized = FALSE;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
46
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
47 if (!initialized) {
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
48 int fd;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
49 Tt_status status;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
50
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
51 HxProcID = tt_open();
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
52 fd = tt_fd();
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
53 if (TT_OK != (status = tt_session_join( tt_default_session() )))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
54 return status;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
55 (void)XtAppAddInput(xt_app_con, fd, (void *)XtInputReadMask, handle_tt_input, NULL);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
56 initialized = TRUE;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
57 }
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
58
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
59 return TT_OK;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
60 }
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
61 #endif
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
62
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
63 main(int argc, char **argv)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
64 {
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
65 Widget shell, rowcolumn, scale, pushbutton, label1, label2, text;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
66 Widget paned, text2;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
67 int n, i;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
68 Widget widlist[100];
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
69 Widget emacscli[100];
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
70 Arg args[100];
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
71 int no_ews = 1;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
72 char buf[100];
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
73
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
74 if (argc > 1)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
75 no_ews = atoi (argv[1]);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
76
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
77 shell = XtAppInitialize(&xt_app_con, "Testmotif", NULL, 0,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
78 &argc, argv, NULL, NULL, 0);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
79
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
80 #ifdef TOOLTALK
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
81 HxInitializeToolTalk();
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
82 #endif
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
83
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
84 rowcolumn = XmCreateRowColumn(shell, "rowcolumn", NULL, 0);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
85 XtManageChild(rowcolumn);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
86
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
87 n = 0;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
88 XtSetArg(args[n], XmNtraversalOn, TRUE); n++;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
89 #if 0
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
90 label1 = XmCreateLabel(rowcolumn, "label1", args, n);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
91 #endif
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
92 label1 = XtVaCreateWidget("label1", xmLabelWidgetClass, rowcolumn,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
93 XmNwidth, 50, XmNheight, 30,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
94 XmNtraversalOn, TRUE, NULL);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
95 label2 = XmCreateLabel(rowcolumn, "label2", NULL, 0);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
96 scale = XmCreateScale(rowcolumn, "scale", NULL, 0);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
97 XtAddCallback(scale, XmNvalueChangedCallback, ScaleValueChangedCB, label1);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
98 paned = XmCreatePanedWindow(rowcolumn, "paned", NULL, 0);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
99 n = 0;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
100 widlist[n++] = label1;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
101 widlist[n++] = label2;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
102 widlist[n++] = scale;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
103 widlist[n++] = paned;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
104 XtManageChildren(widlist, n);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
105
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
106 pushbutton = XmCreatePushButton(paned, "pushbutton", NULL, 0);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
107 text = XmCreateText(paned, "text", NULL, 0);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
108 for (i=0; i<no_ews; i++) {
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
109 sprintf (buf, "extcli%d", i);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
110 emacscli[i] = XtVaCreateWidget(buf, externalClientWidgetClass, paned,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
111 XmNwidth, 500, XmNheight, 200,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
112 XmNtraversalOn, TRUE,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
113 #ifdef TOOLTALK
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
114 XtNuseToolTalk, TRUE,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
115 #endif
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
116 NULL);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
117 }
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
118 text2 = XmCreateText(paned, "text2", 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++] = pushbutton;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
121 widlist[n++] = text;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
122 for (i=0; i<no_ews; i++)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
123 widlist[n++] = emacscli[i];
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
124 widlist[n++] = text2;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
125 XtManageChildren(widlist, n);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
126
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
127 XtRealizeWidget(shell);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
128
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
129 {
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
130 XmString lab;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
131 char labarr[1000];
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
132 char tmpbuf[50];
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
133
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
134 strcpy (labarr, "window:");
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
135 for (i=0; i<no_ews; i++) {
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
136 sprintf (tmpbuf, " %d", XtWindow(emacscli[i]));
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
137 strcat (labarr, tmpbuf);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
138 }
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
139 lab = XmStringCreateLocalized(labarr);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
140 XtVaSetValues(label2, XmNlabelString, lab, NULL);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
141 XmStringFree(lab);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
142 }
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
143
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
144 XtAppMainLoop(xt_app_con);
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
145 }