annotate src/input-method-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
parents 943eaba38521
children 7da79fbe37bb
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 /* Various functions for X11R5+ input methods, using the Motif XmIm* functions.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 input-method-xlib.c provides a lower-level implementation.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 Copyright (C) 1996 Sun Microsystems.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 for more details.
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 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 /* Synched up with: Not in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 /* Written by Martin Buchholz. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 #include <X11/Xlocale.h> /* More portable than <locale.h> ? */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 #include "lisp.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 #include "console-x.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 #include "device.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 #include "frame.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 #include "EmacsFrame.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 #include <Xm/Xm.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 #ifndef XIM_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 #error XIM_MOTIF is not defined??
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 /* Create X input method for device */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 XIM_init_device (struct device *d)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 /* Nothing to do */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46
651
98b3721724bd [xemacs-hg @ 2001-08-26 09:42:22 by stephent]
stephent
parents: 440
diff changeset
47 /* Callback for the deleting frame. */
98b3721724bd [xemacs-hg @ 2001-08-26 09:42:22 by stephent]
stephent
parents: 440
diff changeset
48 static void
98b3721724bd [xemacs-hg @ 2001-08-26 09:42:22 by stephent]
stephent
parents: 440
diff changeset
49 XIM_delete_frame (Widget w, XtPointer client_data, XtPointer call_data)
98b3721724bd [xemacs-hg @ 2001-08-26 09:42:22 by stephent]
stephent
parents: 440
diff changeset
50 {
98b3721724bd [xemacs-hg @ 2001-08-26 09:42:22 by stephent]
stephent
parents: 440
diff changeset
51 XmImUnregister ((Widget) client_data);
98b3721724bd [xemacs-hg @ 2001-08-26 09:42:22 by stephent]
stephent
parents: 440
diff changeset
52 }
98b3721724bd [xemacs-hg @ 2001-08-26 09:42:22 by stephent]
stephent
parents: 440
diff changeset
53
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 XIM_init_frame (struct frame *f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 Widget w = FRAME_X_TEXT_WIDGET (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 XPoint spot = {0,0};
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 XmFontList fontlist;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 XmFontListEntry fontlistEntry;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 typedef struct
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 XFontSet fontset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 Pixel fg;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 Pixel bg;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 } xim_resources_t;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 xim_resources_t xim_resources;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 /* mrb: #### Fix so that background and foreground is set from
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 default face, rather than foreground and background resources, or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 that the user can use set-frame-parameters to set xic attributes */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
75 #define res(name, class, representation, field, default_value) \
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
76 { name, class, representation, sizeof(xim_resources.field), \
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
77 XtOffsetOf(xim_resources_t, field), \
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
78 XtRString, (XtPointer) (default_value) }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 static XtResource resources[] =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 /* name class represent'n field default value */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 res(XtNfontSet, XtCFontSet, XtRFontSet, fontset, XtDefaultFontSet),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 res(XtNximForeground, XtCForeground, XtRPixel, fg, XtDefaultForeground),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 res(XtNximBackground, XtCBackground, XtRPixel, bg, XtDefaultBackground)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 XtGetApplicationResources (w, &xim_resources,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 resources, XtNumber (resources),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 NULL, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 if (! xim_resources.fontset)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 stderr_out ("Can't get fontset resource for Input Method\n");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 fontlistEntry = XmFontListEntryCreate(XmFONTLIST_DEFAULT_TAG,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 XmFONT_IS_FONTSET,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 (XtPointer) xim_resources.fontset);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 fontlist = XmFontListAppendEntry (NULL, fontlistEntry);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 XmImRegister (w, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 XmImVaSetValues (w,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 XmNfontList, fontlist,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 XmNforeground, xim_resources.fg,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 XmNbackground, xim_resources.bg,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 XmNspotLocation, &spot,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 /* XmNlineSpace, 0, */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 NULL);
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 XmFontListEntryFree (&fontlistEntry);
651
98b3721724bd [xemacs-hg @ 2001-08-26 09:42:22 by stephent]
stephent
parents: 440
diff changeset
112
98b3721724bd [xemacs-hg @ 2001-08-26 09:42:22 by stephent]
stephent
parents: 440
diff changeset
113 XtAddCallback (w, XmNdestroyCallback, XIM_delete_frame, (XtPointer) w);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 XIM_SetGeometry (struct frame *f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 XIM_SetSpotLocation (struct frame *f, int x, int y)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
124 /* #### FIX: Must make sure spot fits within Preedit Area */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 XPoint *spot = &(FRAME_X_XIC_SPOT (f));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 if (spot->x == (short) x &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 spot->y == (short) y)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 spot->x = (short) x;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 spot->y = (short) y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 XmImVaSetValues (FRAME_X_TEXT_WIDGET (f), XmNspotLocation, spot, NULL);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 XIM_focus_event (struct frame *f, int in_p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 if (in_p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 XmImVaSetFocusValues (FRAME_X_TEXT_WIDGET (f), NULL);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 XmImUnsetFocus (FRAME_X_TEXT_WIDGET (f));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 vars_of_input_method_motif (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 Fprovide (intern ("xim"));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 }