mirror of
https://github.com/gnustep/libs-back.git
synced 2025-02-24 04:11:28 +00:00
* Tools/xpbs.m: Get copy and paste of rich text from OpenOffice.org
to Ink working. - OOo uses the MIME type "text/richtext", so make that another alias for RTF - Fix an obscure bug in measuring the size of the return buffer of XGetWindowProperty. When an array of Atom's is returned xlib will claim that they are 32-bit when in fact they may be 64-bit. This was causing xpbs to miss half of the available types for a clipboard on 64-bit systems. - Don't use 'True' for the delete paramater of XGetWindowProperty. I'm not sure why we were deleting window properties before. gtk doesn't do that. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@33695 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
479d1a76ca
commit
624f34ea4f
2 changed files with 43 additions and 7 deletions
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
||||||
|
2011-08-04 Eric Wasylishen <ewasylishen@gmail.com>
|
||||||
|
|
||||||
|
* Tools/xpbs.m: Get copy and paste of rich text from OpenOffice.org
|
||||||
|
to Ink working.
|
||||||
|
|
||||||
|
- OOo uses the MIME type "text/richtext", so make that another alias for RTF
|
||||||
|
- Fix an obscure bug in measuring the size of the return buffer of
|
||||||
|
XGetWindowProperty. When an array of Atom's is returned xlib will claim
|
||||||
|
that they are 32-bit when in fact they may be 64-bit. This was causing
|
||||||
|
xpbs to miss half of the available types for a clipboard on 64-bit systems.
|
||||||
|
- Don't use 'True' for the delete paramater of XGetWindowProperty. I'm not sure
|
||||||
|
why we were deleting window properties before. gtk doesn't do that.
|
||||||
|
|
||||||
2011-08-01 Eric Wasylishen <ewasylishen@gmail.com>
|
2011-08-01 Eric Wasylishen <ewasylishen@gmail.com>
|
||||||
|
|
||||||
* configure.ac: Add a configure test for Xcursor
|
* configure.ac: Add a configure test for Xcursor
|
||||||
|
|
33
Tools/xpbs.m
33
Tools/xpbs.m
|
@ -77,6 +77,7 @@ static char *atom_names[] = {
|
||||||
"image/png",
|
"image/png",
|
||||||
"image/svg",
|
"image/svg",
|
||||||
"application/rtf",
|
"application/rtf",
|
||||||
|
"text/richtext"
|
||||||
};
|
};
|
||||||
static Atom atoms[sizeof(atom_names)/sizeof(char*)];
|
static Atom atoms[sizeof(atom_names)/sizeof(char*)];
|
||||||
|
|
||||||
|
@ -119,6 +120,7 @@ static Atom atoms[sizeof(atom_names)/sizeof(char*)];
|
||||||
#define XG_MIME_PNG atoms[32]
|
#define XG_MIME_PNG atoms[32]
|
||||||
#define XG_MIME_SVG atoms[33]
|
#define XG_MIME_SVG atoms[33]
|
||||||
#define XG_MIME_APP_RTF atoms[34]
|
#define XG_MIME_APP_RTF atoms[34]
|
||||||
|
#define XG_MIME_TEXT_RICHTEXT atoms[35]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -651,6 +653,8 @@ static NSString *xWaitMode = @"XPasteboardWaitMode";
|
||||||
[self requestData: XG_MIME_RTF];
|
[self requestData: XG_MIME_RTF];
|
||||||
if ([self data] == nil)
|
if ([self data] == nil)
|
||||||
[self requestData: XG_MIME_APP_RTF];
|
[self requestData: XG_MIME_APP_RTF];
|
||||||
|
if ([self data] == nil)
|
||||||
|
[self requestData: XG_MIME_TEXT_RICHTEXT];
|
||||||
}
|
}
|
||||||
else if ([type isEqual: NSTIFFPboardType])
|
else if ([type isEqual: NSTIFFPboardType])
|
||||||
{
|
{
|
||||||
|
@ -720,6 +724,8 @@ xErrorHandler(Display *d, XErrorEvent *e)
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
Atom *targets;
|
Atom *targets;
|
||||||
|
|
||||||
|
NSDebugLLog(@"Pbs", @"%@ availableTypes called", [[self osPb] name]);
|
||||||
|
|
||||||
[self setData: nil];
|
[self setData: nil];
|
||||||
[self requestData: XG_TARGETS];
|
[self requestData: XG_TARGETS];
|
||||||
data = [self data];
|
data = [self data];
|
||||||
|
@ -729,6 +735,9 @@ xErrorHandler(Display *d, XErrorEvent *e)
|
||||||
count = [data length] / sizeof(Atom);
|
count = [data length] / sizeof(Atom);
|
||||||
targets = (Atom*)[data bytes];
|
targets = (Atom*)[data bytes];
|
||||||
types = [NSMutableArray arrayWithCapacity: count];
|
types = [NSMutableArray arrayWithCapacity: count];
|
||||||
|
|
||||||
|
NSDebugLLog(@"Pbs", @"%@ availableTypes: %d types available", [[self osPb] name], count);
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
Atom type;
|
Atom type;
|
||||||
|
@ -747,7 +756,8 @@ xErrorHandler(Display *d, XErrorEvent *e)
|
||||||
[types addObject: NSFilenamesPboardType];
|
[types addObject: NSFilenamesPboardType];
|
||||||
}
|
}
|
||||||
else if ((type == XG_MIME_RTF)
|
else if ((type == XG_MIME_RTF)
|
||||||
|| (type == XG_MIME_APP_RTF))
|
|| (type == XG_MIME_APP_RTF)
|
||||||
|
|| (type == XG_MIME_TEXT_RICHTEXT))
|
||||||
{
|
{
|
||||||
[types addObject: NSRTFPboardType];
|
[types addObject: NSRTFPboardType];
|
||||||
}
|
}
|
||||||
|
@ -816,7 +826,7 @@ xErrorHandler(Display *d, XErrorEvent *e)
|
||||||
xEvent->property,
|
xEvent->property,
|
||||||
long_offset, // offset
|
long_offset, // offset
|
||||||
long_length,
|
long_length,
|
||||||
True, // Delete prop when read.
|
False, // Aug 2011 - changed to False (don't delete property)
|
||||||
req_type,
|
req_type,
|
||||||
&actual_type,
|
&actual_type,
|
||||||
&actual_format,
|
&actual_format,
|
||||||
|
@ -826,7 +836,17 @@ xErrorHandler(Display *d, XErrorEvent *e)
|
||||||
|
|
||||||
if ((status == Success) && (number_items > 0))
|
if ((status == Success) && (number_items > 0))
|
||||||
{
|
{
|
||||||
long count = number_items * actual_format / 8;
|
long count;
|
||||||
|
if (actual_type == XA_ATOM)
|
||||||
|
{
|
||||||
|
// xlib will report an actual_format of 32, even if
|
||||||
|
// data contains an array of 64-bit Atoms
|
||||||
|
count = number_items * sizeof(Atom);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
count = number_items * actual_format / 8;
|
||||||
|
}
|
||||||
|
|
||||||
if (md == nil)
|
if (md == nil)
|
||||||
{
|
{
|
||||||
|
@ -985,7 +1005,8 @@ xErrorHandler(Display *d, XErrorEvent *e)
|
||||||
RELEASE(url);
|
RELEASE(url);
|
||||||
}
|
}
|
||||||
else if ((actual_type == XG_MIME_RTF)
|
else if ((actual_type == XG_MIME_RTF)
|
||||||
|| (actual_type == XG_MIME_APP_RTF))
|
|| (actual_type == XG_MIME_APP_RTF)
|
||||||
|
|| (actual_type == XG_MIME_TEXT_RICHTEXT))
|
||||||
{
|
{
|
||||||
[self setData: md];
|
[self setData: md];
|
||||||
}
|
}
|
||||||
|
@ -1093,6 +1114,7 @@ xErrorHandler(Display *d, XErrorEvent *e)
|
||||||
{
|
{
|
||||||
xTypes[numTypes++] = XG_MIME_RTF;
|
xTypes[numTypes++] = XG_MIME_RTF;
|
||||||
xTypes[numTypes++] = XG_MIME_APP_RTF;
|
xTypes[numTypes++] = XG_MIME_APP_RTF;
|
||||||
|
xTypes[numTypes++] = XG_MIME_TEXT_RICHTEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([types containsObject: NSTIFFPboardType])
|
if ([types containsObject: NSTIFFPboardType])
|
||||||
|
@ -1319,7 +1341,8 @@ xErrorHandler(Display *d, XErrorEvent *e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (((xEvent->target == XG_MIME_RTF)
|
else if (((xEvent->target == XG_MIME_RTF)
|
||||||
|| (xEvent->target == XG_MIME_APP_RTF))
|
|| (xEvent->target == XG_MIME_APP_RTF)
|
||||||
|
|| (xEvent->target == XG_MIME_TEXT_RICHTEXT))
|
||||||
&& [types containsObject: NSRTFPboardType])
|
&& [types containsObject: NSRTFPboardType])
|
||||||
{
|
{
|
||||||
NSData *d = [_pb dataForType: NSRTFPboardType];
|
NSData *d = [_pb dataForType: NSRTFPboardType];
|
||||||
|
|
Loading…
Reference in a new issue