annotate lib/OnConv.c @ 21:7a454839a6de default tip

add some missing header files
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Tue, 09 Mar 2010 19:02:39 +0900
parents 55ed5c42c22f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1 #ifndef lint
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
2 static char *rcsid = "$Id: OnConv.c,v 10.9 1999/05/19 08:52:42 ishisone Exp $";
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
3 #endif
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
4 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
5 * Copyright (c) 1990 Software Research Associates, Inc.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
6 * Copyright (c) 1999 Kazuki YASUMATSU
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
7 *
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
8 * Permission to use, copy, modify, and distribute this software and its
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
9 * documentation for any purpose and without fee is hereby granted, provided
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
10 * that the above copyright notice appear in all copies and that both that
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
11 * copyright notice and this permission notice appear in supporting
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
12 * documentation, and that the name of Software Research Associates not be
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
13 * used in advertising or publicity pertaining to distribution of the
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
14 * software without specific, written prior permission. Software Research
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
15 * Associates makes no representations about the suitability of this software
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
16 * for any purpose. It is provided "as is" without express or implied
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
17 * warranty.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
18 *
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
19 * Author: Makoto Ishisone, Software Research Associates, Inc., Japan
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
20 * Author: Kazuki YASUMATSU (Kazuki.Yasumatsu@fujixerox.co.jp)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
21 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
22
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
23
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
24 #include <X11/IntrinsicP.h>
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
25 #include <X11/StringDefs.h>
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
26 #include <X11/Xmu/Atoms.h>
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
27 #if XtSpecificationRelease > 4
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
28 #include <X11/Xfuncs.h>
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
29 #endif
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
30 #include "CachedAtom.h"
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
31 #include "AsyncErr.h"
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
32 #include "OnConvP.h"
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
33 #include "InputConv.h"
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
34 #include "ConvDisp.h"
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
35 #include "CandPanel.h"
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
36 #include "AuxPanel.h"
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
37 #include "ICLabel.h"
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
38
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
39 #define DEBUG_VAR debug_OnTheSpotConversion
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
40 #include "DebugPrint.h"
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
41
18
07a41a882b14 imported patch 21_kinput2-v3.1-rootwindow-1.patch
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
42 #define CloseWindowProtection(w) \
07a41a882b14 imported patch 21_kinput2-v3.1-rootwindow-1.patch
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
43 {\
07a41a882b14 imported patch 21_kinput2-v3.1-rootwindow-1.patch
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
44 Atom protocols;\
07a41a882b14 imported patch 21_kinput2-v3.1-rootwindow-1.patch
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
45 protocols = XInternAtom(XtDisplay(w), "WM_DELETE_WINDOW", False);\
07a41a882b14 imported patch 21_kinput2-v3.1-rootwindow-1.patch
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
46 XSetWMProtocols(XtDisplay(w), XtWindow(w), &protocols, 1);\
07a41a882b14 imported patch 21_kinput2-v3.1-rootwindow-1.patch
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
47 }
07a41a882b14 imported patch 21_kinput2-v3.1-rootwindow-1.patch
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
48
07a41a882b14 imported patch 21_kinput2-v3.1-rootwindow-1.patch
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
49
0
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
50 /*- resource table -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
51 static XtResource resources[] = {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
52 #define offset(field) XtOffset(OnTheSpotConversionWidget, onthespot.field)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
53 { XtNpreeditStartCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList),
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
54 offset(preeditstartcallback), XtRCallback, (XtPointer)NULL },
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
55 { XtNpreeditDoneCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList),
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
56 offset(preeditdonecallback), XtRCallback, (XtPointer)NULL },
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
57 { XtNpreeditDrawCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList),
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
58 offset(preeditdrawcallback), XtRCallback, (XtPointer)NULL },
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
59 { XtNpreeditCaretCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList),
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
60 offset(preeditcaretcallback), XtRCallback, (XtPointer)NULL },
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
61 { XtNstatusStartCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList),
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
62 offset(statusstartcallback), XtRCallback, (XtPointer)NULL },
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
63 { XtNstatusDoneCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList),
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
64 offset(statusdonecallback), XtRCallback, (XtPointer)NULL },
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
65 { XtNstatusDrawCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList),
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
66 offset(statusdrawcallback), XtRCallback, (XtPointer)NULL },
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
67 { XtNfeedbackAttributes, XtCFeedbackAttributes,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
68 XtRFeedbackAttributes, sizeof(FeedbackAttributes),
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
69 offset(feedbackattrs), XtRString, (XtPointer)"U,,R,H" },
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
70 #undef offset
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
71 };
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
72
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
73 /*- default translations -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
74 static char translations[] = "<Key>: to-inputobj()"; /* same as superclass's */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
75
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
76 /*- declarations of local structures -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
77 typedef struct {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
78 int attrs_length;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
79 int attrs_limit;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
80 unsigned long *attrs_buffer;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
81 } AttributeBuffer;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
82
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
83 /*- declarations of static functions -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
84 static void ClassInitialize();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
85 static void Initialize();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
86 static void Destroy();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
87 static Boolean SetValues();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
88
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
89 static void ConversionStartup();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
90 static void ConversionFinish();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
91 static void ChangeAttributes();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
92 static void ChangeFocus();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
93
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
94 static void StringToFeedbackAttrs();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
95
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
96 static Widget CreateSelectionWidget();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
97
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
98 static void UpdateText();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
99 static void CommitText();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
100 static void UpdateMode();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
101 static void SelectionControl();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
102
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
103 static void SelectionStart();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
104 static void LocateSelectionPopup();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
105 static void SelectionEnd();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
106 static void SelectionSet();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
107 static void SelectionGet();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
108 static void SelectionMove();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
109
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
110 static Widget CreateAuxWidget();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
111 static void AuxControl();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
112 static void AuxStart();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
113 static void AuxEnd();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
114 static void AuxChange();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
115 static void LocateAuxPopup();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
116
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
117 static void SelectionSelected();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
118
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
119 static Boolean SafeGetWindowAttributes();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
120 static void MoveShell();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
121 static Window getToplevelWindow();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
122 static void setTransientFor();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
123 static void allocDisplaySegments();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
124 static void freeDisplaySegment();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
125 static void clearAllDisplaySegments();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
126 static void copyString();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
127 static void freeString();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
128 static AttributeBuffer *allocAttributeBuffer();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
129 static void destroyAttributeBuffer();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
130 static void addAttributeBuffer();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
131 static unsigned long attrToFeedback();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
132 static void CBPreeditStart();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
133 static void CBPreeditDone();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
134 static void CBPreeditDraw();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
135 static void CBPreeditCaret();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
136 static void CBStatusStart();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
137 static void CBStatusDone();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
138 static void CBStatusDraw();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
139
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
140 /*- composite-extension rec: for enabling non-widget children -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
141 static CompositeClassExtensionRec CompositeExtension = {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
142 /* next_extension */ NULL,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
143 /* record_type */ NULLQUARK,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
144 /* version */ XtCompositeExtensionVersion,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
145 /* record_size */ sizeof(CompositeClassExtensionRec),
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
146 /* accept_objects */ True,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
147 };
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
148
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
149 /*- onTheSpotConversionClass record -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
150 OnTheSpotConversionClassRec onTheSpotConversionClassRec = {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
151 { /* core fields */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
152 /* superclass */ (WidgetClass)&conversionControlClassRec,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
153 /* class_name */ "OnTheSpotConversion",
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
154 /* widget_size */ sizeof(OnTheSpotConversionRec),
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
155 /* class_initialize */ ClassInitialize,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
156 /* class_part_initialize */ NULL,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
157 /* class_inited */ FALSE,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
158 /* initialize */ Initialize,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
159 /* initialize_hook */ NULL,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
160 /* realize */ XtInheritRealize,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
161 /* actions */ NULL,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
162 /* num_actions */ 0,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
163 /* resources */ resources,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
164 /* num_resources */ XtNumber(resources),
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
165 /* xrm_class */ NULLQUARK,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
166 /* compress_motion */ TRUE,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
167 /* compress_exposure */ TRUE,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
168 /* compress_enterleave */ TRUE,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
169 /* visible_interest */ FALSE,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
170 /* destroy */ Destroy,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
171 /* resize */ XtInheritResize,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
172 /* expose */ NULL,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
173 /* set_values */ SetValues,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
174 /* set_values_hook */ NULL,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
175 /* set_values_almost */ XtInheritSetValuesAlmost,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
176 /* get_values_hook */ NULL,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
177 /* accept_focus */ NULL,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
178 /* version */ XtVersion,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
179 /* callback_private */ NULL,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
180 /* tm_table */ translations,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
181 /* query_geometry */ XtInheritQueryGeometry,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
182 /* display_accelerator */ XtInheritDisplayAccelerator,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
183 /* extension */ NULL
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
184 },
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
185 { /* composite fields */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
186 /* geometry_manager */ XtInheritGeometryManager,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
187 /* change_managed */ XtInheritChangeManaged,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
188 /* insert_child */ XtInheritInsertChild,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
189 /* delete_child */ XtInheritDeleteChild,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
190 /* extension */ (XtPointer)&CompositeExtension,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
191 },
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
192 { /* shell fields */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
193 /* extension */ NULL
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
194 },
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
195 { /* wm_shell fields */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
196 /* extension */ NULL
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
197 },
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
198 { /* vendor_shell fields */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
199 /* extension */ NULL
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
200 },
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
201 { /* transient_shell fields */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
202 /* extension */ NULL
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
203 },
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
204 { /* conversionControl fields */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
205 /* Startup */ ConversionStartup,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
206 /* Finish */ ConversionFinish,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
207 /* ChangeAttributes */ ChangeAttributes,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
208 /* ChangeFocus */ ChangeFocus,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
209 /* TextChange */ UpdateText,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
210 /* Fix */ CommitText,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
211 /* ModeChange */ UpdateMode,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
212 /* SelectionControl */ SelectionControl,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
213 /* AuxControl */ AuxControl,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
214 },
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
215 { /* onTheSpotConversion fields */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
216 /* empty */ 0
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
217 },
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
218 };
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
219
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
220 WidgetClass onTheSpotConversionWidgetClass = (WidgetClass)&onTheSpotConversionClassRec;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
221
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
222 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
223 *+ Core class method
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
224 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
225
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
226 /*- ClassInitialize: class initializer -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
227 /* ARGSUSED */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
228 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
229 ClassInitialize()
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
230 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
231 /* add String -> FeedbackAttributes converter */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
232 XtAddConverter(XtRString, XtRFeedbackAttributes, StringToFeedbackAttrs,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
233 (XtConvertArgList)NULL, (Cardinal)0);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
234 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
235
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
236 /*- Initialize: initalize method -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
237 /* ARGSUSED */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
238 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
239 Initialize(req, new, args, num_args)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
240 Widget req;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
241 Widget new;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
242 ArgList args;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
243 Cardinal *num_args;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
244 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
245 OnTheSpotConversionWidget ocw = (OnTheSpotConversionWidget)new;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
246
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
247 (void)CreateSelectionWidget(ocw);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
248 (void)CreateAuxWidget(ocw);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
249
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
250 ocw->onthespot.dispsegments = NULL;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
251 ocw->onthespot.numsegments = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
252 ocw->onthespot.dispsegmentsize = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
253 ocw->onthespot.candlist = NULL;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
254 ocw->onthespot.numcands = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
255 ocw->onthespot.selectionpoppedup = False;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
256 ocw->onthespot.auxpoppedup = False;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
257 ocw->onthespot.lastcaret = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
258 ocw->onthespot.fixnotify = False;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
259 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
260
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
261 /*- Destroy: destroy method -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
262 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
263 Destroy(w)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
264 Widget w;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
265 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
266 OnTheSpotConversionWidget ocw = (OnTheSpotConversionWidget)w;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
267
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
268 /* $B%G%#%9%W%l%$%;%0%a%s%H$NNN0h$r2rJ|(B */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
269 if (ocw->onthespot.dispsegments) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
270 DisplaySegment *dsp = ocw->onthespot.dispsegments;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
271 int i;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
272
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
273 for (i = 0; i < ocw->onthespot.numsegments; i++) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
274 freeString(&dsp[i].seg);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
275 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
276 XtFree((char *)dsp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
277 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
278 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
279
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
280 /*- SetValues: setvalues method -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
281 /* ARGSUSED */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
282 static Boolean
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
283 SetValues(cur, req, new, args, num_args)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
284 Widget cur;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
285 Widget req;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
286 Widget new;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
287 ArgList args;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
288 Cardinal *num_args;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
289 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
290 /* OnTheSpotConversionWidget ocw = (OnTheSpotConversionWidget)new; */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
291 return False;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
292 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
293
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
294 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
295 *+ ConversionControl class method
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
296 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
297
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
298 /*- ConversionStartup: class specific conversion startup -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
299 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
300 ConversionStartup(widget, valuemask, value)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
301 Widget widget;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
302 unsigned long valuemask;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
303 ConversionAttributes *value;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
304 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
305 OnTheSpotConversionWidget ocw = (OnTheSpotConversionWidget)widget;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
306 Widget inputobj = ocw->ccontrol.inputobj;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
307 Window toplevel;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
308
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
309 TRACE(("OnTheSpot:ConversionStartup()\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
310
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
311 /* $BFbIt$N%P%C%U%!$r%/%j%"$9$k(B */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
312 clearAllDisplaySegments(ocw);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
313
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
314 /* WM_TRANSIENT_FOR $B%W%m%Q%F%#$r@5$7$/%;%C%H$9$k(B */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
315 toplevel = getToplevelWindow(XtDisplay(widget),
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
316 ocw->ccontrol.clientwindow);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
317 setTransientFor(ocw->onthespot.selectionshell, toplevel);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
318 setTransientFor(ocw->onthespot.auxshell, toplevel);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
319
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
320 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
321 * OnTheSpotConvesion $B$N(B widget $B<+BN$O%]%C%W%"%C%W$5$;$J$$$,!"(B
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
322 * $B%P%C%/%(%s%I%?%$%W$N;~$K$O%/%i%$%"%s%H$,$3$N(B widget $B$N(B
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
323 * $B%&%#%s%I%&$KBP$7$F%$%Y%s%H$rAw$k$N$G(B Realize $B$@$1$7$F$*$/(B
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
324 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
325 if (!XtIsRealized(widget)) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
326 Arg args[2];
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
327
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
328 XtSetArg(args[0], XtNwidth, 1);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
329 XtSetArg(args[1], XtNheight, 1);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
330 XtSetValues(widget, args, 2);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
331 XtRealizeWidget(widget);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
332 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
333
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
334 ocw->onthespot.lastcaret = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
335 ocw->onthespot.fixnotify = False;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
336
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
337 /* $B%9%F!<%?%9$r99?7$9$k(B */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
338 UpdateMode(widget);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
339
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
340 /* $B%W%l%(%G%#%C%H$r3+;O$9$k(B */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
341 CBPreeditStart(widget);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
342 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
343
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
344 /*- ConversionFinish: class specific conversion finish -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
345 /* ARGSUSED */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
346 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
347 ConversionFinish(w)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
348 Widget w;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
349 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
350 OnTheSpotConversionWidget ocw = (OnTheSpotConversionWidget)w;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
351 Atom encoding = XA_COMPOUND_TEXT(XtDisplayOfObject(w));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
352 int format = 8;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
353
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
354 if (!ocw->onthespot.fixnotify) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
355 /* $B3NDj$7$F$$$J$$(B */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
356 DisplaySegment *dseg = ocw->onthespot.dispsegments;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
357 int i, len = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
358 for (i = 0; i < ocw->onthespot.numsegments; i++, dseg++) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
359 len += dseg->seg.nchars;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
360 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
361 if (len > 0) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
362 /* $B%W%l%(%G%#%C%H%P%C%U%!$N>C5n(B */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
363 unsigned long attr = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
364 CBPreeditDraw(ocw, 0, 0, len, encoding, format, 0, (XPointer)"",
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
365 0, &attr);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
366 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
367 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
368
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
369 /* $B%W%l%(%G%#%C%H$r=*N;$9$k(B */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
370 CBPreeditDone(w);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
371
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
372 /* $B%9%F!<%?%9$r99?7(B($B=i4|2=(B)$B$9$k(B */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
373 CBStatusDraw(ocw, encoding, format, 0, (XPointer)"", 0);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
374
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
375 if (ocw->onthespot.selectionpoppedup) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
376 XtPopdown(ocw->onthespot.selectionshell);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
377 ocw->onthespot.selectionpoppedup = False;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
378 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
379 if (ocw->onthespot.auxpoppedup) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
380 XtPopdown(ocw->onthespot.auxshell);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
381 ocw->onthespot.auxpoppedup = False;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
382 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
383 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
384
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
385 /*- ChangeAttributes: class specific conversion attribute change routine -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
386 /* ARGSUSED */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
387 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
388 ChangeAttributes(w, valuemask, value)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
389 Widget w;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
390 unsigned long valuemask;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
391 ConversionAttributes *value;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
392 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
393 /* do nothing */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
394 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
395
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
396 /*- ChangeFocus: class specific conversion attribute change routine -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
397 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
398 ChangeFocus(w, set)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
399 Widget w;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
400 int set;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
401 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
402 if (set) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
403 UpdateMode(w);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
404 } else {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
405 #if 0
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
406 /* $B%U%)!<%+%9$r<:$C$?>l9g$K$O2?$b$7$J$$(B */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
407 OnTheSpotConversionWidget ocw = (OnTheSpotConversionWidget)w;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
408 Atom encoding = XA_COMPOUND_TEXT(XtDisplayOfObject(w));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
409 int format = 8;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
410
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
411 CBStatusDraw(ocw, encoding, format, 0, (XPointer)"", 0);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
412 #endif
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
413 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
414 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
415
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
416 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
417 *+ resource converter
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
418 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
419
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
420 /*- StringToFeedbackAttrs: string to feedback attiributes converter -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
421 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
422 StringToFeedbackAttrs(args, num_args, from, to)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
423 XrmValue *args;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
424 Cardinal *num_args;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
425 XrmValue *from;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
426 XrmValue *to;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
427 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
428 char *s = (char *)from->addr;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
429 int idx;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
430 int invalid = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
431 static FeedbackAttributes fba;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
432
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
433 for (idx = 0; idx < 4; idx++) fba.feedbacks[idx] = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
434
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
435 for (idx = 0; idx < 4; idx++) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
436 int c;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
437 unsigned long fb = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
438
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
439 while ((c = *s++) != ',' && c != '\0') {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
440 switch (c) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
441 case 'R': case 'r': fb |= XIMReverse; break;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
442 case 'U': case 'u': fb |= XIMUnderline; break;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
443 case 'H': case 'h': fb |= XIMHighlight; break;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
444 case 'P': case 'p': fb |= XIMPrimary; break;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
445 case 'S': case 's': fb |= XIMSecondary; break;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
446 case 'T': case 't': fb |= XIMTertiary; break;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
447 case ' ': case '\t':
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
448 break;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
449 default:
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
450 invalid++;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
451 break;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
452 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
453 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
454 fba.feedbacks[idx] = fb;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
455 if (c == '\0') break;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
456 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
457
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
458 if (invalid) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
459 XtStringConversionWarning((char *)from->addr, XtRFeedbackAttributes);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
460 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
461 to->size = sizeof(fba);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
462 to->addr = (caddr_t)&fba;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
463 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
464
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
465 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
466 *+ sub-widget creation
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
467 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
468
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
469 /*- CreateSelectionWidget: create selection widget for selecting candidates -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
470 static Widget
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
471 CreateSelectionWidget(ocw)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
472 OnTheSpotConversionWidget ocw;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
473 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
474 Widget shell, sel;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
475
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
476 /* set width/height so that XtRealizeWidget() doesn't cause error */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
477 shell = XtVaCreatePopupShell("selectionShell",
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
478 transientShellWidgetClass,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
479 (Widget)ocw,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
480 XtNwidth, 1,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
481 XtNheight, 1,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
482 NULL);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
483 ocw->onthespot.selectionshell = shell;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
484
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
485 sel = XtCreateManagedWidget("selection", candidatePanelWidgetClass,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
486 shell, NULL, 0);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
487 (void)XtCreateWidget("display", ocw->ccontrol.displayobjclass, sel,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
488 NULL, 0);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
489 XtAddCallback(sel, XtNcallback, SelectionSelected, (XtPointer)ocw);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
490 XtInstallAccelerators(sel, (Widget)ocw);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
491
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
492 ocw->onthespot.selectionwidget = sel;
19
55ed5c42c22f imported patch 22_kinput2-override_redirect.patch
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 18
diff changeset
493 setMwmHints(shell);
55ed5c42c22f imported patch 22_kinput2-override_redirect.patch
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 18
diff changeset
494 {
55ed5c42c22f imported patch 22_kinput2-override_redirect.patch
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 18
diff changeset
495 XSetWindowAttributes attr;
55ed5c42c22f imported patch 22_kinput2-override_redirect.patch
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 18
diff changeset
496
55ed5c42c22f imported patch 22_kinput2-override_redirect.patch
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 18
diff changeset
497 attr.override_redirect = True;
55ed5c42c22f imported patch 22_kinput2-override_redirect.patch
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 18
diff changeset
498 XChangeWindowAttributes (XtDisplay (shell), XtWindow (shell),
55ed5c42c22f imported patch 22_kinput2-override_redirect.patch
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 18
diff changeset
499 CWOverrideRedirect, &attr);
55ed5c42c22f imported patch 22_kinput2-override_redirect.patch
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 18
diff changeset
500 }
0
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
501
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
502 return shell;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
503 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
504
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
505 /*- CreateAuxWidget: create aux widget for display auxiliary data -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
506 static Widget
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
507 CreateAuxWidget(ocw)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
508 OnTheSpotConversionWidget ocw;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
509 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
510 Widget shell, sel;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
511
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
512 /* set width/height so that XtRealizeWidget() doesn't cause error */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
513 shell = XtVaCreatePopupShell("auxShell",
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
514 transientShellWidgetClass,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
515 (Widget)ocw,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
516 XtNwidth, 1,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
517 XtNheight, 1,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
518 XtNallowShellResize, True,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
519 NULL);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
520 ocw->onthespot.auxshell = shell;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
521
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
522 sel = XtCreateManagedWidget("aux", auxPanelWidgetClass,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
523 shell, NULL, 0);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
524 (void)XtCreateWidget("display", ocw->ccontrol.displayobjclass, sel,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
525 NULL, 0);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
526 XtAddCallback(sel, XtNcallback, SelectionSelected, (XtPointer)ocw);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
527 XtInstallAccelerators(sel, (Widget)ocw);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
528
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
529 ocw->onthespot.auxwidget = sel;
19
55ed5c42c22f imported patch 22_kinput2-override_redirect.patch
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 18
diff changeset
530 setMwmHints(shell);
55ed5c42c22f imported patch 22_kinput2-override_redirect.patch
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 18
diff changeset
531 {
55ed5c42c22f imported patch 22_kinput2-override_redirect.patch
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 18
diff changeset
532 XSetWindowAttributes attr;
55ed5c42c22f imported patch 22_kinput2-override_redirect.patch
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 18
diff changeset
533
55ed5c42c22f imported patch 22_kinput2-override_redirect.patch
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 18
diff changeset
534 attr.override_redirect = True;
55ed5c42c22f imported patch 22_kinput2-override_redirect.patch
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 18
diff changeset
535 XChangeWindowAttributes (XtDisplay (shell), XtWindow (shell),
55ed5c42c22f imported patch 22_kinput2-override_redirect.patch
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 18
diff changeset
536 CWOverrideRedirect, &attr);
55ed5c42c22f imported patch 22_kinput2-override_redirect.patch
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 18
diff changeset
537 }
0
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
538
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
539 return shell;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
540 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
541
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
542 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
543 *+ inputobject callback
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
544 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
545
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
546 /*- UpdateText: update text -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
547 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
548 UpdateText(w)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
549 Widget w;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
550 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
551 OnTheSpotConversionWidget ocw = (OnTheSpotConversionWidget)w;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
552 Widget inputobj = ocw->ccontrol.inputobj;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
553 int nnew = ICNumSegments(inputobj);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
554 int nold = ocw->onthespot.numsegments;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
555 FeedbackAttributes *fba = &ocw->onthespot.feedbackattrs;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
556 Cardinal cseg, caret;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
557 ICString *newseg;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
558 DisplaySegment *dseg;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
559 Boolean changed;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
560 int chgseg, chgoffset;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
561 int oldlen;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
562 AttributeBuffer *buffer;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
563 int i;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
564 int diff;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
565 Cardinal nsame;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
566
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
567 TRACE(("OnTheSpotConversion:UpdateText() nnew=%d\n", nnew));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
568
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
569 ocw->onthespot.fixnotify = False;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
570
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
571 if (!ICCursorPos(inputobj, &cseg, &caret)) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
572 cseg = nnew;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
573 caret = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
574 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
575
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
576 allocDisplaySegments(ocw, nnew);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
577
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
578 changed = False;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
579 chgseg = chgoffset = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
580 oldlen = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
581 buffer = allocAttributeBuffer();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
582 for (i = 0, dseg = ocw->onthespot.dispsegments; i < nnew; i++, dseg++) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
583 newseg = ICGetSegment(inputobj, i);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
584 if (i < cseg) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
585 caret += newseg->nchars;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
586 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
587 if (i >= nold) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
588 copyString(newseg, &dseg->seg);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
589 addAttributeBuffer(buffer, inputobj, newseg, 0, fba);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
590 if (!changed) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
591 chgseg = i;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
592 chgoffset = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
593 changed = True;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
594 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
595 } else {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
596 oldlen += dseg->seg.nchars;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
597 diff = ICCompareSegment(inputobj, newseg, &dseg->seg, &nsame);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
598 switch (diff) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
599 case ICSame:
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
600 if (changed) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
601 addAttributeBuffer(buffer, inputobj, newseg, 0, fba);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
602 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
603 break;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
604 case ICAttrChanged:
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
605 dseg->seg.attr = newseg->attr;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
606 addAttributeBuffer(buffer, inputobj, newseg, 0, fba);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
607 if (!changed) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
608 chgseg = i;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
609 chgoffset = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
610 changed = True;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
611 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
612 break;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
613 case ICStringChanged:
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
614 freeString(&dseg->seg);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
615 copyString(newseg, &dseg->seg);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
616 if (!changed) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
617 addAttributeBuffer(buffer, inputobj, newseg, nsame, fba);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
618 chgseg = i;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
619 chgoffset = nsame;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
620 changed = True;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
621 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
622 else {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
623 addAttributeBuffer(buffer, inputobj, newseg, 0, fba);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
624 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
625 break;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
626 default: /* ICAttrChanged | ICStringChanged */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
627 freeString(&dseg->seg);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
628 copyString(newseg, &dseg->seg);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
629 addAttributeBuffer(buffer, inputobj, newseg, 0, fba);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
630 if (!changed) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
631 chgseg = i;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
632 chgoffset = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
633 changed = True;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
634 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
635 break;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
636 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
637 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
638 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
639
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
640 for (; i < nold; i++, dseg++) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
641 oldlen += dseg->seg.nchars;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
642 if (!changed) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
643 chgseg = i;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
644 chgoffset = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
645 changed = True;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
646 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
647 freeDisplaySegment(dseg);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
648 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
649
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
650 ocw->onthespot.numsegments = nnew;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
651
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
652 if (!changed) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
653 if (ocw->onthespot.lastcaret != caret) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
654 CBPreeditCaret(ocw, caret);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
655 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
656 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
657 else { /* changed */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
658 Atom encoding = ocw->ccontrol.textencoding;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
659 int format;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
660 int length;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
661 XtPointer string;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
662
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
663 if (ICGetPreeditString(inputobj, chgseg, chgoffset, &encoding, &format,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
664 &length, &string) == 0) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
665
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
666 dseg = ocw->onthespot.dispsegments;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
667 for (i = 0; i < chgseg; i++, dseg++) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
668 chgoffset += dseg->seg.nchars;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
669 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
670 CBPreeditDraw(ocw, caret, chgoffset, oldlen - chgoffset,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
671 encoding, format, length, string,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
672 buffer->attrs_length, buffer->attrs_buffer);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
673
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
674 /* string $B$r(B free $B$7$F$*$/(B */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
675 XtFree((char *)string);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
676 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
677 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
678
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
679 ocw->onthespot.lastcaret = caret;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
680
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
681 /* buffer $B$r(B destroy $B$7$F$*$/(B */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
682 destroyAttributeBuffer(buffer);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
683 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
684
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
685 /*- CommitText: commit text -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
686 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
687 CommitText(w, arg)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
688 Widget w;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
689 CCTextCallbackArg *arg;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
690 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
691 OnTheSpotConversionWidget ocw = (OnTheSpotConversionWidget)w;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
692 DisplaySegment *dseg;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
693 int i, len;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
694
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
695 dseg = ocw->onthespot.dispsegments;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
696 len = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
697 for (i = 0; i < ocw->onthespot.numsegments; i++, dseg++) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
698 len += dseg->seg.nchars;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
699 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
700 if (len > 0) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
701 /* $B%W%l%(%G%#%C%H%P%C%U%!$N>C5n(B */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
702 Atom encoding = XA_COMPOUND_TEXT(XtDisplayOfObject(w));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
703 int format = 8;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
704 unsigned long attr = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
705 CBPreeditDraw(ocw, 0, 0, len, encoding, format, 0, (XPointer)"",
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
706 0, &attr);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
707 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
708 /* $BFbIt$N%P%C%U%!$r%/%j%"$9$k(B */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
709 clearAllDisplaySegments(ocw);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
710 ocw->onthespot.lastcaret = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
711
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
712 XtCallCallbackList((Widget)ocw, ocw->ccontrol.textcallback,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
713 (XtPointer)arg);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
714
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
715 ocw->onthespot.fixnotify = True;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
716 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
717
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
718 /*- UpdateMode: update mode -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
719 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
720 UpdateMode(w)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
721 Widget w;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
722 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
723 OnTheSpotConversionWidget ocw = (OnTheSpotConversionWidget)w;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
724 Widget inputobj = ocw->ccontrol.inputobj;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
725 Atom encoding = ocw->ccontrol.textencoding;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
726 int format;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
727 int length;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
728 XtPointer string;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
729 int nchars;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
730
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
731 TRACE(("OnTheSpotConversion:UpdateMode()\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
732
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
733 if (ICGetStatusString(inputobj, &encoding, &format, &length, &string,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
734 &nchars) == -1)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
735 return;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
736
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
737 CBStatusDraw(ocw, encoding, format, length, string, nchars);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
738
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
739 /* string $B$r(B free $B$7$F$*$/(B */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
740 XtFree((char *)string);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
741 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
742
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
743 /*- SelectionControl: selection control -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
744 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
745 SelectionControl(w, arg)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
746 Widget w;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
747 ICSelectionControlArg *arg;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
748 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
749 OnTheSpotConversionWidget ocw = (OnTheSpotConversionWidget)w;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
750 String params[1];
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
751 Cardinal num_params;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
752
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
753 switch (arg->command) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
754 case ICSelectionStart:
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
755 SelectionStart(ocw, arg->u.selection_kind);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
756 break;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
757 case ICSelectionEnd:
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
758 SelectionEnd(ocw, &arg->u.current_item);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
759 break;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
760 case ICSelectionSet:
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
761 SelectionSet(ocw, arg->u.current_item);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
762 break;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
763 case ICSelectionMove:
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
764 SelectionMove(ocw, arg->u.dir);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
765 break;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
766 case ICSelectionGet:
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
767 SelectionGet(ocw, &arg->u.current_item);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
768 break;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
769 default:
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
770 params[0] = XtClass(w)->core_class.class_name;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
771 num_params = 1;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
772 XtAppWarningMsg(XtWidgetToApplicationContext(w),
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
773 "parameterError", "SelectionControl", "WidgetError",
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
774 "%s: unknown selection control command",
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
775 params, &num_params);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
776 break;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
777 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
778 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
779
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
780 /*- SelectionStart: selection startup -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
781 /* ARGSUSED */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
782 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
783 SelectionStart(ocw, kind)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
784 OnTheSpotConversionWidget ocw;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
785 int kind;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
786 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
787 Cardinal ncand;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
788
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
789 TRACE(("OnTheSpotConversion:SelectionStart()\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
790 if (ocw->onthespot.selectionpoppedup) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
791 TRACE(("\tselection already started -- ignored\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
792 return;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
793 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
794
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
795 ocw->onthespot.candlist = ICGetItemList(ocw->ccontrol.inputobj, &ncand);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
796 ocw->onthespot.numcands = ncand;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
797
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
798 TRACE(("\tnumcands=%d\n", ocw->onthespot.numcands));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
799 CPanelSetList(ocw->onthespot.selectionwidget,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
800 ocw->onthespot.candlist,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
801 ocw->onthespot.numcands, 0, True);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
802
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
803 LocateSelectionPopup(ocw);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
804 XtPopup(ocw->onthespot.selectionshell, XtGrabNone);
18
07a41a882b14 imported patch 21_kinput2-v3.1-rootwindow-1.patch
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
805 CloseWindowProtection(ocw->onthespot.selectionshell);
0
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
806 ocw->onthespot.selectionpoppedup = True;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
807 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
808
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
809 /*- LocateSelectionPopup: put selection popup at an appropriate position -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
810 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
811 LocateSelectionPopup(ocw)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
812 OnTheSpotConversionWidget ocw;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
813 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
814 Position x, y;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
815 int clx, cly;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
816 Dimension dpyWidth, dpyHeight;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
817 Widget panel = ocw->onthespot.selectionwidget;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
818 Widget shell = ocw->onthespot.selectionshell;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
819 Window junk;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
820 int barheight = ocw->ccontrol.titlebarheight;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
821
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
822 (void)XTranslateCoordinates(XtDisplay(ocw),
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
823 ocw->ccontrol.clientwindow,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
824 RootWindowOfScreen(XtScreen(ocw)),
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
825 0, 0, &clx, &cly, &junk);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
826
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
827 (void)SafeGetWindowAttributes(XtDisplay(ocw), ocw->ccontrol.clientwindow,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
828 &(ocw->ccontrol.client_attr));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
829
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
830 x = clx;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
831 y = cly + ocw->ccontrol.client_attr.height;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
832
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
833 dpyWidth = WidthOfScreen(XtScreen(shell));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
834 dpyHeight = HeightOfScreen(XtScreen(shell));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
835
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
836 if (x + panel->core.width > (int)dpyWidth) x = dpyWidth - panel->core.width;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
837 if (x < 0) x = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
838 #if 0
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
839 if (y + panel->core.height + barheight > (int)dpyHeight) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
840 y = cly - panel->core.height - 8 - barheight - 20; /* XXX */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
841 if (y < 0) y = dpyHeight - panel->core.height - barheight;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
842 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
843 #endif
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
844 if (y + panel->core.height + barheight > (int)dpyHeight)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
845 y = dpyHeight - panel->core.height - 8 - barheight - 20; /* XXX */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
846 if (y < 0) y = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
847 MoveShell(shell, x, y);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
848 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
849
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
850 /*- SelectionEnd: selection finish -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
851 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
852 SelectionEnd(ocw, current)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
853 OnTheSpotConversionWidget ocw;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
854 int *current;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
855 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
856 TRACE(("OnTheSpotConversion:SelectionEnd()\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
857
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
858 if (!ocw->onthespot.selectionpoppedup) { /* for safe */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
859 TRACE(("\tnot in selection mode -- ignored\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
860 return;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
861 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
862
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
863 XtVaGetValues(ocw->onthespot.selectionwidget,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
864 XtNcurrentItem, current,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
865 NULL);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
866
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
867 XtPopdown(ocw->onthespot.selectionshell);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
868
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
869 ocw->onthespot.selectionpoppedup = False;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
870 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
871
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
872 /*- SelectionSet: set current selection item -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
873 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
874 SelectionSet(ocw, current)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
875 OnTheSpotConversionWidget ocw;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
876 int current;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
877 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
878 TRACE(("OnTheSpotConversion:SelectionSet()\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
879
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
880 if (!ocw->onthespot.selectionpoppedup) { /* for safe */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
881 TRACE(("\tnot in selection mode -- ignored\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
882 return;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
883 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
884
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
885 XtVaSetValues(ocw->onthespot.selectionwidget,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
886 XtNcurrentItem, current,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
887 NULL);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
888 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
889
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
890 /*- SelectionGet: get current selection item -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
891 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
892 SelectionGet(ocw, current)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
893 OnTheSpotConversionWidget ocw;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
894 int *current;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
895 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
896 TRACE(("OnTheSpotConversion:SelectionGet()\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
897
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
898 if (!ocw->onthespot.selectionpoppedup) { /* for safe */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
899 TRACE(("\tnot in selection mode -- ignored\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
900 return;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
901 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
902
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
903 XtVaGetValues(ocw->onthespot.selectionwidget,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
904 XtNcurrentItem, current,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
905 NULL);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
906 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
907
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
908 /*- SelectionMove: move crrent selection to specified direction -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
909 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
910 SelectionMove(ocw, dir)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
911 OnTheSpotConversionWidget ocw;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
912 int dir;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
913 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
914 TRACE(("OnTheSpotConversion:SelectionMove()\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
915
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
916 if (!ocw->onthespot.selectionpoppedup) { /* for safe */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
917 TRACE(("\tnot in selection mode -- ignored\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
918 return;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
919 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
920
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
921 CPanelMoveCurrent(ocw->onthespot.selectionwidget, dir);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
922 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
923
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
924 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
925 * Aux Callback
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
926 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
927
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
928 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
929 AuxControl(w, arg)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
930 Widget w;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
931 ICAuxControlArg *arg;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
932 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
933 OnTheSpotConversionWidget ocw = (OnTheSpotConversionWidget)w;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
934 String params[1];
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
935 Cardinal num_params;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
936
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
937 switch (arg->command) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
938 case ICAuxStart:
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
939 AuxStart(ocw);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
940 break;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
941 case ICAuxEnd:
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
942 AuxEnd(ocw);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
943 break;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
944 case ICAuxChange:
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
945 AuxChange(ocw);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
946 break;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
947 default:
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
948 params[0] = XtClass(w)->core_class.class_name;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
949 num_params = 1;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
950 XtAppWarningMsg(XtWidgetToApplicationContext(w),
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
951 "parameterError", "AuxControl", "WidgetError",
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
952 "%s: unknown aux control command",
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
953 params, &num_params);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
954 break;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
955 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
956 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
957
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
958 /* ARGSUSED */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
959 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
960 AuxStart(ocw)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
961 OnTheSpotConversionWidget ocw;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
962 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
963 ICString *auxstr;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
964 Cardinal ncand, curseg, cursorpos;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
965
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
966 if (ocw->onthespot.auxpoppedup) return;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
967
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
968 /* $B%F%-%9%H%3!<%k%P%C%/$N;~$N$h$&$J=hM}$r$9$k(B
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
969 $B$N$O(B AuxPanel.c $B$K$^$+$;$h$&(B */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
970
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
971 auxstr = ICGetAuxSegments(ocw->ccontrol.inputobj,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
972 &ncand, &curseg, &cursorpos);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
973
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
974 APanelStart(ocw->onthespot.auxwidget, auxstr, ncand, curseg, cursorpos);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
975
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
976 /* $B%]%C%W%"%C%W$9$k>l=j$r7h$a$k(B */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
977 LocateAuxPopup(ocw);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
978
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
979 XtPopup(ocw->onthespot.auxshell, XtGrabNone);
18
07a41a882b14 imported patch 21_kinput2-v3.1-rootwindow-1.patch
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
980 CloseWindowProtection(ocw->onthespot.auxshell);
0
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
981 ocw->onthespot.auxpoppedup = True;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
982 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
983
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
984 /* ARGSUSED */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
985 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
986 AuxEnd(ocw)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
987 OnTheSpotConversionWidget ocw;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
988 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
989 if (!ocw->onthespot.auxpoppedup) return; /* for safe */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
990
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
991 /* APanelEnd(ocw->onthespot.auxwidget); */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
992
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
993 XtPopdown(ocw->onthespot.auxshell);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
994
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
995 ocw->onthespot.auxpoppedup = False;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
996 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
997
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
998 /* ARGSUSED */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
999 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1000 AuxChange(ocw)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1001 OnTheSpotConversionWidget ocw;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1002 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1003 Cardinal ncand, curseg, cursorpos;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1004 ICString *auxstr;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1005
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1006 if (!ocw->onthespot.auxpoppedup) return; /* for safe */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1007
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1008 auxstr = ICGetAuxSegments(ocw->ccontrol.inputobj,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1009 &ncand, &curseg, &cursorpos);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1010
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1011 APanelChange(ocw->onthespot.auxwidget, auxstr, ncand, curseg, cursorpos);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1012 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1013
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1014 /*- LocateAuxPopup: put aux popup at an appropriate position -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1015 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1016 LocateAuxPopup(ocw)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1017 OnTheSpotConversionWidget ocw;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1018 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1019 Position x, y;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1020 int clx, cly;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1021 Dimension dpyWidth, dpyHeight;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1022 Widget panel = ocw->onthespot.auxwidget;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1023 Widget shell = ocw->onthespot.auxshell;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1024 Window junk;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1025 int barheight = ocw->ccontrol.titlebarheight;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1026
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1027 (void)XTranslateCoordinates(XtDisplay(ocw),
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1028 ocw->ccontrol.clientwindow,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1029 RootWindowOfScreen(XtScreen(ocw)),
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1030 0, 0, &clx, &cly, &junk);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1031
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1032 (void)SafeGetWindowAttributes(XtDisplay(ocw), ocw->ccontrol.clientwindow,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1033 &(ocw->ccontrol.client_attr));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1034
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1035 x = clx;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1036 y = cly + ocw->ccontrol.client_attr.height;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1037
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1038 dpyWidth = WidthOfScreen(XtScreen(shell));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1039 dpyHeight = HeightOfScreen(XtScreen(shell));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1040
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1041 if (x + panel->core.width > (int)dpyWidth) x = dpyWidth - panel->core.width;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1042 if (x < 0) x = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1043 #if 0
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1044 if (y + panel->core.height + barheight > (int)dpyHeight) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1045 y = cly - panel->core.height - 8 - barheight - 20; /* XXX */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1046 if (y < 0) y = dpyHeight - panel->core.height - barheight;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1047 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1048 #endif
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1049 if (y + panel->core.height + barheight > (int)dpyHeight)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1050 y = dpyHeight - panel->core.height - 8 - barheight - 20; /* XXX */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1051 if (y < 0) y = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1052 MoveShell(shell, x, y);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1053 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1054
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1055 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1056 *+ Selection Widget callback
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1057 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1058
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1059 /*- SelectionSelected: selection selected callback -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1060 /* ARGSUSED */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1061 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1062 SelectionSelected(w, client_data, call_data)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1063 Widget w;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1064 XtPointer client_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1065 XtPointer call_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1066 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1067 OnTheSpotConversionWidget ocw = (OnTheSpotConversionWidget)client_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1068 int current = (int)call_data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1069
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1070 TRACE(("OnTheSpotConversion:SelectionSelected()\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1071 XtPopdown(ocw->onthespot.selectionshell);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1072 ocw->onthespot.selectionpoppedup = False;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1073 ICSelectItem(ocw->ccontrol.inputobj, current);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1074 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1075
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1076 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1077 *+ miscelaneous functions
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1078 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1079
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1080 /*- SafeGetWindowAttributes: get window attributes -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1081 static Boolean
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1082 SafeGetWindowAttributes(dpy, w, attr)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1083 Display *dpy;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1084 Window w;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1085 XWindowAttributes *attr;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1086 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1087 XAEHandle h;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1088 unsigned long errbits = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1089
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1090 h = XAESetRecordErrors(dpy, &errbits);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1091 (void)XGetWindowAttributes(dpy, w, attr);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1092 XAEUnset(h);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1093
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1094 return (errbits == 0);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1095 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1096
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1097 /*- MoveShell: move shell widget -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1098 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1099 MoveShell(w, x, y)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1100 Widget w;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1101 Position x;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1102 Position y;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1103 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1104 XtWidgetGeometry req;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1105
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1106 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1107 * calling XtMoveWidget() is NOT enough to move shell widgets.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1108 * we must use XtMakeGeometryRequest() or XtSetValues() to
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1109 * invoke root-geometry-manager which modifies the size hint
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1110 * appropriately.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1111 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1112 req.request_mode = CWX | CWY;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1113 req.x = x;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1114 req.y = y;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1115 (void)XtMakeGeometryRequest(w, &req, (XtWidgetGeometry *)NULL);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1116 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1117
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1118 /*- getToplevelWindow: get top-level window of a given window -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1119 static Window
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1120 getToplevelWindow(dpy, win)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1121 Display *dpy;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1122 Window win;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1123 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1124 Atom wm_state;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1125 Atom type;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1126 int format;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1127 unsigned long nitems, bytesafter;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1128 unsigned char *data;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1129 Window root, parent;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1130 Window *children;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1131 unsigned int nchildren;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1132
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1133 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1134 * find toplevel window which has WM_STATE property or if no exists,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1135 * direct subwindow of the root window. (ie I assume that if a
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1136 * window manager is running, that is a ICCCM compliant one)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1137 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1138 wm_state = CachedInternAtom(dpy, "WM_STATE", True);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1139 for (;;) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1140 type = None;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1141 if (wm_state != None) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1142 data = NULL;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1143 XGetWindowProperty(dpy, win, wm_state, 0L, 0L, False,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1144 AnyPropertyType, &type, &format,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1145 &nitems, &bytesafter, &data);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1146 if (data != NULL) XtFree((char *)data);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1147 if (type != None) break;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1148 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1149 if (!XQueryTree(dpy, win, &root, &parent, &children, &nchildren)) break;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1150 if (nchildren > 0) XtFree((char *)children);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1151 if (root == parent) break;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1152 win = parent;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1153 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1154 return win;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1155 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1156
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1157 /*- setTransientFor: set WM_TRANSIENT_FOR property to specified widget -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1158 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1159 setTransientFor(w, win)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1160 Widget w;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1161 Window win;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1162 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1163 if (!XtIsRealized(w)) XtRealizeWidget(w);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1164 XSetTransientForHint(XtDisplay(w), XtWindow(w), win);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1165 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1166
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1167 /*- allocDisplaySegments: prepare specified number of display segments -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1168 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1169 allocDisplaySegments(ocw, n)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1170 OnTheSpotConversionWidget ocw;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1171 Cardinal n;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1172 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1173 if (ocw->onthespot.dispsegmentsize > n) return;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1174 n = ((n + 3) / 4) * 4 ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1175 if (ocw->onthespot.dispsegments == NULL) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1176 ocw->onthespot.dispsegments = (DisplaySegment *)XtMalloc(n * sizeof(DisplaySegment));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1177 } else {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1178 ocw->onthespot.dispsegments = (DisplaySegment *)XtRealloc((char *)ocw->onthespot.dispsegments, n * sizeof(DisplaySegment));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1179 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1180 ocw->onthespot.dispsegmentsize = n;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1181 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1182
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1183 /*- freeDisplaySegment: free display segment's contents -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1184 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1185 freeDisplaySegment(dsp)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1186 DisplaySegment *dsp;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1187 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1188 freeString(&dsp->seg);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1189 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1190
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1191 /*- clearAllDisplaySegments: clear all display segment's -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1192 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1193 clearAllDisplaySegments(ocw)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1194 OnTheSpotConversionWidget ocw;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1195 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1196 DisplaySegment *dsp = ocw->onthespot.dispsegments;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1197 int i;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1198
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1199 for (i = 0; i < ocw->onthespot.numsegments; i++) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1200 freeDisplaySegment(dsp++);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1201 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1202 ocw->onthespot.numsegments = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1203 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1204
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1205 /*- copyString: copy ICString -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1206 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1207 copyString(from, to)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1208 ICString *from;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1209 ICString *to;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1210 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1211 *to = *from;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1212 to->data = XtMalloc(to->nbytes);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1213 (void)bcopy(from->data, to->data, to->nbytes);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1214 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1215
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1216 /*- freeString: free ICString -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1217 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1218 freeString(seg)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1219 ICString *seg;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1220 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1221 XtFree(seg->data);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1222 seg->data = NULL;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1223 seg->nbytes = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1224 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1225
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1226 /*- allocAttributeBuffer: allocate attribute buffer -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1227 static AttributeBuffer *
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1228 allocAttributeBuffer()
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1229 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1230 AttributeBuffer *buffer;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1231
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1232 buffer = (AttributeBuffer *)XtMalloc(sizeof(AttributeBuffer));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1233 buffer->attrs_length = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1234 buffer->attrs_limit = 64;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1235 buffer->attrs_buffer = (unsigned long *)XtMalloc(buffer->attrs_limit * sizeof(unsigned long));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1236 return buffer;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1237 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1238
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1239 /*- destroyAttributeBuffer: destroy draw string buffer's contents -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1240 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1241 destroyAttributeBuffer(buffer)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1242 AttributeBuffer *buffer;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1243 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1244 XtFree((char *)buffer->attrs_buffer);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1245 XtFree((char *)buffer);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1246 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1247
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1248 /*- addAttributeBuffer: add segment to draw string buffer's contents -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1249 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1250 addAttributeBuffer(buffer, inputobj, seg, offset, fba)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1251 AttributeBuffer *buffer;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1252 Widget inputobj;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1253 ICString *seg;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1254 int offset;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1255 FeedbackAttributes *fba;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1256 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1257 int nchars = seg->nchars - offset;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1258 unsigned long fb;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1259 int i;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1260
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1261 if (buffer->attrs_length + nchars > buffer->attrs_limit) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1262 unsigned long *new_attrs_buffer;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1263 int new_limit = buffer->attrs_limit * 2;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1264 if (new_limit < buffer->attrs_length + nchars)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1265 new_limit = buffer->attrs_length + nchars + 8;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1266 new_attrs_buffer = (unsigned long *)XtMalloc(new_limit * sizeof(unsigned long));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1267 bcopy(buffer->attrs_buffer, new_attrs_buffer,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1268 buffer->attrs_length * sizeof(unsigned long));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1269 XtFree((char *)buffer->attrs_buffer);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1270 buffer->attrs_limit = new_limit;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1271 buffer->attrs_buffer = new_attrs_buffer;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1272 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1273 fb = attrToFeedback(fba, seg->attr);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1274 for (i = 0; i < nchars; i++) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1275 buffer->attrs_buffer[buffer->attrs_length + i] = fb;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1276 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1277 buffer->attrs_length += nchars;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1278 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1279
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1280 /*- attrToFeedback: ICString attribute -> XIMFeedback attribute converter -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1281 static unsigned long
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1282 attrToFeedback(fba, attr)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1283 FeedbackAttributes *fba;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1284 int attr;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1285 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1286 int idx;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1287
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1288 if (attr == ICAttrNormalString) return 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1289
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1290 if (!(attr & ICAttrConverted)) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1291 /* Not yet converted */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1292 idx = FEEDBACK_NOCONV;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1293 } else if (attr & ICAttrCurrentSegment) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1294 /* it's converted and the current segment */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1295 idx = FEEDBACK_CURRENT;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1296 } else if (attr & ICAttrCurrentSubSegment) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1297 /* it's converted and the current sub segment */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1298 idx = FEEDBACK_CURRENTSUB;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1299 } else {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1300 /* converted, not current */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1301 idx = FEEDBACK_CONV;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1302 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1303 return fba->feedbacks[idx];
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1304 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1305
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1306 /*- CBPreeditStart: callback preedit start -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1307 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1308 CBPreeditStart(ocw)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1309 OnTheSpotConversionWidget ocw;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1310 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1311 if (ocw->onthespot.preeditstartcallback == NULL ||
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1312 XtHasCallbacks((Widget)ocw, XtNpreeditStartCallback) != XtCallbackHasSome)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1313 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1314 /* no callback */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1315 return;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1316 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1317
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1318 TRACE(("OnTheSpot:CBPreeditStart()\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1319
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1320 XtCallCallbackList((Widget)ocw, ocw->onthespot.preeditstartcallback,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1321 (XtPointer)NULL);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1322 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1323
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1324 /*- CBPreeditDone: callback preedit done -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1325 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1326 CBPreeditDone(ocw)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1327 OnTheSpotConversionWidget ocw;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1328 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1329 if (ocw->onthespot.preeditdonecallback == NULL ||
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1330 XtHasCallbacks((Widget)ocw, XtNpreeditDoneCallback) != XtCallbackHasSome)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1331 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1332 /* no callback */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1333 return;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1334 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1335
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1336 TRACE(("OnTheSpot:CBPreeditDone()\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1337
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1338 XtCallCallbackList((Widget)ocw, ocw->onthespot.preeditdonecallback,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1339 (XtPointer)NULL);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1340 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1341
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1342 /*- CBPreeditDraw: callback preedit draw -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1343 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1344 CBPreeditDraw(ocw, caret, chg_first, chg_length, encoding, format, text_length, text, attrs_length, attrs)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1345 OnTheSpotConversionWidget ocw;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1346 int caret;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1347 int chg_first;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1348 int chg_length;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1349 Atom encoding;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1350 int format;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1351 int text_length;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1352 XtPointer text;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1353 int attrs_length;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1354 unsigned long *attrs;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1355 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1356 OCCPreeditDrawArg arg;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1357
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1358 if (ocw->onthespot.preeditdrawcallback == NULL ||
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1359 XtHasCallbacks((Widget)ocw, XtNpreeditDrawCallback) != XtCallbackHasSome)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1360 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1361 /* no callback */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1362 return;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1363 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1364
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1365 TRACE(("OnTheSpot:CBPreeditDraw()\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1366
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1367 arg.caret = caret;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1368 arg.chg_first = chg_first;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1369 arg.chg_length = chg_length;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1370 arg.encoding = encoding;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1371 arg.format = format;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1372 arg.text_length = text_length;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1373 arg.text = text;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1374 arg.attrs_length = attrs_length;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1375 arg.attrs = attrs;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1376 XtCallCallbackList((Widget)ocw, ocw->onthespot.preeditdrawcallback,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1377 (XtPointer)&arg);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1378 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1379
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1380 /*- CBPreeditCaret: callback preedit caret -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1381 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1382 CBPreeditCaret(ocw, caret)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1383 OnTheSpotConversionWidget ocw;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1384 int caret;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1385 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1386 if (ocw->onthespot.preeditcaretcallback == NULL ||
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1387 XtHasCallbacks((Widget)ocw, XtNpreeditCaretCallback) != XtCallbackHasSome)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1388 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1389 /* no callback */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1390 return;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1391 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1392
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1393 TRACE(("OnTheSpot:CBPreeditCaret()\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1394
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1395 XtCallCallbackList((Widget)ocw, ocw->onthespot.preeditcaretcallback,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1396 (XtPointer)caret);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1397 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1398
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1399 /*- CBStatusStart: callback status start -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1400 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1401 CBStatusStart(ocw)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1402 OnTheSpotConversionWidget ocw;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1403 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1404 if (ocw->onthespot.statusstartcallback == NULL ||
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1405 XtHasCallbacks((Widget)ocw, XtNstatusStartCallback) != XtCallbackHasSome)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1406 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1407 /* no callback */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1408 return;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1409 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1410
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1411 TRACE(("OnTheSpot:CBStatusStart()\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1412
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1413 XtCallCallbackList((Widget)ocw, ocw->onthespot.statusstartcallback,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1414 (XtPointer)NULL);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1415 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1416
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1417 /*- CBStatusDone: callback status done -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1418 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1419 CBStatusDone(ocw)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1420 OnTheSpotConversionWidget ocw;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1421 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1422 if (ocw->onthespot.statusdonecallback == NULL ||
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1423 XtHasCallbacks((Widget)ocw, XtNstatusDoneCallback) != XtCallbackHasSome)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1424 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1425 /* no callback */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1426 return;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1427 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1428
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1429 TRACE(("OnTheSpot:CBStatusDone()\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1430
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1431 XtCallCallbackList((Widget)ocw, ocw->onthespot.statusdonecallback,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1432 (XtPointer)NULL);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1433 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1434
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1435 /*- CBStatusDraw: callback status draw -*/
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1436 static void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1437 CBStatusDraw(ocw, encoding, format, length, text, nchars)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1438 OnTheSpotConversionWidget ocw;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1439 Atom encoding;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1440 int format;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1441 int length;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1442 XtPointer text;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1443 int nchars;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1444 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1445 OCCPreeditDrawArg arg;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1446
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1447 if (ocw->onthespot.statusdrawcallback == NULL ||
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1448 XtHasCallbacks((Widget)ocw, XtNstatusDrawCallback) != XtCallbackHasSome)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1449 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1450 /* no callback */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1451 return;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1452 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1453
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1454 TRACE(("OnTheSpot:CBStatusDraw()\n"));
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1455
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1456 arg.caret = 0; /* ignored */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1457 arg.chg_first = 0; /* ignored */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1458 arg.chg_length = 0; /* ignored */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1459 arg.encoding = encoding;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1460 arg.format = format;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1461 arg.text_length = length;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1462 arg.text = text;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1463 arg.attrs_length = nchars;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1464 arg.attrs = NULL; /* ignored */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1465 XtCallCallbackList((Widget)ocw, ocw->onthespot.statusdrawcallback,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1466 (XtPointer)&arg);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1467 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1468