|

楼主 |
发表于 2003-7-21 01:10:27
|
显示全部楼层
回复: 你打的什么补丁?哪里可以下载?
最初由 abaiyi 发表
是最新的0709的补丁吗?
对,水木清华bbs上有人贴过一个
diff -urN wine-20030709-orig/controls/edit.c wine-20030709/controls/edit.c
--- wine-20030709-orig/controls/edit.c 2003-06-04 13:29:06.000000000 -0700
+++ wine-20030709/controls/edit.c 2003-07-10 17:59:04.000000000 -0700
@@ -57,6 +57,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(edit);
WINE_DECLARE_DEBUG_CHANNEL(combo);
WINE_DECLARE_DEBUG_CHANNEL(relay);
+WINE_DECLARE_DEBUG_CHANNEL(xim);
#define BUFLIMIT_MULTI 65534 /* maximum buffer size (not including '\0')
FIXME: BTW, new specs say 65535 (do you dare ???) */
@@ -775,6 +776,7 @@
break;
}
/* fall through */
+
case WM_CHAR:
{
WCHAR charW;
@@ -793,6 +795,7 @@
SendMessageW(GetParent(hwnd), WM_KEYDOWN, charW, 0);
break;
}
+ TRACE_(xim)("receive charW: %04x\n",charW);
EDIT_WM_Char(es, charW);
break;
}
diff -urN wine-20030709-orig/dlls/x11drv/event.c wine-20030709/dlls/x11drv/event.c
--- wine-20030709-orig/dlls/x11drv/event.c 2003-07-08 14:02:51.000000000 -0700
+++ wine-20030709/dlls/x11drv/event.c 2003-07-10 17:40:37.000000000 -0700
@@ -55,6 +55,7 @@
extern Atom wmProtocols;
extern Atom wmDeleteWindow;
extern Atom dndProtocol;
+extern BOOL updatedXIMPos;
extern Atom dndSelection;
extern Atom netwmPing;
@@ -142,10 +143,45 @@
XNextEvent( data->display, &event );
ignore = XFilterEvent( &event, None );
- wine_tsx11_unlock();
- if (!ignore) EVENT_ProcessEvent( &event );
+// wine_tsx11_unlock();
+// if (!ignore) EVENT_ProcessEvent( &event );
+ if (!ignore){
+ wine_tsx11_unlock();
+ EVENT_ProcessEvent( &event );
+ wine_tsx11_lock();
+ }else{ // Support for OVERTHESPOT style of XIM (force keymap update)
+ if ( data->xim && event.type == KeyRelease && !updatedXIMPos){
+ HWND hWnd;
+ if (XFindContext( data->display, event.xany.window, winContext,
+(char **)&hWnd ) != 0)
+ hWnd = 0; // Not for a registered window
+ XIC xic = X11DRV_get_ic(hWnd);
+ if(xic){
+ POINT p[1];
+ XVaNestedList preedit_attr;
+ GetCaretPos(&p[0]);
+ MapWindowPoints(GetFocus(),hWnd,p,1);
+ //ClientToScreen(hWnd, &p);
+ XPoint spot;
+ spot.x = p[0].x;
+ spot.y = p[0].y;
+ spot.y += 30; //FIXME: How to get the caret's height
+ preedit_attr = XVaCreateNestedList(0,
+ XNSpotLocation, &spot,
+ NULL);
+ XSetICValues(xic,XNPreeditAttributes,preedit_attr,NULL);
+ // use this variable to check whether we need to update XIM position
+ updatedXIMPos = TRUE;
+
+ //force wine to update keymap
+ XKeymapEvent forceUpdateKeymap;
+ XQueryKeymap(data->display, forceUpdateKeymap.key_vector);
+ X11DRV_KeymapNotify(hWnd, &forceUpdateKeymap);
+ }
+ }
+ }
+
count++;
- wine_tsx11_lock();
}
wine_tsx11_unlock();
return count;
@@ -594,6 +630,10 @@
}
if (!bExists)
+// { /* Add COMPOUND_TEXT prop for STRING additionally */
+ // if (prop == XA_STRING)
+
+// targets[(*cTargets)++] = TSXInternAtom(display, "COMPOUND_TEXT", False);
targets[(*cTargets)++] = prop;
}
diff -urN wine-20030709-orig/dlls/x11drv/keyboard.c wine-20030709/dlls/x11drv/keyboard.c
--- wine-20030709-orig/dlls/x11drv/keyboard.c 2003-07-08 21:22:57.000000000 -0700
+++ wine-20030709/dlls/x11drv/keyboard.c 2003-07-10 17:04:56.000000000 -0700
@@ -51,6 +51,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(keyboard);
WINE_DECLARE_DEBUG_CHANNEL(key);
WINE_DECLARE_DEBUG_CHANNEL(dinput);
+WINE_DECLARE_DEBUG_CHANNEL(xim);
int min_keycode, max_keycode, keysyms_per_keycode;
WORD keyc2vkey[256], keyc2scan[256];
@@ -61,6 +62,8 @@
static char KEYBOARD_MapDeadKeysym(KeySym keysym);
+BOOL updatedXIMPos = FALSE;
+
/* Keyboard translation tables */
#define MAIN_LEN 49
static const WORD main_key_scan_qwerty[MAIN_LEN] =
@@ -975,6 +978,90 @@
KEYBOARD_UpdateOneState( VK_SHIFT, shift, time );
}
+
+#define NALLOC 64
+static BOOL XIM_KeyEvent(XIC xic, HWND hwnd, XKeyEvent *event)
+{
+ BOOL done = FALSE;
+
+ TRACE_(xim)("hwnd %04x \n", (unsigned int) hwnd);
+
+ if (event->type == KeyPress)
+ {
+ KeySym keysym;
+ Status status;
+ int i, nbyte;
+ DWORD dwOutput;
+ WCHAR wcOutput[NALLOC];
+ LPSTR bytes;
+ DWORD nalloc = NALLOC;
+ updatedXIMPos = FALSE;
+ bytes = HeapAlloc(GetProcessHeap(),0,NALLOC);
+
+
+ nbyte = XmbLookupString(xic, event, bytes, nalloc, &keysym, &status);
+ TRACE_(xim)("nbyte = %d, status = 0x%x\n", nbyte, status);
+
+ if (status == XBufferOverflow)
+ {
+ nalloc = nbyte;
+ bytes = HeapReAlloc(GetProcessHeap(), 0, bytes, nbyte);
+ nbyte = XmbLookupString(xic, event, bytes, nalloc, &keysym, &status
+);
+ TRACE_(xim)("nbyte = %d, status = 0x%x\n", nbyte, status);
+ }
+
+ switch (status)
+ {
+ case XLookupBoth:
+ if (keysym < 128 || (keysym & 0xff00) == 0xff00)
+ {
+ TRACE_(xim)("keysym = 0x%x\n", (int)keysym);
+ break; /* Leave to the default handler */
+ }
+ /* fall through */
+ case XLookupChars:
+ {
+ INT codepage = GetACP();
+ if (codepage == 932)
+ {
+ /*
+ * Japanese is encoded with windows as SJIS (932) however
+ * Under unix we use EUS (20932) So we need to translate
+ * the input as 20932...
+ */
+ dwOutput = MultiByteToWideChar(20932,
+ 0, bytes, nbyte, wcOutput, sizeof(wcOutput));
+ }
+ else
+ dwOutput = MultiByteToWideChar(codepage,
+ 0, bytes, nbyte, wcOutput, sizeof(wcOutput));
+
+ for(i=0; i<dwOutput; i++)
+ {
+ TRACE_(xim)("sending wchar %04x\n", wcOutput);
+ PostMessageW(hwnd, WM_IME_CHAR, wcOutput, 1);
+ }
+ done = True;
+ break;
+ }
+
+ case XLookupKeySym:
+ TRACE_(xim)("XLookupKeySym\n");
+ break; /* Leave to the default handler */
+
+ case XLookupNone:
+ TRACE_(xim)("XLookupNone\n");
+ done = True; /* No further processing is necessary */
+ break;
+ }
+ HeapFree(GetProcessHeap(),0,bytes);
+ }
+ return done;
+}
+
+
+
/***********************************************************************
* X11DRV_KeyEvent
*
@@ -995,9 +1082,10 @@
event->keycode=(event->keycode & 0xff);
wine_tsx11_lock();
- if (xic)
- ascii_chars = XmbLookupString(xic, event, Str, sizeof(Str), &keysym, NULL);
- else
+ if (xic && XIM_KeyEvent(xic, GetFocus(), event)){
+ wine_tsx11_unlock();
+ return;
+ }else
ascii_chars = XLookupString(event, Str, sizeof(Str), &keysym, NULL);
wine_tsx11_unlock();
diff -urN wine-20030709-orig/dlls/x11drv/window.c wine-20030709/dlls/x11drv/window.c
--- wine-20030709-orig/dlls/x11drv/window.c 2003-07-08 21:22:57.000000000 -0700
+++ wine-20030709/dlls/x11drv/window.c 2003-07-10 17:07:05.000000000 -0700
@@ -68,6 +68,8 @@
static LPCSTR client_window_atom;
static LPCSTR icon_window_atom;
+XFontSet ximFontSet;
+
/***********************************************************************
* is_window_managed
*
@@ -728,11 +730,26 @@
if (is_top_level)
{
XIM xim = x11drv_thread_data()->xim;
- if (xim) data->xic = XCreateIC( xim,
- XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
- XNClientWindow, data->whole_window,
- XNFocusWindow, data->whole_window,
- 0 );
+ if (xim){ // OVERTHESPOT STYLE support
+ XPoint spot = {0,0};
+ char * FontSet = "*-r-*";
+ char **missing_charsets;
+ int count;
+ ximFontSet = XCreateFontSet(display, FontSet, &missing_charsets,
+ &count, NULL);
+ XFreeStringList (missing_charsets);
+ XVaNestedList preedit = XVaCreateNestedList(0,
+ XNFontSet, ximFontSet,
+ XNSpotLocation, &spot,
+ NULL);
+ data->xic = XCreateIC( xim,
+ XNInputStyle, XIMPreeditPosition | XIMStatusNothing,
+ XNClientWindow, root_window,
+ XNFocusWindow, data->whole_window,
+ XNPreeditAttributes, preedit,
+ 0 );
+ }
+
}
/* non-maximized child must be at bottom of Z order */ |
|