Re: Lifting size limitation on X-to-GS copy & paste (was Re: [bug#4658] Broken gpbs when doing pb operations between GS and X)
Hi Fred, Fred Kiefer wrote: Hi Kazu, your proposed change overlapps with the changes I did do yesterday to get copy and paste to GNUstep working with my Emacs (21.2.1) again. So your patch needs a bit of rewritting to work in this changed environment (and not to break my Emacs again). I would also suggest not to read bigger and bigger junks of data, but to append each read junk to an NSMutableData object and read the next junk while supplying an offset. OK, it's easy. So I need to make another patch against the file in the current CVS, right? BTW. the long wainting on conversion failers has laos be removed through my patch (this was not part of the original plan, but it did anoy me as well). Great. Was the patch already committed? For the ignorance of the existing selection I have a strong feeling that this is caused by the method [XPbOwner initialize] not being called when gpbs is started. This could be changed by using different code in [PasteboardServer init]. Ja, I also feel we need to establish a server-client connection as soon as a client begin to run. Your idea sounds promising. I'll take a look at the code. Cheers, - Kazu ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Re: Lifting size limitation on X-to-GS copy & paste (was Re: [bug#4658] Broken gpbs when doing pb operations between GS and X)
I checked with Emacs and xedit and at least middle mouse copy works for both. For the Emacs copy wont work, which may be due to it using the wrong clipboard. For xedit I don't know how to do a copy. If you say that the last patch causes this behaviour could you cross check with an older version or try with setting GSOldClipboard to YES. Cheers Fred Kazunobu Kuriyama wrote: I'm afraid I have to withdraw all my words in the quoted email below. The gpbs in the current CVS doesn't do copy and paste from an X application (e.g., emacs, xedit) to a GNUstep one (even for Latin-1 characters), though the reverse is seemingly ok. The X's property sticks to text which has been selected with a GNUstep application. So, if the observation above is right, I don't think I need to modify the submitted patch in accordance with the modification you did. ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Re: Lifting size limitation on X-to-GS copy & paste (was Re: [bug#4658] Broken gpbs when doing pb operations between GS and X)
Hi Kazu, your proposed change overlapps with the changes I did do yesterday to get copy and paste to GNUstep working with my Emacs (21.2.1) again. So your patch needs a bit of rewritting to work in this changed environment (and not to break my Emacs again). I would also suggest not to read bigger and bigger junks of data, but to append each read junk to an NSMutableData object and read the next junk while supplying an offset. I wont have time for this changes today, so you either have to do them yourself or wait for another week. BTW. the long wainting on conversion failers has laos be removed through my patch (this was not part of the original plan, but it did anoy me as well). For the ignorance of the existing selection I have a strong feeling that this is caused by the method [XPbOwner initialize] not being called when gpbs is started. This could be changed by using different code in [PasteboardServer init]. Cheers Fred Kazunobu Kuriyama wrote: Hi, Attached is the patch fixing the bug that is pointed out by part of the bug report #4658: 2. It is not possible to copy from X and paste in GNUstep strings longer than 1024 characters. The patch is slightly better in memory management (preventing possible memory leak resulting from an error) than the one I sent a few hours ago. ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Re: Lifting size limitation on X-to-GS copy & paste (was Re: [bug#4658] Broken gpbs when doing pb operations between GS and X)
Fred Kiefer wrote: I checked with Emacs and xedit and at least middle mouse copy works for both. For the Emacs copy wont work, which may be due to it using the wrong clipboard. For xedit I don't know how to do a copy. If you say that the last patch causes this behaviour could you cross check with an older version or try with setting GSOldClipboard to YES. Cheers Fred No, I'm not talking about the middle mouse copy, but copy and paste from an X app to a GNUstep. Please make sure you can copy text on an X app and paste it on a GNUstep app. For xedit to copy text, specifying a region with mouse is enough (clicking mouse and then dragging it). I'll try GSOldClipboard, but I'm not sure this is a cause. As far as I checked, xSelectionNotify is not called when X-to-GS copy and paste is tried. Regards, - Kazu Kazunobu Kuriyama wrote: I'm afraid I have to withdraw all my words in the quoted email below. The gpbs in the current CVS doesn't do copy and paste from an X application (e.g., emacs, xedit) to a GNUstep one (even for Latin-1 characters), though the reverse is seemingly ok. The X's property sticks to text which has been selected with a GNUstep application. So, if the observation above is right, I don't think I need to modify the submitted patch in accordance with the modification you did. ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Lifting size limitation on X-to-GS copy & paste (was Re: [bug #4658]Broken gpbs when doing pb operations between GS and X)
Hi, Attached is the patch fixing the bug that is pointed out by part of the bug report #4658: 2. It is not possible to copy from X and paste in GNUstep strings longer than 1024 characters. The patch is slightly better in memory management (preventing possible memory leak resulting from an error) than the one I sent a few hours ago. 2003-08-09 Kazunobu Kuriyama <[EMAIL PROTECTED]> * Tools/xpbs.m ([XPbOwner -xSelectionNotify:]): Lift the size limitation imposed on XGetWindowProperty(). --- xpbs.m 2003-08-09 03:41:55.0 +0900 +++ xpbs.m.rev 2003-08-09 03:41:41.0 +0900 @@ -711,6 +711,7 @@ int actual_format; unsigned longbytes_remaining; unsigned longnumber_items; + long full_length; if ([self waitingForSelection] > xEvent->time) { @@ -722,62 +723,70 @@ /* * Read data from property identified in SelectionNotify event. */ - status = XGetWindowProperty(xDisplay, - xEvent->requestor, - xEvent->property, - 0L, // offset - FULL_LENGTH, - True, // Delete prop when read. - new_target, - &actual_target, - &actual_format, - &number_items, - &bytes_remaining, - &data); + full_length = FULL_LENGTH; + bytes_remaining = 0; + data = NULL; + do +{ + status = XGetWindowProperty(xDisplay, + xEvent->requestor, + xEvent->property, + 0L, // offset + full_length, + True, // Delete prop when read. + new_target, + &actual_target, + &actual_format, + &number_items, + &bytes_remaining, + &data); + + if (status != Success || + actual_target == None || + actual_format == 0 || + number_items == 0 || + actual_target != new_target) + { + NSLog(@"Unsupported data type from X selection."); + break; + } + else if (bytes_remaining > 0) + { + if (data) + { + XFree(data); + data = NULL; + } + full_length *= 2; + } +} + while (bytes_remaining > 0); - if ((status == Success) && (number_items > 0)) + if (status == Success && actual_target == new_target && number_items > 0) { -// Convert data to text string. -// string = PropertyToString(xDisplay,new_target,number_items,(char*)data); + NSData *d; + NSString *s; + d = [[NSData alloc] initWithBytes: (void *)data +length: number_items]; #ifdef X_HAVE_UTF8_STRING - if (actual_target == XG_UTF8_STRING) - { - NSData*d; - NSString *s; - - d = [[NSData alloc] initWithBytes: (void *)data -length: number_items]; - s = [[NSString alloc] initWithData: d - encoding: NSUTF8StringEncoding]; - RELEASE(d); - d = [NSSerializer serializePropertyList: s]; - RELEASE(s); - [self setData: d]; - } + s = [[NSString alloc] initWithData: d + encoding: NSUTF8StringEncoding]; #else // X_HAVE_UTF8_STRING not defined - if (new_target == XA_STRING) - { - NSData*d; - NSString *s; - - d = [[NSData alloc] initWithBytes: (void*)data - length: number_items]; - s = [[NSString alloc] initWithData: d - encoding: NSISOLatin1StringEncoding]; - RELEASE(d); - d = [NSSerializer serializePropertyList: s]; - RELEASE(s); - [self setData: d]; - } + s = [[NSString alloc] initWithData: d + encoding: NSISOLatin1StringEncoding]; #endif // X_HAVE_UTF8_STRING not defined - else - { - NSLog(@"Unsupported data type from X selection."); - } + RELEASE(d); + d = [NSSerializer serializePropertyList: s]; + RELEASE(s); + [self setData: d]; + +} - if (data) - XFree(data); + if (data) +{ + XFree(data); + data = NULL; } } ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
Re: Lifting size limitation on X-to-GS copy & paste (was Re: [bug#4658] Broken gpbs when doing pb operations between GS and X)
Hi Fred, I'm afraid I have to withdraw all my words in the quoted email below. The gpbs in the current CVS doesn't do copy and paste from an X application (e.g., emacs, xedit) to a GNUstep one (even for Latin-1 characters), though the reverse is seemingly ok. The X's property sticks to text which has been selected with a GNUstep application. So, if the observation above is right, I don't think I need to modify the submitted patch in accordance with the modification you did. Cheers, - Kazu -- Kazunobu Kuriyama wrote: Hi Fred, Fred Kiefer wrote: Hi Kazu, your proposed change overlapps with the changes I did do yesterday to get copy and paste to GNUstep working with my Emacs (21.2.1) again. So your patch needs a bit of rewritting to work in this changed environment (and not to break my Emacs again). I would also suggest not to read bigger and bigger junks of data, but to append each read junk to an NSMutableData object and read the next junk while supplying an offset. OK, it's easy. So I need to make another patch against the file in the current CVS, right? BTW. the long wainting on conversion failers has laos be removed through my patch (this was not part of the original plan, but it did anoy me as well). Great. Was the patch already committed? For the ignorance of the existing selection I have a strong feeling that this is caused by the method [XPbOwner initialize] not being called when gpbs is started. This could be changed by using different code in [PasteboardServer init]. Ja, I also feel we need to establish a server-client connection as soon as a client begin to run. Your idea sounds promising. I'll take a look at the code. Cheers, - Kazu ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep ___ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep