This patch seems to be ignored. I submit it again.
Or could anyone give some clues on how to improve it?
When copy text from wine to KDE programs, I only got
unreadable characters and vice versa. This patch
solves this.
CHANGELOG:
- dlls/x11drv/clipboard.c
Add support for QT's "text/plain" property to
support for copying CJK text from KDE programs to
wine;
In X11DRV_CLIPBOARD_CacheDataFormats, exit for loop
after getting the first recognized format;
Remove unused variable lRequestLength.
- dlls/x11drv/event.c
Add COMPOUND_TEXT property for STRING additionally
to support for copying CJK text from wine to KDE programs.
__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com
Index: dlls/x11drv/clipboard.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/clipboard.c,v
retrieving revision 1.8
diff -u -r1.8 clipboard.c
--- dlls/x11drv/clipboard.c 23 Jan 2003 21:32:35 -0000 1.8
+++ dlls/x11drv/clipboard.c 5 Apr 2003 12:04:38 -0000
@@ -127,7 +127,7 @@
return 0;
else if ( 0 == strncmp(itemFmtName, FMT_PREFIX, strlen(FMT_PREFIX)) )
return RegisterClipboardFormatA(itemFmtName + strlen(FMT_PREFIX));
- else if ( 0 == strcmp(itemFmtName, "STRING") )
+ else if ( 0 == strcmp(itemFmtName, "STRING") || 0 == strcmp(itemFmtName, "text/plain"))
return CF_UNICODETEXT;
else if ( 0 == strcmp(itemFmtName, "PIXMAP")
|| 0 == strcmp(itemFmtName, "BITMAP") )
@@ -482,6 +482,7 @@
lpFormat->drvData = targetList[i];
TRACE("\tAtom# %d: '%s' --> FormatID(%d) %s\n",
i, itemFmtName, wFormat, lpFormat->Name);
+ break; //Exit after getting the First recognized format
}
}
@@ -510,7 +511,7 @@
Atom atype=AnyPropertyType;
int aformat;
unsigned long total,nitems,remain,itemSize,val_cnt;
- long lRequestLength,bwc;
+ long bwc;
unsigned char* val;
unsigned char* buffer;
LPWINE_CLIPFORMAT lpFormat;
@@ -544,7 +545,6 @@
}
TRACE("\tretrieving %ld bytes...\n", itemSize * aformat/8);
- lRequestLength = (itemSize * aformat/8)/4 + 1;
bwc = aformat/8;
/* we want to read the property, but not it too large of chunks or
@@ -583,8 +583,10 @@
* Translate the X property into the appropriate Windows clipboard
* format, if possible.
*/
- if ( (reqType == XA_STRING)
- && (atype == XA_STRING) && (aformat == 8) )
+ char *itemFmtName = TSXGetAtomName(display, atype);
+ if ( ( ((reqType == XA_STRING) && (atype == XA_STRING) )
+ || strcmp(itemFmtName, "text/plain") == 0 )
+ && (aformat == 8) )
/* convert Unix text to CF_UNICODETEXT */
{
int i,inlcount = 0;
Index: dlls/x11drv/event.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/event.c,v
retrieving revision 1.18
diff -u -r1.18 event.c
--- dlls/x11drv/event.c 23 Jan 2003 01:29:58 -0000 1.18
+++ dlls/x11drv/event.c 5 Apr 2003 12:04:38 -0000
@@ -610,6 +610,10 @@
}
if (!bExists)
{
+ /* Add COMPOUND_TEXT prop for STRING additionally */
+ if (prop == XA_STRING)
+ targets[cTargets++] = TSXInternAtom(display, "COMPOUND_TEXT", False);
+
targets[cTargets++] = prop;
/* Add PIXMAP prop for bitmaps additionally */
@@ -721,7 +725,7 @@
/* Update the X property */
TRACE("\tUpdating property %s...\n", TSXGetAtomName(display, rprop));
xRc = TSXChangeProperty(display, requestor, rprop,
- XA_STRING, 8, PropModeReplace,
+ target, 8, PropModeReplace,
lpstr, j);
TRACE("(Rc=%d)\n", xRc);
@@ -1007,7 +1011,7 @@
Atom xaClipboard = TSXInternAtom(display, "CLIPBOARD", False);
Atom xaTargets = TSXInternAtom(display, "TARGETS", False);
Atom xaMultiple = TSXInternAtom(display, "MULTIPLE", False);
-
+ Atom xaCompoud = TSXInternAtom(display, "COMPOUND_TEXT", True);
/*
* We can only handle the selection request if :
* The selection is PRIMARY or CLIPBOARD, AND we can successfully open the clipboard.
@@ -1038,7 +1042,7 @@
/* MULTIPLE selection request */
rprop = EVENT_SelectionRequest_MULTIPLE( hWnd, event );
}
- else if(event->target == XA_STRING) /* treat CF_TEXT as Unix text */
+ else if(event->target == XA_STRING || event->target == xaCompoud) /* treat CF_TEXT as Unix text */
{
/* XA_STRING selection request */
rprop = EVENT_SelectionRequest_STRING( display, request, event->target, rprop );