• R/O
  • SSH
  • HTTPS

mikuinstaller: Commit


Commit MetaInfo

Revision2 (tree)
Zeit2008-07-20 15:21:48
Autormikuinstaller

Log Message

MikuInstaller-patches version 20080720 released.

Ändern Zusammenfassung

Diff

--- MikuInstaller-patches/trunk/wine-opengl-workaround.diff (nonexistent)
+++ MikuInstaller-patches/trunk/wine-opengl-workaround.diff (revision 2)
@@ -0,0 +1,55 @@
1+This patch is provided by MikuInstaller project for Wine.
2+
3+You can obtain the whole of source code of Wine from
4+ http://www.winehq.org/
5+
6+Copyright (c) 1993-2008 the Wine project authors (see the file AUTHORS
7+for a complete list)
8+
9+Wine is free software; you can redistribute it and/or modify it under
10+the terms of the GNU Lesser General Public License as published by the
11+Free Software Foundation; either version 2.1 of the License, or (at
12+your option) any later version.
13+
14+This program is distributed in the hope that it will be useful, but
15+WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16+Lesser General Public License for more details.
17+
18+A copy of the GNU Lesser General Public License is included in the
19+Wine distribution in the file COPYING.LIB. If you did not receive this
20+copy, write to the Free Software Foundation, Inc., 51 Franklin St,
21+Fifth Floor, Boston, MA 02110-1301, USA.
22+
23+
24+index a24591e..38f05d2 100644
25+--- a/dlls/winex11.drv/opengl.c
26++++ b/dlls/winex11.drv/opengl.c
27+@@ -23,0 +23,1 @@
28++/* Modified by MikuInstaller project on 2008-06-27. */
29+@@ -355,6 +355,7 @@ static BOOL has_opengl(void)
30+ {
31+ static int init_done;
32+ static void *opengl_handle;
33++ const char *soname_libgl;
34+
35+ char buffer[200];
36+ int error_base, event_base;
37+@@ -362,9 +363,17 @@ static BOOL has_opengl(void)
38+ if (init_done) return (opengl_handle != NULL);
39+ init_done = 1;
40+
41++ soname_libgl = getenv("WINE_OPENGL_HACK");
42++ if (soname_libgl && strcmp(soname_libgl, "0") == 0) {
43++ WARN("OpenGL support is disabled by WINE_OPENGL_HACK\n");
44++ return FALSE;
45++ }
46++ if (!soname_libgl)
47++ soname_libgl = SONAME_LIBGL;
48++
49+ /* No need to load any other libraries as according to the ABI, libGL should be self-sufficient
50+ and include all dependencies */
51+- opengl_handle = wine_dlopen(SONAME_LIBGL, RTLD_NOW|RTLD_GLOBAL, buffer, sizeof(buffer));
52++ opengl_handle = wine_dlopen(soname_libgl, RTLD_NOW|RTLD_GLOBAL, buffer, sizeof(buffer));
53+ if (opengl_handle == NULL)
54+ {
55+ ERR( "Failed to load libGL: %s\n", buffer );
--- MikuInstaller-patches/trunk/wine-osxime-workaround.diff (nonexistent)
+++ MikuInstaller-patches/trunk/wine-osxime-workaround.diff (revision 2)
@@ -0,0 +1,286 @@
1+This patch is provided by MikuInstaller project for CrossOver.
2+
3+You can obtain the whole of source code of CrossOver from
4+ http://www.codeweavers.com/products/source/
5+
6+Copyright (c) 1993-2008 the Wine project authors (see the file AUTHORS
7+for a complete list)
8+
9+Wine is free software; you can redistribute it and/or modify it under
10+the terms of the GNU Lesser General Public License as published by the
11+Free Software Foundation; either version 2.1 of the License, or (at
12+your option) any later version.
13+
14+This program is distributed in the hope that it will be useful, but
15+WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16+Lesser General Public License for more details.
17+
18+A copy of the GNU Lesser General Public License is included in the
19+Wine distribution in the file COPYING.LIB. If you did not receive this
20+copy, write to the Free Software Foundation, Inc., 51 Franklin St,
21+Fifth Floor, Boston, MA 02110-1301, USA.
22+
23+
24+diff --git a/dlls/wineosxime.drv/IMKClient.m b/dlls/wineosxime.drv/IMKClient.m
25+index 409a6c5..d39300c 100644
26+--- a/dlls/wineosxime.drv/IMKClient.m
27++++ b/dlls/wineosxime.drv/IMKClient.m
28+@@ -0,0 +1 @@
29++/* Modified by MikuInstaller project on 2008-06-27. */
30+@@ -1,6 +1,7 @@
31+ #ifdef __APPLE__
32+
33+ #include "wine/debug.h"
34++#include <dlfcn.h> // for workaround
35+
36+ #define BOOL MacBOOL
37+
38+@@ -22,10 +23,12 @@
39+
40+ #include <unistd.h>
41+
42+-#define debugstr_ns(s) debugstr_a([(s) UTF8String])
43++#define debugstr_ns(s) \
44++[([(s) isKindOfClass:[NSAttributedString class]] ? [((id)s) string] : (s)) \
45++ UTF8String]
46+
47+
48+-WINE_DEFAULT_DEBUG_CHANNEL(mac_xim);
49++WINE_DEFAULT_DEBUG_CHANNEL(mac_imk);
50+
51+
52+ @interface NSObject (wine_IMKEvent)
53+@@ -312,6 +315,51 @@ void CXIMKClientSetInputMode(CXIMKClientRef inClient, CFStringRef inMode)
54+ [inClient->im setValue:(NSString*)inMode forTag:kTSMDocumentInputModePropertyTag client:inClient->ti];
55+
56+ [pool release];
57++
58++ // 10.5.3: setValue for kTSMDocumentInputModePropertyTag doesn't seem to work.
59++ // This is an workaround to select an input source by TISSelectInputSource.
60++ {
61++#if !defined(MAC_OS_X_VERSION_10_5) || !defined(MAC_OS_X_VERSION_MAX_ALLOWED) \
62++ || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
63++typedef void *TISInputSourceRef;
64++#endif
65++ static CFArrayRef (*pTISCreateInputSourceList)(CFDictionaryRef, Boolean);
66++ static void *(*pTISGetInputSourceProperty)(TISInputSourceRef, CFStringRef);
67++ static OSStatus (*pTISSelectInputSource)(TISInputSourceRef);
68++ static CFStringRef *kTISPropertyInputModeID;
69++ CFArrayRef ary;
70++ CFIndex i, len;
71++
72++ if (!pTISCreateInputSourceList || !pTISGetInputSourceProperty
73++ || !pTISSelectInputSource || !kTISPropertyInputModeID) {
74++ pTISCreateInputSourceList = dlsym(RTLD_DEFAULT,"TISCreateInputSourceList");
75++ pTISGetInputSourceProperty = dlsym(RTLD_DEFAULT,"TISGetInputSourceProperty");
76++ pTISSelectInputSource = dlsym(RTLD_DEFAULT,"TISSelectInputSource");
77++ kTISPropertyInputModeID = dlsym(RTLD_DEFAULT,"kTISPropertyInputModeID");
78++ if (!pTISCreateInputSourceList || !pTISGetInputSourceProperty
79++ || !pTISSelectInputSource || !kTISPropertyInputModeID) {
80++ TRACE("load failed\n");
81++ return;
82++ }
83++ }
84++
85++ ary = pTISCreateInputSourceList(NULL, false);
86++ len = CFArrayGetCount(ary);
87++
88++ for (i = 0; i < len; i++) {
89++ TISInputSourceRef is = (TISInputSourceRef)CFArrayGetValueAtIndex(ary, i);
90++ CFStringRef mode = pTISGetInputSourceProperty(is, *kTISPropertyInputModeID);
91++ TRACE("mode:%s\n", debugstr_ns((NSString*)mode));
92++ if (CFStringCompare(mode, inMode, 0) == kCFCompareEqualTo) {
93++ TRACE("select\n");
94++ pTISSelectInputSource(is);
95++ CFRelease(mode);
96++ break;
97++ }
98++ }
99++
100++ CFRelease(ary);
101++ }
102+ }
103+
104+ int CXIMKClientSendEvent(CXIMKClientRef inClient, EventRef inEvent)
105+diff --git a/dlls/wineosxime.drv/ime.c b/dlls/wineosxime.drv/ime.c
106+index d1bccc7..b66399f 100644
107+--- a/dlls/wineosxime.drv/ime.c
108++++ b/dlls/wineosxime.drv/ime.c
109+@@ -19,0 +19,1 @@
110++/* Modified by MikuInstaller project on 2008-06-27. */
111+@@ -622,16 +622,19 @@ BOOL WINAPI ImeProcessKey(HIMC hIMC, UINT vKey, LPARAM lKeyData,
112+ return FALSE;
113+ }
114+
115++ inIME = MacTSMCheckModeAndIME(gHandle);
116++
117+ if ((vKey == VK_KANA) || (vKey == VK_KANJI) ||
118+ (vKey == VK_SPACE && lpbKeyState[VK_MENU] & 0x80 ))
119+ {
120++ if (!(lpbKeyState[vKey] & 0x80))
121++ return TRUE;
122+ TRACE("Mode Switch\n");
123+ MacTSMFixTextService(gHandle);
124+ MacTSMRevertToPreviousMode(gHandle);
125+ return TRUE;
126+ }
127+
128+- inIME = MacTSMCheckModeAndIME(gHandle);
129+ lpIMC = LockRealIMC(hIMC);
130+ if (lpIMC)
131+ {
132+@@ -717,7 +720,8 @@ UINT WINAPI ImeToAsciiEx (UINT uVKey, UINT uScanCode,
133+
134+ TRACE("Incomming %x %x %p\n",vkey, uScanCode,hIMC);
135+
136+- if ((vkey == VK_KANA) || (vkey == VK_KANJI) || (vkey == VK_MENU))
137++ if ((vkey == VK_KANA) || (vkey == VK_KANJI) || (vkey == VK_MENU)
138++ || (vkey == VK_SPACE && lpbKeyState[VK_MENU] & 0x80 ))
139+ {
140+ TRACE("Skipping metakey\n");
141+ return 0;
142+diff --git a/dlls/wineosxime.drv/mactext.c b/dlls/wineosxime.drv/mactext.c
143+index d73bd8a..51dcefa 100644
144+--- a/dlls/wineosxime.drv/mactext.c
145++++ b/dlls/wineosxime.drv/mactext.c
146+@@ -48,0 +48,1 @@
147++/* Modified by MikuInstaller project on 2008-06-27. */
148+@@ -623,6 +623,7 @@ Boolean MacTSMRevertToPreviousMode(TSMHandle internals)
149+ kCFCompareEqualTo)
150+ {
151+ CFStringRef temp = internals->CurrentScript;
152++ CFStringRef mode, bundleid = NULL;
153+
154+ if (TRACE_ON(mac_xim))
155+ {
156+@@ -632,7 +633,13 @@ Boolean MacTSMRevertToPreviousMode(TSMHandle internals)
157+ TRACE("Switching from %s to %s\n",ss,ss2);
158+ }
159+
160+- OpenAppropriateService(internals, internals->OldScript, NULL);
161++ if (internals->isLeopard) {
162++ GetTISInputModeCFS(&mode, &bundleid);
163++ CFRelease(mode);
164++ }
165++ OpenAppropriateService(internals, internals->OldScript, bundleid);
166++ if (bundleid)
167++ CFRelease(bundleid);
168+
169+ internals->CurrentScript = internals->OldScript;
170+ internals->OldScript = temp;
171+@@ -783,9 +790,9 @@ TSMHandle MacInitTSMAwareApplication(void)
172+ internals->CurrentModeString = CFStringCreateCopy(NULL,
173+ kTextServiceInputModeRoman);
174+ internals->OldModeString = CFStringCreateCopy(NULL,
175+- kTextServiceInputModeRoman);
176++ kTextServiceInputModeJapanese);
177+ internals->CurrentScript= CFStringCreateCopy(NULL,CFSTR("smRoman"));
178+- internals->OldScript= CFStringCreateCopy(NULL,CFSTR("smRoman"));
179++ internals->OldScript= CFStringCreateCopy(NULL,CFSTR("smJapanese"));
180+
181+ InstallStandardEventHandler(GetApplicationEventTarget());
182+
183+diff --git a/dlls/wineosxime.drv/toascii.c b/dlls/wineosxime.drv/toascii.c
184+index 26a9dfc..1befcd4 100644
185+--- a/dlls/wineosxime.drv/toascii.c
186++++ b/dlls/wineosxime.drv/toascii.c
187+@@ -20,0 +20,1 @@
188++/* Modified by MikuInstaller project on 2008-06-27. */
189+@@ -395,7 +395,8 @@ int MacToAscii(UINT uVKey, UINT keysym, UINT keycode, CONST LPBYTE lpbKeyState,
190+ break;
191+ }
192+
193+- theCode = xToMacKeycodeMap[keycode];
194++ //theCode = xToMacKeycodeMap[keycode];
195++ theCode = keycode;
196+ MacActivateTSMDocument(gHandle);
197+ unichar = keysym2ucs(keysym);
198+
199+diff --git a/dlls/winex11.drv/mac_xim.c b/dlls/winex11.drv/mac_xim.c
200+index 430b1ee..bdc1c96 100644
201+--- a/dlls/winex11.drv/mac_xim.c
202++++ b/dlls/winex11.drv/mac_xim.c
203+@@ -20,0 +20,1 @@
204++/* Modified by MikuInstaller project on 2008-06-27. */
205+@@ -43,7 +43,7 @@
206+ #include "winnls.h"
207+ #include "imm.h"
208+ #include "ddk/imm.h"
209+-#include "keysym2ucs.h"
210++/* #include "keysym2ucs.h" */
211+ #include "wine/debug.h"
212+
213+ WINE_DEFAULT_DEBUG_CHANNEL(mac_ime);
214+diff --git a/configure b/configure
215+index be80629..896d234 100755
216+--- a/configure
217++++ b/configure
218+@@ -733,6 +733,9 @@ MINGWAR
219+ SECURITYLIB
220+ COREFOUNDATIONLIB
221+ IOKITLIB
222++APPKITLIB
223++OBJC_SRCS
224++OBJC_OBJS
225+ LDEXECFLAGS
226+ DISKARBITRATIONLIB
227+ COREAUDIO
228+@@ -8591,6 +8594,7 @@ fi
229+ LIBWINE_LDFLAGS="-multiply_defined suppress"
230+ LDSHARED="\$(CC) -dynamiclib"
231+ STRIP="$STRIP -x"
232++ INSTALL="STRIPPROG=\\\"$STRIP\\\" \\\$(TOPSRCDIR)/tools/install-sh -c"
233+ LDRPATH_LOCAL="&& install_name_tool -change @executable_path/\`\$(RELPATH) \$(bindir) \$(libdir)\`/libwine.1.dylib @executable_path/\$(TOPOBJDIR)/libs/wine/libwine.1.dylib \$@ || \$(RM) \$@"
234+ SECURITYLIB="-framework Security -framework CoreFoundation"
235+
236+@@ -8598,7 +8602,13 @@ fi
237+
238+ IOKITLIB="-framework IOKit -framework CoreFoundation"
239+
240+- LDEXECFLAGS="-image_base 0x7bf00000 -Wl,-segaddr,WINE_DOS,0x00000000,-segaddr,WINE_SHARED_HEAP,0x7f000000"
241++ APPKITLIB="-framework AppKit"
242++
243++ OBJC_SRCS="\$(OBJC_SRCS)"
244++
245++ OBJC_OBJS="\$(OBJC_SRCS:.m=.o)"
246++
247++ LDEXECFLAGS="-image_base 0x7bf00000 -Wl,-segaddr,WINE_DOS,0x00000000,-segaddr,WINE_OLE32,0x65f00000,-segaddr,WINE_SHARED_HEAP,0x7f000000"
248+
249+ if test "$ac_cv_header_DiskArbitration_DiskArbitration_h" = "yes"
250+ then
251+@@ -22406,6 +22416,8 @@ ac_config_files="$ac_config_files dlls/winenas.drv/Makefile"
252+
253+ ac_config_files="$ac_config_files dlls/wineoss.drv/Makefile"
254+
255++ac_config_files="$ac_config_files dlls/wineosxime.drv/Makefile"
256++
257+ ac_config_files="$ac_config_files dlls/wineps.drv/Makefile"
258+
259+ ac_config_files="$ac_config_files dlls/winequartz.drv/Makefile"
260+@@ -23476,6 +23488,7 @@ do
261+ "dlls/winemp3.acm/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winemp3.acm/Makefile" ;;
262+ "dlls/winenas.drv/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winenas.drv/Makefile" ;;
263+ "dlls/wineoss.drv/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/wineoss.drv/Makefile" ;;
264++ "dlls/wineosxime.drv/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/wineosxime.drv/Makefile" ;;
265+ "dlls/wineps.drv/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/wineps.drv/Makefile" ;;
266+ "dlls/winequartz.drv/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winequartz.drv/Makefile" ;;
267+ "dlls/winex11.drv/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winex11.drv/Makefile" ;;
268+@@ -23808,6 +23821,9 @@ MINGWAR!$MINGWAR$ac_delim
269+ SECURITYLIB!$SECURITYLIB$ac_delim
270+ COREFOUNDATIONLIB!$COREFOUNDATIONLIB$ac_delim
271+ IOKITLIB!$IOKITLIB$ac_delim
272++APPKITLIB!$APPKITLIB$ac_delim
273++OBJC_SRCS!$OBJC_SRCS$ac_delim
274++OBJC_OBJS!$OBJC_OBJS$ac_delim
275+ LDEXECFLAGS!$LDEXECFLAGS$ac_delim
276+ DISKARBITRATIONLIB!$DISKARBITRATIONLIB$ac_delim
277+ COREAUDIO!$COREAUDIO$ac_delim
278+@@ -23854,7 +23870,7 @@ LIBOBJS!$LIBOBJS$ac_delim
279+ LTLIBOBJS!$LTLIBOBJS$ac_delim
280+ _ACEOF
281+
282+- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 80; then
283++ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 83; then
284+ break
285+ elif $ac_last_try; then
286+ { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
--- MikuInstaller-patches/trunk/wine-xrender-UenoB.diff (nonexistent)
+++ MikuInstaller-patches/trunk/wine-xrender-UenoB.diff (revision 2)
@@ -0,0 +1,100 @@
1+This patch is provided by uenoB for Wine.
2+ http://d.hatena.ne.jp/uenoB/20080107/1199702633
3+
4+You can obtain the whole of source code of Wine from
5+ http://www.winehq.org/
6+
7+Copyright (c) 1993-2008 the Wine project authors (see the file AUTHORS
8+for a complete list)
9+
10+Wine is free software; you can redistribute it and/or modify it under
11+the terms of the GNU Lesser General Public License as published by the
12+Free Software Foundation; either version 2.1 of the License, or (at
13+your option) any later version.
14+
15+This program is distributed in the hope that it will be useful, but
16+WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FIT
17+NESS FOR A PARTICULAR PURPOSE. See the GNU
18+Lesser General Public License for more details.
19+
20+A copy of the GNU Lesser General Public License is included in the
21+Wine distribution in the file COPYING.LIB. If you did not receive this
22+copy, write to the Free Software Foundation, Inc., 51 Franklin St,
23+Fifth Floor, Boston, MA 02110-1301, USA.
24+
25+
26+--- wine-0.9.52/dlls/winex11.drv/xrender.c.orig 2007-12-29 00:26:23.000000000 +0900
27++++ wine-0.9.52/dlls/winex11.drv/xrender.c 2008-01-07 11:19:19.000000000 +0900
28+@@ -22,0 +22,1 @@
29++/* Modified by uenoB on 2008-01-07. */
30+@@ -1522,6 +1522,7 @@
31+ Picture dst_pict, src_pict;
32+ Pixmap xpm;
33+ DIBSECTION dib;
34++ HBITMAP hbitmap = NULL;
35+ XImage *image;
36+ GC gc;
37+ XGCValues gcv;
38+@@ -1569,8 +1570,36 @@
39+
40+ if (!devSrc->bitmap || GetObjectW( devSrc->bitmap->hbitmap, sizeof(dib), &dib ) != sizeof(dib))
41+ {
42+- FIXME("not a dibsection\n");
43+- return FALSE;
44++ if (devSrc->bitmap && GetObjectW( devSrc->bitmap->hbitmap, sizeof(dib.dsBm), &dib.dsBm ) == sizeof(dib.dsBm))
45++ {
46++ void *bits;
47++
48++ /* FIXME: I don't know whether this way is correct or not. */
49++ TRACE("forcely convert bitmap to dib\n");
50++ dib.dsBmih.biSize = sizeof(BITMAPINFOHEADER);
51++ dib.dsBmih.biWidth = dib.dsBm.bmWidth;
52++ dib.dsBmih.biHeight = -dib.dsBm.bmHeight;
53++ dib.dsBmih.biPlanes = dib.dsBm.bmPlanes;
54++ dib.dsBmih.biBitCount = dib.dsBm.bmBitsPixel;
55++ dib.dsBmih.biCompression = BI_RGB;
56++ dib.dsBmih.biSizeImage = 0;
57++ dib.dsBmih.biXPelsPerMeter = 0;
58++ dib.dsBmih.biYPelsPerMeter = 0;
59++ dib.dsBmih.biClrUsed = 0;
60++ dib.dsBmih.biClrImportant = 0;
61++ hbitmap = CreateDIBSection(NULL, (BITMAPINFO*)&dib.dsBmih, DIB_RGB_COLORS, &bits, NULL, 0);
62++ if (!hbitmap) {
63++ FIXME("Failed to convert bitmap to dib");
64++ return FALSE;
65++ }
66++ GetObjectW(hbitmap, sizeof(dib), &dib);
67++ GetBitmapBits(devSrc->bitmap->hbitmap, dib.dsBmih.biSizeImage, bits);
68++ }
69++ else
70++ {
71++ FIXME("neighter a dibsection nor a bitmap\n");
72++ return FALSE;
73++ }
74+ }
75+
76+ if (xSrc < 0 || ySrc < 0 || widthSrc < 0 || heightSrc < 0 || xSrc + widthSrc > dib.dsBmih.biWidth
77+@@ -1578,6 +1607,7 @@
78+ {
79+ WARN("Invalid src coords: (%d,%d), size %dx%d\n", xSrc, ySrc, widthSrc, heightSrc);
80+ SetLastError(ERROR_INVALID_PARAMETER);
81++ if (hbitmap) DeleteObject(hbitmap);
82+ return FALSE;
83+ }
84+
85+@@ -1586,6 +1616,7 @@
86+
87+ if(dib.dsBm.bmBitsPixel != 32) {
88+ FIXME("not a 32 bpp dibsection\n");
89++ if (hbitmap) DeleteObject(hbitmap);
90+ return FALSE;
91+ }
92+ dstbits = data = HeapAlloc(GetProcessHeap(), 0, heightSrc * widthSrc * 4);
93+@@ -1702,6 +1733,7 @@
94+
95+ wine_tsx11_unlock();
96+ HeapFree(GetProcessHeap(), 0, data);
97++ if (hbitmap) DeleteObject(hbitmap);
98+ return TRUE;
99+ }
100+
--- MikuInstaller-patches/trunk/wine-naisyo-ArrowFix026-gdi32.diff (nonexistent)
+++ MikuInstaller-patches/trunk/wine-naisyo-ArrowFix026-gdi32.diff (revision 2)
@@ -0,0 +1,40 @@
1+This patch is provided by MikuInstaller project for Wine.
2+
3+You can obtain the whole of source code of Wine from
4+ http://www.winehq.org/
5+
6+Copyright (c) 1993-2008 the Wine project authors (see the file AUTHORS
7+for a complete list)
8+
9+Wine is free software; you can redistribute it and/or modify it under
10+the terms of the GNU Lesser General Public License as published by the
11+Free Software Foundation; either version 2.1 of the License, or (at
12+your option) any later version.
13+
14+This program is distributed in the hope that it will be useful, but
15+WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16+Lesser General Public License for more details.
17+
18+A copy of the GNU Lesser General Public License is included in the
19+Wine distribution in the file COPYING.LIB. If you did not receive this
20+copy, write to the Free Software Foundation, Inc., 51 Franklin St,
21+Fifth Floor, Boston, MA 02110-1301, USA.
22+
23+
24+diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
25+index 70a043e..6d1582a 100644
26+--- a/dlls/gdi32/font.c
27++++ b/dlls/gdi32/font.c
28+@@ -21,0 +21,1 @@
29++/* Modified by MikuInstaller project on 2008-05-30. */
30+@@ -2076,7 +2076,9 @@ done:
31+ */
32+ BOOL WINAPI TextOutA( HDC hdc, INT x, INT y, LPCSTR str, INT count )
33+ {
34+- return ExtTextOutA( hdc, x, y, 0, NULL, str, count, NULL );
35++ /* Hatyune no Naisyo ArrowFix 0.26 requires that lpRect is not NULL. */
36++ static const RECT dummy = {0,0,0,0};
37++ return ExtTextOutA( hdc, x, y, 0, &dummy, str, count, NULL );
38+ }
39+
40+
--- MikuInstaller-patches/trunk/COPYING (nonexistent)
+++ MikuInstaller-patches/trunk/COPYING (revision 2)
@@ -0,0 +1,502 @@
1+ GNU LESSER GENERAL PUBLIC LICENSE
2+ Version 2.1, February 1999
3+
4+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
5+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6+ Everyone is permitted to copy and distribute verbatim copies
7+ of this license document, but changing it is not allowed.
8+
9+[This is the first released version of the Lesser GPL. It also counts
10+ as the successor of the GNU Library Public License, version 2, hence
11+ the version number 2.1.]
12+
13+ Preamble
14+
15+ The licenses for most software are designed to take away your
16+freedom to share and change it. By contrast, the GNU General Public
17+Licenses are intended to guarantee your freedom to share and change
18+free software--to make sure the software is free for all its users.
19+
20+ This license, the Lesser General Public License, applies to some
21+specially designated software packages--typically libraries--of the
22+Free Software Foundation and other authors who decide to use it. You
23+can use it too, but we suggest you first think carefully about whether
24+this license or the ordinary General Public License is the better
25+strategy to use in any particular case, based on the explanations below.
26+
27+ When we speak of free software, we are referring to freedom of use,
28+not price. Our General Public Licenses are designed to make sure that
29+you have the freedom to distribute copies of free software (and charge
30+for this service if you wish); that you receive source code or can get
31+it if you want it; that you can change the software and use pieces of
32+it in new free programs; and that you are informed that you can do
33+these things.
34+
35+ To protect your rights, we need to make restrictions that forbid
36+distributors to deny you these rights or to ask you to surrender these
37+rights. These restrictions translate to certain responsibilities for
38+you if you distribute copies of the library or if you modify it.
39+
40+ For example, if you distribute copies of the library, whether gratis
41+or for a fee, you must give the recipients all the rights that we gave
42+you. You must make sure that they, too, receive or can get the source
43+code. If you link other code with the library, you must provide
44+complete object files to the recipients, so that they can relink them
45+with the library after making changes to the library and recompiling
46+it. And you must show them these terms so they know their rights.
47+
48+ We protect your rights with a two-step method: (1) we copyright the
49+library, and (2) we offer you this license, which gives you legal
50+permission to copy, distribute and/or modify the library.
51+
52+ To protect each distributor, we want to make it very clear that
53+there is no warranty for the free library. Also, if the library is
54+modified by someone else and passed on, the recipients should know
55+that what they have is not the original version, so that the original
56+author's reputation will not be affected by problems that might be
57+introduced by others.
58+
59+ Finally, software patents pose a constant threat to the existence of
60+any free program. We wish to make sure that a company cannot
61+effectively restrict the users of a free program by obtaining a
62+restrictive license from a patent holder. Therefore, we insist that
63+any patent license obtained for a version of the library must be
64+consistent with the full freedom of use specified in this license.
65+
66+ Most GNU software, including some libraries, is covered by the
67+ordinary GNU General Public License. This license, the GNU Lesser
68+General Public License, applies to certain designated libraries, and
69+is quite different from the ordinary General Public License. We use
70+this license for certain libraries in order to permit linking those
71+libraries into non-free programs.
72+
73+ When a program is linked with a library, whether statically or using
74+a shared library, the combination of the two is legally speaking a
75+combined work, a derivative of the original library. The ordinary
76+General Public License therefore permits such linking only if the
77+entire combination fits its criteria of freedom. The Lesser General
78+Public License permits more lax criteria for linking other code with
79+the library.
80+
81+ We call this license the "Lesser" General Public License because it
82+does Less to protect the user's freedom than the ordinary General
83+Public License. It also provides other free software developers Less
84+of an advantage over competing non-free programs. These disadvantages
85+are the reason we use the ordinary General Public License for many
86+libraries. However, the Lesser license provides advantages in certain
87+special circumstances.
88+
89+ For example, on rare occasions, there may be a special need to
90+encourage the widest possible use of a certain library, so that it becomes
91+a de-facto standard. To achieve this, non-free programs must be
92+allowed to use the library. A more frequent case is that a free
93+library does the same job as widely used non-free libraries. In this
94+case, there is little to gain by limiting the free library to free
95+software only, so we use the Lesser General Public License.
96+
97+ In other cases, permission to use a particular library in non-free
98+programs enables a greater number of people to use a large body of
99+free software. For example, permission to use the GNU C Library in
100+non-free programs enables many more people to use the whole GNU
101+operating system, as well as its variant, the GNU/Linux operating
102+system.
103+
104+ Although the Lesser General Public License is Less protective of the
105+users' freedom, it does ensure that the user of a program that is
106+linked with the Library has the freedom and the wherewithal to run
107+that program using a modified version of the Library.
108+
109+ The precise terms and conditions for copying, distribution and
110+modification follow. Pay close attention to the difference between a
111+"work based on the library" and a "work that uses the library". The
112+former contains code derived from the library, whereas the latter must
113+be combined with the library in order to run.
114+
115+ GNU LESSER GENERAL PUBLIC LICENSE
116+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
117+
118+ 0. This License Agreement applies to any software library or other
119+program which contains a notice placed by the copyright holder or
120+other authorized party saying it may be distributed under the terms of
121+this Lesser General Public License (also called "this License").
122+Each licensee is addressed as "you".
123+
124+ A "library" means a collection of software functions and/or data
125+prepared so as to be conveniently linked with application programs
126+(which use some of those functions and data) to form executables.
127+
128+ The "Library", below, refers to any such software library or work
129+which has been distributed under these terms. A "work based on the
130+Library" means either the Library or any derivative work under
131+copyright law: that is to say, a work containing the Library or a
132+portion of it, either verbatim or with modifications and/or translated
133+straightforwardly into another language. (Hereinafter, translation is
134+included without limitation in the term "modification".)
135+
136+ "Source code" for a work means the preferred form of the work for
137+making modifications to it. For a library, complete source code means
138+all the source code for all modules it contains, plus any associated
139+interface definition files, plus the scripts used to control compilation
140+and installation of the library.
141+
142+ Activities other than copying, distribution and modification are not
143+covered by this License; they are outside its scope. The act of
144+running a program using the Library is not restricted, and output from
145+such a program is covered only if its contents constitute a work based
146+on the Library (independent of the use of the Library in a tool for
147+writing it). Whether that is true depends on what the Library does
148+and what the program that uses the Library does.
149+
150+ 1. You may copy and distribute verbatim copies of the Library's
151+complete source code as you receive it, in any medium, provided that
152+you conspicuously and appropriately publish on each copy an
153+appropriate copyright notice and disclaimer of warranty; keep intact
154+all the notices that refer to this License and to the absence of any
155+warranty; and distribute a copy of this License along with the
156+Library.
157+
158+ You may charge a fee for the physical act of transferring a copy,
159+and you may at your option offer warranty protection in exchange for a
160+fee.
161+
162+ 2. You may modify your copy or copies of the Library or any portion
163+of it, thus forming a work based on the Library, and copy and
164+distribute such modifications or work under the terms of Section 1
165+above, provided that you also meet all of these conditions:
166+
167+ a) The modified work must itself be a software library.
168+
169+ b) You must cause the files modified to carry prominent notices
170+ stating that you changed the files and the date of any change.
171+
172+ c) You must cause the whole of the work to be licensed at no
173+ charge to all third parties under the terms of this License.
174+
175+ d) If a facility in the modified Library refers to a function or a
176+ table of data to be supplied by an application program that uses
177+ the facility, other than as an argument passed when the facility
178+ is invoked, then you must make a good faith effort to ensure that,
179+ in the event an application does not supply such function or
180+ table, the facility still operates, and performs whatever part of
181+ its purpose remains meaningful.
182+
183+ (For example, a function in a library to compute square roots has
184+ a purpose that is entirely well-defined independent of the
185+ application. Therefore, Subsection 2d requires that any
186+ application-supplied function or table used by this function must
187+ be optional: if the application does not supply it, the square
188+ root function must still compute square roots.)
189+
190+These requirements apply to the modified work as a whole. If
191+identifiable sections of that work are not derived from the Library,
192+and can be reasonably considered independent and separate works in
193+themselves, then this License, and its terms, do not apply to those
194+sections when you distribute them as separate works. But when you
195+distribute the same sections as part of a whole which is a work based
196+on the Library, the distribution of the whole must be on the terms of
197+this License, whose permissions for other licensees extend to the
198+entire whole, and thus to each and every part regardless of who wrote
199+it.
200+
201+Thus, it is not the intent of this section to claim rights or contest
202+your rights to work written entirely by you; rather, the intent is to
203+exercise the right to control the distribution of derivative or
204+collective works based on the Library.
205+
206+In addition, mere aggregation of another work not based on the Library
207+with the Library (or with a work based on the Library) on a volume of
208+a storage or distribution medium does not bring the other work under
209+the scope of this License.
210+
211+ 3. You may opt to apply the terms of the ordinary GNU General Public
212+License instead of this License to a given copy of the Library. To do
213+this, you must alter all the notices that refer to this License, so
214+that they refer to the ordinary GNU General Public License, version 2,
215+instead of to this License. (If a newer version than version 2 of the
216+ordinary GNU General Public License has appeared, then you can specify
217+that version instead if you wish.) Do not make any other change in
218+these notices.
219+
220+ Once this change is made in a given copy, it is irreversible for
221+that copy, so the ordinary GNU General Public License applies to all
222+subsequent copies and derivative works made from that copy.
223+
224+ This option is useful when you wish to copy part of the code of
225+the Library into a program that is not a library.
226+
227+ 4. You may copy and distribute the Library (or a portion or
228+derivative of it, under Section 2) in object code or executable form
229+under the terms of Sections 1 and 2 above provided that you accompany
230+it with the complete corresponding machine-readable source code, which
231+must be distributed under the terms of Sections 1 and 2 above on a
232+medium customarily used for software interchange.
233+
234+ If distribution of object code is made by offering access to copy
235+from a designated place, then offering equivalent access to copy the
236+source code from the same place satisfies the requirement to
237+distribute the source code, even though third parties are not
238+compelled to copy the source along with the object code.
239+
240+ 5. A program that contains no derivative of any portion of the
241+Library, but is designed to work with the Library by being compiled or
242+linked with it, is called a "work that uses the Library". Such a
243+work, in isolation, is not a derivative work of the Library, and
244+therefore falls outside the scope of this License.
245+
246+ However, linking a "work that uses the Library" with the Library
247+creates an executable that is a derivative of the Library (because it
248+contains portions of the Library), rather than a "work that uses the
249+library". The executable is therefore covered by this License.
250+Section 6 states terms for distribution of such executables.
251+
252+ When a "work that uses the Library" uses material from a header file
253+that is part of the Library, the object code for the work may be a
254+derivative work of the Library even though the source code is not.
255+Whether this is true is especially significant if the work can be
256+linked without the Library, or if the work is itself a library. The
257+threshold for this to be true is not precisely defined by law.
258+
259+ If such an object file uses only numerical parameters, data
260+structure layouts and accessors, and small macros and small inline
261+functions (ten lines or less in length), then the use of the object
262+file is unrestricted, regardless of whether it is legally a derivative
263+work. (Executables containing this object code plus portions of the
264+Library will still fall under Section 6.)
265+
266+ Otherwise, if the work is a derivative of the Library, you may
267+distribute the object code for the work under the terms of Section 6.
268+Any executables containing that work also fall under Section 6,
269+whether or not they are linked directly with the Library itself.
270+
271+ 6. As an exception to the Sections above, you may also combine or
272+link a "work that uses the Library" with the Library to produce a
273+work containing portions of the Library, and distribute that work
274+under terms of your choice, provided that the terms permit
275+modification of the work for the customer's own use and reverse
276+engineering for debugging such modifications.
277+
278+ You must give prominent notice with each copy of the work that the
279+Library is used in it and that the Library and its use are covered by
280+this License. You must supply a copy of this License. If the work
281+during execution displays copyright notices, you must include the
282+copyright notice for the Library among them, as well as a reference
283+directing the user to the copy of this License. Also, you must do one
284+of these things:
285+
286+ a) Accompany the work with the complete corresponding
287+ machine-readable source code for the Library including whatever
288+ changes were used in the work (which must be distributed under
289+ Sections 1 and 2 above); and, if the work is an executable linked
290+ with the Library, with the complete machine-readable "work that
291+ uses the Library", as object code and/or source code, so that the
292+ user can modify the Library and then relink to produce a modified
293+ executable containing the modified Library. (It is understood
294+ that the user who changes the contents of definitions files in the
295+ Library will not necessarily be able to recompile the application
296+ to use the modified definitions.)
297+
298+ b) Use a suitable shared library mechanism for linking with the
299+ Library. A suitable mechanism is one that (1) uses at run time a
300+ copy of the library already present on the user's computer system,
301+ rather than copying library functions into the executable, and (2)
302+ will operate properly with a modified version of the library, if
303+ the user installs one, as long as the modified version is
304+ interface-compatible with the version that the work was made with.
305+
306+ c) Accompany the work with a written offer, valid for at
307+ least three years, to give the same user the materials
308+ specified in Subsection 6a, above, for a charge no more
309+ than the cost of performing this distribution.
310+
311+ d) If distribution of the work is made by offering access to copy
312+ from a designated place, offer equivalent access to copy the above
313+ specified materials from the same place.
314+
315+ e) Verify that the user has already received a copy of these
316+ materials or that you have already sent this user a copy.
317+
318+ For an executable, the required form of the "work that uses the
319+Library" must include any data and utility programs needed for
320+reproducing the executable from it. However, as a special exception,
321+the materials to be distributed need not include anything that is
322+normally distributed (in either source or binary form) with the major
323+components (compiler, kernel, and so on) of the operating system on
324+which the executable runs, unless that component itself accompanies
325+the executable.
326+
327+ It may happen that this requirement contradicts the license
328+restrictions of other proprietary libraries that do not normally
329+accompany the operating system. Such a contradiction means you cannot
330+use both them and the Library together in an executable that you
331+distribute.
332+
333+ 7. You may place library facilities that are a work based on the
334+Library side-by-side in a single library together with other library
335+facilities not covered by this License, and distribute such a combined
336+library, provided that the separate distribution of the work based on
337+the Library and of the other library facilities is otherwise
338+permitted, and provided that you do these two things:
339+
340+ a) Accompany the combined library with a copy of the same work
341+ based on the Library, uncombined with any other library
342+ facilities. This must be distributed under the terms of the
343+ Sections above.
344+
345+ b) Give prominent notice with the combined library of the fact
346+ that part of it is a work based on the Library, and explaining
347+ where to find the accompanying uncombined form of the same work.
348+
349+ 8. You may not copy, modify, sublicense, link with, or distribute
350+the Library except as expressly provided under this License. Any
351+attempt otherwise to copy, modify, sublicense, link with, or
352+distribute the Library is void, and will automatically terminate your
353+rights under this License. However, parties who have received copies,
354+or rights, from you under this License will not have their licenses
355+terminated so long as such parties remain in full compliance.
356+
357+ 9. You are not required to accept this License, since you have not
358+signed it. However, nothing else grants you permission to modify or
359+distribute the Library or its derivative works. These actions are
360+prohibited by law if you do not accept this License. Therefore, by
361+modifying or distributing the Library (or any work based on the
362+Library), you indicate your acceptance of this License to do so, and
363+all its terms and conditions for copying, distributing or modifying
364+the Library or works based on it.
365+
366+ 10. Each time you redistribute the Library (or any work based on the
367+Library), the recipient automatically receives a license from the
368+original licensor to copy, distribute, link with or modify the Library
369+subject to these terms and conditions. You may not impose any further
370+restrictions on the recipients' exercise of the rights granted herein.
371+You are not responsible for enforcing compliance by third parties with
372+this License.
373+
374+ 11. If, as a consequence of a court judgment or allegation of patent
375+infringement or for any other reason (not limited to patent issues),
376+conditions are imposed on you (whether by court order, agreement or
377+otherwise) that contradict the conditions of this License, they do not
378+excuse you from the conditions of this License. If you cannot
379+distribute so as to satisfy simultaneously your obligations under this
380+License and any other pertinent obligations, then as a consequence you
381+may not distribute the Library at all. For example, if a patent
382+license would not permit royalty-free redistribution of the Library by
383+all those who receive copies directly or indirectly through you, then
384+the only way you could satisfy both it and this License would be to
385+refrain entirely from distribution of the Library.
386+
387+If any portion of this section is held invalid or unenforceable under any
388+particular circumstance, the balance of the section is intended to apply,
389+and the section as a whole is intended to apply in other circumstances.
390+
391+It is not the purpose of this section to induce you to infringe any
392+patents or other property right claims or to contest validity of any
393+such claims; this section has the sole purpose of protecting the
394+integrity of the free software distribution system which is
395+implemented by public license practices. Many people have made
396+generous contributions to the wide range of software distributed
397+through that system in reliance on consistent application of that
398+system; it is up to the author/donor to decide if he or she is willing
399+to distribute software through any other system and a licensee cannot
400+impose that choice.
401+
402+This section is intended to make thoroughly clear what is believed to
403+be a consequence of the rest of this License.
404+
405+ 12. If the distribution and/or use of the Library is restricted in
406+certain countries either by patents or by copyrighted interfaces, the
407+original copyright holder who places the Library under this License may add
408+an explicit geographical distribution limitation excluding those countries,
409+so that distribution is permitted only in or among countries not thus
410+excluded. In such case, this License incorporates the limitation as if
411+written in the body of this License.
412+
413+ 13. The Free Software Foundation may publish revised and/or new
414+versions of the Lesser General Public License from time to time.
415+Such new versions will be similar in spirit to the present version,
416+but may differ in detail to address new problems or concerns.
417+
418+Each version is given a distinguishing version number. If the Library
419+specifies a version number of this License which applies to it and
420+"any later version", you have the option of following the terms and
421+conditions either of that version or of any later version published by
422+the Free Software Foundation. If the Library does not specify a
423+license version number, you may choose any version ever published by
424+the Free Software Foundation.
425+
426+ 14. If you wish to incorporate parts of the Library into other free
427+programs whose distribution conditions are incompatible with these,
428+write to the author to ask for permission. For software which is
429+copyrighted by the Free Software Foundation, write to the Free
430+Software Foundation; we sometimes make exceptions for this. Our
431+decision will be guided by the two goals of preserving the free status
432+of all derivatives of our free software and of promoting the sharing
433+and reuse of software generally.
434+
435+ NO WARRANTY
436+
437+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
438+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
439+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
440+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
441+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
442+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
443+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
444+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
445+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
446+
447+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
448+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
449+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
450+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
451+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
452+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
453+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
454+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
455+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
456+DAMAGES.
457+
458+ END OF TERMS AND CONDITIONS
459+
460+ How to Apply These Terms to Your New Libraries
461+
462+ If you develop a new library, and you want it to be of the greatest
463+possible use to the public, we recommend making it free software that
464+everyone can redistribute and change. You can do so by permitting
465+redistribution under these terms (or, alternatively, under the terms of the
466+ordinary General Public License).
467+
468+ To apply these terms, attach the following notices to the library. It is
469+safest to attach them to the start of each source file to most effectively
470+convey the exclusion of warranty; and each file should have at least the
471+"copyright" line and a pointer to where the full notice is found.
472+
473+ <one line to give the library's name and a brief idea of what it does.>
474+ Copyright (C) <year> <name of author>
475+
476+ This library is free software; you can redistribute it and/or
477+ modify it under the terms of the GNU Lesser General Public
478+ License as published by the Free Software Foundation; either
479+ version 2.1 of the License, or (at your option) any later version.
480+
481+ This library is distributed in the hope that it will be useful,
482+ but WITHOUT ANY WARRANTY; without even the implied warranty of
483+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
484+ Lesser General Public License for more details.
485+
486+ You should have received a copy of the GNU Lesser General Public
487+ License along with this library; if not, write to the Free Software
488+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
489+
490+Also add information on how to contact you by electronic and paper mail.
491+
492+You should also get your employer (if you work as a programmer) or your
493+school, if any, to sign a "copyright disclaimer" for the library, if
494+necessary. Here is a sample; alter the names:
495+
496+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
497+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
498+
499+ <signature of Ty Coon>, 1 April 1990
500+ Ty Coon, President of Vice
501+
502+That's all there is to it!
--- MikuInstaller-patches/trunk/wine-d3d-workaround.diff (nonexistent)
+++ MikuInstaller-patches/trunk/wine-d3d-workaround.diff (revision 2)
@@ -0,0 +1,72 @@
1+This patch is provided by MikuInstaller project for Wine.
2+
3+You can obtain the whole of source code of Wine from
4+ http://www.winehq.org/
5+
6+Copyright (c) 1993-2008 the Wine project authors (see the file AUTHORS
7+for a complete list)
8+
9+Wine is free software; you can redistribute it and/or modify it under
10+the terms of the GNU Lesser General Public License as published by the
11+Free Software Foundation; either version 2.1 of the License, or (at
12+your option) any later version.
13+
14+This program is distributed in the hope that it will be useful, but
15+WITHOUT ANY WARRANTY; without even the implied warranty of
16+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17+Lesser General Public License for more details.
18+
19+A copy of the GNU Lesser General Public License is included in the
20+Wine distribution in the file COPYING.LIB. If you did not receive this
21+copy, write to the Free Software Foundation, Inc., 51 Franklin St,
22+Fifth Floor, Boston, MA 02110-1301, USA.
23+
24+
25+diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
26+index 32f7323..c5c3c1c 100644
27+--- a/dlls/wined3d/directx.c
28++++ b/dlls/wined3d/directx.c
29+@@ -23,0 +23,1 @@
30++/* Modified by MikuInstaller project on 2008-07-02. */
31+@@ -775,10 +775,20 @@ BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info) {
32+ if(gl_info->supported[ext]) gl_info->pfn = (type) pwglGetProcAddress(#pfn); \
33+ else if(ver && ver <= gl_info->gl_version) gl_info->pfn = (type) pwglGetProcAddress(#replace); \
34+ else gl_info->pfn = NULL; \
35++ if(gl_info->pfn == NULL) gl_info->supported[ext] = FALSE; \
36+ }
37+ GL_EXT_FUNCS_GEN;
38+ #undef USE_GL_FUNC
39+
40++ if (!gl_info->supported[ARB_VERTEX_PROGRAM])
41++ gl_info->supported[ARB_FRAGMENT_PROGRAM] = FALSE;
42++ if (!gl_info->supported[ARB_VERTEX_BUFFER_OBJECT])
43++ gl_info->supported[ARB_PIXEL_BUFFER_OBJECT] = FALSE;
44++ if (!gl_info->supported[ARB_SHADER_OBJECTS]) {
45++ gl_info->supported[ARB_VERTEX_SHADER] = FALSE;
46++ gl_info->supported[ARB_FRAGMENT_SHADER] = FALSE;
47++ }
48++
49+ #define USE_GL_FUNC(type, pfn, ext, replace) gl_info->pfn = (type) pwglGetProcAddress(#pfn);
50+ WGL_EXT_FUNCS_GEN;
51+ #undef USE_GL_FUNC
52+diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
53+index 393c11a..706d93c 100644
54+--- a/dlls/winex11.drv/opengl.c
55++++ b/dlls/winex11.drv/opengl.c
56+@@ -23,0 +23,1 @@
57++/* Modified by MikuInstaller project on 2008-07-02. */
58+@@ -484,7 +484,13 @@ LOAD_FUNCPTR(glXFreeMemoryNV)
59+ * enable this function when the Xserver understand GLX 1.3 or newer
60+ */
61+ pglXQueryDrawable = NULL;
62+- } else if(strcmp("ATI", WineGLInfo.glxClientVendor) == 0) {
63++ } else if (strstr(WineGLInfo.glxServerExtensions, "GLX_SGIX_fbconfig") != NULL
64++ && strstr(WineGLInfo.glxClientExtensions, "GLX_SGIX_fbconfig") != NULL) {
65++ pglXChooseFBConfig = pglXGetProcAddressARB((const GLubyte *) "glXChooseFBConfigSGIX");
66++ pglXGetFBConfigAttrib = pglXGetProcAddressARB((const GLubyte *) "glXGetFBConfigAttribSGIX");
67++ pglXGetVisualFromFBConfig = pglXGetProcAddressARB((const GLubyte *) "glXGetVisualFromFBConfigSGIX");
68++ pglXQueryDrawable = NULL;
69++ } else if(strcmp("ATI", WineGLInfo.glxClientVendor) == 0) {
70+ TRACE("Overriding ATI GLX capabilities!\n");
71+ pglXChooseFBConfig = pglXGetProcAddressARB((const GLubyte *) "glXChooseFBConfig");
72+ pglXGetFBConfigAttrib = pglXGetProcAddressARB((const GLubyte *) "glXGetFBConfigAttrib");
--- MikuInstaller-patches/trunk/wine-libs-wine-Makefile.diff (nonexistent)
+++ MikuInstaller-patches/trunk/wine-libs-wine-Makefile.diff (revision 2)
@@ -0,0 +1,38 @@
1+This patch is provided by MikuInstaller project for Wine.
2+
3+You can obtain the whole of source code of Wine from
4+ http://www.winehq.org/
5+
6+Copyright (c) 1993-2008 the Wine project authors (see the file AUTHORS
7+for a complete list)
8+
9+Wine is free software; you can redistribute it and/or modify it under
10+the terms of the GNU Lesser General Public License as published by the
11+Free Software Foundation; either version 2.1 of the License, or (at
12+your option) any later version.
13+
14+This program is distributed in the hope that it will be useful, but
15+WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16+Lesser General Public License for more details.
17+
18+A copy of the GNU Lesser General Public License is included in the
19+Wine distribution in the file COPYING.LIB. If you did not receive this
20+copy, write to the Free Software Foundation, Inc., 51 Franklin St,
21+Fifth Floor, Boston, MA 02110-1301, USA.
22+
23+
24+--- wine/libs/wine/Makefile.in.orig
25++++ wine/libs/wine/Makefile.in
26+@@ -0,0 +1 @@
27++# modified by MikuInstaller project on 2008-07-06.
28+@@ -176,8 +176,9 @@
29+ -cd $(DESTDIR)$(libdir) && $(RM) libwine.a libwine.dll libwine.so libwine.so.$(VERSION) \
30+ libwine.so.$(SOVERSION) libwine.dylib libwine.$(VERSION).dylib libwine.$(SOVERSION).dylib
31+
32++GIT=git
33+ version-stamp: dummy
34+- (GIT_DIR=$(TOPSRCDIR)/.git git describe HEAD 2>/dev/null || echo "wine-@PACKAGE_VERSION@") | sed -n -e '$$s/\(.*\)/const char wine_build[] = "\1";/p' >$@ || ($(RM) $@ && exit 1)
35++ (GIT_DIR=$(TOPSRCDIR)/.git $(GIT) describe HEAD 2>/dev/null || echo "wine-@PACKAGE_VERSION@") | sed -n -e '$$s/\(.*\)/const char wine_build[] = "\1";/p' >$@ || ($(RM) $@ && exit 1)
36+
37+ version.c: version-stamp
38+ @cmp -s version-stamp $@ || cp version-stamp $@
--- MikuInstaller-patches/trunk/wine-programs-Makefile.diff (nonexistent)
+++ MikuInstaller-patches/trunk/wine-programs-Makefile.diff (revision 2)
@@ -0,0 +1,42 @@
1+This patch is provided by MikuInstaller project for Wine.
2+
3+You can obtain the whole of source code of Wine from
4+ http://www.winehq.org/
5+
6+Copyright (c) 1993-2008 the Wine project authors (see the file AUTHORS
7+for a complete list)
8+
9+Wine is free software; you can redistribute it and/or modify it under
10+the terms of the GNU Lesser General Public License as published by the
11+Free Software Foundation; either version 2.1 of the License, or (at
12+your option) any later version.
13+
14+This program is distributed in the hope that it will be useful, but
15+WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16+Lesser General Public License for more details.
17+
18+A copy of the GNU Lesser General Public License is included in the
19+Wine distribution in the file COPYING.LIB. If you did not receive this
20+copy, write to the Free Software Foundation, Inc., 51 Franklin St,
21+Fifth Floor, Boston, MA 02110-1301, USA.
22+
23+
24+diff --git a/programs/Makefile.in b/programs/Makefile.in
25+index 967cd8e..cd814aa 100644
26+--- a/programs/Makefile.in
27++++ b/programs/Makefile.in
28+@@ -1,0 +1,1 @@
29++# Modified by MikuInstaller project on 2008-06-06.
30+@@ -133,10 +133,10 @@ install-apploader: wineapploader $(INSTALLDIRS) dummy
31+ $(INSTALL_SCRIPT) wineapploader $(DESTDIR)$(bindir)/wineapploader
32+
33+ $(INSTALLPROGS:%=%/__installprog__): install-apploader
34+- $(RM) $(DESTDIR)$(bindir)/`dirname $@` && $(LN) $(DESTDIR)$(bindir)/wineapploader $(DESTDIR)$(bindir)/`dirname $@`
35++ $(RM) $(DESTDIR)$(bindir)/`dirname $@` && $(LN_S) wineapploader $(DESTDIR)$(bindir)/`dirname $@`
36+
37+ install-progs.so: $(INSTALLPROGS:%=%/__installprog__)
38+- $(RM) $(DESTDIR)$(bindir)/wineapploader
39++# $(RM) $(DESTDIR)$(bindir)/wineapploader
40+
41+ install-progs: # nothing to do here
42+
--- MikuInstaller-patches/trunk/wine-crossover-7.0.0-osxime.diff (nonexistent)
+++ MikuInstaller-patches/trunk/wine-crossover-7.0.0-osxime.diff (revision 2)
@@ -0,0 +1,4987 @@
1+This patch is derived from CrossOver 7.0.0.
2+
3+You can obtain the whole of source code of CrossOver from
4+ http://www.codeweavers.com/products/source/
5+
6+Copyright (c) 1993-2008 the Wine project authors (see the file AUTHORS
7+for a complete list)
8+
9+Wine is free software; you can redistribute it and/or modify it under
10+the terms of the GNU Lesser General Public License as published by the
11+Free Software Foundation; either version 2.1 of the License, or (at
12+your option) any later version.
13+
14+This program is distributed in the hope that it will be useful, but
15+WITHOUT ANY WARRANTY; without even the implied warranty of
16+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17+Lesser General Public License for more details.
18+
19+A copy of the GNU Lesser General Public License is included in the
20+Wine distribution in the file COPYING.LIB. If you did not receive this
21+copy, write to the Free Software Foundation, Inc., 51 Franklin St,
22+Fifth Floor, Boston, MA 02110-1301, USA.
23+
24+
25+--- wine-1.0-rc4/Make.rules.in 2008-06-07 00:24:30.000000000 +0900
26++++ wine/Make.rules.in 2008-06-07 01:12:15.000000000 +0900
27+@@ -9,6 +9,7 @@
28+ # Each individual makefile may define the following additional variables:
29+ # C_SRCS : C sources for the module
30+ # C_SRCS16 : 16-bit C sources for the module
31++# OBJC_SRCS : Objective-C sources for the module
32+ # RC_SRCS : resource source files
33+ # EXTRA_SRCS : extra source files for make depend
34+ # EXTRA_OBJS : extra object files
35+@@ -120,7 +121,7 @@
36+ CLEAN_TARGETS = $(IDL_GEN_C_SRCS) $(IDL_GEN_HEADERS) $(IDL_TLB_SRCS:.idl=.tlb) $(IDL_P_SRCS:%=dlldata.c) \
37+ $(BISON_SRCS:.y=.tab.c) $(BISON_SRCS:.y=.tab.h) $(LEX_SRCS:.l=.yy.c) $(MC_SRCS:.mc=.mc.rc)
38+
39+-OBJS = $(C_SRCS:.c=.o) $(BISON_SRCS:.y=.tab.o) $(LEX_SRCS:.l=.yy.o) $(IDL_GEN_C_SRCS:.c=.o) $(EXTRA_OBJS)
40++OBJS = $(C_SRCS:.c=.o) @OBJC_OBJS@ $(BISON_SRCS:.y=.tab.o) $(LEX_SRCS:.l=.yy.o) $(IDL_GEN_C_SRCS:.c=.o) $(EXTRA_OBJS)
41+
42+ RCOBJS = $(RC_SRCS:.rc=.res.o)
43+ LINTS = $(C_SRCS:.c=.ln)
44+@@ -136,11 +137,14 @@
45+
46+ # Implicit rules
47+
48+-.SUFFIXES: .mc .rc .mc.rc .res .res.o .spec .spec.o .idl .tlb .h .y .l .tab.c .tab.h .yy.c .ok .man.in .man _c.c _i.c _p.c _s.c @MAINTAINER_MODE@ .sfd .ttf .svg .ico
49++.SUFFIXES: .mc .rc .mc.rc .res .res.o .spec .spec.o .idl .tlb .h .y .l .tab.c .tab.h .yy.c .ok .man.in .man _c.c _i.c _p.c _s.c .m @MAINTAINER_MODE@ .sfd .ttf .svg .ico
50+
51+ .c.o:
52+ $(CC) -c $(ALLCFLAGS) -o $@ $<
53+
54++.m.o:
55++ $(CC) -c $(ALLCFLAGS) -o $@ $<
56++
57+ .s.o:
58+ $(AS) -o $@ $<
59+
60+@@ -229,7 +233,7 @@
61+
62+ # Rules for dependencies
63+
64+-DEPEND_SRCS = $(C_SRCS) $(C_SRCS16) $(RC_SRCS) $(RC_SRCS16) $(MC_SRCS) \
65++DEPEND_SRCS = $(C_SRCS) $(C_SRCS16) @OBJC_SRCS@ $(RC_SRCS) $(RC_SRCS16) $(MC_SRCS) \
66+ $(IDL_H_SRCS) $(IDL_C_SRCS) $(IDL_I_SRCS) $(IDL_P_SRCS) $(IDL_S_SRCS) \
67+ $(IDL_GEN_C_SRCS) $(IDL_TLB_SRCS) $(IDL_TLB_SRCS:.idl=.tlb) \
68+ $(BISON_SRCS) $(LEX_SRCS) $(EXTRA_SRCS)
69+--- wine-1.0-rc4/Makefile.in 2008-06-07 00:24:30.000000000 +0900
70++++ wine/Makefile.in 2008-06-07 01:12:15.000000000 +0900
71+@@ -487,6 +495,7 @@
72+ dlls/winemp3.acm/Makefile \
73+ dlls/winenas.drv/Makefile \
74+ dlls/wineoss.drv/Makefile \
75++ dlls/wineosxime.drv/Makefile \
76+ dlls/wineps.drv/Makefile \
77+ dlls/winequartz.drv/Makefile \
78+ dlls/winex11.drv/Makefile \
79+@@ -913,6 +925,7 @@
80+ dlls/winemp3.acm/Makefile: dlls/winemp3.acm/Makefile.in dlls/Makedll.rules
81+ dlls/winenas.drv/Makefile: dlls/winenas.drv/Makefile.in dlls/Makedll.rules
82+ dlls/wineoss.drv/Makefile: dlls/wineoss.drv/Makefile.in dlls/Makedll.rules
83++dlls/wineosxime.drv/Makefile: dlls/wineosxime.drv/Makefile.in dlls/Makedll.rules
84+ dlls/wineps.drv/Makefile: dlls/wineps.drv/Makefile.in dlls/Makedll.rules
85+ dlls/winequartz.drv/Makefile: dlls/winequartz.drv/Makefile.in dlls/Makedll.rules
86+ dlls/winex11.drv/Makefile: dlls/winex11.drv/Makefile.in dlls/Makedll.rules
87+--- wine-1.0-rc4/configure.ac 2008-06-07 00:24:30.000000000 +0900
88++++ wine/configure.ac 2008-06-07 01:12:15.000000000 +0900
89+@@ -456,12 +474,17 @@
90+ LIBWINE_LDFLAGS="-multiply_defined suppress"
91+ LDSHARED="\$(CC) -dynamiclib"
92+ STRIP="$STRIP -x"
93++ dnl Work around Apple's broken strip
94++ INSTALL="STRIPPROG=\\\"$STRIP\\\" \\\$(TOPSRCDIR)/tools/install-sh -c"
95+ LDRPATH_LOCAL="&& install_name_tool -change @executable_path/\`\$(RELPATH) \$(bindir) \$(libdir)\`/libwine.1.dylib @executable_path/\$(TOPOBJDIR)/libs/wine/libwine.1.dylib \$@ || \$(RM) \$@"
96+ dnl declare needed frameworks
97+ AC_SUBST(SECURITYLIB,"-framework Security -framework CoreFoundation")
98+ AC_SUBST(COREFOUNDATIONLIB,"-framework CoreFoundation")
99+ AC_SUBST(IOKITLIB,"-framework IOKit -framework CoreFoundation")
100+- AC_SUBST(LDEXECFLAGS,["-image_base 0x7bf00000 -Wl,-segaddr,WINE_DOS,0x00000000,-segaddr,WINE_SHARED_HEAP,0x7f000000"])
101++ AC_SUBST(APPKITLIB,"-framework AppKit")
102++ AC_SUBST(OBJC_SRCS,"\$(OBJC_SRCS)")
103++ AC_SUBST(OBJC_OBJS,"\$(OBJC_SRCS:.m=.o)")
104++ AC_SUBST(LDEXECFLAGS,["-image_base 0x7bf00000 -Wl,-segaddr,WINE_DOS,0x00000000,-segaddr,WINE_OLE32,0x65f00000,-segaddr,WINE_SHARED_HEAP,0x7f000000"])
105+ if test "$ac_cv_header_DiskArbitration_DiskArbitration_h" = "yes"
106+ then
107+ dnl DiskArbitration API is not public on Darwin < 8.0, use it only if header found
108+@@ -1999,6 +2118,7 @@
109+ AC_CONFIG_FILES([dlls/winemp3.acm/Makefile])
110+ AC_CONFIG_FILES([dlls/winenas.drv/Makefile])
111+ AC_CONFIG_FILES([dlls/wineoss.drv/Makefile])
112++AC_CONFIG_FILES([dlls/wineosxime.drv/Makefile])
113+ AC_CONFIG_FILES([dlls/wineps.drv/Makefile])
114+ AC_CONFIG_FILES([dlls/winequartz.drv/Makefile])
115+ AC_CONFIG_FILES([dlls/winex11.drv/Makefile])
116+--- wine-1.0-rc4/dlls/Makefile.in 2008-06-07 00:24:30.000000000 +0900
117++++ wine/dlls/Makefile.in 2008-06-07 01:12:15.000000000 +0900
118+@@ -11,7 +11,7 @@
119+
120+ GLU32FILES = glu32
121+ OPENGLFILES = opengl32
122+-QUARTZFILES = winequartz.drv
123++QUARTZFILES = wineosxime.drv winequartz.drv
124+ XFILES = winex11.drv
125+ EXTRADIRS = @GLU32FILES@ @OPENGLFILES@ @QUARTZFILES@ @XFILES@
126+
127+@@ -371,6 +373,7 @@
128+ $(TESTSUBDIRS) \
129+ glu32 \
130+ opengl32 \
131++ wineosxime.drv \
132+ winequartz.drv \
133+ winex11.drv
134+
135+--- wine-1.0-rc4/dlls/user32/message.c 2008-06-07 00:24:30.000000000 +0900
136++++ wine/dlls/user32/message.c 2008-06-07 01:12:15.000000000 +0900
137+@@ -1741,7 +1743,11 @@
138+ }
139+ accept_hardware_message( hw_id, remove, 0 );
140+
141++#ifdef __APPLE__
142++ if ( msg->message == WM_KEYDOWN || msg->message == WM_KEYUP || msg->message == WM_SYSKEYDOWN || msg->message == WM_SYSKEYUP)
143++#else
144+ if ( msg->message == WM_KEYDOWN || msg->message == WM_KEYUP )
145++#endif
146+ if ( ImmProcessKey(msg->hwnd, GetKeyboardLayout(0), msg->wParam, msg->lParam, 0) )
147+ msg->wParam = VK_PROCESSKEY;
148+
149+--- wine-1.0-rc4/dlls/wineosxime.drv/IMKClient.h 1970-01-01 09:00:00.000000000 +0900
150++++ wine/dlls/wineosxime.drv/IMKClient.h 2008-06-07 01:12:15.000000000 +0900
151+@@ -0,0 +1,39 @@
152++#ifdef __APPLE__
153++
154++#include <Carbon/Carbon.h>
155++
156++
157++typedef struct CXIMKClient* CXIMKClientRef;
158++
159++
160++typedef void (*CXIMKClientUpdatedEdit)(CXIMKClientRef inClient, CFStringRef inString,
161++ long inReplacementRangeLocation, long inReplacementRangeLength,
162++ void *data);
163++
164++typedef void (*CXIMKClientCompletedText)(CXIMKClientRef inClient, CFStringRef inString,
165++ long inReplacementRangeLocation, long inReplacementRangeLength,
166++ void* data);
167++
168++typedef void (*CXIMKClientModeChanged)(CXIMKClientRef inClient, CFStringRef mode, void* data);
169++
170++
171++CXIMKClientRef CXIMKClientInitialize(
172++ CFStringRef inServerName,
173++ CXIMKClientUpdatedEdit inUpdateEditCallback,
174++ CXIMKClientCompletedText inCompletedTextCallback,
175++ CXIMKClientModeChanged inModeChanged,
176++ void* data);
177++
178++void CXIMKClientCleanup(CXIMKClientRef inClient);
179++
180++int CXIMKClientActivate(CXIMKClientRef inClient);
181++
182++void CXIMKClientDeactivate(CXIMKClientRef inClient);
183++
184++void CXIMKClientSetInputMode(CXIMKClientRef inClient, CFStringRef inMode);
185++
186++int CXIMKClientSendEvent(CXIMKClientRef inClient, EventRef inEvent);
187++
188++void CXIMKClientForceComplete(CXIMKClientRef inClient);
189++
190++#endif /* __APPLE__ */
191+--- wine-1.0-rc4/dlls/wineosxime.drv/IMKClient.m 1970-01-01 09:00:00.000000000 +0900
192++++ wine/dlls/wineosxime.drv/IMKClient.m 2008-06-07 01:12:15.000000000 +0900
193+@@ -0,0 +1,340 @@
194++#ifdef __APPLE__
195++
196++#include "wine/debug.h"
197++
198++#define BOOL MacBOOL
199++
200++#include "IMKClient.h"
201++
202++#import <Foundation/Foundation.h>
203++
204++#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4
205++ #import <InputMethodKit/IMKInputController.h>
206++#else
207++ @protocol IMKTextInput
208++ @end
209++ @protocol IMKUnicodeTextInput
210++ @end
211++ typedef long NSInteger;
212++ typedef unsigned long NSUInteger;
213++ typedef NSInteger IMKLocationToOffsetMappingMode;
214++#endif
215++
216++#include <unistd.h>
217++
218++#define debugstr_ns(s) debugstr_a([(s) UTF8String])
219++
220++
221++WINE_DEFAULT_DEBUG_CHANNEL(mac_xim);
222++
223++
224++@interface NSObject (wine_IMKEvent)
225+++ (id) packageEventRef:(EventRef)eventRef;
226++@end
227++
228++
229++// This protocol has several close relatives in Leopard's
230++// <InputMethodKit/IMKInputController.h> header. The IMKStateSetting protocol
231++// also describes methods implemented by the server object. Where this protocol
232++// describes the interface between a client and the input method server, the
233++// IMKServerInput informal protocol describes the complementary interface
234++// between the server object and the IMKInputController inside the server
235++// process which provides the logic of how a specific input method behaves. As
236++// such, the semantics for IMKStateSetting and IMKServerInput help elucidate the
237++// semantics of this protocol.
238++@protocol IMKServerProxy
239++- (void)activateServer:(id)sender;
240++- (void)deactivateServer:(id)sender;
241++- (void)sessionFinished:(id)sender;
242++- (id)valueForTag:(unsigned long)tag client:(id)sender;
243++- (void)setValue:(id)value forTag:(unsigned long)tag client:(id)sender;
244++- (NSDictionary*)modes:(id)sender;
245++- (id)menusDictionary:(id)sender;
246++- (BOOL)handleEvent:(bycopy id)event characterIndex:(unsigned long)characterIndex edge:(unsigned long)edge client:(id)sender;
247++- (void)commitComposition:(id)sender;
248++- (void)hidePalettes:(id)sender;
249++- (BOOL)didCommandBySelector:(SEL)aSelector client:(id)sender;
250++- (void)doCommandBySelector:(SEL)aSelector commandDictionary:(NSDictionary*)infoDictionary client:(id)sender;
251++- (NSUInteger)recognizedEvents:(id)sender;
252++@end
253++
254++
255++// See Leopard's <HIToolbox/IMKInputSession.h> header for documentation of
256++// the protocols to which this class conforms.
257++@interface MyTextInput : NSObject <IMKTextInput, IMKUnicodeTextInput>
258++{
259++ CXIMKClientRef client;
260++ CXIMKClientUpdatedEdit updateEditCallback;
261++ CXIMKClientCompletedText completedTextCallback;
262++ CXIMKClientModeChanged modeChangedCallback;
263++ void *data;
264++}
265++
266++@end
267++
268++@implementation MyTextInput
269++
270++- (id) initWithClientRef:(CXIMKClientRef)inClient
271++ updateCallback:(CXIMKClientUpdatedEdit)inUpdateEditCallback
272++ completedCallback:(CXIMKClientCompletedText)inCompletedTextCallback
273++ modeChangedCallback:(CXIMKClientModeChanged)inModeChangedCallback
274++ clientData:(void*)inData
275++{
276++ self = [super init];
277++ if (self != nil)
278++ {
279++ client = inClient;
280++ updateEditCallback = inUpdateEditCallback;
281++ completedTextCallback = inCompletedTextCallback;
282++ modeChangedCallback = inModeChangedCallback;
283++ data = inData;
284++ }
285++ return self;
286++}
287++
288++
289++- (void)insertText:(id)string replacementRange:(NSRange)replacementRange
290++{
291++ TRACE("%s { %d, %d }\n", debugstr_ns(string), replacementRange.length, replacementRange.location);
292++
293++ if ([string isKindOfClass:[NSAttributedString class]])
294++ string = [string string];
295++
296++ if (string)
297++ completedTextCallback(client, (CFStringRef)[[string copy] autorelease], replacementRange.location, replacementRange.length, data);
298++}
299++
300++
301++- (void)setMarkedText:(id)string selectionRange:(NSRange)selectionRange replacementRange:(NSRange)replacementRange
302++{
303++ TRACE("%s { %d, %d } { %d, %d }\n", debugstr_ns(string), selectionRange.length, selectionRange.location, replacementRange.length, replacementRange.location);
304++
305++ if ([string isKindOfClass:[NSAttributedString class]])
306++ string = [string string];
307++
308++ if (string)
309++ updateEditCallback(client, (CFStringRef)[[string copy] autorelease], replacementRange.location, replacementRange.length, data);
310++}
311++
312++
313++- (NSRange)selectedRange
314++{
315++ TRACE("\n");
316++ return NSMakeRange(NSNotFound, NSNotFound);
317++}
318++
319++
320++- (NSRange)markedRange
321++{
322++ TRACE("\n");
323++ return NSMakeRange(NSNotFound, NSNotFound);
324++}
325++
326++
327++- (NSAttributedString*)attributedSubstringFromRange:(NSRange)range
328++{
329++ TRACE("{ %d, %d }\n", range.length, range.location);
330++ return [[[NSAttributedString alloc] init] autorelease];
331++}
332++
333++
334++- (NSInteger)length
335++{
336++ TRACE("\n");
337++ return NSNotFound;
338++}
339++
340++
341++- (NSInteger)characterIndexForPoint:(NSPoint)point tracking:(IMKLocationToOffsetMappingMode)mappingMode inMarkedRange:(BOOL*)inMarkedRange
342++{
343++ TRACE("{ %f, %f } %ld %p\n", point.x, point.y, (long)mappingMode, inMarkedRange);
344++ if (inMarkedRange)
345++ *inMarkedRange = NO;
346++ return NSNotFound;
347++}
348++
349++
350++- (NSDictionary*)attributesForCharacterIndex:(NSUInteger)index lineHeightRectangle:(NSRect*)lineRect
351++{
352++ TRACE("%lu %p\n", (unsigned long)index, lineRect);
353++ *lineRect = NSMakeRect(100, 100, 1, 12);
354++ return [NSDictionary dictionary];
355++}
356++
357++
358++- (NSArray*)validAttributesForMarkedText
359++{
360++ TRACE("\n");
361++ return [NSArray array];
362++}
363++
364++
365++-(void)overrideKeyboardWithKeyboardNamed:(NSString*)keyboardUniqueName
366++{
367++ TRACE("%s\n", debugstr_ns(keyboardUniqueName));
368++}
369++
370++
371++-(void)selectInputMode:(NSString*)modeIdentifier
372++{
373++ TRACE("%s\n", debugstr_ns(modeIdentifier));
374++
375++ modeChangedCallback(client, (CFStringRef)[[modeIdentifier copy] autorelease], data);
376++}
377++
378++
379++-(BOOL)supportsUnicode
380++{
381++ TRACE("\n");
382++ return TRUE;
383++}
384++
385++
386++-(NSString*)bundleIdentifier
387++{
388++ TRACE("\n");
389++ return [NSString stringWithFormat:@"com.codeweavers.CXIMKClient.%d", getpid()];
390++}
391++
392++
393++-(CGWindowLevel)windowLevel
394++{
395++ TRACE("\n");
396++ return kCGNormalWindowLevelKey;
397++}
398++
399++
400++-(void)insertText:(id)string
401++{
402++ TRACE("%s\n", debugstr_ns(string));
403++
404++ if ([string isKindOfClass:[NSAttributedString class]])
405++ string = [string string];
406++
407++ if (string)
408++ completedTextCallback(client, (CFStringRef)[[string copy] autorelease], NSNotFound, NSNotFound, data);
409++}
410++
411++@end
412++
413++
414++
415++struct CXIMKClient
416++{
417++ MyTextInput* ti;
418++ id<IMKServerProxy> im;
419++};
420++
421++
422++CXIMKClientRef CXIMKClientInitialize(
423++ CFStringRef inServerName,
424++ CXIMKClientUpdatedEdit inUpdateEditCallback,
425++ CXIMKClientCompletedText inCompletedTextCallback,
426++ CXIMKClientModeChanged inModeChangedCallback,
427++ void *data)
428++{
429++ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
430++
431++ CXIMKClientRef client = malloc(sizeof(*client));
432++ if (!client)
433++ goto out;
434++
435++ client->ti = [[MyTextInput alloc] initWithClientRef:client
436++ updateCallback:inUpdateEditCallback
437++ completedCallback:inCompletedTextCallback
438++ modeChangedCallback:inModeChangedCallback
439++ clientData:data];
440++ if (!client->ti)
441++ {
442++ free(client);
443++ client = NULL;
444++ goto out;
445++ }
446++
447++ client->im = (id<IMKServerProxy>)[NSConnection rootProxyForConnectionWithRegisteredName:(NSString*)inServerName host:nil];
448++ if (!client->im)
449++ {
450++ [client->ti release];
451++ free(client);
452++ client = NULL;
453++ goto out;
454++ }
455++
456++ [(id)client->im retain];
457++ [(NSDistantObject*)client->im setProtocolForProxy:@protocol(IMKServerProxy)];
458++
459++out:
460++ [pool release];
461++ return client;
462++}
463++
464++
465++void CXIMKClientCleanup(CXIMKClientRef inClient)
466++{
467++ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
468++
469++ [(id)inClient->im release];
470++ [inClient->ti release];
471++ free(inClient);
472++
473++ [pool release];
474++}
475++
476++
477++int CXIMKClientActivate(CXIMKClientRef inClient)
478++{
479++ NSUInteger recognizedEvents;
480++ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
481++
482++ [inClient->im activateServer:inClient->ti];
483++ recognizedEvents = [inClient->im recognizedEvents:inClient->ti];
484++
485++ [pool release];
486++
487++ return (recognizedEvents & NX_KEYDOWNMASK) != 0;
488++}
489++
490++
491++void CXIMKClientDeactivate(CXIMKClientRef inClient)
492++{
493++ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
494++
495++ [inClient->im deactivateServer:inClient->ti];
496++
497++ [pool release];
498++}
499++
500++
501++void CXIMKClientSetInputMode(CXIMKClientRef inClient, CFStringRef inMode)
502++{
503++ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
504++
505++ [inClient->im setValue:(NSString*)inMode forTag:kTSMDocumentInputModePropertyTag client:inClient->ti];
506++
507++ [pool release];
508++}
509++
510++int CXIMKClientSendEvent(CXIMKClientRef inClient, EventRef inEvent)
511++{
512++ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
513++
514++ id imkEvent = [NSClassFromString(@"IMKEvent") packageEventRef:inEvent];
515++ int handled = [inClient->im handleEvent:imkEvent characterIndex:0 edge:0 client:inClient->ti];
516++
517++ [pool release];
518++
519++ return handled;
520++}
521++
522++
523++void CXIMKClientForceComplete(CXIMKClientRef inClient)
524++{
525++ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
526++
527++ [inClient->im commitComposition:inClient->ti];
528++
529++ [pool release];
530++}
531++
532++
533++#endif /* __APPLE__ */
534+--- wine-1.0-rc4/dlls/wineosxime.drv/Makefile.in 1970-01-01 09:00:00.000000000 +0900
535++++ wine/dlls/wineosxime.drv/Makefile.in 2008-06-07 01:12:15.000000000 +0900
536+@@ -0,0 +1,22 @@
537++TOPSRCDIR = @top_srcdir@
538++TOPOBJDIR = ../..
539++SRCDIR = @srcdir@
540++VPATH = @srcdir@
541++MODULE = wineosxime.drv
542++IMPORTS = user32 gdi32 kernel32 imm32
543++EXTRALIBS = @CARBONLIB@ @APPKITLIB@
544++
545++
546++C_SRCS = \
547++ ime.c \
548++ keysym2ucs.c \
549++ main.c \
550++ mactext.c \
551++ toascii.c \
552++
553++OBJC_SRCS = \
554++ IMKClient.m
555++
556++@MAKE_DLL_RULES@
557++
558++@DEPENDENCIES@ # everything below this line is overwritten by make depend
559+--- wine-1.0-rc4/dlls/wineosxime.drv/ime.c 1970-01-01 09:00:00.000000000 +0900
560++++ wine/dlls/wineosxime.drv/ime.c 2008-06-07 01:12:15.000000000 +0900
561+@@ -0,0 +1,1527 @@
562++/*
563++ * The IME for interfacing with Apple OS X
564++ *
565++ * Copyright 2008 CodeWeavers, Aric Stewart
566++ *
567++ * This library is free software; you can redistribute it and/or
568++ * modify it under the terms of the GNU Lesser General Public
569++ * License as published by the Free Software Foundation; either
570++ * version 2.1 of the License, or (at your option) any later version.
571++ *
572++ * This library is distributed in the hope that it will be useful,
573++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
574++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
575++ * Lesser General Public License for more details.
576++ *
577++ * You should have received a copy of the GNU Lesser General Public
578++ * License along with this library; if not, write to the Free Software
579++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
580++ */
581++
582++/*
583++ * Notes:
584++ * The normal flow for IMM/IME Processing is as follows.
585++ * 1) The Keyboard Driver generates key messages which are first passed to
586++ * the IMM and then to IME via ImeProcessKey. If the IME returns 0 then
587++ * it does not want the key and the keyboard driver then generates the
588++ * WM_KEYUP/WM_KEYDOWN messages. However if the IME is going to process the
589++ * key it returns non-zero.
590++ * 2) If the IME is going to process the key then the IMM calls ImeToAsciiEx to
591++ * process the key. the IME modifies the HIMC structure to reflect the
592++ * current state and generates any messages it needs the IMM to process.
593++ * 3) IMM checks the messages and send them to the application in question. From
594++ * here the IMM level deals with if the application is IME aware or not.
595++ */
596++
597++#ifdef __APPLE__
598++#include "config.h"
599++
600++#include <stdarg.h>
601++#include "windef.h"
602++#include "winbase.h"
603++#include "wingdi.h"
604++#include "winuser.h"
605++#include "winerror.h"
606++#include "wine/debug.h"
607++#include "imm.h"
608++#include "ddk/imm.h"
609++#include "winnls.h"
610++#include "osxime_private.h"
611++
612++WINE_DEFAULT_DEBUG_CHANNEL(mac_ime);
613++
614++extern TSMHandle gHandle;
615++
616++#define FROM_X11 ((HIMC)0xcafe1337)
617++
618++typedef struct _IMEPRIVATE {
619++ BOOL bInComposition;
620++ BOOL bInternalState;
621++ HFONT textfont;
622++ HWND hwndDefault;
623++
624++ LONG xKeySym;
625++ LONG xKeyCode;
626++} IMEPRIVATE, *LPIMEPRIVATE;
627++
628++typedef struct _tagTRANSMSG {
629++ UINT message;
630++ WPARAM wParam;
631++ LPARAM lParam;
632++} TRANSMSG, *LPTRANSMSG;
633++
634++static const WCHAR UI_CLASS_NAME[] = {'W','i','n','e','O','S',' ','X','I','M','E',0};
635++
636++static HIMC *hSelectedFrom = NULL;
637++static INT hSelectedCount = 0;
638++
639++/* MSIME messages */
640++static UINT WM_MSIME_SERVICE;
641++static UINT WM_MSIME_RECONVERTOPTIONS;
642++static UINT WM_MSIME_MOUSE;
643++static UINT WM_MSIME_RECONVERTREQUEST;
644++static UINT WM_MSIME_RECONVERT;
645++static UINT WM_MSIME_QUERYPOSITION;
646++static UINT WM_MSIME_DOCUMENTFEED;
647++
648++static LRESULT WINAPI IME_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
649++ LPARAM lParam);
650++static void UpdateDataInDefaultIMEWindow(HIMC hHIMC, HWND hwnd, BOOL showable);
651++
652++static HIMC RealIMC(HIMC hIMC)
653++{
654++ if (hIMC == FROM_X11)
655++ {
656++ INT i;
657++ HWND wnd = GetFocus();
658++ HIMC winHimc = ImmGetContext(wnd);
659++ for (i = 0; i < hSelectedCount; i++)
660++ if (winHimc == hSelectedFrom[i])
661++ return winHimc;
662++ return NULL;
663++ }
664++ else
665++ return hIMC;
666++}
667++
668++static LPINPUTCONTEXT LockRealIMC(HIMC hIMC)
669++{
670++ HIMC real_imc = RealIMC(hIMC);
671++ if (real_imc)
672++ return (LPINPUTCONTEXT)ImmLockIMC(real_imc);
673++ else
674++ return NULL;
675++}
676++
677++static BOOL UnlockRealIMC(HIMC hIMC)
678++{
679++ HIMC real_imc = RealIMC(hIMC);
680++ if (real_imc)
681++ return ImmUnlockIMC(real_imc);
682++ else
683++ return FALSE;
684++}
685++
686++static HIMCC ImeCreateBlankCompStr(void)
687++{
688++ HIMCC rc;
689++ LPCOMPOSITIONSTRING ptr;
690++ rc = ImmCreateIMCC(sizeof(COMPOSITIONSTRING));
691++ ptr = (LPCOMPOSITIONSTRING)ImmLockIMCC(rc);
692++ memset(ptr,0,sizeof(COMPOSITIONSTRING));
693++ ptr->dwSize = sizeof(COMPOSITIONSTRING);
694++ ImmUnlockIMCC(rc);
695++ return rc;
696++}
697++
698++static int updateField(DWORD origLen, DWORD origOffset, DWORD currentOffset,
699++ LPBYTE target, LPBYTE source, DWORD* lenParam,
700++ DWORD* offsetParam, BOOL wchars )
701++{
702++ if (origLen > 0 && origOffset > 0)
703++ {
704++ int truelen = origLen;
705++ if (wchars)
706++ truelen *= sizeof(WCHAR);
707++
708++ memcpy(&target[currentOffset], &source[origOffset], truelen);
709++
710++ *lenParam = origLen;
711++ *offsetParam = currentOffset;
712++ currentOffset += truelen;
713++ }
714++ return currentOffset;
715++}
716++
717++static HIMCC updateCompStr(HIMCC old, LPWSTR compstr, DWORD len)
718++{
719++ /* we need to make sure the CompStr, CompClaus and CompAttr fields are all
720++ * set and correct */
721++ int needed_size;
722++ HIMCC rc;
723++ LPBYTE newdata = NULL;
724++ LPBYTE olddata = NULL;
725++ LPCOMPOSITIONSTRING new_one;
726++ LPCOMPOSITIONSTRING lpcs = NULL;
727++ INT current_offset = 0;
728++
729++ TRACE("%s, %i\n",debugstr_wn(compstr,len),len);
730++
731++ if (old == NULL && compstr == NULL && len == 0)
732++ return NULL;
733++
734++ if (old != NULL)
735++ {
736++ olddata = ImmLockIMCC(old);
737++ lpcs = (LPCOMPOSITIONSTRING)olddata;
738++ }
739++
740++ needed_size = sizeof(COMPOSITIONSTRING) + len * sizeof(WCHAR) +
741++ len + sizeof(DWORD) * 2;
742++
743++ if (lpcs != NULL)
744++ {
745++ needed_size += lpcs->dwCompReadAttrLen;
746++ needed_size += lpcs->dwCompReadClauseLen;
747++ needed_size += lpcs->dwCompReadStrLen * sizeof(DWORD);
748++ needed_size += lpcs->dwResultReadClauseLen;
749++ needed_size += lpcs->dwResultReadStrLen * sizeof(DWORD);
750++ needed_size += lpcs->dwResultClauseLen;
751++ needed_size += lpcs->dwResultStrLen * sizeof(DWORD);
752++ needed_size += lpcs->dwPrivateSize;
753++ }
754++ rc = ImmCreateIMCC(needed_size);
755++ newdata = ImmLockIMCC(rc);
756++ new_one = (LPCOMPOSITIONSTRING)newdata;
757++
758++ new_one->dwSize = needed_size;
759++ current_offset = sizeof(COMPOSITIONSTRING);
760++ if (lpcs != NULL)
761++ {
762++ current_offset = updateField(lpcs->dwCompReadAttrLen,
763++ lpcs->dwCompReadAttrOffset,
764++ current_offset, newdata, olddata,
765++ &new_one->dwCompReadAttrLen,
766++ &new_one->dwCompReadAttrOffset, FALSE);
767++
768++ current_offset = updateField(lpcs->dwCompReadClauseLen,
769++ lpcs->dwCompReadClauseOffset,
770++ current_offset, newdata, olddata,
771++ &new_one->dwCompReadClauseLen,
772++ &new_one->dwCompReadClauseOffset, FALSE);
773++
774++ current_offset = updateField(lpcs->dwCompReadStrLen,
775++ lpcs->dwCompReadStrOffset,
776++ current_offset, newdata, olddata,
777++ &new_one->dwCompReadStrLen,
778++ &new_one->dwCompReadStrOffset, TRUE);
779++
780++ /* new CompAttr, CompClause, CompStr, dwCursorPos */
781++ new_one->dwDeltaStart = 0;
782++
783++ current_offset = updateField(lpcs->dwResultReadClauseLen,
784++ lpcs->dwResultReadClauseOffset,
785++ current_offset, newdata, olddata,
786++ &new_one->dwResultReadClauseLen,
787++ &new_one->dwResultReadClauseOffset, FALSE);
788++
789++ current_offset = updateField(lpcs->dwResultReadStrLen,
790++ lpcs->dwResultReadStrOffset,
791++ current_offset, newdata, olddata,
792++ &new_one->dwResultReadStrLen,
793++ &new_one->dwResultReadStrOffset, TRUE);
794++
795++ current_offset = updateField(lpcs->dwResultClauseLen,
796++ lpcs->dwResultClauseOffset,
797++ current_offset, newdata, olddata,
798++ &new_one->dwResultClauseLen,
799++ &new_one->dwResultClauseOffset, FALSE);
800++
801++ current_offset = updateField(lpcs->dwResultStrLen,
802++ lpcs->dwResultStrOffset,
803++ current_offset, newdata, olddata,
804++ &new_one->dwResultStrLen,
805++ &new_one->dwResultStrOffset, TRUE);
806++
807++ current_offset = updateField(lpcs->dwPrivateSize,
808++ lpcs->dwPrivateOffset,
809++ current_offset, newdata, olddata,
810++ &new_one->dwPrivateSize,
811++ &new_one->dwPrivateOffset, FALSE);
812++ }
813++
814++ /* set new data */
815++ /* CompAttr */
816++ new_one->dwCompAttrLen = len;
817++ if (len > 0)
818++ {
819++ new_one->dwCompAttrOffset = current_offset;
820++ memset(&newdata[current_offset],ATTR_INPUT,len);
821++ current_offset += len;
822++ }
823++
824++ /* CompClause */
825++ if (len > 0)
826++ {
827++ new_one->dwCompClauseLen = sizeof(DWORD) * 2;
828++ new_one->dwCompClauseOffset = current_offset;
829++ *(DWORD*)(&newdata[current_offset]) = 0;
830++ current_offset += sizeof(DWORD);
831++ *(DWORD*)(&newdata[current_offset]) = len;
832++ current_offset += sizeof(DWORD);
833++ }
834++
835++ /* CompStr */
836++ new_one->dwCompStrLen = len;
837++ if (len > 0)
838++ {
839++ new_one->dwCompStrOffset = current_offset;
840++ memcpy(&newdata[current_offset],compstr,len*sizeof(WCHAR));
841++ }
842++
843++ /* CursorPos */
844++ new_one->dwCursorPos = len;
845++
846++ ImmUnlockIMCC(rc);
847++ if (lpcs)
848++ ImmUnlockIMCC(old);
849++
850++ return rc;
851++}
852++
853++static HIMCC updateResultStr(HIMCC old, LPWSTR resultstr, DWORD len)
854++{
855++ /* we need to make sure the ResultStr and ResultClause fields are all
856++ * set and correct */
857++ int needed_size;
858++ HIMCC rc;
859++ LPBYTE newdata = NULL;
860++ LPBYTE olddata = NULL;
861++ LPCOMPOSITIONSTRING new_one;
862++ LPCOMPOSITIONSTRING lpcs = NULL;
863++ INT current_offset = 0;
864++
865++ TRACE("%s, %i\n",debugstr_wn(resultstr,len),len);
866++
867++ if (old == NULL && resultstr == NULL && len == 0)
868++ return NULL;
869++
870++ if (old != NULL)
871++ {
872++ olddata = ImmLockIMCC(old);
873++ lpcs = (LPCOMPOSITIONSTRING)olddata;
874++ }
875++
876++ needed_size = sizeof(COMPOSITIONSTRING) + len * sizeof(WCHAR) +
877++ sizeof(DWORD) * 2;
878++
879++ if (lpcs != NULL)
880++ {
881++ needed_size += lpcs->dwCompReadAttrLen;
882++ needed_size += lpcs->dwCompReadClauseLen;
883++ needed_size += lpcs->dwCompReadStrLen * sizeof(DWORD);
884++ needed_size += lpcs->dwCompAttrLen;
885++ needed_size += lpcs->dwCompClauseLen;
886++ needed_size += lpcs->dwCompStrLen * sizeof(DWORD);
887++ needed_size += lpcs->dwResultReadClauseLen;
888++ needed_size += lpcs->dwResultReadStrLen * sizeof(DWORD);
889++ needed_size += lpcs->dwPrivateSize;
890++ }
891++ rc = ImmCreateIMCC(needed_size);
892++ newdata = ImmLockIMCC(rc);
893++ new_one = (LPCOMPOSITIONSTRING)newdata;
894++
895++ new_one->dwSize = needed_size;
896++ current_offset = sizeof(COMPOSITIONSTRING);
897++ if (lpcs != NULL)
898++ {
899++ current_offset = updateField(lpcs->dwCompReadAttrLen,
900++ lpcs->dwCompReadAttrOffset,
901++ current_offset, newdata, olddata,
902++ &new_one->dwCompReadAttrLen,
903++ &new_one->dwCompReadAttrOffset, FALSE);
904++
905++ current_offset = updateField(lpcs->dwCompReadClauseLen,
906++ lpcs->dwCompReadClauseOffset,
907++ current_offset, newdata, olddata,
908++ &new_one->dwCompReadClauseLen,
909++ &new_one->dwCompReadClauseOffset, FALSE);
910++
911++ current_offset = updateField(lpcs->dwCompReadStrLen,
912++ lpcs->dwCompReadStrOffset,
913++ current_offset, newdata, olddata,
914++ &new_one->dwCompReadStrLen,
915++ &new_one->dwCompReadStrOffset, TRUE);
916++
917++ current_offset = updateField(lpcs->dwCompAttrLen,
918++ lpcs->dwCompAttrOffset,
919++ current_offset, newdata, olddata,
920++ &new_one->dwCompAttrLen,
921++ &new_one->dwCompAttrOffset, FALSE);
922++
923++ current_offset = updateField(lpcs->dwCompClauseLen,
924++ lpcs->dwCompClauseOffset,
925++ current_offset, newdata, olddata,
926++ &new_one->dwCompClauseLen,
927++ &new_one->dwCompClauseOffset, FALSE);
928++
929++ current_offset = updateField(lpcs->dwCompStrLen,
930++ lpcs->dwCompStrOffset,
931++ current_offset, newdata, olddata,
932++ &new_one->dwCompStrLen,
933++ &new_one->dwCompStrOffset, TRUE);
934++
935++ new_one->dwCursorPos = lpcs->dwCursorPos;
936++ new_one->dwDeltaStart = 0;
937++
938++ current_offset = updateField(lpcs->dwResultReadClauseLen,
939++ lpcs->dwResultReadClauseOffset,
940++ current_offset, newdata, olddata,
941++ &new_one->dwResultReadClauseLen,
942++ &new_one->dwResultReadClauseOffset, FALSE);
943++
944++ current_offset = updateField(lpcs->dwResultReadStrLen,
945++ lpcs->dwResultReadStrOffset,
946++ current_offset, newdata, olddata,
947++ &new_one->dwResultReadStrLen,
948++ &new_one->dwResultReadStrOffset, TRUE);
949++
950++ /* new ResultClause , ResultStr */
951++
952++ current_offset = updateField(lpcs->dwPrivateSize,
953++ lpcs->dwPrivateOffset,
954++ current_offset, newdata, olddata,
955++ &new_one->dwPrivateSize,
956++ &new_one->dwPrivateOffset, FALSE);
957++ }
958++
959++ /* set new data */
960++ /* ResultClause */
961++ if (len > 0)
962++ {
963++ new_one->dwResultClauseLen = sizeof(DWORD) * 2;
964++ new_one->dwResultClauseOffset = current_offset;
965++ *(DWORD*)(&newdata[current_offset]) = 0;
966++ current_offset += sizeof(DWORD);
967++ *(DWORD*)(&newdata[current_offset]) = len;
968++ current_offset += sizeof(DWORD);
969++ }
970++
971++ /* ResultStr */
972++ new_one->dwResultStrLen = len;
973++ if (len > 0)
974++ {
975++ new_one->dwResultStrOffset = current_offset;
976++ memcpy(&newdata[current_offset],resultstr,len*sizeof(WCHAR));
977++ }
978++ ImmUnlockIMCC(rc);
979++ if (lpcs)
980++ ImmUnlockIMCC(old);
981++
982++ return rc;
983++}
984++
985++static void GenerateIMEMessage(HIMC hIMC, UINT msg, WPARAM wParam,
986++ LPARAM lParam)
987++{
988++ LPINPUTCONTEXT lpIMC;
989++ LPTRANSMSG lpTransMsg;
990++
991++ lpIMC = LockRealIMC(hIMC);
992++ if (lpIMC == NULL)
993++ return;
994++
995++ lpIMC->hMsgBuf = ImmReSizeIMCC(lpIMC->hMsgBuf, (lpIMC->dwNumMsgBuf + 1) *
996++ sizeof(TRANSMSG));
997++ if (!lpIMC->hMsgBuf)
998++ return;
999++
1000++ lpTransMsg = (LPTRANSMSG)ImmLockIMCC(lpIMC->hMsgBuf);
1001++ if (!lpTransMsg)
1002++ return;
1003++
1004++ lpTransMsg += lpIMC->dwNumMsgBuf;
1005++ lpTransMsg->message = msg;
1006++ lpTransMsg->wParam = wParam;
1007++ lpTransMsg->lParam = lParam;
1008++
1009++ ImmUnlockIMCC(lpIMC->hMsgBuf);
1010++ lpIMC->dwNumMsgBuf++;
1011++
1012++ ImmGenerateMessage(RealIMC(hIMC));
1013++ UnlockRealIMC(hIMC);
1014++}
1015++
1016++static void GenerateIMECHARMessages(HIMC hIMC, LPWSTR String, DWORD length)
1017++{
1018++ LPINPUTCONTEXT lpIMC;
1019++ LPTRANSMSG lpTransMsg;
1020++ INT i;
1021++
1022++ if (length <= 0)
1023++ return;
1024++
1025++ lpIMC = LockRealIMC(hIMC);
1026++ if (lpIMC == NULL)
1027++ return;
1028++
1029++ lpIMC->hMsgBuf = ImmReSizeIMCC(lpIMC->hMsgBuf,
1030++ (lpIMC->dwNumMsgBuf + length) *
1031++ sizeof(TRANSMSG));
1032++ if (!lpIMC->hMsgBuf)
1033++ return;
1034++
1035++ lpTransMsg = (LPTRANSMSG)ImmLockIMCC(lpIMC->hMsgBuf);
1036++ if (!lpTransMsg)
1037++ return;
1038++
1039++ lpTransMsg += lpIMC->dwNumMsgBuf;
1040++ for (i = 0; i < length; i++)
1041++ {
1042++ lpTransMsg->message = WM_IME_CHAR;
1043++ lpTransMsg->wParam = String[i];
1044++ lpTransMsg->lParam = 1;
1045++ lpTransMsg ++;
1046++ }
1047++
1048++ ImmUnlockIMCC(lpIMC->hMsgBuf);
1049++ lpIMC->dwNumMsgBuf+=length;
1050++
1051++ ImmGenerateMessage(RealIMC(hIMC));
1052++ UnlockRealIMC(hIMC);
1053++}
1054++
1055++static BOOL IME_RemoveFromSelected(HIMC hIMC)
1056++{
1057++ int i;
1058++ for (i = 0; i < hSelectedCount; i++)
1059++ if (hSelectedFrom[i] == hIMC)
1060++ {
1061++ if (i < hSelectedCount - 1)
1062++ memcpy(&hSelectedFrom[i], &hSelectedFrom[i+1], (hSelectedCount - i - 1)*sizeof(HIMC));
1063++ hSelectedCount --;
1064++ return TRUE;
1065++ }
1066++ return FALSE;
1067++}
1068++
1069++static void IME_AddToSelected(HIMC hIMC)
1070++{
1071++ hSelectedCount++;
1072++ if (hSelectedFrom)
1073++ hSelectedFrom = HeapReAlloc(GetProcessHeap(), 0, hSelectedFrom, hSelectedCount*sizeof(HIMC));
1074++ else
1075++ hSelectedFrom = HeapAlloc(GetProcessHeap(), 0, sizeof(HIMC));
1076++ hSelectedFrom[hSelectedCount-1] = hIMC;
1077++}
1078++
1079++BOOL WINAPI ImeInquire(LPIMEINFO lpIMEInfo, LPWSTR lpszUIClass,
1080++ LPCWSTR lpszOption)
1081++{
1082++ TRACE("\n");
1083++ lpIMEInfo->dwPrivateDataSize = sizeof (IMEPRIVATE);
1084++ lpIMEInfo->fdwProperty = IME_PROP_UNICODE | IME_PROP_AT_CARET;
1085++ lpIMEInfo->fdwConversionCaps = IME_CMODE_NATIVE;
1086++ lpIMEInfo->fdwSentenceCaps = IME_SMODE_AUTOMATIC;
1087++ lpIMEInfo->fdwUICaps = UI_CAP_2700;
1088++ /* Tell App we cannot accept ImeSetCompositionString calls */
1089++ lpIMEInfo->fdwSCSCaps = 0;
1090++ lpIMEInfo->fdwSelectCaps = SELECT_CAP_CONVERSION;
1091++
1092++ lstrcpyW(lpszUIClass,UI_CLASS_NAME);
1093++
1094++ return TRUE;
1095++}
1096++
1097++BOOL WINAPI ImeConfigure(HKL hKL,HWND hWnd, DWORD dwMode, LPVOID lpData)
1098++{
1099++ FIXME("(%p, %p, %d, %p): stub\n", hKL, hWnd, dwMode, lpData);
1100++ SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1101++ return FALSE;
1102++}
1103++
1104++DWORD WINAPI ImeConversionList(HIMC hIMC, LPCWSTR lpSource,
1105++ LPCANDIDATELIST lpCandList, DWORD dwBufLen, UINT uFlag)
1106++
1107++{
1108++ FIXME("(%p, %s, %p, %d, %d): stub\n", hIMC, debugstr_w(lpSource),
1109++ lpCandList, dwBufLen, uFlag);
1110++ SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1111++ return 0;
1112++}
1113++
1114++BOOL WINAPI ImeDestroy(UINT uForce)
1115++{
1116++ TRACE("\n");
1117++ HeapFree(GetProcessHeap(),0,hSelectedFrom);
1118++ hSelectedFrom = NULL;
1119++ hSelectedCount = 0;
1120++ return TRUE;
1121++}
1122++
1123++LRESULT WINAPI ImeEscape(HIMC hIMC, UINT uSubFunc, LPVOID lpData)
1124++{
1125++ TRACE("%x %p\n",uSubFunc, lpData);
1126++ switch (uSubFunc)
1127++ {
1128++ case IME_ESC_QUERY_SUPPORT:
1129++ {
1130++ DWORD *dwEsc = (DWORD*)lpData;
1131++ if ((*dwEsc == IME_ESC_PRIVATE_FIRST + 0x10) ||
1132++ (*dwEsc == IME_ESC_PRIVATE_FIRST + 0x11))
1133++ return 1;
1134++ }
1135++ case IME_ESC_PRIVATE_FIRST + 0x10: /* X keysym */
1136++ {
1137++ LPINPUTCONTEXT lpIMC;
1138++ lpIMC = LockRealIMC(hIMC);
1139++ if (lpIMC)
1140++ {
1141++ LPIMEPRIVATE myPrivate;
1142++ myPrivate = (LPIMEPRIVATE)ImmLockIMCC(lpIMC->hPrivate);
1143++ myPrivate->xKeySym = (LONG)lpData;
1144++ ImmUnlockIMCC(lpIMC->hPrivate);
1145++ }
1146++ UnlockRealIMC(hIMC);
1147++ }
1148++ case IME_ESC_PRIVATE_FIRST + 0x11: /* X keycode */
1149++ {
1150++ LPINPUTCONTEXT lpIMC;
1151++ lpIMC = LockRealIMC(hIMC);
1152++ if (lpIMC)
1153++ {
1154++ LPIMEPRIVATE myPrivate;
1155++ myPrivate = (LPIMEPRIVATE)ImmLockIMCC(lpIMC->hPrivate);
1156++ myPrivate->xKeyCode = (LONG)lpData;
1157++ ImmUnlockIMCC(lpIMC->hPrivate);
1158++ }
1159++ UnlockRealIMC(hIMC);
1160++ }
1161++ default:
1162++ return 0;
1163++ }
1164++}
1165++
1166++BOOL WINAPI ImeProcessKey(HIMC hIMC, UINT vKey, LPARAM lKeyData,
1167++ CONST LPBYTE lpbKeyState)
1168++{
1169++ LPINPUTCONTEXT lpIMC;
1170++ BOOL inIME;
1171++
1172++ if (!gHandle)
1173++ return FALSE;
1174++
1175++ TRACE("%x 0x%lx %p\n",vKey, lKeyData, lpbKeyState);
1176++
1177++ switch (vKey)
1178++ {
1179++ case VK_SHIFT:
1180++ case VK_CONTROL:
1181++ case VK_CAPITAL:
1182++ case VK_MENU:
1183++ return FALSE;
1184++ }
1185++
1186++ if ((vKey == VK_KANA) || (vKey == VK_KANJI) ||
1187++ (vKey == VK_SPACE && lpbKeyState[VK_MENU] & 0x80 ))
1188++ {
1189++ TRACE("Mode Switch\n");
1190++ MacTSMFixTextService(gHandle);
1191++ MacTSMRevertToPreviousMode(gHandle);
1192++ return TRUE;
1193++ }
1194++
1195++ inIME = MacTSMCheckModeAndIME(gHandle);
1196++ lpIMC = LockRealIMC(hIMC);
1197++ if (lpIMC)
1198++ {
1199++ LPIMEPRIVATE myPrivate;
1200++ myPrivate = (LPIMEPRIVATE)ImmLockIMCC(lpIMC->hPrivate);
1201++
1202++ if (inIME && !myPrivate->bInternalState)
1203++ {
1204++ ImmSetOpenStatus(RealIMC(FROM_X11), TRUE);
1205++ }
1206++ else if (!inIME && myPrivate->bInternalState)
1207++ {
1208++ ShowWindow(myPrivate->hwndDefault, SW_HIDE);
1209++ ImmDestroyIMCC(lpIMC->hCompStr);
1210++ lpIMC->hCompStr = ImeCreateBlankCompStr();
1211++ ImmSetOpenStatus(RealIMC(FROM_X11), FALSE);
1212++ }
1213++
1214++ myPrivate->bInternalState = inIME;
1215++ ImmUnlockIMCC(lpIMC->hPrivate);
1216++ }
1217++ UnlockRealIMC(hIMC);
1218++
1219++ return inIME;
1220++}
1221++
1222++BOOL WINAPI ImeSelect(HIMC hIMC, BOOL fSelect)
1223++{
1224++ LPINPUTCONTEXT lpIMC;
1225++ TRACE("%p %s\n",hIMC,(fSelect)?"TRUE":"FALSE");
1226++
1227++ if (hIMC == FROM_X11)
1228++ {
1229++ ERR("ImeSelect should never be called from X11\n");
1230++ return FALSE;
1231++ }
1232++
1233++ if (!hIMC)
1234++ return TRUE;
1235++
1236++ /* not selected */
1237++ if (!fSelect)
1238++ return IME_RemoveFromSelected(hIMC);
1239++
1240++ IME_AddToSelected(hIMC);
1241++
1242++ /* Initialize our structures */
1243++ lpIMC = LockRealIMC(hIMC);
1244++ if (lpIMC != NULL)
1245++ {
1246++ LPIMEPRIVATE myPrivate;
1247++ myPrivate = (LPIMEPRIVATE)ImmLockIMCC(lpIMC->hPrivate);
1248++ myPrivate->bInComposition = FALSE;
1249++ myPrivate->bInternalState = FALSE;
1250++ myPrivate->textfont = NULL;
1251++ myPrivate->hwndDefault = NULL;
1252++ myPrivate->xKeySym = 0;
1253++ myPrivate->xKeyCode = 0;
1254++ ImmUnlockIMCC(lpIMC->hPrivate);
1255++ UnlockRealIMC(hIMC);
1256++ }
1257++
1258++ return TRUE;
1259++}
1260++
1261++BOOL WINAPI ImeSetActiveContext(HIMC hIMC,BOOL fFlag)
1262++{
1263++ FIXME("Stub");
1264++ return TRUE;
1265++}
1266++
1267++UINT WINAPI ImeToAsciiEx (UINT uVKey, UINT uScanCode,
1268++ CONST LPBYTE lpbKeyState, LPDWORD lpdwTransKey,
1269++ UINT fuState, HIMC hIMC)
1270++{
1271++ LONG keysym;
1272++ LONG keycode;
1273++ UINT vkey;
1274++ LPINPUTCONTEXT lpIMC;
1275++ LPIMEPRIVATE myPrivate;
1276++
1277++ vkey = LOWORD(uVKey);
1278++
1279++ TRACE("Incomming %x %x %p\n",vkey, uScanCode,hIMC);
1280++
1281++ if ((vkey == VK_KANA) || (vkey == VK_KANJI) || (vkey == VK_MENU))
1282++ {
1283++ TRACE("Skipping metakey\n");
1284++ return 0;
1285++ }
1286++
1287++ lpIMC = LockRealIMC(hIMC);
1288++ myPrivate = (LPIMEPRIVATE)ImmLockIMCC(lpIMC->hPrivate);
1289++ if (!myPrivate->bInternalState)
1290++ {
1291++ ImmUnlockIMCC(lpIMC->hPrivate);
1292++ UnlockRealIMC(hIMC);
1293++ return 0;
1294++ }
1295++ keysym = myPrivate->xKeySym;
1296++ keycode = myPrivate->xKeyCode;
1297++ ImmUnlockIMCC(lpIMC->hPrivate);
1298++ UnlockRealIMC(hIMC);
1299++
1300++ TRACE("Processing %x %x %x\n",vkey, keysym, keycode);
1301++ if (!MacToAscii(vkey,keysym,keycode,lpbKeyState,lpdwTransKey))
1302++ {
1303++ /* KeyStroke not processed by the IME
1304++ * so we need to rebuild the KeyDown message and pass it on to WINE
1305++ */
1306++ GenerateIMEMessage(hIMC,WM_KEYDOWN,vkey,uScanCode);
1307++ }
1308++ return 0;
1309++}
1310++
1311++BOOL WINAPI NotifyIME(HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue)
1312++{
1313++ BOOL bRet = FALSE;
1314++ LPINPUTCONTEXT lpIMC;
1315++
1316++ TRACE("%p %i %i %i\n",hIMC,dwAction,dwIndex,dwValue);
1317++
1318++ lpIMC = LockRealIMC(hIMC);
1319++ if (lpIMC == NULL)
1320++ return FALSE;
1321++
1322++ switch (dwAction)
1323++ {
1324++ case NI_OPENCANDIDATE: FIXME("NI_OPENCANDIDATE\n"); break;
1325++ case NI_CLOSECANDIDATE: FIXME("NI_CLOSECANDIDATE\n"); break;
1326++ case NI_SELECTCANDIDATESTR: FIXME("NI_SELECTCANDIDATESTR\n"); break;
1327++ case NI_CHANGECANDIDATELIST: FIXME("NI_CHANGECANDIDATELIST\n"); break;
1328++ case NI_SETCANDIDATE_PAGESTART: FIXME("NI_SETCANDIDATE_PAGESTART\n"); break;
1329++ case NI_SETCANDIDATE_PAGESIZE: FIXME("NI_SETCANDIDATE_PAGESIZE\n"); break;
1330++ case NI_CONTEXTUPDATED:
1331++ FIXME("NI_CONTEXTUPDATED:");
1332++ switch (dwValue)
1333++ {
1334++ case IMC_SETCOMPOSITIONWINDOW: FIXME("IMC_SETCOMPOSITIONWINDOW\n"); break;
1335++ case IMC_SETCONVERSIONMODE: FIXME("IMC_SETCONVERSIONMODE\n"); break;
1336++ case IMC_SETSENTENCEMODE: FIXME("IMC_SETSENTENCEMODE\n"); break;
1337++ case IMC_SETCANDIDATEPOS: FIXME("IMC_SETCANDIDATEPOS\n"); break;
1338++ case IMC_SETCOMPOSITIONFONT:
1339++ {
1340++ LPIMEPRIVATE myPrivate;
1341++ TRACE("IMC_SETCOMPOSITIONFONT\n");
1342++
1343++ myPrivate = (LPIMEPRIVATE)ImmLockIMCC(lpIMC->hPrivate);
1344++ if (myPrivate->textfont)
1345++ {
1346++ DeleteObject(myPrivate->textfont);
1347++ myPrivate->textfont = NULL;
1348++ }
1349++ myPrivate->textfont = CreateFontIndirectW(&lpIMC->lfFont.W);
1350++ ImmUnlockIMCC(lpIMC->hPrivate);
1351++ }
1352++ break;
1353++ case IMC_SETOPENSTATUS:
1354++ {
1355++ LPIMEPRIVATE myPrivate;
1356++ TRACE("IMC_SETOPENSTATUS\n");
1357++
1358++ myPrivate = (LPIMEPRIVATE)ImmLockIMCC(lpIMC->hPrivate);
1359++ if (lpIMC->fOpen != myPrivate->bInternalState)
1360++ {
1361++ if(lpIMC->fOpen == FALSE)
1362++ {
1363++ GenerateIMEMessage(hIMC,WM_IME_ENDCOMPOSITION,0,0);
1364++ }
1365++ else
1366++ GenerateIMEMessage(hIMC,WM_IME_STARTCOMPOSITION,0,0);
1367++ }
1368++ bRet = TRUE;
1369++ }
1370++ break;
1371++ default: FIXME("Unknown\n"); break;
1372++ }
1373++ break;
1374++ case NI_COMPOSITIONSTR:
1375++ TRACE("NI_COMPOSITIONSTR:");
1376++ switch (dwIndex)
1377++ {
1378++ case CPS_COMPLETE:
1379++ {
1380++ HIMCC newCompStr;
1381++ DWORD cplen = 0;
1382++ LPWSTR cpstr;
1383++ LPCOMPOSITIONSTRING cs = NULL;
1384++ LPBYTE cdata = NULL;
1385++ LPIMEPRIVATE myPrivate;
1386++
1387++ TRACE("CPS_COMPLETE\n");
1388++
1389++ /* clear existing result */
1390++ newCompStr = updateResultStr(lpIMC->hCompStr, NULL, 0);
1391++
1392++ ImmDestroyIMCC(lpIMC->hCompStr);
1393++ lpIMC->hCompStr = newCompStr;
1394++
1395++ if (lpIMC->hCompStr)
1396++ {
1397++ cdata = ImmLockIMCC(lpIMC->hCompStr);
1398++ cs = (LPCOMPOSITIONSTRING)cdata;
1399++ cplen = cs->dwCompStrLen;
1400++ cpstr = (LPWSTR)&(cdata[cs->dwCompStrOffset]);
1401++ ImmUnlockIMCC(lpIMC->hCompStr);
1402++ }
1403++ if (cplen > 0)
1404++ {
1405++ WCHAR param = cpstr[0];
1406++
1407++ newCompStr = updateResultStr(lpIMC->hCompStr, cpstr, cplen);
1408++ ImmDestroyIMCC(lpIMC->hCompStr);
1409++ lpIMC->hCompStr = newCompStr;
1410++ newCompStr = updateCompStr(lpIMC->hCompStr, NULL, 0);
1411++ ImmDestroyIMCC(lpIMC->hCompStr);
1412++ lpIMC->hCompStr = newCompStr;
1413++
1414++ GenerateIMEMessage(hIMC, WM_IME_COMPOSITION, 0,
1415++ GCS_COMPSTR);
1416++
1417++ GenerateIMEMessage(hIMC, WM_IME_COMPOSITION, param,
1418++ GCS_RESULTSTR|GCS_RESULTCLAUSE);
1419++ }
1420++
1421++ GenerateIMEMessage(hIMC,WM_IME_ENDCOMPOSITION, 0, 0);
1422++
1423++ myPrivate = (LPIMEPRIVATE)ImmLockIMCC(lpIMC->hPrivate);
1424++ myPrivate->bInComposition = FALSE;
1425++ ImmUnlockIMCC(lpIMC->hPrivate);
1426++
1427++ bRet = TRUE;
1428++ }
1429++ break;
1430++ case CPS_CONVERT: FIXME("CPS_CONVERT\n"); break;
1431++ case CPS_REVERT: FIXME("CPS_REVERT\n"); break;
1432++ case CPS_CANCEL:
1433++ {
1434++ BOOL send;
1435++ LPCOMPOSITIONSTRING lpCompStr;
1436++
1437++ TRACE("CPS_CANCEL\n");
1438++
1439++ lpCompStr = ImmLockIMCC(lpIMC->hCompStr);
1440++ send = (lpCompStr->dwCompStrLen != 0);
1441++ ImmUnlockIMCC(lpIMC->hCompStr);
1442++
1443++ if (send)
1444++ {
1445++ HIMCC newCompStr;
1446++ newCompStr = updateCompStr(lpIMC->hCompStr, NULL, 0);
1447++ ImmDestroyIMCC(lpIMC->hCompStr);
1448++ lpIMC->hCompStr = newCompStr;
1449++ GenerateIMEMessage(hIMC, WM_IME_COMPOSITION, 0, GCS_COMPSTR);
1450++ }
1451++ bRet = TRUE;
1452++ }
1453++ break;
1454++ default: FIXME("Unknown\n"); break;
1455++ }
1456++ break;
1457++ default: FIXME("Unknown Message\n"); break;
1458++ }
1459++
1460++ UnlockRealIMC(hIMC);
1461++ return bRet;
1462++}
1463++
1464++BOOL WINAPI ImeRegisterWord(LPCWSTR lpszReading, DWORD dwStyle,
1465++ LPCWSTR lpszRegister)
1466++{
1467++ FIXME("(%s, %d, %s): stub\n", debugstr_w(lpszReading), dwStyle,
1468++ debugstr_w(lpszRegister));
1469++ SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1470++ return FALSE;
1471++}
1472++
1473++BOOL WINAPI ImeUnregisterWord(LPCWSTR lpszReading, DWORD dwStyle,
1474++ LPCWSTR lpszUnregister)
1475++{
1476++ FIXME("(%s, %d, %s): stub\n", debugstr_w(lpszReading), dwStyle,
1477++ debugstr_w(lpszUnregister));
1478++ SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1479++ return FALSE;
1480++}
1481++
1482++UINT WINAPI ImeGetRegisterWordStyle(UINT nItem, LPSTYLEBUFW lpStyleBuf)
1483++{
1484++ FIXME("(%d, %p): stub\n", nItem, lpStyleBuf);
1485++ SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1486++ return 0;
1487++}
1488++
1489++UINT WINAPI ImeEnumRegisterWord(REGISTERWORDENUMPROCW lpfnEnumProc,
1490++ LPCWSTR lpszReading, DWORD dwStyle,
1491++ LPCWSTR lpszRegister, LPVOID lpData)
1492++{
1493++ FIXME("(%p, %s, %d, %s, %p): stub\n", lpfnEnumProc,
1494++ debugstr_w(lpszReading), dwStyle, debugstr_w(lpszRegister),
1495++ lpData);
1496++ SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1497++ return 0;
1498++}
1499++
1500++BOOL WINAPI ImeSetCompositionString(HIMC hIMC, DWORD dwIndex, LPCVOID lpComp,
1501++ DWORD dwCompLen, LPCVOID lpRead,
1502++ DWORD dwReadLen)
1503++{
1504++ LPINPUTCONTEXT lpIMC;
1505++ DWORD flags = 0;
1506++ WCHAR wParam = 0;
1507++ LPIMEPRIVATE myPrivate;
1508++
1509++ TRACE("(%p, %d, %p, %d, %p, %d):\n",
1510++ hIMC, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen);
1511++
1512++
1513++ if (hIMC != FROM_X11)
1514++ FIXME("PROBLEM: This only sets the wine level string\n");
1515++
1516++ /*
1517++ * Explanation:
1518++ * this sets the composition string in the imm32.dll level
1519++ * of the composition buffer. we cannot manipulate the xim level
1520++ * buffer, which means that once the xim level buffer changes again
1521++ * any call to this function from the application will be lost
1522++ */
1523++
1524++ if (lpRead && dwReadLen)
1525++ FIXME("Reading string unimplemented\n");
1526++
1527++ lpIMC = LockRealIMC(hIMC);
1528++
1529++ if (lpIMC == NULL)
1530++ return FALSE;
1531++
1532++ myPrivate = (LPIMEPRIVATE)ImmLockIMCC(lpIMC->hPrivate);
1533++
1534++ if (dwIndex == SCS_SETSTR)
1535++ {
1536++ HIMCC newCompStr;
1537++
1538++ if (!myPrivate->bInComposition)
1539++ {
1540++ GenerateIMEMessage(hIMC, WM_IME_STARTCOMPOSITION, 0, 0);
1541++ myPrivate->bInComposition = TRUE;
1542++ }
1543++
1544++ flags = GCS_COMPSTR;
1545++
1546++ if (dwCompLen && lpComp)
1547++ {
1548++ newCompStr = updateCompStr(lpIMC->hCompStr, (LPWSTR)lpComp, dwCompLen / sizeof(WCHAR));
1549++ ImmDestroyIMCC(lpIMC->hCompStr);
1550++ lpIMC->hCompStr = newCompStr;
1551++
1552++ wParam = ((const WCHAR*)lpComp)[0];
1553++ flags |= GCS_COMPCLAUSE | GCS_COMPATTR | GCS_DELTASTART;
1554++ }
1555++ else
1556++ {
1557++ newCompStr = updateCompStr(lpIMC->hCompStr, NULL, 0);
1558++ ImmDestroyIMCC(lpIMC->hCompStr);
1559++ lpIMC->hCompStr = newCompStr;
1560++ }
1561++ }
1562++
1563++ UpdateDataInDefaultIMEWindow(hIMC, myPrivate->hwndDefault,FALSE);
1564++
1565++ GenerateIMEMessage(hIMC, WM_IME_COMPOSITION, wParam, flags);
1566++ ImmUnlockIMCC(lpIMC->hPrivate);
1567++ UnlockRealIMC(hIMC);
1568++
1569++ return TRUE;
1570++}
1571++
1572++DWORD WINAPI ImeGetImeMenuItems(HIMC hIMC, DWORD dwFlags, DWORD dwType,
1573++ LPIMEMENUITEMINFOW lpImeParentMenu, LPIMEMENUITEMINFOW lpImeMenu,
1574++ DWORD dwSize)
1575++{
1576++ FIXME("(%p, %x %x %p %p %x): stub\n", hIMC, dwFlags, dwType,
1577++ lpImeParentMenu, lpImeMenu, dwSize);
1578++ SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1579++ return 0;
1580++}
1581++
1582++/* Interfaces to XIM and other parts of winex11drv */
1583++
1584++void IME_RegisterClasses(HINSTANCE hImeInst)
1585++{
1586++ WNDCLASSW wndClass;
1587++ ZeroMemory(&wndClass, sizeof(WNDCLASSW));
1588++ wndClass.style = CS_GLOBALCLASS | CS_IME | CS_HREDRAW | CS_VREDRAW;
1589++ wndClass.lpfnWndProc = (WNDPROC) IME_WindowProc;
1590++ wndClass.cbClsExtra = 0;
1591++ wndClass.cbWndExtra = 2 * sizeof(LONG);
1592++ wndClass.hInstance = hImeInst;
1593++ wndClass.hCursor = LoadCursorW(NULL, (LPWSTR)IDC_ARROW);
1594++ wndClass.hIcon = LoadIconW(NULL, (LPWSTR)IDI_APPLICATION);
1595++ wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW +1);
1596++ wndClass.lpszMenuName = 0;
1597++ wndClass.lpszClassName = UI_CLASS_NAME;
1598++
1599++ RegisterClassW(&wndClass);
1600++
1601++ WM_MSIME_SERVICE = RegisterWindowMessageA("MSIMEService");
1602++ WM_MSIME_RECONVERTOPTIONS = RegisterWindowMessageA("MSIMEReconvertOptions");
1603++ WM_MSIME_MOUSE = RegisterWindowMessageA("MSIMEMouseOperation");
1604++ WM_MSIME_RECONVERTREQUEST = RegisterWindowMessageA("MSIMEReconvertRequest");
1605++ WM_MSIME_RECONVERT = RegisterWindowMessageA("MSIMEReconvert");
1606++ WM_MSIME_QUERYPOSITION = RegisterWindowMessageA("MSIMEQueryPosition");
1607++ WM_MSIME_DOCUMENTFEED = RegisterWindowMessageA("MSIMEDocumentFeed");
1608++}
1609++
1610++void IME_UnregisterClasses(HINSTANCE hImeInst)
1611++{
1612++ UnregisterClassW(UI_CLASS_NAME, hImeInst);
1613++}
1614++
1615++LRESULT IME_SendMessageToSelectedHWND(UINT msg, WPARAM wParam, LPARAM lParam)
1616++{
1617++ LPINPUTCONTEXT lpIMC;
1618++ LRESULT rc = 0;
1619++
1620++ if (!hSelectedFrom)
1621++ return rc;
1622++
1623++ lpIMC = LockRealIMC(FROM_X11);
1624++ if (lpIMC)
1625++ rc = SendMessageW(lpIMC->hWnd,msg,wParam,lParam);
1626++
1627++ UnlockRealIMC(FROM_X11);
1628++ return rc;
1629++}
1630++
1631++INT IME_GetCursorPos()
1632++{
1633++ LPINPUTCONTEXT lpIMC;
1634++ INT rc = 0;
1635++ LPCOMPOSITIONSTRING compstr;
1636++
1637++ if (!hSelectedFrom)
1638++ return rc;
1639++
1640++ lpIMC = LockRealIMC(FROM_X11);
1641++ if (lpIMC)
1642++ {
1643++ compstr = (LPCOMPOSITIONSTRING)ImmLockIMCC(lpIMC->hCompStr);
1644++ rc = compstr->dwCursorPos;
1645++ ImmUnlockIMCC(lpIMC->hCompStr);
1646++ }
1647++ UnlockRealIMC(FROM_X11);
1648++ return rc;
1649++}
1650++
1651++void IME_SetCursorPos(DWORD pos)
1652++{
1653++ LPINPUTCONTEXT lpIMC;
1654++ LPCOMPOSITIONSTRING compstr;
1655++
1656++ if (!hSelectedFrom)
1657++ return;
1658++
1659++ lpIMC = LockRealIMC(FROM_X11);
1660++ if (!lpIMC)
1661++ return;
1662++
1663++ compstr = (LPCOMPOSITIONSTRING)ImmLockIMCC(lpIMC->hCompStr);
1664++ if (!compstr)
1665++ {
1666++ UnlockRealIMC(FROM_X11);
1667++ return;
1668++ }
1669++
1670++ compstr->dwCursorPos = pos;
1671++ ImmUnlockIMCC(lpIMC->hCompStr);
1672++ UnlockRealIMC(FROM_X11);
1673++ GenerateIMEMessage(FROM_X11, WM_IME_COMPOSITION, pos, GCS_CURSORPOS);
1674++ return;
1675++}
1676++
1677++void IME_UpdateAssociation(HWND focus)
1678++{
1679++ ImmGetContext(focus);
1680++
1681++ if (!focus || !hSelectedFrom)
1682++ return;
1683++
1684++ ImmAssociateContext(focus,RealIMC(FROM_X11));
1685++}
1686++
1687++
1688++void IME_SetCompositionString(LPCVOID lpComp, DWORD dwCompLen)
1689++{
1690++ ImeSetCompositionString(FROM_X11, SCS_SETSTR, lpComp, dwCompLen,
1691++ NULL, 0);
1692++}
1693++
1694++void IME_NotifyComplete()
1695++{
1696++ NotifyIME(FROM_X11, NI_COMPOSITIONSTR, CPS_COMPLETE, 0);
1697++}
1698++
1699++/*****
1700++ * Internal functions to help with IME window management
1701++ */
1702++static void PaintDefaultIMEWnd(HIMC hIMC, HWND hwnd)
1703++{
1704++ PAINTSTRUCT ps;
1705++ RECT rect;
1706++ HDC hdc;
1707++ LPCOMPOSITIONSTRING compstr;
1708++ LPBYTE compdata = NULL;
1709++ HMONITOR monitor;
1710++ MONITORINFO mon_info;
1711++ INT offX=0, offY=0;
1712++ LPINPUTCONTEXT lpIMC;
1713++
1714++ lpIMC = LockRealIMC(hIMC);
1715++ if (lpIMC == NULL)
1716++ return;
1717++
1718++ hdc = BeginPaint(hwnd,&ps);
1719++
1720++ GetClientRect(hwnd,&rect);
1721++ FillRect(hdc, &rect, (HBRUSH)(COLOR_WINDOW + 1));
1722++
1723++ compdata = ImmLockIMCC(lpIMC->hCompStr);
1724++ compstr = (LPCOMPOSITIONSTRING)compdata;
1725++
1726++ if (compstr->dwCompStrLen && compstr->dwCompStrOffset)
1727++ {
1728++ SIZE size;
1729++ POINT pt;
1730++ HFONT oldfont = NULL;
1731++ LPWSTR CompString;
1732++ LPIMEPRIVATE myPrivate;
1733++
1734++ CompString = (LPWSTR)(compdata + compstr->dwCompStrOffset);
1735++ myPrivate = (LPIMEPRIVATE)ImmLockIMCC(lpIMC->hPrivate);
1736++
1737++ if (myPrivate->textfont)
1738++ oldfont = SelectObject(hdc,myPrivate->textfont);
1739++
1740++ ImmUnlockIMCC(lpIMC->hPrivate);
1741++
1742++ GetTextExtentPoint32W(hdc, CompString, compstr->dwCompStrLen, &size);
1743++ pt.x = size.cx;
1744++ pt.y = size.cy;
1745++ LPtoDP(hdc,&pt,1);
1746++
1747++ /*
1748++ * How this works based on tests on windows:
1749++ * CFS_POINT: then we start our window at the point and grow it as large
1750++ * as it needs to be for the string.
1751++ * CFS_RECT: we still use the ptCurrentPos as a starting point and our
1752++ * window is only as large as we need for the string, but we do not
1753++ * grow such that our window exceeds the given rect. Wrapping if
1754++ * needed and possible. If our ptCurrentPos is outside of our rect
1755++ * then no window is displayed.
1756++ * CFS_FORCE_POSITION: appears to behave just like CFS_POINT
1757++ * maybe becase the default MSIME does not do any IME adjusting.
1758++ */
1759++ if (lpIMC->cfCompForm.dwStyle != CFS_DEFAULT)
1760++ {
1761++ POINT cpt = lpIMC->cfCompForm.ptCurrentPos;
1762++ ClientToScreen(lpIMC->hWnd,&cpt);
1763++ rect.left = cpt.x;
1764++ rect.top = cpt.y;
1765++ rect.right = rect.left + pt.x;
1766++ rect.bottom = rect.top + pt.y;
1767++ monitor = MonitorFromPoint(cpt, MONITOR_DEFAULTTOPRIMARY);
1768++ }
1769++ else /* CFS_DEFAULT */
1770++ {
1771++ /* Windows places the default IME window in the bottom left */
1772++ HWND target = lpIMC->hWnd;
1773++ if (!target) target = GetFocus();
1774++
1775++ GetWindowRect(target,&rect);
1776++ rect.top = rect.bottom;
1777++ rect.right = rect.left + pt.x + 20;
1778++ rect.bottom = rect.top + pt.y + 20;
1779++ offX=offY=10;
1780++ monitor = MonitorFromWindow(target, MONITOR_DEFAULTTOPRIMARY);
1781++ }
1782++
1783++ if (lpIMC->cfCompForm.dwStyle == CFS_RECT)
1784++ {
1785++ RECT client;
1786++ client =lpIMC->cfCompForm.rcArea;
1787++ MapWindowPoints( lpIMC->hWnd, 0, (POINT *)&client, 2 );
1788++ IntersectRect(&rect,&rect,&client);
1789++ /* TODO: Wrap the input if needed */
1790++ }
1791++
1792++ if (lpIMC->cfCompForm.dwStyle == CFS_DEFAULT)
1793++ {
1794++ /* make sure we are on the desktop */
1795++ mon_info.cbSize = sizeof(mon_info);
1796++ GetMonitorInfoW(monitor, &mon_info);
1797++
1798++ if (rect.bottom > mon_info.rcWork.bottom)
1799++ {
1800++ int shift = rect.bottom - mon_info.rcWork.bottom;
1801++ rect.top -= shift;
1802++ rect.bottom -= shift;
1803++ }
1804++ if (rect.left < 0)
1805++ {
1806++ rect.right -= rect.left;
1807++ rect.left = 0;
1808++ }
1809++ if (rect.right > mon_info.rcWork.right)
1810++ {
1811++ int shift = rect.right - mon_info.rcWork.right;
1812++ rect.left -= shift;
1813++ rect.right -= shift;
1814++ }
1815++ }
1816++
1817++ SetWindowPos(hwnd, HWND_TOPMOST, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOACTIVATE);
1818++
1819++ TextOutW(hdc, offX,offY, CompString, compstr->dwCompStrLen);
1820++
1821++ if (oldfont)
1822++ SelectObject(hdc,oldfont);
1823++ }
1824++
1825++ ImmUnlockIMCC(lpIMC->hCompStr);
1826++
1827++ EndPaint(hwnd,&ps);
1828++ UnlockRealIMC(hIMC);
1829++}
1830++
1831++static void UpdateDataInDefaultIMEWindow(HIMC hIMC, HWND hwnd, BOOL showable)
1832++{
1833++ LPCOMPOSITIONSTRING compstr;
1834++ LPINPUTCONTEXT lpIMC;
1835++
1836++ lpIMC = LockRealIMC(hIMC);
1837++ if (lpIMC == NULL)
1838++ return;
1839++
1840++ if (lpIMC->hCompStr)
1841++ compstr = ImmLockIMCC(lpIMC->hCompStr);
1842++ else
1843++ compstr = NULL;
1844++
1845++ if (compstr == NULL || compstr->dwCompStrLen == 0)
1846++ ShowWindow(hwnd,SW_HIDE);
1847++ else if (showable)
1848++ ShowWindow(hwnd,SW_SHOWNOACTIVATE);
1849++
1850++ RedrawWindow(hwnd,NULL,NULL,RDW_ERASENOW|RDW_INVALIDATE);
1851++
1852++ if (compstr != NULL)
1853++ ImmUnlockIMCC(lpIMC->hCompStr);
1854++
1855++ UnlockRealIMC(hIMC);
1856++}
1857++
1858++static void DefaultIMEComposition(HIMC hIMC, HWND hwnd, LPARAM lParam)
1859++{
1860++ TRACE("IME message WM_IME_COMPOSITION 0x%lx\n", lParam);
1861++ if (lParam & GCS_RESULTSTR)
1862++ {
1863++ LPCOMPOSITIONSTRING compstr;
1864++ LPBYTE compdata;
1865++ LPWSTR ResultStr;
1866++ HIMCC newCompStr;
1867++ LPINPUTCONTEXT lpIMC;
1868++
1869++ lpIMC = LockRealIMC(hIMC);
1870++ if (lpIMC == NULL)
1871++ return;
1872++
1873++ TRACE("Posting result as IME_CHAR\n");
1874++ compdata = ImmLockIMCC(lpIMC->hCompStr);
1875++ compstr = (LPCOMPOSITIONSTRING)compdata;
1876++ ResultStr = (LPWSTR)(compdata + compstr->dwResultStrOffset);
1877++ GenerateIMECHARMessages(hIMC, ResultStr, compstr->dwResultStrLen);
1878++ ImmUnlockIMCC(lpIMC->hCompStr);
1879++
1880++ /* clear the buffer */
1881++ newCompStr = updateResultStr(lpIMC->hCompStr, NULL, 0);
1882++ ImmDestroyIMCC(lpIMC->hCompStr);
1883++ lpIMC->hCompStr = newCompStr;
1884++ UnlockRealIMC(hIMC);
1885++ }
1886++ else
1887++ UpdateDataInDefaultIMEWindow(hIMC,hwnd,TRUE);
1888++}
1889++
1890++static void DefaultIMEStartComposition(HIMC hIMC, HWND hwnd )
1891++{
1892++ LPINPUTCONTEXT lpIMC;
1893++
1894++ lpIMC = LockRealIMC(hIMC);
1895++ if (lpIMC == NULL)
1896++ return;
1897++
1898++ TRACE("IME message WM_IME_STARTCOMPOSITION\n");
1899++ lpIMC->hWnd = GetFocus();
1900++ ShowWindow(hwnd,SW_SHOWNOACTIVATE);
1901++ UnlockRealIMC(hIMC);
1902++}
1903++
1904++static LRESULT ImeHandleNotify(HIMC hIMC, HWND hwnd, UINT msg, WPARAM wParam,
1905++ LPARAM lParam)
1906++{
1907++ switch (wParam)
1908++ {
1909++ case IMN_OPENSTATUSWINDOW:
1910++ FIXME("WM_IME_NOTIFY:IMN_OPENSTATUSWINDOW\n");
1911++ break;
1912++ case IMN_CLOSESTATUSWINDOW:
1913++ FIXME("WM_IME_NOTIFY:IMN_CLOSESTATUSWINDOW\n");
1914++ break;
1915++ case IMN_OPENCANDIDATE:
1916++ FIXME("WM_IME_NOTIFY:IMN_OPENCANDIDATE\n");
1917++ break;
1918++ case IMN_CHANGECANDIDATE:
1919++ FIXME("WM_IME_NOTIFY:IMN_CHANGECANDIDATE\n");
1920++ break;
1921++ case IMN_CLOSECANDIDATE:
1922++ FIXME("WM_IME_NOTIFY:IMN_CLOSECANDIDATE\n");
1923++ break;
1924++ case IMN_SETCONVERSIONMODE:
1925++ FIXME("WM_IME_NOTIFY:IMN_SETCONVERSIONMODE\n");
1926++ break;
1927++ case IMN_SETSENTENCEMODE:
1928++ FIXME("WM_IME_NOTIFY:IMN_SETSENTENCEMODE\n");
1929++ break;
1930++ case IMN_SETOPENSTATUS:
1931++ FIXME("WM_IME_NOTIFY:IMN_SETOPENSTATUS\n");
1932++ break;
1933++ case IMN_SETCANDIDATEPOS:
1934++ FIXME("WM_IME_NOTIFY:IMN_SETCANDIDATEPOS\n");
1935++ break;
1936++ case IMN_SETCOMPOSITIONFONT:
1937++ FIXME("WM_IME_NOTIFY:IMN_SETCOMPOSITIONFONT\n");
1938++ break;
1939++ case IMN_SETCOMPOSITIONWINDOW:
1940++ FIXME("WM_IME_NOTIFY:IMN_SETCOMPOSITIONWINDOW\n");
1941++ break;
1942++ case IMN_GUIDELINE:
1943++ FIXME("WM_IME_NOTIFY:IMN_GUIDELINE\n");
1944++ break;
1945++ case IMN_SETSTATUSWINDOWPOS:
1946++ FIXME("WM_IME_NOTIFY:IMN_SETSTATUSWINDOWPOS\n");
1947++ break;
1948++ default:
1949++ FIXME("WM_IME_NOTIFY:<Unknown 0x%lx>\n",wParam);
1950++ break;
1951++ }
1952++ return 0;
1953++}
1954++
1955++static LRESULT WINAPI IME_WindowProc(HWND hwnd, UINT msg, WPARAM wParam,
1956++ LPARAM lParam)
1957++{
1958++ LRESULT rc = 0;
1959++ HIMC hIMC;
1960++
1961++ TRACE("Incoming Message 0x%x (0x%08lx, 0x%08lx)\n", msg, wParam, lParam);
1962++
1963++ /*
1964++ * Each UI window contains the current Input Context.
1965++ * This Input Context can be obtained by calling GetWindowLong
1966++ * with IMMGWL_IMC when the UI window receives a WM_IME_xxx message.
1967++ * The UI window can refer to this Input Context and handles the
1968++ * messages.
1969++ */
1970++
1971++ hIMC = (HIMC)GetWindowLongW(hwnd,IMMGWL_IMC);
1972++ if (!hIMC)
1973++ hIMC = RealIMC(FROM_X11);
1974++
1975++ /* if we have no hIMC there are many messages we cannot process */
1976++ if (hIMC == NULL)
1977++ {
1978++ switch (msg) {
1979++ case WM_IME_STARTCOMPOSITION:
1980++ case WM_IME_ENDCOMPOSITION:
1981++ case WM_IME_COMPOSITION:
1982++ case WM_IME_NOTIFY:
1983++ case WM_IME_CONTROL:
1984++ case WM_IME_COMPOSITIONFULL:
1985++ case WM_IME_SELECT:
1986++ case WM_IME_CHAR:
1987++ return 0L;
1988++ default:
1989++ break;
1990++ }
1991++ }
1992++
1993++ switch(msg)
1994++ {
1995++ case WM_CREATE:
1996++ {
1997++ LPIMEPRIVATE myPrivate;
1998++ LPINPUTCONTEXT lpIMC;
1999++
2000++ SetWindowTextA(hwnd,"Wine Ime Active");
2001++
2002++ lpIMC = LockRealIMC(hIMC);
2003++ if (lpIMC)
2004++ {
2005++ myPrivate = (LPIMEPRIVATE)ImmLockIMCC(lpIMC->hPrivate);
2006++ myPrivate->hwndDefault = hwnd;
2007++ ImmUnlockIMCC(lpIMC->hPrivate);
2008++ }
2009++ UnlockRealIMC(hIMC);
2010++
2011++ return TRUE;
2012++ }
2013++ case WM_PAINT:
2014++ PaintDefaultIMEWnd(hIMC, hwnd);
2015++ return FALSE;
2016++
2017++ case WM_NCCREATE:
2018++ return TRUE;
2019++
2020++ case WM_SETFOCUS:
2021++ if (wParam)
2022++ SetFocus((HWND)wParam);
2023++ else
2024++ FIXME("Received focus, should never have focus\n");
2025++ break;
2026++ case WM_IME_COMPOSITION:
2027++ DefaultIMEComposition(hIMC, hwnd, lParam);
2028++ break;
2029++ case WM_IME_STARTCOMPOSITION:
2030++ DefaultIMEStartComposition(hIMC, hwnd);
2031++ break;
2032++ case WM_IME_ENDCOMPOSITION:
2033++ TRACE("IME message %s, 0x%lx, 0x%lx\n",
2034++ "WM_IME_ENDCOMPOSITION", wParam, lParam);
2035++ ShowWindow(hwnd,SW_HIDE);
2036++ break;
2037++ case WM_IME_SELECT:
2038++ TRACE("IME message %s, 0x%lx, 0x%lx\n","WM_IME_SELECT", wParam, lParam);
2039++ break;
2040++ case WM_IME_CONTROL:
2041++ TRACE("IME message %s, 0x%lx, 0x%lx\n","WM_IME_CONTROL", wParam, lParam);
2042++ rc = 1;
2043++ break;
2044++ case WM_IME_NOTIFY:
2045++ rc = ImeHandleNotify(hIMC,hwnd,msg,wParam,lParam);
2046++ break;
2047++ default:
2048++ TRACE("Non-standard message 0x%x\n",msg);
2049++ }
2050++ /* check the MSIME messages */
2051++ if (msg == WM_MSIME_SERVICE)
2052++ {
2053++ TRACE("IME message %s, 0x%lx, 0x%lx\n","WM_MSIME_SERVICE", wParam, lParam);
2054++ rc = FALSE;
2055++ }
2056++ else if (msg == WM_MSIME_RECONVERTOPTIONS)
2057++ {
2058++ TRACE("IME message %s, 0x%lx, 0x%lx\n","WM_MSIME_RECONVERTOPTIONS", wParam, lParam);
2059++ }
2060++ else if (msg == WM_MSIME_MOUSE)
2061++ {
2062++ TRACE("IME message %s, 0x%lx, 0x%lx\n","WM_MSIME_MOUSE", wParam, lParam);
2063++ }
2064++ else if (msg == WM_MSIME_RECONVERTREQUEST)
2065++ {
2066++ TRACE("IME message %s, 0x%lx, 0x%lx\n","WM_MSIME_RECONVERTREQUEST", wParam, lParam);
2067++ }
2068++ else if (msg == WM_MSIME_RECONVERT)
2069++ {
2070++ TRACE("IME message %s, 0x%lx, 0x%lx\n","WM_MSIME_RECONVERT", wParam, lParam);
2071++ }
2072++ else if (msg == WM_MSIME_QUERYPOSITION)
2073++ {
2074++ TRACE("IME message %s, 0x%lx, 0x%lx\n","WM_MSIME_QUERYPOSITION", wParam, lParam);
2075++ }
2076++ else if (msg == WM_MSIME_DOCUMENTFEED)
2077++ {
2078++ TRACE("IME message %s, 0x%lx, 0x%lx\n","WM_MSIME_DOCUMENTFEED", wParam, lParam);
2079++ }
2080++ /* DefWndProc if not an IME message */
2081++ if (!rc && !((msg >= WM_IME_STARTCOMPOSITION && msg <= WM_IME_KEYLAST) ||
2082++ (msg >= WM_IME_SETCONTEXT && msg <= WM_IME_KEYUP)))
2083++ rc = DefWindowProcW(hwnd,msg,wParam,lParam);
2084++
2085++ return rc;
2086++}
2087++
2088++#endif
2089+--- wine-1.0-rc4/dlls/wineosxime.drv/keysym2ucs.c 1970-01-01 09:00:00.000000000 +0900
2090++++ wine/dlls/wineosxime.drv/keysym2ucs.c 2008-06-07 01:12:15.000000000 +0900
2091+@@ -0,0 +1,914 @@
2092++/* $XFree86: $
2093++ *
2094++ * IMPORTANT NOTE: If you modify this file you MUST modify the corresponding
2095++ * copy of this file located in the x11 build tree
2096++ *
2097++ * This module converts keysym values into the corresponding ISO 10646
2098++ * (UCS, Unicode) values.
2099++ *
2100++ * The array keysymtab[] contains pairs of X11 keysym values for graphical
2101++ * characters and the corresponding Unicode value. The function
2102++ * keysym2ucs() maps a keysym onto a Unicode value using a binary search,
2103++ * therefore keysymtab[] must remain SORTED by keysym value.
2104++ *
2105++ * The keysym -> UTF-8 conversion will hopefully one day be provided
2106++ * by Xlib via XmbLookupString() and should ideally not have to be
2107++ * done in X applications. But we are not there yet.
2108++ *
2109++ * We allow to represent any UCS character in the range U-00000000 to
2110++ * U-00FFFFFF by a keysym value in the range 0x01000000 to 0x01ffffff.
2111++ * This admittedly does not cover the entire 31-bit space of UCS, but
2112++ * it does cover all of the characters up to U-10FFFF, which can be
2113++ * represented by UTF-16, and more, and it is very unlikely that higher
2114++ * UCS codes will ever be assigned by ISO. So to get Unicode character
2115++ * U+ABCD you can directly use keysym 0x0100abcd.
2116++ *
2117++ * NOTE: The comments in the table below contain the actual character
2118++ * encoded in UTF-8, so for viewing and editing best use an editor in
2119++ * UTF-8 mode.
2120++ *
2121++ * Author: Markus G. Kuhn <mkuhn@acm.org>, University of Cambridge, April 2001
2122++ *
2123++ * Special thanks to Richard Verhoeven <river@win.tue.nl> for preparing
2124++ * an initial draft of the mapping table.
2125++ *
2126++ * This software is in the public domain. Share and enjoy!
2127++ *
2128++ * AUTOMATICALLY GENERATED FILE, DO NOT EDIT !!! (unicode/convmap.pl)
2129++ */
2130++
2131++#ifdef __APPLE__
2132++#include "keysym2ucs.h"
2133++
2134++#include <stdlib.h>
2135++#include <string.h>
2136++
2137++struct codepair {
2138++ unsigned short keysym;
2139++ unsigned short ucs;
2140++};
2141++
2142++const static struct codepair keysymtab[] = {
2143++ { 0x01a1, 0x0104 },
2144++ { 0x01a2, 0x02d8 },
2145++ { 0x01a3, 0x0141 },
2146++ { 0x01a5, 0x013d },
2147++ { 0x01a6, 0x015a },
2148++ { 0x01a9, 0x0160 },
2149++ { 0x01aa, 0x015e },
2150++ { 0x01ab, 0x0164 },
2151++ { 0x01ac, 0x0179 },
2152++ { 0x01ae, 0x017d },
2153++ { 0x01af, 0x017b },
2154++ { 0x01b1, 0x0105 },
2155++ { 0x01b2, 0x02db },
2156++ { 0x01b3, 0x0142 },
2157++ { 0x01b5, 0x013e },
2158++ { 0x01b6, 0x015b },
2159++ { 0x01b7, 0x02c7 },
2160++ { 0x01b9, 0x0161 },
2161++ { 0x01ba, 0x015f },
2162++ { 0x01bb, 0x0165 },
2163++ { 0x01bc, 0x017a },
2164++ { 0x01bd, 0x02dd },
2165++ { 0x01be, 0x017e },
2166++ { 0x01bf, 0x017c },
2167++ { 0x01c0, 0x0154 },
2168++ { 0x01c3, 0x0102 },
2169++ { 0x01c5, 0x0139 },
2170++ { 0x01c6, 0x0106 },
2171++ { 0x01c8, 0x010c },
2172++ { 0x01ca, 0x0118 },
2173++ { 0x01cc, 0x011a },
2174++ { 0x01cf, 0x010e },
2175++ { 0x01d0, 0x0110 },
2176++ { 0x01d1, 0x0143 },
2177++ { 0x01d2, 0x0147 },
2178++ { 0x01d5, 0x0150 },
2179++ { 0x01d8, 0x0158 },
2180++ { 0x01d9, 0x016e },
2181++ { 0x01db, 0x0170 },
2182++ { 0x01de, 0x0162 },
2183++ { 0x01e0, 0x0155 },
2184++ { 0x01e3, 0x0103 },
2185++ { 0x01e5, 0x013a },
2186++ { 0x01e6, 0x0107 },
2187++ { 0x01e8, 0x010d },
2188++ { 0x01ea, 0x0119 },
2189++ { 0x01ec, 0x011b },
2190++ { 0x01ef, 0x010f },
2191++ { 0x01f0, 0x0111 },
2192++ { 0x01f1, 0x0144 },
2193++ { 0x01f2, 0x0148 },
2194++ { 0x01f5, 0x0151 },
2195++ { 0x01f8, 0x0159 },
2196++ { 0x01f9, 0x016f },
2197++ { 0x01fb, 0x0171 },
2198++ { 0x01fe, 0x0163 },
2199++ { 0x01ff, 0x02d9 },
2200++ { 0x02a1, 0x0126 },
2201++ { 0x02a6, 0x0124 },
2202++ { 0x02a9, 0x0130 },
2203++ { 0x02ab, 0x011e },
2204++ { 0x02ac, 0x0134 },
2205++ { 0x02b1, 0x0127 },
2206++ { 0x02b6, 0x0125 },
2207++ { 0x02b9, 0x0131 },
2208++ { 0x02bb, 0x011f },
2209++ { 0x02bc, 0x0135 },
2210++ { 0x02c5, 0x010a },
2211++ { 0x02c6, 0x0108 },
2212++ { 0x02d5, 0x0120 },
2213++ { 0x02d8, 0x011c },
2214++ { 0x02dd, 0x016c },
2215++ { 0x02de, 0x015c },
2216++ { 0x02e5, 0x010b },
2217++ { 0x02e6, 0x0109 },
2218++ { 0x02f5, 0x0121 },
2219++ { 0x02f8, 0x011d },
2220++ { 0x02fd, 0x016d },
2221++ { 0x02fe, 0x015d },
2222++ { 0x03a2, 0x0138 },
2223++ { 0x03a3, 0x0156 },
2224++ { 0x03a5, 0x0128 },
2225++ { 0x03a6, 0x013b },
2226++ { 0x03aa, 0x0112 },
2227++ { 0x03ab, 0x0122 },
2228++ { 0x03ac, 0x0166 },
2229++ { 0x03b3, 0x0157 },
2230++ { 0x03b5, 0x0129 },
2231++ { 0x03b6, 0x013c },
2232++ { 0x03ba, 0x0113 },
2233++ { 0x03bb, 0x0123 },
2234++ { 0x03bc, 0x0167 },
2235++ { 0x03bd, 0x014a },
2236++ { 0x03bf, 0x014b },
2237++ { 0x03c0, 0x0100 },
2238++ { 0x03c7, 0x012e },
2239++ { 0x03cc, 0x0116 },
2240++ { 0x03cf, 0x012a },
2241++ { 0x03d1, 0x0145 },
2242++ { 0x03d2, 0x014c },
2243++ { 0x03d3, 0x0136 },
2244++ { 0x03d9, 0x0172 },
2245++ { 0x03dd, 0x0168 },
2246++ { 0x03de, 0x016a },
2247++ { 0x03e0, 0x0101 },
2248++ { 0x03e7, 0x012f },
2249++ { 0x03ec, 0x0117 },
2250++ { 0x03ef, 0x012b },
2251++ { 0x03f1, 0x0146 },
2252++ { 0x03f2, 0x014d },
2253++ { 0x03f3, 0x0137 },
2254++ { 0x03f9, 0x0173 },
2255++ { 0x03fd, 0x0169 },
2256++ { 0x03fe, 0x016b },
2257++ { 0x047e, 0x203e },
2258++ { 0x04a1, 0x3002 },
2259++ { 0x04a2, 0x300c },
2260++ { 0x04a3, 0x300d },
2261++ { 0x04a4, 0x3001 },
2262++ { 0x04a5, 0x30fb },
2263++ { 0x04a6, 0x30f2 },
2264++ { 0x04a7, 0x30a1 },
2265++ { 0x04a8, 0x30a3 },
2266++ { 0x04a9, 0x30a5 },
2267++ { 0x04aa, 0x30a7 },
2268++ { 0x04ab, 0x30a9 },
2269++ { 0x04ac, 0x30e3 },
2270++ { 0x04ad, 0x30e5 },
2271++ { 0x04ae, 0x30e7 },
2272++ { 0x04af, 0x30c3 },
2273++ { 0x04b0, 0x30fc },
2274++ { 0x04b1, 0x30a2 },
2275++ { 0x04b2, 0x30a4 },
2276++ { 0x04b3, 0x30a6 },
2277++ { 0x04b4, 0x30a8 },
2278++ { 0x04b5, 0x30aa },
2279++ { 0x04b6, 0x30ab },
2280++ { 0x04b7, 0x30ad },
2281++ { 0x04b8, 0x30af },
2282++ { 0x04b9, 0x30b1 },
2283++ { 0x04ba, 0x30b3 },
2284++ { 0x04bb, 0x30b5 },
2285++ { 0x04bc, 0x30b7 },
2286++ { 0x04bd, 0x30b9 },
2287++ { 0x04be, 0x30bb },
2288++ { 0x04bf, 0x30bd },
2289++ { 0x04c0, 0x30bf },
2290++ { 0x04c1, 0x30c1 },
2291++ { 0x04c2, 0x30c4 },
2292++ { 0x04c3, 0x30c6 },
2293++ { 0x04c4, 0x30c8 },
2294++ { 0x04c5, 0x30ca },
2295++ { 0x04c6, 0x30cb },
2296++ { 0x04c7, 0x30cc },
2297++ { 0x04c8, 0x30cd },
2298++ { 0x04c9, 0x30ce },
2299++ { 0x04ca, 0x30cf },
2300++ { 0x04cb, 0x30d2 },
2301++ { 0x04cc, 0x30d5 },
2302++ { 0x04cd, 0x30d8 },
2303++ { 0x04ce, 0x30db },
2304++ { 0x04cf, 0x30de },
2305++ { 0x04d0, 0x30df },
2306++ { 0x04d1, 0x30e0 },
2307++ { 0x04d2, 0x30e1 },
2308++ { 0x04d3, 0x30e2 },
2309++ { 0x04d4, 0x30e4 },
2310++ { 0x04d5, 0x30e6 },
2311++ { 0x04d6, 0x30e8 },
2312++ { 0x04d7, 0x30e9 },
2313++ { 0x04d8, 0x30ea },
2314++ { 0x04d9, 0x30eb },
2315++ { 0x04da, 0x30ec },
2316++ { 0x04db, 0x30ed },
2317++ { 0x04dc, 0x30ef },
2318++ { 0x04dd, 0x30f3 },
2319++ { 0x04de, 0x309b },
2320++ { 0x04df, 0x309c },
2321++ { 0x05ac, 0x060c },
2322++ { 0x05bb, 0x061b },
2323++ { 0x05bf, 0x061f },
2324++ { 0x05c1, 0x0621 },
2325++ { 0x05c2, 0x0622 },
2326++ { 0x05c3, 0x0623 },
2327++ { 0x05c4, 0x0624 },
2328++ { 0x05c5, 0x0625 },
2329++ { 0x05c6, 0x0626 },
2330++ { 0x05c7, 0x0627 },
2331++ { 0x05c8, 0x0628 },
2332++ { 0x05c9, 0x0629 },
2333++ { 0x05ca, 0x062a },
2334++ { 0x05cb, 0x062b },
2335++ { 0x05cc, 0x062c },
2336++ { 0x05cd, 0x062d },
2337++ { 0x05ce, 0x062e },
2338++ { 0x05cf, 0x062f },
2339++ { 0x05d0, 0x0630 },
2340++ { 0x05d1, 0x0631 },
2341++ { 0x05d2, 0x0632 },
2342++ { 0x05d3, 0x0633 },
2343++ { 0x05d4, 0x0634 },
2344++ { 0x05d5, 0x0635 },
2345++ { 0x05d6, 0x0636 },
2346++ { 0x05d7, 0x0637 },
2347++ { 0x05d8, 0x0638 },
2348++ { 0x05d9, 0x0639 },
2349++ { 0x05da, 0x063a },
2350++ { 0x05e0, 0x0640 },
2351++ { 0x05e1, 0x0641 },
2352++ { 0x05e2, 0x0642 },
2353++ { 0x05e3, 0x0643 },
2354++ { 0x05e4, 0x0644 },
2355++ { 0x05e5, 0x0645 },
2356++ { 0x05e6, 0x0646 },
2357++ { 0x05e7, 0x0647 },
2358++ { 0x05e8, 0x0648 },
2359++ { 0x05e9, 0x0649 },
2360++ { 0x05ea, 0x064a },
2361++ { 0x05eb, 0x064b },
2362++ { 0x05ec, 0x064c },
2363++ { 0x05ed, 0x064d },
2364++ { 0x05ee, 0x064e },
2365++ { 0x05ef, 0x064f },
2366++ { 0x05f0, 0x0650 },
2367++ { 0x05f1, 0x0651 },
2368++ { 0x05f2, 0x0652 },
2369++ { 0x06a1, 0x0452 },
2370++ { 0x06a2, 0x0453 },
2371++ { 0x06a3, 0x0451 },
2372++ { 0x06a4, 0x0454 },
2373++ { 0x06a5, 0x0455 },
2374++ { 0x06a6, 0x0456 },
2375++ { 0x06a7, 0x0457 },
2376++ { 0x06a8, 0x0458 },
2377++ { 0x06a9, 0x0459 },
2378++ { 0x06aa, 0x045a },
2379++ { 0x06ab, 0x045b },
2380++ { 0x06ac, 0x045c },
2381++ { 0x06ae, 0x045e },
2382++ { 0x06af, 0x045f },
2383++ { 0x06b0, 0x2116 },
2384++ { 0x06b1, 0x0402 },
2385++ { 0x06b2, 0x0403 },
2386++ { 0x06b3, 0x0401 },
2387++ { 0x06b4, 0x0404 },
2388++ { 0x06b5, 0x0405 },
2389++ { 0x06b6, 0x0406 },
2390++ { 0x06b7, 0x0407 },
2391++ { 0x06b8, 0x0408 },
2392++ { 0x06b9, 0x0409 },
2393++ { 0x06ba, 0x040a },
2394++ { 0x06bb, 0x040b },
2395++ { 0x06bc, 0x040c },
2396++ { 0x06be, 0x040e },
2397++ { 0x06bf, 0x040f },
2398++ { 0x06c0, 0x044e },
2399++ { 0x06c1, 0x0430 },
2400++ { 0x06c2, 0x0431 },
2401++ { 0x06c3, 0x0446 },
2402++ { 0x06c4, 0x0434 },
2403++ { 0x06c5, 0x0435 },
2404++ { 0x06c6, 0x0444 },
2405++ { 0x06c7, 0x0433 },
2406++ { 0x06c8, 0x0445 },
2407++ { 0x06c9, 0x0438 },
2408++ { 0x06ca, 0x0439 },
2409++ { 0x06cb, 0x043a },
2410++ { 0x06cc, 0x043b },
2411++ { 0x06cd, 0x043c },
2412++ { 0x06ce, 0x043d },
2413++ { 0x06cf, 0x043e },
2414++ { 0x06d0, 0x043f },
2415++ { 0x06d1, 0x044f },
2416++ { 0x06d2, 0x0440 },
2417++ { 0x06d3, 0x0441 },
2418++ { 0x06d4, 0x0442 },
2419++ { 0x06d5, 0x0443 },
2420++ { 0x06d6, 0x0436 },
2421++ { 0x06d7, 0x0432 },
2422++ { 0x06d8, 0x044c },
2423++ { 0x06d9, 0x044b },
2424++ { 0x06da, 0x0437 },
2425++ { 0x06db, 0x0448 },
2426++ { 0x06dc, 0x044d },
2427++ { 0x06dd, 0x0449 },
2428++ { 0x06de, 0x0447 },
2429++ { 0x06df, 0x044a },
2430++ { 0x06e0, 0x042e },
2431++ { 0x06e1, 0x0410 },
2432++ { 0x06e2, 0x0411 },
2433++ { 0x06e3, 0x0426 },
2434++ { 0x06e4, 0x0414 },
2435++ { 0x06e5, 0x0415 },
2436++ { 0x06e6, 0x0424 },
2437++ { 0x06e7, 0x0413 },
2438++ { 0x06e8, 0x0425 },
2439++ { 0x06e9, 0x0418 },
2440++ { 0x06ea, 0x0419 },
2441++ { 0x06eb, 0x041a },
2442++ { 0x06ec, 0x041b },
2443++ { 0x06ed, 0x041c },
2444++ { 0x06ee, 0x041d },
2445++ { 0x06ef, 0x041e },
2446++ { 0x06f0, 0x041f },
2447++ { 0x06f1, 0x042f },
2448++ { 0x06f2, 0x0420 },
2449++ { 0x06f3, 0x0421 },
2450++ { 0x06f4, 0x0422 },
2451++ { 0x06f5, 0x0423 },
2452++ { 0x06f6, 0x0416 },
2453++ { 0x06f7, 0x0412 },
2454++ { 0x06f8, 0x042c },
2455++ { 0x06f9, 0x042b },
2456++ { 0x06fa, 0x0417 },
2457++ { 0x06fb, 0x0428 },
2458++ { 0x06fc, 0x042d },
2459++ { 0x06fd, 0x0429 },
2460++ { 0x06fe, 0x0427 },
2461++ { 0x06ff, 0x042a },
2462++ { 0x07a1, 0x0386 },
2463++ { 0x07a2, 0x0388 },
2464++ { 0x07a3, 0x0389 },
2465++ { 0x07a4, 0x038a },
2466++ { 0x07a5, 0x03aa },
2467++ { 0x07a7, 0x038c },
2468++ { 0x07a8, 0x038e },
2469++ { 0x07a9, 0x03ab },
2470++ { 0x07ab, 0x038f },
2471++ { 0x07ae, 0x0385 },
2472++ { 0x07af, 0x2015 },
2473++ { 0x07b1, 0x03ac },
2474++ { 0x07b2, 0x03ad },
2475++ { 0x07b3, 0x03ae },
2476++ { 0x07b4, 0x03af },
2477++ { 0x07b5, 0x03ca },
2478++ { 0x07b6, 0x0390 },
2479++ { 0x07b7, 0x03cc },
2480++ { 0x07b8, 0x03cd },
2481++ { 0x07b9, 0x03cb },
2482++ { 0x07ba, 0x03b0 },
2483++ { 0x07bb, 0x03ce },
2484++ { 0x07c1, 0x0391 },
2485++ { 0x07c2, 0x0392 },
2486++ { 0x07c3, 0x0393 },
2487++ { 0x07c4, 0x0394 },
2488++ { 0x07c5, 0x0395 },
2489++ { 0x07c6, 0x0396 },
2490++ { 0x07c7, 0x0397 },
2491++ { 0x07c8, 0x0398 },
2492++ { 0x07c9, 0x0399 },
2493++ { 0x07ca, 0x039a },
2494++ { 0x07cb, 0x039b },
2495++ { 0x07cc, 0x039c },
2496++ { 0x07cd, 0x039d },
2497++ { 0x07ce, 0x039e },
2498++ { 0x07cf, 0x039f },
2499++ { 0x07d0, 0x03a0 },
2500++ { 0x07d1, 0x03a1 },
2501++ { 0x07d2, 0x03a3 },
2502++ { 0x07d4, 0x03a4 },
2503++ { 0x07d5, 0x03a5 },
2504++ { 0x07d6, 0x03a6 },
2505++ { 0x07d7, 0x03a7 },
2506++ { 0x07d8, 0x03a8 },
2507++ { 0x07d9, 0x03a9 },
2508++ { 0x07e1, 0x03b1 },
2509++ { 0x07e2, 0x03b2 },
2510++ { 0x07e3, 0x03b3 },
2511++ { 0x07e4, 0x03b4 },
2512++ { 0x07e5, 0x03b5 },
2513++ { 0x07e6, 0x03b6 },
2514++ { 0x07e7, 0x03b7 },
2515++ { 0x07e8, 0x03b8 },
2516++ { 0x07e9, 0x03b9 },
2517++ { 0x07ea, 0x03ba },
2518++ { 0x07eb, 0x03bb },
2519++ { 0x07ec, 0x03bc },
2520++ { 0x07ed, 0x03bd },
2521++ { 0x07ee, 0x03be },
2522++ { 0x07ef, 0x03bf },
2523++ { 0x07f0, 0x03c0 },
2524++ { 0x07f1, 0x03c1 },
2525++ { 0x07f2, 0x03c3 },
2526++ { 0x07f3, 0x03c2 },
2527++ { 0x07f4, 0x03c4 },
2528++ { 0x07f5, 0x03c5 },
2529++ { 0x07f6, 0x03c6 },
2530++ { 0x07f7, 0x03c7 },
2531++ { 0x07f8, 0x03c8 },
2532++ { 0x07f9, 0x03c9 },
2533++ { 0x08a1, 0x23b7 },
2534++ { 0x08a2, 0x250c },
2535++ { 0x08a3, 0x2500 },
2536++ { 0x08a4, 0x2320 },
2537++ { 0x08a5, 0x2321 },
2538++ { 0x08a6, 0x2502 },
2539++ { 0x08a7, 0x23a1 },
2540++ { 0x08a8, 0x23a3 },
2541++ { 0x08a9, 0x23a4 },
2542++ { 0x08aa, 0x23a6 },
2543++ { 0x08ab, 0x239b },
2544++ { 0x08ac, 0x239d },
2545++ { 0x08ad, 0x239e },
2546++ { 0x08ae, 0x23a0 },
2547++ { 0x08af, 0x23a8 },
2548++ { 0x08b0, 0x23ac },
2549++ { 0x08bc, 0x2264 },
2550++ { 0x08bd, 0x2260 },
2551++ { 0x08be, 0x2265 },
2552++ { 0x08bf, 0x222b },
2553++ { 0x08c0, 0x2234 },
2554++ { 0x08c1, 0x221d },
2555++ { 0x08c2, 0x221e },
2556++ { 0x08c5, 0x2207 },
2557++ { 0x08c8, 0x223c },
2558++ { 0x08c9, 0x2243 },
2559++ { 0x08cd, 0x21d4 },
2560++ { 0x08ce, 0x21d2 },
2561++ { 0x08cf, 0x2261 },
2562++ { 0x08d6, 0x221a },
2563++ { 0x08da, 0x2282 },
2564++ { 0x08db, 0x2283 },
2565++ { 0x08dc, 0x2229 },
2566++ { 0x08dd, 0x222a },
2567++ { 0x08de, 0x2227 },
2568++ { 0x08df, 0x2228 },
2569++ { 0x08ef, 0x2202 },
2570++ { 0x08f6, 0x0192 },
2571++ { 0x08fb, 0x2190 },
2572++ { 0x08fc, 0x2191 },
2573++ { 0x08fd, 0x2192 },
2574++ { 0x08fe, 0x2193 },
2575++ { 0x09e0, 0x25c6 },
2576++ { 0x09e1, 0x2592 },
2577++ { 0x09e2, 0x2409 },
2578++ { 0x09e3, 0x240c },
2579++ { 0x09e4, 0x240d },
2580++ { 0x09e5, 0x240a },
2581++ { 0x09e8, 0x2424 },
2582++ { 0x09e9, 0x240b },
2583++ { 0x09ea, 0x2518 },
2584++ { 0x09eb, 0x2510 },
2585++ { 0x09ec, 0x250c },
2586++ { 0x09ed, 0x2514 },
2587++ { 0x09ee, 0x253c },
2588++ { 0x09ef, 0x23ba },
2589++ { 0x09f0, 0x23bb },
2590++ { 0x09f1, 0x2500 },
2591++ { 0x09f2, 0x23bc },
2592++ { 0x09f3, 0x23bd },
2593++ { 0x09f4, 0x251c },
2594++ { 0x09f5, 0x2524 },
2595++ { 0x09f6, 0x2534 },
2596++ { 0x09f7, 0x252c },
2597++ { 0x09f8, 0x2502 },
2598++ { 0x0aa1, 0x2003 },
2599++ { 0x0aa2, 0x2002 },
2600++ { 0x0aa3, 0x2004 },
2601++ { 0x0aa4, 0x2005 },
2602++ { 0x0aa5, 0x2007 },
2603++ { 0x0aa6, 0x2008 },
2604++ { 0x0aa7, 0x2009 },
2605++ { 0x0aa8, 0x200a },
2606++ { 0x0aa9, 0x2014 },
2607++ { 0x0aaa, 0x2013 },
2608++ { 0x0aae, 0x2026 },
2609++ { 0x0aaf, 0x2025 },
2610++ { 0x0ab0, 0x2153 },
2611++ { 0x0ab1, 0x2154 },
2612++ { 0x0ab2, 0x2155 },
2613++ { 0x0ab3, 0x2156 },
2614++ { 0x0ab4, 0x2157 },
2615++ { 0x0ab5, 0x2158 },
2616++ { 0x0ab6, 0x2159 },
2617++ { 0x0ab7, 0x215a },
2618++ { 0x0ab8, 0x2105 },
2619++ { 0x0abb, 0x2012 },
2620++ { 0x0abc, 0x2329 },
2621++ { 0x0abe, 0x232a },
2622++ { 0x0ac3, 0x215b },
2623++ { 0x0ac4, 0x215c },
2624++ { 0x0ac5, 0x215d },
2625++ { 0x0ac6, 0x215e },
2626++ { 0x0ac9, 0x2122 },
2627++ { 0x0aca, 0x2613 },
2628++ { 0x0acc, 0x25c1 },
2629++ { 0x0acd, 0x25b7 },
2630++ { 0x0ace, 0x25cb },
2631++ { 0x0acf, 0x25af },
2632++ { 0x0ad0, 0x2018 },
2633++ { 0x0ad1, 0x2019 },
2634++ { 0x0ad2, 0x201c },
2635++ { 0x0ad3, 0x201d },
2636++ { 0x0ad4, 0x211e },
2637++ { 0x0ad6, 0x2032 },
2638++ { 0x0ad7, 0x2033 },
2639++ { 0x0ad9, 0x271d },
2640++ { 0x0adb, 0x25ac },
2641++ { 0x0adc, 0x25c0 },
2642++ { 0x0add, 0x25b6 },
2643++ { 0x0ade, 0x25cf },
2644++ { 0x0adf, 0x25ae },
2645++ { 0x0ae0, 0x25e6 },
2646++ { 0x0ae1, 0x25ab },
2647++ { 0x0ae2, 0x25ad },
2648++ { 0x0ae3, 0x25b3 },
2649++ { 0x0ae4, 0x25bd },
2650++ { 0x0ae5, 0x2606 },
2651++ { 0x0ae6, 0x2022 },
2652++ { 0x0ae7, 0x25aa },
2653++ { 0x0ae8, 0x25b2 },
2654++ { 0x0ae9, 0x25bc },
2655++ { 0x0aea, 0x261c },
2656++ { 0x0aeb, 0x261e },
2657++ { 0x0aec, 0x2663 },
2658++ { 0x0aed, 0x2666 },
2659++ { 0x0aee, 0x2665 },
2660++ { 0x0af0, 0x2720 },
2661++ { 0x0af1, 0x2020 },
2662++ { 0x0af2, 0x2021 },
2663++ { 0x0af3, 0x2713 },
2664++ { 0x0af4, 0x2717 },
2665++ { 0x0af5, 0x266f },
2666++ { 0x0af6, 0x266d },
2667++ { 0x0af7, 0x2642 },
2668++ { 0x0af8, 0x2640 },
2669++ { 0x0af9, 0x260e },
2670++ { 0x0afa, 0x2315 },
2671++ { 0x0afb, 0x2117 },
2672++ { 0x0afc, 0x2038 },
2673++ { 0x0afd, 0x201a },
2674++ { 0x0afe, 0x201e },
2675++ { 0x0ba3, 0x003c },
2676++ { 0x0ba6, 0x003e },
2677++ { 0x0ba8, 0x2228 },
2678++ { 0x0ba9, 0x2227 },
2679++ { 0x0bc0, 0x00af },
2680++ { 0x0bc2, 0x22a5 },
2681++ { 0x0bc3, 0x2229 },
2682++ { 0x0bc4, 0x230a },
2683++ { 0x0bc6, 0x005f },
2684++ { 0x0bca, 0x2218 },
2685++ { 0x0bcc, 0x2395 },
2686++ { 0x0bce, 0x22a4 },
2687++ { 0x0bcf, 0x25cb },
2688++ { 0x0bd3, 0x2308 },
2689++ { 0x0bd6, 0x222a },
2690++ { 0x0bd8, 0x2283 },
2691++ { 0x0bda, 0x2282 },
2692++ { 0x0bdc, 0x22a2 },
2693++ { 0x0bfc, 0x22a3 },
2694++ { 0x0cdf, 0x2017 },
2695++ { 0x0ce0, 0x05d0 },
2696++ { 0x0ce1, 0x05d1 },
2697++ { 0x0ce2, 0x05d2 },
2698++ { 0x0ce3, 0x05d3 },
2699++ { 0x0ce4, 0x05d4 },
2700++ { 0x0ce5, 0x05d5 },
2701++ { 0x0ce6, 0x05d6 },
2702++ { 0x0ce7, 0x05d7 },
2703++ { 0x0ce8, 0x05d8 },
2704++ { 0x0ce9, 0x05d9 },
2705++ { 0x0cea, 0x05da },
2706++ { 0x0ceb, 0x05db },
2707++ { 0x0cec, 0x05dc },
2708++ { 0x0ced, 0x05dd },
2709++ { 0x0cee, 0x05de },
2710++ { 0x0cef, 0x05df },
2711++ { 0x0cf0, 0x05e0 },
2712++ { 0x0cf1, 0x05e1 },
2713++ { 0x0cf2, 0x05e2 },
2714++ { 0x0cf3, 0x05e3 },
2715++ { 0x0cf4, 0x05e4 },
2716++ { 0x0cf5, 0x05e5 },
2717++ { 0x0cf6, 0x05e6 },
2718++ { 0x0cf7, 0x05e7 },
2719++ { 0x0cf8, 0x05e8 },
2720++ { 0x0cf9, 0x05e9 },
2721++ { 0x0cfa, 0x05ea },
2722++ { 0x0da1, 0x0e01 },
2723++ { 0x0da2, 0x0e02 },
2724++ { 0x0da3, 0x0e03 },
2725++ { 0x0da4, 0x0e04 },
2726++ { 0x0da5, 0x0e05 },
2727++ { 0x0da6, 0x0e06 },
2728++ { 0x0da7, 0x0e07 },
2729++ { 0x0da8, 0x0e08 },
2730++ { 0x0da9, 0x0e09 },
2731++ { 0x0daa, 0x0e0a },
2732++ { 0x0dab, 0x0e0b },
2733++ { 0x0dac, 0x0e0c },
2734++ { 0x0dad, 0x0e0d },
2735++ { 0x0dae, 0x0e0e },
2736++ { 0x0daf, 0x0e0f },
2737++ { 0x0db0, 0x0e10 },
2738++ { 0x0db1, 0x0e11 },
2739++ { 0x0db2, 0x0e12 },
2740++ { 0x0db3, 0x0e13 },
2741++ { 0x0db4, 0x0e14 },
2742++ { 0x0db5, 0x0e15 },
2743++ { 0x0db6, 0x0e16 },
2744++ { 0x0db7, 0x0e17 },
2745++ { 0x0db8, 0x0e18 },
2746++ { 0x0db9, 0x0e19 },
2747++ { 0x0dba, 0x0e1a },
2748++ { 0x0dbb, 0x0e1b },
2749++ { 0x0dbc, 0x0e1c },
2750++ { 0x0dbd, 0x0e1d },
2751++ { 0x0dbe, 0x0e1e },
2752++ { 0x0dbf, 0x0e1f },
2753++ { 0x0dc0, 0x0e20 },
2754++ { 0x0dc1, 0x0e21 },
2755++ { 0x0dc2, 0x0e22 },
2756++ { 0x0dc3, 0x0e23 },
2757++ { 0x0dc4, 0x0e24 },
2758++ { 0x0dc5, 0x0e25 },
2759++ { 0x0dc6, 0x0e26 },
2760++ { 0x0dc7, 0x0e27 },
2761++ { 0x0dc8, 0x0e28 },
2762++ { 0x0dc9, 0x0e29 },
2763++ { 0x0dca, 0x0e2a },
2764++ { 0x0dcb, 0x0e2b },
2765++ { 0x0dcc, 0x0e2c },
2766++ { 0x0dcd, 0x0e2d },
2767++ { 0x0dce, 0x0e2e },
2768++ { 0x0dcf, 0x0e2f },
2769++ { 0x0dd0, 0x0e30 },
2770++ { 0x0dd1, 0x0e31 },
2771++ { 0x0dd2, 0x0e32 },
2772++ { 0x0dd3, 0x0e33 },
2773++ { 0x0dd4, 0x0e34 },
2774++ { 0x0dd5, 0x0e35 },
2775++ { 0x0dd6, 0x0e36 },
2776++ { 0x0dd7, 0x0e37 },
2777++ { 0x0dd8, 0x0e38 },
2778++ { 0x0dd9, 0x0e39 },
2779++ { 0x0dda, 0x0e3a },
2780++ { 0x0ddf, 0x0e3f },
2781++ { 0x0de0, 0x0e40 },
2782++ { 0x0de1, 0x0e41 },
2783++ { 0x0de2, 0x0e42 },
2784++ { 0x0de3, 0x0e43 },
2785++ { 0x0de4, 0x0e44 },
2786++ { 0x0de5, 0x0e45 },
2787++ { 0x0de6, 0x0e46 },
2788++ { 0x0de7, 0x0e47 },
2789++ { 0x0de8, 0x0e48 },
2790++ { 0x0de9, 0x0e49 },
2791++ { 0x0dea, 0x0e4a },
2792++ { 0x0deb, 0x0e4b },
2793++ { 0x0dec, 0x0e4c },
2794++ { 0x0ded, 0x0e4d },
2795++ { 0x0df0, 0x0e50 },
2796++ { 0x0df1, 0x0e51 },
2797++ { 0x0df2, 0x0e52 },
2798++ { 0x0df3, 0x0e53 },
2799++ { 0x0df4, 0x0e54 },
2800++ { 0x0df5, 0x0e55 },
2801++ { 0x0df6, 0x0e56 },
2802++ { 0x0df7, 0x0e57 },
2803++ { 0x0df8, 0x0e58 },
2804++ { 0x0df9, 0x0e59 },
2805++ { 0x0ea1, 0x3131 },
2806++ { 0x0ea2, 0x3132 },
2807++ { 0x0ea3, 0x3133 },
2808++ { 0x0ea4, 0x3134 },
2809++ { 0x0ea5, 0x3135 },
2810++ { 0x0ea6, 0x3136 },
2811++ { 0x0ea7, 0x3137 },
2812++ { 0x0ea8, 0x3138 },
2813++ { 0x0ea9, 0x3139 },
2814++ { 0x0eaa, 0x313a },
2815++ { 0x0eab, 0x313b },
2816++ { 0x0eac, 0x313c },
2817++ { 0x0ead, 0x313d },
2818++ { 0x0eae, 0x313e },
2819++ { 0x0eaf, 0x313f },
2820++ { 0x0eb0, 0x3140 },
2821++ { 0x0eb1, 0x3141 },
2822++ { 0x0eb2, 0x3142 },
2823++ { 0x0eb3, 0x3143 },
2824++ { 0x0eb4, 0x3144 },
2825++ { 0x0eb5, 0x3145 },
2826++ { 0x0eb6, 0x3146 },
2827++ { 0x0eb7, 0x3147 },
2828++ { 0x0eb8, 0x3148 },
2829++ { 0x0eb9, 0x3149 },
2830++ { 0x0eba, 0x314a },
2831++ { 0x0ebb, 0x314b },
2832++ { 0x0ebc, 0x314c },
2833++ { 0x0ebd, 0x314d },
2834++ { 0x0ebe, 0x314e },
2835++ { 0x0ebf, 0x314f },
2836++ { 0x0ec0, 0x3150 },
2837++ { 0x0ec1, 0x3151 },
2838++ { 0x0ec2, 0x3152 },
2839++ { 0x0ec3, 0x3153 },
2840++ { 0x0ec4, 0x3154 },
2841++ { 0x0ec5, 0x3155 },
2842++ { 0x0ec6, 0x3156 },
2843++ { 0x0ec7, 0x3157 },
2844++ { 0x0ec8, 0x3158 },
2845++ { 0x0ec9, 0x3159 },
2846++ { 0x0eca, 0x315a },
2847++ { 0x0ecb, 0x315b },
2848++ { 0x0ecc, 0x315c },
2849++ { 0x0ecd, 0x315d },
2850++ { 0x0ece, 0x315e },
2851++ { 0x0ecf, 0x315f },
2852++ { 0x0ed0, 0x3160 },
2853++ { 0x0ed1, 0x3161 },
2854++ { 0x0ed2, 0x3162 },
2855++ { 0x0ed3, 0x3163 },
2856++ { 0x0ed4, 0x11a8 },
2857++ { 0x0ed5, 0x11a9 },
2858++ { 0x0ed6, 0x11aa },
2859++ { 0x0ed7, 0x11ab },
2860++ { 0x0ed8, 0x11ac },
2861++ { 0x0ed9, 0x11ad },
2862++ { 0x0eda, 0x11ae },
2863++ { 0x0edb, 0x11af },
2864++ { 0x0edc, 0x11b0 },
2865++ { 0x0edd, 0x11b1 },
2866++ { 0x0ede, 0x11b2 },
2867++ { 0x0edf, 0x11b3 },
2868++ { 0x0ee0, 0x11b4 },
2869++ { 0x0ee1, 0x11b5 },
2870++ { 0x0ee2, 0x11b6 },
2871++ { 0x0ee3, 0x11b7 },
2872++ { 0x0ee4, 0x11b8 },
2873++ { 0x0ee5, 0x11b9 },
2874++ { 0x0ee6, 0x11ba },
2875++ { 0x0ee7, 0x11bb },
2876++ { 0x0ee8, 0x11bc },
2877++ { 0x0ee9, 0x11bd },
2878++ { 0x0eea, 0x11be },
2879++ { 0x0eeb, 0x11bf },
2880++ { 0x0eec, 0x11c0 },
2881++ { 0x0eed, 0x11c1 },
2882++ { 0x0eee, 0x11c2 },
2883++ { 0x0eef, 0x316d },
2884++ { 0x0ef0, 0x3171 },
2885++ { 0x0ef1, 0x3178 },
2886++ { 0x0ef2, 0x317f },
2887++ { 0x0ef3, 0x3181 },
2888++ { 0x0ef4, 0x3184 },
2889++ { 0x0ef5, 0x3186 },
2890++ { 0x0ef6, 0x318d },
2891++ { 0x0ef7, 0x318e },
2892++ { 0x0ef8, 0x11eb },
2893++ { 0x0ef9, 0x11f0 },
2894++ { 0x0efa, 0x11f9 },
2895++ { 0x0eff, 0x20a9 },
2896++#if 0
2897++ /* FIXME: there is no keysym 0x13a4? But 0x20ac is EuroSign in both
2898++ keysym and Unicode */
2899++ { 0x13a4, 0x20ac },
2900++#endif
2901++ { 0x13bc, 0x0152 },
2902++ { 0x13bd, 0x0153 },
2903++ { 0x13be, 0x0178 },
2904++ { 0x20ac, 0x20ac },
2905++
2906++ /* Special function keys. */
2907++
2908++ { 0xff08, 0x0008 }, /* XK_BackSpace */
2909++ { 0xff09, 0x0009 }, /* XK_Tab */
2910++ { 0xff0a, 0x000a }, /* XK_Linefeed */
2911++ { 0xff0d, 0x000d }, /* XK_Return */
2912++ { 0xff13, 0x0013 }, /* XK_Pause */
2913++ { 0xff1b, 0x001b }, /* XK_Escape */
2914++ { 0xff50, 0x0001 }, /* XK_Home */
2915++ { 0xff51, 0x001c }, /* XK_Left */
2916++ { 0xff52, 0x001e }, /* XK_Up */
2917++ { 0xff53, 0x001d }, /* XK_Right */
2918++ { 0xff54, 0x001f }, /* XK_Down */
2919++ { 0xff55, 0x000b }, /* XK_Prior */
2920++ { 0xff56, 0x000c }, /* XK_Next */
2921++ { 0xff57, 0x0004 }, /* XK_End */
2922++ { 0xff6a, 0x0005 }, /* XK_Help */
2923++ { 0xffff, 0x007f }, /* XK_Delete */
2924++};
2925++
2926++long keysym2ucs(int keysym)
2927++{
2928++ int min = 0;
2929++ int max = sizeof(keysymtab) / sizeof(struct codepair) - 1;
2930++ int mid;
2931++
2932++ /* first check for Latin-1 characters (1:1 mapping) */
2933++ if ((keysym >= 0x0020 && keysym <= 0x007e) ||
2934++ (keysym >= 0x00a0 && keysym <= 0x00ff))
2935++ return keysym;
2936++
2937++ /* also check for directly encoded 24-bit UCS characters */
2938++ if ((keysym & 0xff000000) == 0x01000000)
2939++ return keysym & 0x00ffffff;
2940++
2941++ /* binary search in table */
2942++ while (max >= min) {
2943++ mid = (min + max) / 2;
2944++ if (keysymtab[mid].keysym < keysym)
2945++ min = mid + 1;
2946++ else if (keysymtab[mid].keysym > keysym)
2947++ max = mid - 1;
2948++ else {
2949++ /* found it */
2950++ return keysymtab[mid].ucs;
2951++ }
2952++ }
2953++
2954++ /* no matching Unicode value found */
2955++ return -1;
2956++}
2957++
2958++static int reverse_compare (const void *a, const void *b)
2959++{
2960++ const struct codepair *ca = a, *cb = b;
2961++
2962++ return ca->ucs - cb->ucs;
2963++}
2964++
2965++int ucs2keysym(long ucs)
2966++{
2967++ static struct codepair *reverse_keysymtab;
2968++
2969++ int min = 0;
2970++ int max = sizeof(keysymtab) / sizeof(struct codepair) - 1;
2971++ int mid;
2972++
2973++ if (reverse_keysymtab == NULL)
2974++ {
2975++ reverse_keysymtab = malloc (sizeof (keysymtab));
2976++ memcpy (reverse_keysymtab, keysymtab, sizeof (keysymtab));
2977++
2978++ qsort (reverse_keysymtab,
2979++ sizeof (keysymtab) / sizeof (struct codepair),
2980++ sizeof (struct codepair),
2981++ reverse_compare);
2982++ }
2983++
2984++ /* first check for Latin-1 characters (1:1 mapping) */
2985++ if ((ucs >= 0x0020 && ucs <= 0x007e) ||
2986++ (ucs >= 0x00a0 && ucs <= 0x00ff))
2987++ return ucs;
2988++
2989++ /* binary search in table */
2990++ while (max >= min) {
2991++ mid = (min + max) / 2;
2992++ if (reverse_keysymtab[mid].ucs < ucs)
2993++ min = mid + 1;
2994++ else if (reverse_keysymtab[mid].ucs > ucs)
2995++ max = mid - 1;
2996++ else {
2997++ /* found it */
2998++ return reverse_keysymtab[mid].keysym;
2999++ }
3000++ }
3001++
3002++ /* finally, assume a directly encoded 24-bit UCS character */
3003++ return ucs | 0x01000000;
3004++}
3005++#endif
3006+--- wine-1.0-rc4/dlls/wineosxime.drv/keysym2ucs.h 1970-01-01 09:00:00.000000000 +0900
3007++++ wine/dlls/wineosxime.drv/keysym2ucs.h 2008-06-07 01:12:15.000000000 +0900
3008+@@ -0,0 +1,41 @@
3009++/* $XFree86: $
3010++ *
3011++ * IMPORTANT NOTE: If you modify this file you MUST modify the corresponding
3012++ * copy of this file located in the x11 build tree
3013++ *
3014++ *
3015++ * This module converts keysym values into the corresponding ISO 10646
3016++ * (UCS, Unicode) values.
3017++ *
3018++ * The array keysymtab[] contains pairs of X11 keysym values for graphical
3019++ * characters and the corresponding Unicode value. The function
3020++ * keysym2ucs() maps a keysym onto a Unicode value using a binary search,
3021++ * therefore keysymtab[] must remain SORTED by keysym value.
3022++ *
3023++ * The keysym -> UTF-8 conversion will hopefully one day be provided
3024++ * by Xlib via XmbLookupString() and should ideally not have to be
3025++ * done in X applications. But we are not there yet.
3026++ *
3027++ * We allow to represent any UCS character in the range U-00000000 to
3028++ * U-00FFFFFF by a keysym value in the range 0x01000000 to 0x01ffffff.
3029++ * This admittedly does not cover the entire 31-bit space of UCS, but
3030++ * it does cover all of the characters up to U-10FFFF, which can be
3031++ * represented by UTF-16, and more, and it is very unlikely that higher
3032++ * UCS codes will ever be assigned by ISO. So to get Unicode character
3033++ * U+ABCD you can directly use keysym 0x0100abcd.
3034++ *
3035++ * Author: Markus G. Kuhn <mkuhn@acm.org>, University of Cambridge, April 2001
3036++ *
3037++ * Special thanks to Richard Verhoeven <river@win.tue.nl> for preparing
3038++ * an initial draft of the mapping table.
3039++ *
3040++ * This software is in the public domain. Share and enjoy!
3041++ */
3042++
3043++#ifndef KEYSYM2UCS_H
3044++#define KEYSYM2UCS_H 1
3045++
3046++extern long keysym2ucs(int keysym);
3047++extern int ucs2keysym(long ucs);
3048++
3049++#endif /* KEYSYM2UCS_H */
3050+--- wine-1.0-rc4/dlls/wineosxime.drv/mactext.c 1970-01-01 09:00:00.000000000 +0900
3051++++ wine/dlls/wineosxime.drv/mactext.c 2008-06-07 01:12:15.000000000 +0900
3052+@@ -0,0 +1,1243 @@
3053++/*
3054++ * Functions for Mac Input methods using Carbon
3055++ *
3056++ * Copyright 2006 CodeWeavers, Aric Stewart
3057++ *
3058++ * This library is free software; you can redistribute it and/or
3059++ * modify it under the terms of the GNU Lesser General Public
3060++ * License as published by the Free Software Foundation; either
3061++ * version 2.1 of the License, or (at your option) any later version.
3062++ *
3063++ * This library is distributed in the hope that it will be useful,
3064++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3065++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3066++ * Lesser General Public License for more details.
3067++ *
3068++ * You should have received a copy of the GNU Lesser General Public
3069++ * License along with this library; if not, write to the Free Software
3070++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
3071++ *
3072++ * Much of this code based off of Kinput2.
3073++ *
3074++ * Copyright (c) 1990 Software Research Associates, Inc.
3075++ *
3076++ * Permission to use, copy, modify, and distribute this software and its
3077++ * documentation for any purpose and without fee is hereby granted, provided
3078++ * that the above copyright notice appear in all copies and that both that
3079++ * copyright notice and this permission notice appear in supporting
3080++ * documentation, and that the name of Software Research Associates not be
3081++ * used in advertising or publicity pertaining to distribution of the
3082++ * software without specific, written prior permission. Software Research
3083++ * Associates makes no representations about the suitability of this software
3084++ * for any purpose. It is provided "as is" without express or implied
3085++ * warranty.
3086++ *
3087++ * Author: Makoto Ishisone, Software Research Associates, Inc., Japan
3088++ *
3089++ */
3090++
3091++/*
3092++ * Copyright 1998 Takanori Sonoda.
3093++ *
3094++ * Author: Takanori Sonoda, Kyushu Univ. (tsonoda@gynob.med.kyushu-u.ac.jp)
3095++ */
3096++
3097++/*
3098++ * Copyright (c) 2004 kenichi kikuchi
3099++ * Author: kenichi kikuchi
3100++ */
3101++
3102++#ifdef __APPLE__
3103++
3104++#include "wine/debug.h"
3105++#include <Carbon/Carbon.h>
3106++#include <dlfcn.h>
3107++#include "IMKClient.h"
3108++
3109++WINE_DEFAULT_DEBUG_CHANNEL(mac_xim);
3110++
3111++#define kUniCharReverseSolidus 0x005c
3112++#define kUniCharTilde 0x007e
3113++#define kUniCharYenSign 0x00a5
3114++#define kUniCharOverline 0x203e
3115++#define kCandWindWidth (127 + 11 + 80 + 11)
3116++#define kMenuBarHeight 22
3117++
3118++enum {TYPE_COMPONENT,TYPE_SERVER};
3119++enum {STATE_NOT_ACTIVATED,STATE_ACTIVATED};
3120++
3121++typedef struct{
3122++ int type;
3123++ union {
3124++ CXIMKClientRef server;
3125++ ComponentInstance component;
3126++ } handle;
3127++ int state;
3128++ CFStringRef key;
3129++} MethodTarget;
3130++
3131++MethodTarget **AllMethods;
3132++
3133++typedef struct
3134++ {
3135++ char *text;
3136++ int textsize;
3137++ int textmax;
3138++
3139++ TextRange *hiliteRange;
3140++ int hilitesize;
3141++ int hilitemax;
3142++
3143++ int fixsize;
3144++ } myAERecord;
3145++
3146++typedef struct
3147++ {
3148++ int isLeopard;
3149++
3150++ /* basic objects */
3151++ EventTargetRef EventTarget;
3152++ TSMDocumentID docID;
3153++ MethodTarget *ts;
3154++
3155++ /* tracking Modes */
3156++ CFStringRef CurrentModeString;
3157++ CFStringRef OldModeString;
3158++ CFStringRef CurrentScript;
3159++ CFStringRef OldScript;
3160++
3161++ /* for event handling */
3162++ EventHandlerRef EventHandler;
3163++ WindowRef CandWind;
3164++ myAERecord AERecord;
3165++ } MacTSMInternals;
3166++
3167++typedef MacTSMInternals* TSMHandle;
3168++
3169++extern void IME_SetCompositionString(char* text, long textSize);
3170++extern void IME_NotifyComplete();
3171++
3172++static void UpdateCandWindow(TSMHandle internals);
3173++static void PumpEvents();
3174++
3175++void MyIMKClientUpdatedEdit(CXIMKClientRef inClient, CFStringRef inString,
3176++ long inReplacementRangeLocation, long inReplacementRangeLength,
3177++ void* data)
3178++{
3179++ TSMHandle internals = (TSMHandle)data;
3180++ CFIndex length = CFStringGetLength(inString);
3181++ UniChar *buffer = malloc(length * sizeof(UniChar));
3182++
3183++ if (internals->CandWind)
3184++ UpdateCandWindow(internals);
3185++
3186++ TRACE("Entered (Loc %li Len %li)\n",inReplacementRangeLocation,inReplacementRangeLength);
3187++
3188++ CFStringGetCharacters(inString, CFRangeMake(0, length), buffer);
3189++ IME_SetCompositionString((char*)buffer ,length * sizeof (UniChar));
3190++}
3191++
3192++void MyIMKClientCompletedText(CXIMKClientRef inClient, CFStringRef inString,
3193++ long inReplacementRangeLocation, long inReplacementRangeLength,
3194++ void *data)
3195++{
3196++ TSMHandle internals = (TSMHandle)data;
3197++ CFIndex length = CFStringGetLength(inString);
3198++ UniChar *buffer = malloc(length * sizeof(UniChar));
3199++
3200++ TRACE("ENTERED (Loc %li Len %li)\n",inReplacementRangeLocation,inReplacementRangeLength);
3201++ if (internals->CandWind)
3202++ UpdateCandWindow(internals);
3203++
3204++ CFStringGetCharacters(inString, CFRangeMake(0, length), buffer);
3205++ IME_SetCompositionString((char*)buffer, length * sizeof (UniChar));
3206++ IME_NotifyComplete();
3207++}
3208++
3209++void MyIMKClientModeChanged(CXIMKClientRef inClient, CFStringRef newmode, void* data)
3210++{
3211++ TSMHandle internals = (TSMHandle)data;
3212++
3213++ if (CFStringCompare(newmode, internals->CurrentModeString,0)
3214++ != kCFCompareEqualTo)
3215++ {
3216++ CFRelease(internals->CurrentModeString);
3217++ internals->CurrentModeString = CFStringCreateCopy(NULL,newmode);
3218++ }
3219++
3220++ PumpEvents();
3221++}
3222++
3223++ScriptLanguageRecord *GetScriptRecord(CFStringRef script)
3224++{
3225++ static ScriptLanguageRecord scriptLanguageTCh = { smTradChinese, langTradChinese};
3226++ static ScriptLanguageRecord scriptLanguageSCh = { smSimpChinese, langSimpChinese};
3227++ static ScriptLanguageRecord scriptLanguageKr = { smKorean, langKorean};
3228++ static ScriptLanguageRecord scriptLanguageJp = { smJapanese, langJapanese};
3229++ static ScriptLanguageRecord scriptLanguageVt = { smVietnamese, langVietnamese};
3230++ if (CFStringCompare(script, CFSTR("smJapanese"), 0)
3231++ == kCFCompareEqualTo)
3232++ return &scriptLanguageJp;
3233++ else if (CFStringCompare(script, CFSTR("smTradChinese"), 0)
3234++ == kCFCompareEqualTo)
3235++ return &scriptLanguageTCh;
3236++ else if (CFStringCompare(script, CFSTR("smTCIM"), 0)
3237++ == kCFCompareEqualTo)
3238++ return &scriptLanguageTCh;
3239++ else if (CFStringCompare(script, CFSTR("smSimpChinese"), 0)
3240++ == kCFCompareEqualTo)
3241++ return &scriptLanguageSCh;
3242++ else if (CFStringCompare(script, CFSTR("smSCIM"), 0)
3243++ == kCFCompareEqualTo)
3244++ return &scriptLanguageSCh;
3245++ else if (CFStringCompare(script, CFSTR("smKorean"), 0)
3246++ == kCFCompareEqualTo)
3247++ return &scriptLanguageKr;
3248++ else if (CFStringCompare(script, CFSTR("smVietnamese"), 0)
3249++ == kCFCompareEqualTo)
3250++ return &scriptLanguageVt;
3251++ else if (CFStringCompare(script, CFSTR("smVietnameseSimpleTelex"), 0)
3252++ == kCFCompareEqualTo)
3253++ return &scriptLanguageVt;
3254++
3255++ return NULL;
3256++}
3257++
3258++static CFStringRef GetServerConnection(CFStringRef bundleid)
3259++{
3260++ CFBundleRef bund;
3261++ bund = CFBundleGetBundleWithIdentifier(bundleid);
3262++ if (bund)
3263++ {
3264++ static CFStringRef name = NULL;
3265++
3266++ name = CFBundleGetValueForInfoDictionaryKey(bund,
3267++ CFSTR("InputMethodConnectionName"));
3268++
3269++ if (name)
3270++ {
3271++ if (TRACE_ON(mac_xim))
3272++ {
3273++ char ss[100];
3274++ CFStringGetCString(name,ss,100,kCFStringEncodingASCII);
3275++ TRACE("Server name is: %s\n", ss);
3276++ }
3277++ return name;
3278++ }
3279++
3280++ TRACE("Server name not found\n");
3281++ return CFSTR("none");
3282++ }
3283++
3284++ TRACE("Not an Application Bundle\n");
3285++ return CFSTR("none");
3286++}
3287++
3288++static MethodTarget* CreateNewMethodTarget( TSMHandle internals,
3289++ CFStringRef script,
3290++ CFStringRef bundleid)
3291++{
3292++ MethodTarget *tgt = NULL;
3293++ ScriptLanguageRecord *sl = NULL;
3294++ Component gComp = NULL;
3295++ OSStatus status;
3296++
3297++ sl = GetScriptRecord(script);
3298++ if (sl)
3299++ status = GetDefaultInputMethodOfClass(&gComp, sl, kKeyboardInputMethodClass);
3300++ else
3301++ status = -1;
3302++
3303++ if (status == noErr && gComp)
3304++ {
3305++ tgt = malloc(sizeof(MethodTarget));
3306++ tgt->type = TYPE_COMPONENT;
3307++ OpenTextService(internals->docID, gComp, &tgt->handle.component);
3308++ tgt->state = STATE_ACTIVATED;
3309++ if (bundleid)
3310++ tgt->key = CFStringCreateCopy(NULL,bundleid);
3311++ else
3312++ tgt->key = CFStringCreateCopy(NULL,script);
3313++ TRACE("Created New Component Instance \n");
3314++ }
3315++ else if (internals->isLeopard)
3316++ {
3317++ CXIMKClientRef server;
3318++ TRACE("Attempting Leopard Application Server\n");
3319++
3320++ server = CXIMKClientInitialize( GetServerConnection(bundleid) ,
3321++ &MyIMKClientUpdatedEdit, &MyIMKClientCompletedText,
3322++ &MyIMKClientModeChanged, internals);
3323++
3324++ if (server)
3325++ {
3326++ tgt = malloc(sizeof(MethodTarget));
3327++ tgt->type = TYPE_SERVER;
3328++ tgt->handle.server = server;
3329++ tgt->state = STATE_ACTIVATED;
3330++ if (bundleid)
3331++ tgt->key = CFStringCreateCopy(NULL,bundleid);
3332++ else
3333++ tgt->key = CFStringCreateCopy(NULL,script);
3334++ TRACE("Created New Application Server\n");
3335++ }
3336++ }
3337++
3338++ return tgt;
3339++}
3340++
3341++static MethodTarget* FindCreateMethodTarget(TSMHandle internals,
3342++ CFStringRef script,
3343++ CFStringRef bundleid)
3344++{
3345++ MethodTarget *ptr = (MethodTarget *)AllMethods;
3346++ int i = 0;
3347++ CFStringRef key;
3348++
3349++ if (bundleid)
3350++ key = bundleid;
3351++ else
3352++ key = script;
3353++
3354++ if (ptr != NULL)
3355++ {
3356++ ptr = AllMethods[0];
3357++ while (ptr != NULL)
3358++ {
3359++ if (CFStringCompare(key, ptr->key, 0)
3360++ == kCFCompareEqualTo)
3361++ break;
3362++ i++;
3363++ ptr = AllMethods[i];
3364++ }
3365++ }
3366++
3367++ if (ptr)
3368++ return ptr;
3369++
3370++ ptr = CreateNewMethodTarget(internals, script, bundleid);
3371++ if (!ptr)
3372++ return ptr;
3373++
3374++ if (!AllMethods)
3375++ {
3376++ AllMethods = malloc(sizeof(MethodTarget*) * 2);
3377++ AllMethods[0] = ptr;
3378++ AllMethods[1] = 0;
3379++ }
3380++ else
3381++ {
3382++ AllMethods = realloc(AllMethods,sizeof(MethodTarget*) * (i + 2));
3383++ AllMethods[i] = ptr;
3384++ AllMethods[i+1] = 0;
3385++ }
3386++
3387++ return ptr;
3388++}
3389++
3390++static OSErr OpenAppropriateService(TSMHandle internals,
3391++ CFStringRef script, CFStringRef bundleid)
3392++{
3393++ OSErr err = 1;
3394++
3395++ TRACE("\n");
3396++
3397++ if (internals->ts)
3398++ {
3399++ /* Shut down current service */
3400++ if (internals->ts->type == TYPE_COMPONENT)
3401++ {
3402++ DeactivateTextService(internals->ts->handle.component);
3403++ TerminateTextService(internals->ts->handle.component);
3404++ }
3405++ else
3406++ CXIMKClientDeactivate(internals->ts->handle.server);
3407++
3408++ internals->ts = NULL;
3409++ }
3410++
3411++ if (CFStringCompare(script, CFSTR("smRoman"), 0)
3412++ == kCFCompareEqualTo)
3413++ {
3414++ KeyScript(smKeyRoman);
3415++ err = noErr;
3416++ }
3417++ else
3418++ internals->ts = FindCreateMethodTarget(internals, script, bundleid);
3419++
3420++ if (internals->ts)
3421++ {
3422++ if (internals->ts->type == TYPE_COMPONENT)
3423++ {
3424++ err = InitiateTextService(internals->ts->handle.component);
3425++ if (err != noErr)
3426++ WARN("Failure to Initiate Text Service (%i)\n",err);
3427++ else
3428++ {
3429++ err = ActivateTextService(internals->ts->handle.component);
3430++ if (err != noErr)
3431++ {
3432++ TerminateTextService(internals->ts->handle.component);
3433++ WARN("Failure to Activate Text Service (%i)\n",err);
3434++ }
3435++ }
3436++
3437++ if (err != noErr)
3438++ internals->ts = NULL;
3439++ }
3440++ else
3441++ {
3442++ CXIMKClientActivate(internals->ts->handle.server);
3443++ }
3444++ }
3445++
3446++ return err;
3447++}
3448++
3449++static Boolean SetInputModeCFS(TSMHandle internals, CFStringRef mode)
3450++{
3451++ OSStatus status = noErr;
3452++
3453++ if (TRACE_ON(mac_xim))
3454++ {
3455++ char ss[100];
3456++ CFStringGetCString(mode,ss,100,kCFStringEncodingASCII);
3457++ TRACE("Attempting to set mode to: %s\n", ss);
3458++ }
3459++
3460++ if (!internals->ts)
3461++ return false;
3462++
3463++ if (internals->ts->type == TYPE_SERVER)
3464++ CXIMKClientSetInputMode(internals->ts->handle.server,mode);
3465++ else
3466++ status = SetTextServiceProperty(internals->ts->handle.component,
3467++ kTextServiceInputModePropertyTag, (SInt32)mode);
3468++
3469++ if (status != noErr)
3470++ {
3471++ ERR("can't set input mode (%ld)\n", status);
3472++ return false;
3473++ }
3474++
3475++ return true;
3476++}
3477++
3478++static Boolean GetTISInputModeCFS( CFStringRef *out_mode,
3479++ CFStringRef *out_bundle)
3480++{
3481++ void* src;
3482++ CFStringRef string;
3483++
3484++ typedef void *tTISCopyCurrentKeyboardInputSource();
3485++ typedef void *tTISGetInputSourceProperty ( void* inputSource, CFStringRef
3486++ propertyKey);
3487++
3488++ static CFStringRef *kTISPropertyInputModeID = NULL;
3489++ static CFStringRef *kTISPropertyBundleID = NULL;
3490++ static CFStringRef *kTISPropertyInputSourceType = NULL;
3491++ tTISCopyCurrentKeyboardInputSource *pTISCopyCurrentKeyboardInputSource = NULL;
3492++ tTISGetInputSourceProperty *pTISGetInputSourceProperty = NULL;
3493++
3494++ if (!kTISPropertyInputModeID || !pTISCopyCurrentKeyboardInputSource ||
3495++ !pTISGetInputSourceProperty || !kTISPropertyBundleID)
3496++ {
3497++ pTISCopyCurrentKeyboardInputSource = dlsym(RTLD_DEFAULT,"TISCopyCurrentKeyboardInputSource");
3498++ pTISGetInputSourceProperty = dlsym(RTLD_DEFAULT,"TISGetInputSourceProperty");
3499++ kTISPropertyInputModeID = dlsym(RTLD_DEFAULT,"kTISPropertyInputModeID");
3500++ kTISPropertyBundleID = dlsym(RTLD_DEFAULT,"kTISPropertyBundleID");
3501++ kTISPropertyInputSourceType= dlsym(RTLD_DEFAULT,"kTISPropertyInputSourceType");
3502++
3503++ if (!kTISPropertyInputModeID || !pTISCopyCurrentKeyboardInputSource ||
3504++ !pTISGetInputSourceProperty || !kTISPropertyBundleID)
3505++ {
3506++ TRACE("Unable to load functions\n");
3507++ return false;
3508++ }
3509++ }
3510++
3511++ PumpEvents();
3512++
3513++ src = pTISCopyCurrentKeyboardInputSource();
3514++ TRACE("src %p\n",src);
3515++
3516++ string = pTISGetInputSourceProperty(src,*kTISPropertyInputSourceType);
3517++ if (TRACE_ON(mac_xim) && string)
3518++ {
3519++ char ss[100];
3520++ CFStringGetCString(string,ss,100,kCFStringEncodingASCII);
3521++ TRACE("TIS type %s\n",ss);
3522++ }
3523++ if (CFStringCompare(string, CFSTR("TISTypeKeyboardInputMode"), 0)
3524++ != kCFCompareEqualTo)
3525++ {
3526++ TRACE("Not an Input mode\n");
3527++ return false;
3528++ }
3529++
3530++ string = pTISGetInputSourceProperty(src,*kTISPropertyInputModeID);
3531++ if (TRACE_ON(mac_xim) && string)
3532++ {
3533++ char ss[100];
3534++ CFStringGetCString(string,ss,100,kCFStringEncodingASCII);
3535++ TRACE("TIS mode %s\n",ss);
3536++ }
3537++ *out_mode = CFStringCreateCopy(NULL,string);
3538++
3539++ string = pTISGetInputSourceProperty(src,*kTISPropertyBundleID);
3540++ if (TRACE_ON(mac_xim) && string)
3541++ {
3542++ char ss[100];
3543++ CFStringGetCString(string,ss,100,kCFStringEncodingASCII);
3544++ TRACE("TIS bundleid %s\n",ss);
3545++ }
3546++ *out_bundle = CFStringCreateCopy(NULL,string);
3547++
3548++ return true;
3549++}
3550++
3551++static int GetLeopardInputModeCFS( CFStringRef *out_mode,
3552++ CFStringRef *out_script,
3553++ CFStringRef *out_bundle)
3554++{
3555++ CFStringRef script = NULL;
3556++ int rc = 0;
3557++
3558++ rc = GetTISInputModeCFS(out_mode,out_bundle);
3559++
3560++ if (rc)
3561++ {
3562++ char ss[100];
3563++ char *scr;
3564++ char *end;
3565++
3566++ CFStringGetCString(*out_mode,ss,100,kCFStringEncodingASCII);
3567++ TRACE("aqua default input mode: %s\n", ss);
3568++
3569++ /* Determine script */
3570++ scr = strstr(ss,"inputmethod");
3571++ if (scr)
3572++ {
3573++ scr += 12;
3574++ end = strchr(scr,'.');
3575++ if (end)
3576++ *end = 0;
3577++ *(scr-2) = 's';
3578++ *(scr-1) = 'm';
3579++ scr-=2;
3580++ TRACE("aqua default input script: %s\n", scr);
3581++ script = CFStringCreateWithCString(NULL,scr,kCFStringEncodingASCII);
3582++ *out_script = script;
3583++
3584++ /* check for roman input modes inside of IMEs */
3585++ if (CFStringCompare(script, CFSTR("smRoman"), 0)
3586++ == kCFCompareEqualTo)
3587++ {
3588++ TRACE("Found Roman\n");
3589++ rc = 0;
3590++ }
3591++ }
3592++ else
3593++ {
3594++ ERR("Strange Mode line!\n");
3595++ rc = 0;
3596++ *out_script = CFSTR("smRoman");
3597++ }
3598++ }
3599++
3600++ return rc;
3601++}
3602++
3603++static CFStringRef GetAquaDefaultInputModeCFS(CFStringRef theScript)
3604++{
3605++ CFDictionaryRef dict;
3606++ CFArrayRef array = NULL;
3607++ CFStringRef string = NULL;
3608++ CFStringRef mode = NULL;
3609++
3610++ CFPreferencesSynchronize(CFSTR("com.apple.HIToolbox"),
3611++ kCFPreferencesCurrentUser, kCFPreferencesCurrentHost);
3612++
3613++ dict = CFPreferencesCopyValue(CFSTR("AppleDefaultInputMode"),
3614++ CFSTR("com.apple.HIToolbox"),
3615++ kCFPreferencesCurrentUser, kCFPreferencesCurrentHost);
3616++ if (dict)
3617++ {
3618++ array = CFDictionaryGetValue(dict, theScript);
3619++ if (array)
3620++ {
3621++ string = CFArrayGetValueAtIndex(array, 0);
3622++ mode = CFStringCreateCopy(NULL,string);
3623++ }
3624++ CFRelease(dict);
3625++ }
3626++
3627++ if (mode && TRACE_ON(mac_xim))
3628++ {
3629++ char ss[100];
3630++ CFStringGetCString(mode,ss,100,kCFStringEncodingASCII);
3631++ TRACE("aqua default input mode: %s\n", ss);
3632++ }
3633++ return mode;
3634++}
3635++
3636++static long GetAquaInputModeCFS( CFStringRef *out_mode,
3637++ CFStringRef *out_script)
3638++{
3639++ CFStringRef string;
3640++ long inIME = 0;
3641++
3642++ CFPreferencesSynchronize(CFSTR("com.apple.HIToolbox"),
3643++ kCFPreferencesCurrentUser, kCFPreferencesCurrentHost);
3644++
3645++ string = CFPreferencesCopyValue(CFSTR("AppleKeyboardScript"),
3646++ CFSTR("com.apple.HIToolbox"),
3647++ kCFPreferencesCurrentUser, kCFPreferencesCurrentHost);
3648++ if (string)
3649++ {
3650++ if (TRACE_ON(mac_xim))
3651++ {
3652++ char ss[100];
3653++ CFStringGetCString(string,ss,100,kCFStringEncodingASCII);
3654++ TRACE("Aqua Script %s\n",ss);
3655++ }
3656++ if (CFStringCompare(string, CFSTR("smRoman"), 0) == kCFCompareEqualTo)
3657++ inIME = 0;
3658++ else
3659++ inIME = 1;
3660++
3661++ if (inIME)
3662++ *out_mode = GetAquaDefaultInputModeCFS(string);
3663++ else
3664++ *out_mode = CFStringCreateCopy(NULL, kTextServiceInputModeRoman);
3665++
3666++ *out_script = string;
3667++ }
3668++
3669++ return inIME;
3670++}
3671++
3672++Boolean MacTSMRevertToPreviousMode(TSMHandle internals)
3673++{
3674++ if (CFStringCompare(internals->OldScript, internals->CurrentScript, 0) !=
3675++ kCFCompareEqualTo)
3676++ {
3677++ CFStringRef temp = internals->CurrentScript;
3678++
3679++ if (TRACE_ON(mac_xim))
3680++ {
3681++ char ss[100],ss2[100];
3682++ CFStringGetCString(temp,ss,100,kCFStringEncodingASCII);
3683++ CFStringGetCString(internals->OldScript,ss2,100,kCFStringEncodingASCII);
3684++ TRACE("Switching from %s to %s\n",ss,ss2);
3685++ }
3686++
3687++ OpenAppropriateService(internals, internals->OldScript, NULL);
3688++
3689++ internals->CurrentScript = internals->OldScript;
3690++ internals->OldScript = temp;
3691++ }
3692++
3693++ if (CFStringCompare(internals->OldModeString,
3694++ internals->CurrentModeString,0) != kCFCompareEqualTo)
3695++ {
3696++ CFStringRef temp = internals->CurrentModeString;
3697++ SetInputModeCFS(internals,internals->OldModeString);
3698++ internals->CurrentModeString = internals->OldModeString;
3699++ internals->OldModeString = temp;
3700++ }
3701++
3702++ return true;
3703++}
3704++
3705++Boolean MacTSMCheckModeAndIME(TSMHandle internals)
3706++{
3707++ Boolean inIME;
3708++ CFStringRef mode = NULL;
3709++ CFStringRef script = NULL;
3710++ CFStringRef bundle = NULL;
3711++
3712++ TRACE("\n");
3713++
3714++ if (internals->isLeopard)
3715++ inIME = GetLeopardInputModeCFS(&mode, &script, &bundle);
3716++ else
3717++ inIME = GetAquaInputModeCFS(&mode, &script);
3718++
3719++ if (!mode || !script)
3720++ return false;
3721++
3722++ if (CFStringCompare(script, internals->CurrentScript, 0) !=
3723++ kCFCompareEqualTo)
3724++ {
3725++ OpenAppropriateService(internals, script, bundle);
3726++
3727++ CFRelease(internals->OldScript);
3728++ internals->OldScript = internals->CurrentScript;
3729++ internals->CurrentScript = script;
3730++ }
3731++ else
3732++ CFRelease(script);
3733++
3734++ if (mode)
3735++ {
3736++ if (CFStringCompare(mode, internals->CurrentModeString,0)
3737++ != kCFCompareEqualTo)
3738++ {
3739++ CFRelease(internals->OldModeString);
3740++ internals->OldModeString =
3741++ internals->CurrentModeString;
3742++ internals->CurrentModeString = mode;
3743++ SetInputModeCFS(internals, internals->CurrentModeString);
3744++ }
3745++ else
3746++ CFRelease(mode);
3747++ }
3748++
3749++ return inIME;
3750++}
3751++
3752++
3753++Boolean MacTSMEventCFS(TSMHandle internals, char theChar, unsigned long theCode,
3754++ unsigned long modifiers, unsigned long unichar)
3755++{
3756++ OSStatus status;
3757++ EventRef event = NULL;
3758++ Boolean result;
3759++ UInt32 Keyboard = LMGetKbdType();
3760++
3761++ TRACE("(%02x'%c':%02lx:%04lx)\n",
3762++ (unsigned char)theChar, isprint(theChar) ? theChar : '.',
3763++ (long)theCode, (long)modifiers);
3764++
3765++ if (!internals->ts)
3766++ return false;
3767++
3768++ status = CreateEvent(NULL, kEventClassKeyboard, kEventRawKeyDown, 0,
3769++ kEventAttributeUserEvent, &event);
3770++
3771++ if (status == noErr)
3772++ status = SetEventParameter(event, kEventParamKeyMacCharCodes,
3773++ typeChar, sizeof(char), &theChar);
3774++
3775++ if (status == noErr)
3776++ status = SetEventParameter(event, kEventParamKeyCode, typeUInt32,
3777++ sizeof(UInt32), &theCode);
3778++
3779++ if (status == noErr)
3780++ status = SetEventParameter(event, kEventParamKeyModifiers, typeUInt32,
3781++ sizeof(UInt32), &modifiers);
3782++
3783++ if (status == noErr)
3784++ status = SetEventParameter(event, kEventParamKeyboardType, typeUInt32,
3785++ sizeof(UInt32), &Keyboard);
3786++
3787++ if (status == noErr && unichar != 0xffffffff)
3788++ status = SetEventParameter(event, kEventParamKeyUnicodes,
3789++ typeUnicodeText, sizeof(UniChar), &unichar);
3790++
3791++
3792++ if (status == noErr)
3793++ {
3794++ if (internals->ts->type == TYPE_SERVER)
3795++ status = CXIMKClientSendEvent(internals->ts->handle.server,event);
3796++ else
3797++ status = TextServiceEventRef(internals->ts->handle.component,event);
3798++
3799++ TRACE("Handled? %li\n",status);
3800++ if (status > 0)
3801++ result = true;
3802++ else
3803++ result = false;
3804++ }
3805++ else
3806++ {
3807++ ERR("can't send key to tsm (%ld)\n", status);
3808++ result = false;
3809++ }
3810++
3811++ if (event)
3812++ ReleaseEvent(event);
3813++
3814++ if (result)
3815++ while (CFRunLoopRunInMode(kCFRunLoopDefaultMode,0.0001,true)
3816++ ==kCFRunLoopRunHandledSource);
3817++
3818++ return result;
3819++}
3820++
3821++TSMHandle MacInitTSMAwareApplication(void)
3822++{
3823++ TSMHandle internals;
3824++
3825++ internals = (TSMHandle)malloc(sizeof(MacTSMInternals));
3826++ memset(internals,0,sizeof(MacTSMInternals));
3827++
3828++ if (dlsym(RTLD_DEFAULT,"TISCopyInputSourceForLanguage"))
3829++ internals->isLeopard = 1;
3830++
3831++ internals->EventTarget = GetApplicationEventTarget();
3832++ memset(&(internals->AERecord),0,sizeof(myAERecord));
3833++
3834++ /* Initialize Modes */
3835++ internals->CurrentModeString = CFStringCreateCopy(NULL,
3836++ kTextServiceInputModeRoman);
3837++ internals->OldModeString = CFStringCreateCopy(NULL,
3838++ kTextServiceInputModeRoman);
3839++ internals->CurrentScript= CFStringCreateCopy(NULL,CFSTR("smRoman"));
3840++ internals->OldScript= CFStringCreateCopy(NULL,CFSTR("smRoman"));
3841++
3842++ InstallStandardEventHandler(GetApplicationEventTarget());
3843++
3844++ return internals;
3845++}
3846++
3847++void MacCloseTSMAwareApplication(TSMHandle internals)
3848++{
3849++ MethodTarget *ptr;
3850++ TRACE("\n");
3851++
3852++ CFRelease(internals->CurrentModeString);
3853++ CFRelease(internals->OldModeString);
3854++ CFRelease(internals->CurrentScript);
3855++ CFRelease(internals->OldScript);
3856++
3857++ /* clean out the myAERecord */
3858++ if (internals->AERecord.hiliteRange)
3859++ free(internals->AERecord.hiliteRange);
3860++ if (internals->AERecord.text)
3861++ free(internals->AERecord.text);
3862++
3863++ /* Cleanup all the servers and such */
3864++ if (AllMethods)
3865++ {
3866++ int i = 0;
3867++ ptr = AllMethods[0];
3868++ while (ptr)
3869++ {
3870++ if (ptr->type == TYPE_SERVER && ptr->state == STATE_ACTIVATED)
3871++ CXIMKClientCleanup(ptr->handle.server);
3872++ i++;
3873++ ptr = AllMethods[i];
3874++ }
3875++ }
3876++
3877++ free(internals);
3878++}
3879++
3880++
3881++OSErr MacNewTSMDocument(TSMHandle internals, long refcon)
3882++{
3883++ OSErr err = noErr;
3884++ InterfaceTypeList typeList;
3885++ TRACE("\n");
3886++
3887++ typeList[0] = kUnicodeDocumentInterfaceType;
3888++ err = NewTSMDocument(1, typeList, &(internals->docID), refcon);
3889++ TRACE("(%lx)\n", (long)(internals->docID));
3890++
3891++ if (err != noErr)
3892++ {
3893++ ERR("can't create tsm doc (%d)\n", err);
3894++ return err;
3895++ }
3896++ return noErr;
3897++}
3898++
3899++OSErr MacDeleteTSMDocument(TSMHandle internals)
3900++{
3901++ OSErr err = noErr;
3902++
3903++ TRACE("\n");
3904++
3905++ if (internals->ts && internals->ts->type == TYPE_COMPONENT)
3906++ {
3907++ DeactivateTextService(internals->ts->handle.component);
3908++ TerminateTextService(internals->ts->handle.component);
3909++ }
3910++
3911++ return err;
3912++}
3913++
3914++OSErr MacTSMFixTextService(TSMHandle internals)
3915++{
3916++ OSErr err = noErr;
3917++
3918++ if (!internals->ts)
3919++ return noErr;
3920++
3921++ if (internals->ts->type == TYPE_COMPONENT)
3922++ err = FixTextService(internals->ts->handle.component);
3923++ else
3924++ CXIMKClientForceComplete(internals->ts->handle.server);
3925++
3926++ return err;
3927++}
3928++
3929++OSErr MacActivateTSMDocument(TSMHandle internals)
3930++{
3931++ OSErr err = tsmComponentNoErr;
3932++ TRACE("Checking Active\n");
3933++
3934++ if (TSMGetActiveDocument() != internals->docID)
3935++ err = ActivateTSMDocument(internals->docID);
3936++
3937++ return err;
3938++}
3939++
3940++
3941++/**************************************
3942++ * Event Handler Logic
3943++ **************************************/
3944++static unsigned long getText(EventRef event,myAERecord *theRec)
3945++{
3946++ unsigned long ret;
3947++ char *theText = NULL;
3948++ OSStatus myErr;
3949++ EventParamType textType;
3950++
3951++ textType = typeUnicodeText;
3952++ myErr = GetEventParameter(event, kEventParamTextInputSendText, textType,
3953++ NULL, 0, &ret, NULL);
3954++ if (myErr != noErr)
3955++ ret = 0;
3956++ theRec->textsize = ret;
3957++
3958++ if (ret != 0)
3959++ {
3960++ if (ret >= theRec->textmax)
3961++ {
3962++ free(theRec->text);
3963++ theRec->text = (char *) malloc(sizeof(char) *
3964++ (theRec->textmax + 256));
3965++ theRec->textmax += 256;
3966++ }
3967++
3968++ theText = theRec->text;
3969++
3970++ myErr = GetEventParameter(event, kEventParamTextInputSendText, textType,
3971++ NULL, ret, NULL, theText);
3972++ if (myErr != noErr)
3973++ theRec->textsize = ret = 0;
3974++ *(theText + ret) = 0;
3975++
3976++ }
3977++ else if (theRec->text)
3978++ *(theRec->text) = 0;
3979++
3980++ if (TRACE_ON(mac_xim))
3981++ {
3982++ int i;
3983++
3984++ TRACE("text(%ld): ", ret);
3985++ for (i = 0; i < ret; i++)
3986++ {
3987++ MESSAGE("%02x", (unsigned char)*(theText + i));
3988++ MESSAGE("%s", (i % 2 == 0) ? "" : " ");
3989++ }
3990++ MESSAGE("\n");
3991++ }
3992++
3993++ return ret;
3994++}
3995++
3996++
3997++static void getTextRangeDesc(EventRef event, myAERecord *theRec)
3998++{
3999++ static TextRangeArray *theArray = NULL;
4000++ short ret;
4001++ int i;
4002++ TextRange *theRange;
4003++ OSStatus myErr;
4004++ Size actualSize;
4005++
4006++ myErr = GetEventParameter(event, kEventParamTextInputSendHiliteRng,
4007++ typeTextRangeArray, NULL, 0, (UInt32*)&actualSize, NULL);
4008++ if (myErr == noErr)
4009++ {
4010++ if (theArray == NULL)
4011++ theArray = (TextRangeArray *)NewPtr(actualSize);
4012++ else if (actualSize > GetPtrSize((Ptr)theArray))
4013++ {
4014++ DisposePtr((Ptr)theArray);
4015++ theArray = (TextRangeArray *)NewPtr(actualSize);
4016++ }
4017++
4018++ myErr = GetEventParameter(event, kEventParamTextInputSendHiliteRng,
4019++ typeTextRangeArray, NULL, actualSize, NULL, theArray);
4020++ if (myErr != noErr)
4021++ return;
4022++
4023++ if (TRACE_ON(mac_xim))
4024++ {
4025++ TRACE("hilite(%d): ", theArray->fNumOfRanges);
4026++ for (i = 0; i < theArray->fNumOfRanges; i++)
4027++ MESSAGE("%s(%ld-%ld:%d)", i == 0 ? "" : ", ",
4028++ theArray->fRange[i].fStart, theArray->fRange[i].fEnd,
4029++ theArray->fRange[i].fHiliteStyle);
4030++ MESSAGE("\n");
4031++ }
4032++
4033++ ret = theRec->hilitesize = theArray->fNumOfRanges;
4034++ if (ret == 0)
4035++ return;
4036++ }
4037++ else
4038++ {
4039++ if (theArray != NULL)
4040++ return;
4041++ myErr = GetEventParameter(event, kEventParamTextInputSendUpdateRng,
4042++ typeTextRangeArray, NULL, 0, (UInt32*)&actualSize, NULL);
4043++ if (myErr != noErr)
4044++ return;
4045++ theArray = (TextRangeArray *)NewPtr(actualSize);
4046++ myErr = GetEventParameter(event, kEventParamTextInputSendUpdateRng,
4047++ typeTextRangeArray, NULL, actualSize, NULL, theArray);
4048++ if (myErr != noErr)
4049++ return;
4050++ ret = theRec->hilitesize = theArray->fNumOfRanges;
4051++ if (ret != 2)
4052++ return;
4053++
4054++ if (TRACE_ON(mac_xim))
4055++ {
4056++ TRACE("update(%d): ", theRec->hilitesize);
4057++ for (i = 0; i < theRec->hilitesize; i++)
4058++ MESSAGE("%s(%ld-%ld)", i == 0 ? "" : ", ",
4059++ theArray->fRange[i].fStart, theArray->fRange[i].fEnd);
4060++ MESSAGE("\n");
4061++ }
4062++
4063++ theArray->fRange[0].fStart = theArray->fRange[1].fStart;
4064++ theArray->fRange[0].fEnd = theArray->fRange[1].fEnd;
4065++ theArray->fRange[0].fHiliteStyle = 4;
4066++ theArray->fRange[1].fStart = theArray->fRange[1].fEnd;
4067++ theArray->fRange[1].fHiliteStyle = 1;
4068++ }
4069++
4070++ if (ret > theRec->hilitemax)
4071++ {
4072++ free(theRec->hiliteRange);
4073++ theRec->hiliteRange = (TextRange *) malloc(sizeof(TextRange) * ret);
4074++ theRec->hilitemax = ret;
4075++ }
4076++
4077++ theRange = theRec->hiliteRange;
4078++ for (i = 0; i < ret; i++)
4079++ {
4080++ (theRange + i)->fStart = theArray->fRange[i].fStart;
4081++ (theRange + i)->fEnd = theArray->fRange[i].fEnd;
4082++ (theRange + i)->fHiliteStyle = theArray->fRange[i].fHiliteStyle;
4083++ }
4084++}
4085++
4086++static OSStatus UpAcInputArea(EventRef event, TSMHandle internals)
4087++{
4088++ OSStatus myErr;
4089++ long fixLength;
4090++ long textSize;
4091++ long refCon;
4092++ myAERecord *theRec;
4093++
4094++ theRec = &(internals->AERecord);
4095++
4096++ myErr = GetEventParameter(event, kEventParamTextInputSendRefCon,
4097++ typeLongInteger, NULL, sizeof(long), NULL, &refCon);
4098++
4099++ if (myErr == noErr)
4100++ {
4101++ textSize = getText(event,theRec);
4102++ TRACE("MacIM:AEUpdateEvent:textSize=%ld\n", textSize);
4103++ }
4104++
4105++ if (myErr != noErr)
4106++ {
4107++ return myErr;
4108++ }
4109++
4110++ myErr = GetEventParameter(event, kEventParamTextInputSendFixLen,
4111++ typeLongInteger, NULL, sizeof(long), NULL, &fixLength);
4112++ if (myErr == noErr)
4113++ {
4114++ theRec->fixsize = fixLength;
4115++ TRACE("HERE fix(%d)\n", theRec->fixsize);
4116++ }
4117++ else
4118++ return myErr;
4119++
4120++ if (textSize >= fixLength)
4121++ getTextRangeDesc(event,theRec);
4122++
4123++ if (textSize > 0)
4124++ {
4125++ IME_SetCompositionString(theRec->text,textSize);
4126++
4127++ if (theRec->fixsize == textSize)
4128++ IME_NotifyComplete();
4129++ }
4130++ else
4131++ IME_SetCompositionString(NULL,0);
4132++
4133++ return noErr;
4134++}
4135++
4136++/* Apple Event Off2Pos */
4137++static OSStatus Off2P(EventRef event)
4138++{
4139++ OSStatus myErr;
4140++ long refCon;
4141++ BitMap screenBits;
4142++ Point pos = { 0, 0 };
4143++
4144++ /* extern void getCurrTextPos(long, Point *); */
4145++
4146++ myErr = GetEventParameter(event, kEventParamTextInputSendRefCon,
4147++ typeLongInteger, NULL, sizeof(long), NULL, &refCon);
4148++
4149++/*
4150++ if (myErr == noErr)
4151++ getCurrTextPos(refCon, &pos);
4152++*/
4153++
4154++ if (pos.v == 0 && pos.h == 0)
4155++ {
4156++ GetQDGlobalsScreenBits(&screenBits);
4157++
4158++ pos.h = screenBits.bounds.right - kCandWindWidth - 4;
4159++ pos.v = screenBits.bounds.top + kMenuBarHeight + 4;
4160++ }
4161++
4162++ myErr = SetEventParameter(event, kEventParamTextInputReplyPoint,
4163++ typeQDPoint, sizeof(Point), &pos);
4164++ return myErr;
4165++}
4166++
4167++static void UpdateCandWindow(TSMHandle internals)
4168++{
4169++ /*
4170++ * Mac Documentation says that this call is Deprecated
4171++ */
4172++ QDFlushPortBuffer(GetWindowPort(internals->CandWind), NULL);
4173++}
4174++
4175++static pascal OSStatus MacEventHandler(EventHandlerCallRef nextHandler,
4176++ EventRef event, void *userData)
4177++{
4178++#pragma unused (nextHandler)
4179++
4180++ OSStatus myErr, result = eventNotHandledErr;
4181++ UInt32 class, kind;
4182++ WindowRef wind;
4183++ TSMHandle internals = (TSMHandle)userData;
4184++
4185++ class = GetEventClass(event);
4186++ kind = GetEventKind(event);
4187++
4188++ TRACE("(%c%c%c%c:%ld)\n", (char)(class >> 24) & 0xff,
4189++ (char)(class >> 16) & 0xff, (char)(class >> 8) & 0xff,
4190++ (char)class & 0xff, kind);
4191++
4192++ switch (class)
4193++ {
4194++ case kEventClassTextInput:
4195++ switch (kind)
4196++ {
4197++ case kEventTextInputUpdateActiveInputArea:
4198++ TRACE("kEventTextInputUpdateActiveInputArea\n");
4199++ if (internals->CandWind)
4200++ UpdateCandWindow(internals);
4201++ myErr = UpAcInputArea(event,internals);
4202++ if (myErr == noErr)
4203++ result = noErr;
4204++ break;
4205++ case kEventTextInputOffsetToPos:
4206++ TRACE("kEventTextInputOffsetToPos\n");
4207++ myErr = Off2P(event);
4208++ if (myErr == noErr)
4209++ result = noErr;
4210++ break;
4211++ }
4212++ break;
4213++ case kEventClassWindow:
4214++ TRACE("kEventClassWindow\n");
4215++ myErr = GetEventParameter(event, kEventParamDirectObject,
4216++ typeWindowRef, NULL, sizeof(WindowRef), NULL, &wind);
4217++ if (myErr != noErr)
4218++ break;
4219++ switch (kind)
4220++ {
4221++ case kEventWindowShown:
4222++ TRACE("kEventWindowShown\n");
4223++ if (internals->CandWind == NULL)
4224++ {
4225++ internals->CandWind = wind;
4226++ UpdateCandWindow(internals);
4227++ }
4228++ break;
4229++ case kEventWindowHidden:
4230++ TRACE("kEventWindowHidden\n");
4231++ if (internals->CandWind == wind)
4232++ internals->CandWind = NULL;
4233++ break;
4234++ }
4235++ break;
4236++ }
4237++
4238++ return result;
4239++}
4240++
4241++long MacInstallAppEventHandler(TSMHandle internals)
4242++{
4243++ OSStatus myErr;
4244++ EventTypeSpec eventType[] = {
4245++ { kEventClassTextInput, kEventTextInputUpdateActiveInputArea },/*1*/
4246++ { kEventClassTextInput, kEventTextInputOffsetToPos }, /* 3 */
4247++ { kEventClassWindow, kEventWindowShown }, /* 24 */
4248++ { kEventClassWindow, kEventWindowHidden }, /* 25 */
4249++ };
4250++
4251++ TRACE("Setting up Event Handler\n");
4252++ myErr = InstallApplicationEventHandler(NewEventHandlerUPP(MacEventHandler),
4253++ GetEventTypeCount(eventType), eventType, internals,
4254++ &(internals->EventHandler));
4255++
4256++ if (myErr != noErr)
4257++ {
4258++ ERR("can't install app event handler (%ld)\n", myErr);
4259++ return myErr;
4260++ }
4261++
4262++ return noErr;
4263++}
4264++
4265++void MacRemoveAppEventHandler(TSMHandle internals)
4266++{
4267++ OSStatus myErr;
4268++
4269++ myErr = RemoveEventHandler(internals->EventHandler);
4270++}
4271++
4272++static void PumpEvents()
4273++{
4274++ EventRef theEvent;
4275++ EventTargetRef theTarget = NULL;
4276++ UInt32 class, kind;
4277++
4278++ if (theTarget == NULL)
4279++ theTarget = GetEventDispatcherTarget();
4280++
4281++ while (ReceiveNextEvent(0, NULL, 0.0001, TRUE, &theEvent) == noErr)
4282++ {
4283++ class = GetEventClass(theEvent);
4284++ kind = GetEventKind(theEvent);
4285++
4286++ TRACE("(%c%c%c%c:%ld)\n", (char)(class >> 24) & 0xff,
4287++ (char)(class >> 16) & 0xff, (char)(class >> 8) & 0xff,
4288++ (char)class & 0xff, kind);
4289++
4290++ SendEventToEventTarget(theEvent,theTarget);
4291++ ReleaseEvent(theEvent);
4292++ }
4293++}
4294++
4295++#endif /* __APPLE__ */
4296+--- wine-1.0-rc4/dlls/wineosxime.drv/main.c 1970-01-01 09:00:00.000000000 +0900
4297++++ wine/dlls/wineosxime.drv/main.c 2008-06-07 01:12:15.000000000 +0900
4298+@@ -0,0 +1,72 @@
4299++/*
4300++ * initialization code
4301++ *
4302++ * Copyright 2008 CodeWeavers, Aric Stewart
4303++ *
4304++ * This library is free software; you can redistribute it and/or
4305++ * modify it under the terms of the GNU Lesser General Public
4306++ * License as published by the Free Software Foundation; either
4307++ * version 2.1 of the License, or (at your option) any later version.
4308++ *
4309++ * This library is distributed in the hope that it will be useful,
4310++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4311++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4312++ * Lesser General Public License for more details.
4313++ *
4314++ * You should have received a copy of the GNU Lesser General Public
4315++ * License along with this library; if not, write to the Free Software
4316++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
4317++ */
4318++
4319++#include <stdarg.h>
4320++#include <stdlib.h>
4321++#include "windef.h"
4322++#include "winbase.h"
4323++#include "osxime_private.h"
4324++
4325++#include "wine/debug.h"
4326++WINE_DEFAULT_DEBUG_CHANNEL(mac_ime);
4327++
4328++#ifdef __APPLE__
4329++TSMHandle gHandle = NULL;
4330++
4331++void RemoveAEHandler(void)
4332++{
4333++ MacRemoveAppEventHandler(gHandle);
4334++ MacCloseTSMAwareApplication(gHandle);
4335++
4336++ TRACE("MacIM:End.\n");
4337++}
4338++#endif
4339++
4340++BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
4341++{
4342++#ifdef __APPLE__
4343++ BOOL ret = TRUE;
4344++
4345++ switch(reason)
4346++ {
4347++ case DLL_PROCESS_ATTACH:
4348++ DisableThreadLibraryCalls(hinst);
4349++ IME_RegisterClasses(hinst);
4350++
4351++ if (!gHandle)
4352++ {
4353++ gHandle = MacInitTSMAwareApplication();
4354++ if (gHandle)
4355++ {
4356++ MacInstallAppEventHandler(gHandle);
4357++ MacNewTSMDocument(gHandle,(long)0xfeedface);
4358++ atexit(RemoveAEHandler);
4359++ }
4360++ }
4361++ break;
4362++ case DLL_PROCESS_DETACH:
4363++ IME_UnregisterClasses(hinst);
4364++ break;
4365++ }
4366++ return ret;
4367++#else
4368++ return FALSE;
4369++#endif
4370++}
4371+--- wine-1.0-rc4/dlls/wineosxime.drv/osxime_private.h 1970-01-01 09:00:00.000000000 +0900
4372++++ wine/dlls/wineosxime.drv/osxime_private.h 2008-06-07 01:12:15.000000000 +0900
4373+@@ -0,0 +1,52 @@
4374++/*
4375++ * Copyright 2008 CodeWeavers, Aric Stewart
4376++ *
4377++ * This library is free software; you can redistribute it and/or
4378++ * modify it under the terms of the GNU Lesser General Public
4379++ * License as published by the Free Software Foundation; either
4380++ * version 2.1 of the License, or (at your option) any later version.
4381++ *
4382++ * This library is distributed in the hope that it will be useful,
4383++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4384++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4385++ * Lesser General Public License for more details.
4386++ *
4387++ * You should have received a copy of the GNU Lesser General Public
4388++ * License along with this library; if not, write to the Free Software
4389++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
4390++ */
4391++
4392++#ifndef TSMHandle
4393++typedef void *TSMHandle;
4394++#endif
4395++
4396++/* mactext functions */
4397++
4398++int MacNewTSMDocument(TSMHandle handle, long refcon);
4399++int MacTSMEventCFS(TSMHandle handle, char theChar, unsigned long
4400++ theCode, unsigned long modifiers, unsigned long unichar);
4401++TSMHandle MacInitTSMAwareApplication(void);
4402++void MacCloseTSMAwareApplication(TSMHandle handle);
4403++int MacTSMFixTextService(TSMHandle handle);
4404++int MacActivateTSMDocument(TSMHandle handle);
4405++int MacTSMRevertToPreviousMode(TSMHandle handle);
4406++int MacTSMCheckModeAndIME(TSMHandle handle);
4407++void MacRemoveAppEventHandler(TSMHandle handle);
4408++void MacInstallAppEventHandler(TSMHandle handle);
4409++
4410++/* toAscii */
4411++int MacToAscii(UINT uVKey, UINT keysym, UINT keycode, CONST LPBYTE lpbKeyState,
4412++ LPDWORD lpdwTransKey);
4413++
4414++/* IME support */
4415++extern void IME_RegisterClasses(HINSTANCE hImeInst);
4416++extern void IME_UnregisterClasses(HINSTANCE hImeInst);
4417++extern void IME_SetOpenStatus(BOOL fOpen);
4418++extern LRESULT IME_SendMessageToSelectedHWND(UINT msg, WPARAM wParam, LPARAM lParam);
4419++extern INT IME_GetCursorPos();
4420++extern void IME_UpdateAssociation(HWND focus);
4421++extern void IME_SetCompositionString(LPCVOID lpComp, DWORD dwCompLen);
4422++extern BOOL IME_NotifyIME();
4423++
4424++/* MAC */
4425++void MAC_SetupXIM();
4426+--- wine-1.0-rc4/dlls/wineosxime.drv/toascii.c 1970-01-01 09:00:00.000000000 +0900
4427++++ wine/dlls/wineosxime.drv/toascii.c 2008-06-07 01:12:15.000000000 +0900
4428+@@ -0,0 +1,404 @@
4429++/*
4430++ * Functions to translate keys on the Mac intel OS X platform
4431++ *
4432++ * Copyright 2008 CodeWeavers, Aric Stewart
4433++ *
4434++ * This library is free software; you can redistribute it and/or
4435++ * modify it under the terms of the GNU Lesser General Public
4436++ * License as published by the Free Software Foundation; either
4437++ * version 2.1 of the License, or (at your option) any later version.
4438++ *
4439++ * This library is distributed in the hope that it will be useful,
4440++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4441++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4442++ * Lesser General Public License for more details.
4443++ *
4444++ * You should have received a copy of the GNU Lesser General Public
4445++ * License along with this library; if not, write to the Free Software
4446++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
4447++ *
4448++ */
4449++
4450++#ifdef __APPLE__
4451++
4452++#include <stdio.h>
4453++#include <stdlib.h>
4454++#include <stdarg.h>
4455++
4456++/* Wine Includes */
4457++#include "windef.h"
4458++#include "winbase.h"
4459++#include "winuser.h"
4460++#include "wingdi.h"
4461++#include "winnls.h"
4462++#include "imm.h"
4463++#include "ddk/imm.h"
4464++#include "keysym2ucs.h"
4465++#include "wine/debug.h"
4466++
4467++#include "osxime_private.h"
4468++
4469++WINE_DEFAULT_DEBUG_CHANNEL(mac_ime);
4470++
4471++/* These tables are from Events.h
4472++ * But i want to avoid bringing Mac headers into this file as it causes
4473++ * conflicts with the wine headers.
4474++ */
4475++enum {
4476++ kNullCharCode = 0,
4477++ kHomeCharCode = 1,
4478++ kEnterCharCode = 3,
4479++ kEndCharCode = 4,
4480++ kHelpCharCode = 5,
4481++ kBellCharCode = 7,
4482++ kBackspaceCharCode = 8,
4483++ kTabCharCode = 9,
4484++ kLineFeedCharCode = 10,
4485++ kVerticalTabCharCode = 11,
4486++ kPageUpCharCode = 11,
4487++ kFormFeedCharCode = 12,
4488++ kPageDownCharCode = 12,
4489++ kReturnCharCode = 13,
4490++ kFunctionKeyCharCode = 16,
4491++ kCommandCharCode = 17, /* glyph available only in system fonts*/
4492++ kCheckCharCode = 18, /* glyph available only in system fonts*/
4493++ kDiamondCharCode = 19, /* glyph available only in system fonts*/
4494++ kAppleLogoCharCode = 20, /* glyph available only in system fonts*/
4495++ kEscapeCharCode = 27,
4496++ kClearCharCode = 27,
4497++ kLeftArrowCharCode = 28,
4498++ kRightArrowCharCode = 29,
4499++ kUpArrowCharCode = 30,
4500++ kDownArrowCharCode = 31,
4501++ kSpaceCharCode = 32,
4502++ kDeleteCharCode = 127,
4503++ kBulletCharCode = 165,
4504++ kNonBreakingSpaceCharCode = 202
4505++};
4506++
4507++enum {
4508++ /* modifiers */
4509++ activeFlagBit = 0, /* activate? (activateEvt and mouseDown)*/
4510++ btnStateBit = 7, /* state of button?*/
4511++ cmdKeyBit = 8, /* command key down?*/
4512++ shiftKeyBit = 9, /* shift key down?*/
4513++ alphaLockBit = 10, /* alpha lock down?*/
4514++ optionKeyBit = 11, /* option key down?*/
4515++ controlKeyBit = 12, /* control key down?*/
4516++ rightShiftKeyBit = 13, /* right shift key down? Not supported on Mac OS X.*/
4517++ rightOptionKeyBit = 14, /* right Option key down? Not supported on Mac OS X.*/
4518++ rightControlKeyBit = 15 /* right Control key down? Not supported on Mac OS X.*/
4519++};
4520++
4521++enum {
4522++ activeFlag = 1 << activeFlagBit,
4523++ btnState = 1 << btnStateBit,
4524++ cmdKey = 1 << cmdKeyBit,
4525++ shiftKey = 1 << shiftKeyBit,
4526++ alphaLock = 1 << alphaLockBit,
4527++ optionKey = 1 << optionKeyBit,
4528++ controlKey = 1 << controlKeyBit,
4529++ rightShiftKey = 1 << rightShiftKeyBit, /* Not supported on Mac OS X.*/
4530++ rightOptionKey = 1 << rightOptionKeyBit, /* Not supported on Mac OS X.*/
4531++ rightControlKey = 1 << rightControlKeyBit /* Not supported on Mac OS X.*/
4532++};
4533++
4534++/* End copy from Events.h */
4535++
4536++extern TSMHandle gHandle;
4537++
4538++#define XtoMacKeycode_KnownUnused -1
4539++
4540++int xToMacKeycodeMap[] = {
4541++ /* 0 -> */ XtoMacKeycode_KnownUnused,
4542++ /* 1 -> */ 53,
4543++ /* 2 -> */ 18,
4544++ /* 3 -> */ 19,
4545++ /* 4 -> */ 20,
4546++ /* 5 -> */ 21,
4547++ /* 6 -> */ 23,
4548++ /* 7 -> */ 22,
4549++ /* 8 -> */ 26,
4550++ /* 9 -> */ 28,
4551++ /* 10 -> */ 25,
4552++ /* 11 -> */ 29,
4553++ /* 12 -> */ 27,
4554++ /* 13 -> */ 24,
4555++ /* 14 -> */ 51,
4556++ /* 15 -> */ 48,
4557++ /* 16 -> */ 12,
4558++ /* 17 -> */ 13,
4559++ /* 18 -> */ 14,
4560++ /* 19 -> */ 15,
4561++ /* 20 -> */ 17,
4562++ /* 21 -> */ 16,
4563++ /* 22 -> */ 32,
4564++ /* 23 -> */ 34,
4565++ /* 24 -> */ 31,
4566++ /* 25 -> */ 35,
4567++ /* 26 -> */ 33,
4568++ /* 27 -> */ 30,
4569++ /* 28 -> */ 36,
4570++ /* 29 -> */ 59,
4571++ /* 30 -> */ 0,
4572++ /* 31 -> */ 1,
4573++ /* 32 -> */ 2,
4574++ /* 33 -> */ 3,
4575++ /* 34 -> */ 5,
4576++ /* 35 -> */ 4,
4577++ /* 36 -> */ 38,
4578++ /* 37 -> */ 40,
4579++ /* 38 -> */ 37,
4580++ /* 39 -> */ 41,
4581++ /* 40 -> */ 39,
4582++ /* 41 -> */ 50,
4583++ /* 42 -> */ 56,
4584++ /* 43 -> */ 42,
4585++ /* 44 -> */ 6,
4586++ /* 45 -> */ 7,
4587++ /* 46 -> */ 8,
4588++ /* 47 -> */ 9,
4589++ /* 48 -> */ 11,
4590++ /* 49 -> */ 45,
4591++ /* 50 -> */ 46,
4592++ /* 51 -> */ 43,
4593++ /* 52 -> */ 47,
4594++ /* 53 -> */ 44,
4595++ /* 54 -> */ 60,
4596++ /* 55 -> */ 67,
4597++ /* 56 -> */ 58,
4598++ /* 57 -> */ 49,
4599++ /* 58 -> */ 57,
4600++ /* 59 -> */ 122,
4601++ /* 60 -> */ 120,
4602++ /* 61 -> */ 99,
4603++ /* 62 -> */ 118,
4604++ /* 63 -> */ 96,
4605++ /* 64 -> */ 97,
4606++ /* 65 -> */ 98,
4607++ /* 66 -> */ 100,
4608++ /* 67 -> */ 101,
4609++ /* 68 -> */ 109,
4610++ /* 69 -> */ 71,
4611++ /* 70 -> */ XtoMacKeycode_KnownUnused,
4612++ /* 71 -> */ 89,
4613++ /* 72 -> */ 91,
4614++ /* 73 -> */ 92,
4615++ /* 74 -> */ 78,
4616++ /* 75 -> */ 86,
4617++ /* 76 -> */ 87,
4618++ /* 77 -> */ 88,
4619++ /* 78 -> */ 69,
4620++ /* 79 -> */ 83,
4621++ /* 80 -> */ 84,
4622++ /* 81 -> */ 85,
4623++ /* 82 -> */ 82,
4624++ /* 83 -> */ XtoMacKeycode_KnownUnused,
4625++ /* 84 -> */ XtoMacKeycode_KnownUnused,
4626++ /* 85 -> */ XtoMacKeycode_KnownUnused,
4627++ /* 86 -> */ 10,
4628++ /* 87 -> */ 103,
4629++ /* 88 -> */ 111,
4630++ /* 89 -> */ 115,
4631++ /* 90 -> */ 126,
4632++ /* 91 -> */ 116,
4633++ /* 92 -> */ 123,
4634++ /* 93 -> */ XtoMacKeycode_KnownUnused,
4635++ /* 94 -> */ 124,
4636++ /* 95 -> */ 119,
4637++ /* 96 -> */ 125,
4638++ /* 97 -> */ 121,
4639++ /* 98 -> */ 114,
4640++ /* 99 -> */ 117,
4641++ /* 100 -> */ 76,
4642++ /* 101 -> */ 62,
4643++ /* 102 -> */ XtoMacKeycode_KnownUnused,
4644++ /* 103 -> */ XtoMacKeycode_KnownUnused,
4645++ /* 104 -> */ 75,
4646++ /* 105 -> */ 61,
4647++ /* 106 -> */ XtoMacKeycode_KnownUnused,
4648++ /* 107 -> */ 55,
4649++ /* 108 -> */ 63,
4650++ /* 109 -> */ XtoMacKeycode_KnownUnused,
4651++ /* 110 -> */ 105, /* From /usr/X11R6/lib/X11/xkb/keycodes/xfree86: FK13.*/
4652++ /* 111 -> */ 107, /* From /usr/X11R6/lib/X11/xkb/keycodes/xfree86: FK14.*/
4653++ /* 112 -> */ 113, /* From /usr/X11R6/lib/X11/xkb/keycodes/xfree86: FK15.*/
4654++ /* 113 -> */ 106, /* From /usr/X11R6/lib/X11/xkb/keycodes/xfree86: FK16.*/
4655++ /* 114 -> */ XtoMacKeycode_KnownUnused,
4656++ /* 115 -> */ 65, /* From /usr/X11R6/lib/X11/xkb/keycodes/xfree86: KPDC.*/
4657++ /* 116 -> */ XtoMacKeycode_KnownUnused,
4658++ /* 117 -> */ XtoMacKeycode_KnownUnused,
4659++ /* 118 -> */ 81,
4660++ /* 119 -> */ XtoMacKeycode_KnownUnused,
4661++ /* 120 -> */ XtoMacKeycode_KnownUnused,
4662++ /* 121 -> */ 102, /* From /usr/X11R6/lib/X11/xkb/keycodes/xfree86: XFER. This is a bit of a guess. The Mac mappings do nothing but exit dead key states for JIS keyboards. I'm assuming that's because they're about to switch states, which I'm guessing is what these keys do.*/
4663++ /* 122 -> */ XtoMacKeycode_KnownUnused,
4664++ /* 123 -> */ XtoMacKeycode_KnownUnused,
4665++ /* 124 -> */ XtoMacKeycode_KnownUnused,
4666++ /* 125 -> */ 93, /* Only maps for JIS keyboards; maps to yen/pipe/backslash across many keyboard layouts. From /usr/X11R6/lib/X11/xkb/keycodes/xfree86: AE13. That definition is labeled as "Yen". Also, the position of the Yen key on JIS keyboards is to the right of AE12.*/
4667++ /* 126 -> */ XtoMacKeycode_KnownUnused,
4668++ /* 127 -> */ XtoMacKeycode_KnownUnused,
4669++ /* 128 -> */ XtoMacKeycode_KnownUnused,
4670++ /* 129 -> */ XtoMacKeycode_KnownUnused,
4671++ /* 130 -> */ XtoMacKeycode_KnownUnused,
4672++ /* 131 -> */ XtoMacKeycode_KnownUnused,
4673++ /* 132 -> */ XtoMacKeycode_KnownUnused,
4674++ /* 133 -> */ XtoMacKeycode_KnownUnused,
4675++ /* 134 -> */ XtoMacKeycode_KnownUnused,
4676++ /* 135 -> */ XtoMacKeycode_KnownUnused,
4677++ /* 136 -> */ XtoMacKeycode_KnownUnused,
4678++ /* 137 -> */ XtoMacKeycode_KnownUnused,
4679++ /* 138 -> */ XtoMacKeycode_KnownUnused,
4680++ /* 139 -> */ XtoMacKeycode_KnownUnused,
4681++ /* 140 -> */ XtoMacKeycode_KnownUnused,
4682++ /* 141 -> */ XtoMacKeycode_KnownUnused,
4683++ /* 142 -> */ XtoMacKeycode_KnownUnused,
4684++ /* 143 -> */ XtoMacKeycode_KnownUnused,
4685++ /* 144 -> */ XtoMacKeycode_KnownUnused,
4686++ /* 145 -> */ XtoMacKeycode_KnownUnused,
4687++ /* 146 -> */ XtoMacKeycode_KnownUnused,
4688++ /* 147 -> */ XtoMacKeycode_KnownUnused,
4689++ /* 148 -> */ XtoMacKeycode_KnownUnused,
4690++ /* 149 -> */ XtoMacKeycode_KnownUnused,
4691++ /* 150 -> */ XtoMacKeycode_KnownUnused,
4692++ /* 151 -> */ XtoMacKeycode_KnownUnused,
4693++ /* 152 -> */ XtoMacKeycode_KnownUnused,
4694++ /* 153 -> */ XtoMacKeycode_KnownUnused,
4695++ /* 154 -> */ XtoMacKeycode_KnownUnused,
4696++ /* 155 -> */ XtoMacKeycode_KnownUnused,
4697++ /* 156 -> */ XtoMacKeycode_KnownUnused,
4698++ /* 157 -> */ XtoMacKeycode_KnownUnused,
4699++ /* 158 -> */ XtoMacKeycode_KnownUnused,
4700++ /* 159 -> */ XtoMacKeycode_KnownUnused,
4701++ /* 160 -> */ XtoMacKeycode_KnownUnused,
4702++ /* 161 -> */ XtoMacKeycode_KnownUnused,
4703++ /* 162 -> */ XtoMacKeycode_KnownUnused,
4704++ /* 163 -> */ XtoMacKeycode_KnownUnused,
4705++ /* 164 -> */ XtoMacKeycode_KnownUnused,
4706++ /* 165 -> */ XtoMacKeycode_KnownUnused,
4707++ /* 166 -> */ XtoMacKeycode_KnownUnused,
4708++ /* 167 -> */ XtoMacKeycode_KnownUnused,
4709++ /* 168 -> */ XtoMacKeycode_KnownUnused,
4710++ /* 169 -> */ XtoMacKeycode_KnownUnused,
4711++ /* 170 -> */ XtoMacKeycode_KnownUnused,
4712++ /* 171 -> */ XtoMacKeycode_KnownUnused,
4713++ /* 172 -> */ XtoMacKeycode_KnownUnused,
4714++ /* 173 -> */ XtoMacKeycode_KnownUnused,
4715++ /* 174 -> */ XtoMacKeycode_KnownUnused,
4716++ /* 175 -> */ XtoMacKeycode_KnownUnused,
4717++ /* 176 -> */ XtoMacKeycode_KnownUnused,
4718++ /* 177 -> */ XtoMacKeycode_KnownUnused,
4719++ /* 178 -> */ XtoMacKeycode_KnownUnused,
4720++ /* 179 -> */ XtoMacKeycode_KnownUnused,
4721++ /* 180 -> */ XtoMacKeycode_KnownUnused,
4722++ /* 181 -> */ XtoMacKeycode_KnownUnused,
4723++ /* 182 -> */ XtoMacKeycode_KnownUnused,
4724++ /* 183 -> */ XtoMacKeycode_KnownUnused,
4725++ /* 184 -> */ XtoMacKeycode_KnownUnused,
4726++ /* 185 -> */ XtoMacKeycode_KnownUnused,
4727++ /* 186 -> */ XtoMacKeycode_KnownUnused,
4728++ /* 187 -> */ XtoMacKeycode_KnownUnused,
4729++ /* 188 -> */ XtoMacKeycode_KnownUnused,
4730++ /* 189 -> */ XtoMacKeycode_KnownUnused,
4731++ /* 190 -> */ XtoMacKeycode_KnownUnused,
4732++ /* 191 -> */ XtoMacKeycode_KnownUnused,
4733++ /* 192 -> */ XtoMacKeycode_KnownUnused,
4734++ /* 193 -> */ XtoMacKeycode_KnownUnused,
4735++ /* 194 -> */ XtoMacKeycode_KnownUnused,
4736++ /* 195 -> */ XtoMacKeycode_KnownUnused,
4737++ /* 196 -> */ XtoMacKeycode_KnownUnused,
4738++ /* 197 -> */ XtoMacKeycode_KnownUnused,
4739++ /* 198 -> */ XtoMacKeycode_KnownUnused,
4740++ /* 199 -> */ XtoMacKeycode_KnownUnused,
4741++ /* 200 -> */ 104, /* From /usr/X11R6/lib/X11/xkb/keycodes/xfree86: HKTG. In Leopard's Events.h, this keycode is documented as kVK_JIS_Kana, which I'm
4742++ assuming matches XKB's "Hiragana_Katakana toggle". */
4743++ /* 201 -> */ XtoMacKeycode_KnownUnused,
4744++ /* 202 -> */ XtoMacKeycode_KnownUnused,
4745++ /* 203 -> */ 94, /* Only maps for JIS keyboards; maps to underscore/grave/combining-grave across many keyboard layouts. From /usr/X11R6/lib/X11/xkb/keycodes/xfree86: AB11. This is a bit of a guess. That definition is labeled as "backslash/underscore". Only the "underscore" part matches this key's mapping.*/
4746++ /* No X keycode maps to these Mac keycodes:
4747++ XXX -> 52, // This maps to the Enter character code in all keyboard layouts. Is this some alternate Enter key? See 76.
4748++ XXX -> 54,
4749++ XXX -> 64,
4750++ XXX -> 66,
4751++ XXX -> 68,
4752++ XXX -> 70,
4753++ XXX -> 72,
4754++ XXX -> 73,
4755++ XXX -> 74,
4756++ XXX -> 77,
4757++ XXX -> 79,
4758++ XXX -> 80,
4759++ XXX -> 90,
4760++ XXX -> 95, // Only maps for JIS keyboards; maps to comma for all modifier combinations across many keyboard layouts. It seems unlikely that any such key exists.
4761++ XXX -> 108,
4762++ XXX -> 110,
4763++ XXX -> 112,
4764++ XXX -> 127,
4765++ */
4766++};
4767++
4768++int MacToAscii(UINT uVKey, UINT keysym, UINT keycode, CONST LPBYTE lpbKeyState,
4769++ LPDWORD lpdwTransKey)
4770++{
4771++ char theChar;
4772++ WCHAR unichar;
4773++ unsigned long theCode;
4774++ unsigned long modifiers;
4775++
4776++ modifiers = 0x00;
4777++
4778++/* modifiers */
4779++
4780++ if (lpbKeyState[VK_SHIFT] & 0x80)
4781++ modifiers |= shiftKey;
4782++ if (lpbKeyState[VK_NUMLOCK] & 0x80)
4783++ modifiers |= alphaLock;
4784++ if (lpbKeyState[VK_CONTROL] & 0x80)
4785++ modifiers |= controlKey;
4786++ if (lpbKeyState[VK_MENU] & 0x80)
4787++ modifiers |= cmdKey;
4788++ if (lpbKeyState[VK_MENU] & 0x80)
4789++ modifiers |= optionKey;
4790++
4791++ switch(uVKey) {
4792++ case VK_LEFT:
4793++ theChar = kLeftArrowCharCode;
4794++ break;
4795++ case VK_UP:
4796++ theChar = kUpArrowCharCode;
4797++ break;
4798++ case VK_RIGHT:
4799++ theChar = kRightArrowCharCode;
4800++ break;
4801++ case VK_DOWN:
4802++ theChar = kDownArrowCharCode;
4803++ break;
4804++ case VK_DELETE:
4805++ theChar = kBackspaceCharCode;
4806++ break;
4807++ case VK_F1:
4808++ case VK_F2:
4809++ case VK_F3:
4810++ case VK_F4:
4811++ case VK_F5:
4812++ case VK_F6:
4813++ case VK_F7:
4814++ case VK_F8:
4815++ case VK_F9:
4816++ case VK_F10:
4817++ case VK_F11:
4818++ case VK_F12:
4819++ theChar = kFunctionKeyCharCode;
4820++ break;
4821++ default:
4822++ theChar = keysym & 0x00FF;
4823++ break;
4824++ }
4825++
4826++ theCode = xToMacKeycodeMap[keycode];
4827++ MacActivateTSMDocument(gHandle);
4828++ unichar = keysym2ucs(keysym);
4829++
4830++ return MacTSMEventCFS(gHandle,theChar,theCode,modifiers,unichar);
4831++}
4832++#endif
4833+--- wine-1.0-rc4/dlls/wineosxime.drv/wineosxime.drv.spec 1970-01-01 09:00:00.000000000 +0900
4834++++ wine/dlls/wineosxime.drv/wineosxime.drv.spec 2008-06-07 01:12:15.000000000 +0900
4835+@@ -0,0 +1,18 @@
4836++#ifdef __APPLE__
4837++@ stdcall ImeInquire(ptr wstr wstr)
4838++@ stdcall ImeConfigure(long long long ptr)
4839++@ stdcall ImeDestroy(long)
4840++@ stdcall ImeEscape(long long ptr)
4841++@ stdcall ImeSelect(long long)
4842++@ stdcall ImeSetActiveContext(long long)
4843++@ stdcall ImeToAsciiEx(long long ptr ptr long long)
4844++@ stdcall NotifyIME(long long long long)
4845++@ stdcall ImeRegisterWord(wstr long wstr)
4846++@ stdcall ImeUnregisterWord(wstr long wstr)
4847++@ stdcall ImeEnumRegisterWord(ptr wstr long wstr ptr)
4848++@ stdcall ImeSetCompositionString(long long ptr long ptr long)
4849++@ stdcall ImeConversionList(long wstr ptr long long)
4850++@ stdcall ImeProcessKey(long long long ptr)
4851++@ stdcall ImeGetRegisterWordStyle(wstr long wstr)
4852++@ stdcall ImeGetImeMenuItems(long long long ptr ptr long)
4853++#endif
4854+--- wine-1.0-rc4/dlls/winex11.drv/Makefile.in 2008-06-07 00:24:30.000000000 +0900
4855++++ wine/dlls/winex11.drv/Makefile.in 2008-06-07 01:12:15.000000000 +0900
4856+@@ -24,6 +24,7 @@
4857+ ime.c \
4858+ init.c \
4859+ keyboard.c \
4860++ mac_xim.c \
4861+ mouse.c \
4862+ opengl.c \
4863+ palette.c \
4864+--- wine-1.0-rc4/dlls/winex11.drv/keyboard.c 2008-06-07 00:24:30.000000000 +0900
4865++++ wine/dlls/winex11.drv/keyboard.c 2008-06-07 01:12:15.000000000 +0900
4866+@@ -53,6 +53,10 @@
4867+ WINE_DEFAULT_DEBUG_CHANNEL(keyboard);
4868+ WINE_DECLARE_DEBUG_CHANNEL(key);
4869+
4870++#ifdef __APPLE__
4871++extern int ProcessMacInput(XKeyEvent*);
4872++#endif
4873++
4874+ /* key state table bits:
4875+ 0x80 -> key is pressed
4876+ 0x40 -> key got pressed since last time
4877+@@ -1339,6 +1343,11 @@
4878+ ascii_chars = XLookupString(event, Str, sizeof(Str), &keysym, NULL);
4879+ wine_tsx11_unlock();
4880+
4881++#ifdef __APPLE__
4882++ if (ProcessMacInput(event))
4883++ return;
4884++#endif
4885++
4886+ TRACE_(key)("nbyte = %d, status 0x%x\n", ascii_chars, status);
4887+
4888+ if (status == XBufferOverflow)
4889+--- wine-1.0-rc4/dlls/winex11.drv/mac_xim.c 1970-01-01 09:00:00.000000000 +0900
4890++++ wine/dlls/winex11.drv/mac_xim.c 2008-06-07 01:12:15.000000000 +0900
4891+@@ -0,0 +1,83 @@
4892++/*
4893++ * Functions for further XIM control on the Mac intel OS X platform
4894++ *
4895++ * Copyright 2006,2008 CodeWeavers, Aric Stewart
4896++ *
4897++ * This library is free software; you can redistribute it and/or
4898++ * modify it under the terms of the GNU Lesser General Public
4899++ * License as published by the Free Software Foundation; either
4900++ * version 2.1 of the License, or (at your option) any later version.
4901++ *
4902++ * This library is distributed in the hope that it will be useful,
4903++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4904++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4905++ * Lesser General Public License for more details.
4906++ *
4907++ * You should have received a copy of the GNU Lesser General Public
4908++ * License along with this library; if not, write to the Free Software
4909++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
4910++ *
4911++ */
4912++
4913++#ifdef __APPLE__
4914++
4915++#include <stdio.h>
4916++#include <stdlib.h>
4917++#include <stdarg.h>
4918++
4919++/* X includes */
4920++#include <X11/Xatom.h>
4921++#include <X11/keysym.h>
4922++#include <X11/Xlib.h>
4923++#include <X11/Xresource.h>
4924++#include <X11/Xutil.h>
4925++#ifdef HAVE_XKB
4926++#include <X11/XKBlib.h>
4927++#endif
4928++
4929++/* Wine Includes */
4930++#include "windef.h"
4931++#include "winbase.h"
4932++#include "winuser.h"
4933++#include "wingdi.h"
4934++#include "winnls.h"
4935++#include "imm.h"
4936++#include "ddk/imm.h"
4937++#include "keysym2ucs.h"
4938++#include "wine/debug.h"
4939++
4940++WINE_DEFAULT_DEBUG_CHANNEL(mac_ime);
4941++
4942++int ProcessMacInput(XKeyEvent *event)
4943++{
4944++ HWND wnd;
4945++ static HIMC hImc = NULL;
4946++ HIMC newImc = NULL;
4947++ KeySym keysym;
4948++
4949++ if (event->type != KeyPress)
4950++ return 0;
4951++
4952++ wnd = GetFocus();
4953++ newImc = ImmGetContext(wnd);
4954++
4955++ if (newImc != hImc)
4956++ {
4957++ hImc = newImc;
4958++ if (ImmGetIMEFileNameA(GetKeyboardLayout(0),NULL,0))
4959++ {
4960++ /* We have a non default IME do not do our processing */
4961++ return 0;
4962++ }
4963++ }
4964++
4965++ if (hImc)
4966++ {
4967++ XLookupString(event, NULL, 0, &keysym, NULL);
4968++ ImmEscapeW(GetKeyboardLayout(0),hImc,IME_ESC_PRIVATE_FIRST + 0x10, (LPVOID)keysym);
4969++ ImmEscapeW(GetKeyboardLayout(0),hImc,IME_ESC_PRIVATE_FIRST + 0x11, (LPVOID)(event->keycode-8));
4970++ }
4971++ return 0;
4972++}
4973++
4974++#endif /* __APPLE__ */
4975+diff -U10 -rN wine-1.0-rc4/tools/make_makefiles wine-crossover-7.0.0/tools/make_makefiles
4976+--- wine-1.0-rc4/tools/make_makefiles 2008-06-07 00:24:30.000000000 +0900
4977++++ wine-crossover-7.0.0/tools/make_makefiles 2008-06-07 01:12:15.000000000 +0900
4978+@@ -62,7 +62,8 @@
4979+ "glu32" => "GLU32FILES",
4980+ "opengl32" => "OPENGLFILES",
4981+ "winex11.drv" => "XFILES",
4982+- "winequartz.drv" => "QUARTZFILES"
4983++ "winequartz.drv" => "QUARTZFILES",
4984++ "wineosxime.drv" => "QUARTZFILES"
4985+ );
4986+
4987+ # Default patterns for top-level .gitignore
Show on old repository browser