discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GNUstep paste board (Was: really attracting developers)


From: Fred Kiefer
Subject: Re: GNUstep paste board (Was: really attracting developers)
Date: Wed, 25 Apr 2007 02:18:36 +0200
User-agent: Thunderbird 1.5.0.10 (X11/20060911)

Hi Matt,

it took some time, but I finally did get around to commit part of your
changes to SVN. I changed the code slightly and there still is a lot to
do, but it is a start for DnD interaction with non-GNUstep applications.

Cheers,
Fred

Matt Rice wrote:
> --- Fred Kiefer <fredkiefer@gmx.de> wrote:
>> DND will be another big step. Here a whole rewrite
>> is needed. When we
>> tried to integrate GNUstep DND with X we did get it
>> completely wrong the
>> first time.
> 
> a while back i tried getting gnustep to work as a x
> 'dragging source' as we call it.. it still uses the
> outdated xdnd code but attached is what i ended up
> with and a dragging destination which also uses the
> outdated xdnd code from gnustep..
> 
> the whole thing inside the case SelectionRequest:
> needs to be rewritten doesnt do any of the conversion
> it should (file uris should have file:// etc and other
> conversion methods for other stuff...) 
> 
> i recall there being alot more to the patch than this
> but this is all there seemed to be... so hopefully its
> all here...
> 
> i also remember there being times when the code just
> magically didnt work.. 
> 
> hope it helps, dont forsee finishing it anytime soon
> if someone wants to pick it up...
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 
> 
> ------------------------------------------------------------------------
> 
> Index: Source/x11/XGServerEvent.m
> ===================================================================
> --- Source/x11/XGServerEvent.m        (revision 22775)
> +++ Source/x11/XGServerEvent.m        (working copy)
> @@ -30,6 +30,7 @@
>  #include <AppKit/NSGraphics.h>
>  #include <AppKit/NSMenu.h>
>  #include <AppKit/NSWindow.h>
> +#include <AppKit/NSPasteboard.h>
>  #include <Foundation/NSException.h>
>  #include <Foundation/NSArray.h>
>  #include <Foundation/NSDictionary.h>
> @@ -1294,10 +1295,34 @@
>         break;
>  
>       case SelectionRequest:
> -       NSDebugLLog(@"NSEvent", @"%d SelectionRequest\n",
> -                   xEvent.xselectionrequest.requestor);
> +       {
> +         DndClass dnd = xdnd();
> +         /* ugly hack alert delete all this stuff please*/
> +         NSPasteboard *pb = [NSPasteboard pasteboardWithName:NSDragPboard];
> +         NSArray *types = [pb types];
> +         NSLog(@"%@", [pb types]);
> +         NSData *data;
> +         if ([types count])
> +           {
> +             id uh = [pb propertyListForType:[types objectAtIndex:0]];
> +             if ([uh isKindOfClass:[NSArray class]])
> +               {
> +                 if ([uh count])
> +                 {
> +                   uh = [uh objectAtIndex:0];
> +                   
> +                 }
> +                 NSLog(@"%@", uh);
> +                 data = [uh dataUsingEncoding:NSASCIIStringEncoding 
> allowLossyConversion:YES];
> +               }
> +             xdnd_selection_send(&dnd, &xEvent.xselectionrequest, (unsigned 
> char *)[data bytes], [data length]);     
> +           }
> +         
> +         NSDebugLLog(@"NSEvent", @"%d SelectionRequest\n",
> +                     xEvent.xselectionrequest.requestor);
> +       }
>         break;
> -
> +         
>             // We shouldn't get here unless we forgot to trap an event above
>       default:
>  #ifdef XSHM
> Index: Source/x11/XGDragView.m
> ===================================================================
> --- Source/x11/XGDragView.m   (revision 22775)
> +++ Source/x11/XGDragView.m   (working copy)
> @@ -276,6 +276,7 @@
>       break;
>  
>        case GSAppKitDraggingEnter:
> +     xdnd_set_selection_owner(&dnd, dragWindev->ident, typelist[0]);
>       xdnd_send_enter(&dnd, dWindowNumber, dragWindev->ident, typelist);
>       xdnd_send_position(&dnd, dWindowNumber, dragWindev->ident,
>         GSActionForDragOperation (dragMask & operationMask),





reply via email to

[Prev in Thread] Current Thread [Next in Thread]