mirror of
https://github.com/gnustep/libs-back.git
synced 2025-04-25 08:51:03 +00:00
XDnD improvements by Matt Rice.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@25071 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
110c5d2c78
commit
66caf72438
3 changed files with 91 additions and 36 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2007-04-24 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
|
* Source/x11/XGDragView.m (-sendExternalEvent:... toWindow:) Tell
|
||||||
|
xdnd about available types and selection owner.
|
||||||
|
* Source/x11/XGServerEvent.m (processEvent:): Handle case
|
||||||
|
SelectionRequest to get some simple xdnd support.
|
||||||
|
Based on a patch by Matt Rice <ratmice@yahoo.com>.
|
||||||
|
|
||||||
2007-04-14 Adam Fedor <fedor@gnu.org>
|
2007-04-14 Adam Fedor <fedor@gnu.org>
|
||||||
|
|
||||||
* Version: Bump version
|
* Version: Bump version
|
||||||
|
|
|
@ -278,6 +278,11 @@ static XGDragView *sharedDragView = nil;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GSAppKitDraggingEnter:
|
case GSAppKitDraggingEnter:
|
||||||
|
// FIXME: The first two lines need only be called once for every drag operation.
|
||||||
|
// They should be moved to a different method.
|
||||||
|
xdnd_set_selection_owner(&dnd, dragWindev->ident, typelist[0]);
|
||||||
|
xdnd_set_type_list(&dnd, dragWindev->ident, typelist);
|
||||||
|
|
||||||
xdnd_send_enter(&dnd, dWindowNumber, dragWindev->ident, typelist);
|
xdnd_send_enter(&dnd, dWindowNumber, dragWindev->ident, typelist);
|
||||||
xdnd_send_position(&dnd, dWindowNumber, dragWindev->ident,
|
xdnd_send_position(&dnd, dWindowNumber, dragWindev->ident,
|
||||||
GSActionForDragOperation (dragMask & operationMask),
|
GSActionForDragOperation (dragMask & operationMask),
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include <AppKit/NSApplication.h>
|
#include <AppKit/NSApplication.h>
|
||||||
#include <AppKit/NSGraphics.h>
|
#include <AppKit/NSGraphics.h>
|
||||||
#include <AppKit/NSMenu.h>
|
#include <AppKit/NSMenu.h>
|
||||||
|
#include <AppKit/NSPasteboard.h>
|
||||||
#include <AppKit/NSWindow.h>
|
#include <AppKit/NSWindow.h>
|
||||||
#include <Foundation/NSException.h>
|
#include <Foundation/NSException.h>
|
||||||
#include <Foundation/NSArray.h>
|
#include <Foundation/NSArray.h>
|
||||||
|
@ -1484,6 +1485,47 @@ static int check_modifier (XEvent *xEvent, KeySym key_sym,
|
||||||
case SelectionRequest:
|
case SelectionRequest:
|
||||||
NSDebugLLog(@"NSEvent", @"%d SelectionRequest\n",
|
NSDebugLLog(@"NSEvent", @"%d SelectionRequest\n",
|
||||||
xEvent.xselectionrequest.requestor);
|
xEvent.xselectionrequest.requestor);
|
||||||
|
{
|
||||||
|
NSPasteboard *pb = [NSPasteboard pasteboardWithName: NSDragPboard];
|
||||||
|
NSArray *types = [pb types];
|
||||||
|
NSData *data = nil;
|
||||||
|
Atom xType = xEvent.xselectionrequest.target;
|
||||||
|
static Atom XG_UTF8_STRING = None;
|
||||||
|
static Atom XG_TEXT = None;
|
||||||
|
|
||||||
|
if (XG_UTF8_STRING == None)
|
||||||
|
{
|
||||||
|
XG_UTF8_STRING = XInternAtom(dpy, "UTF8_STRING", False);
|
||||||
|
XG_TEXT = XInternAtom(dpy, "TEXT", False);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (((xType == XG_UTF8_STRING) ||
|
||||||
|
(xType == XA_STRING) ||
|
||||||
|
(xType == XG_TEXT)) &&
|
||||||
|
[types containsObject: NSStringPboardType])
|
||||||
|
{
|
||||||
|
NSString *s = [pb stringForType: NSStringPboardType];
|
||||||
|
|
||||||
|
if (xType == XG_UTF8_STRING)
|
||||||
|
{
|
||||||
|
data = [s dataUsingEncoding: NSUTF8StringEncoding];
|
||||||
|
}
|
||||||
|
else if ((xType == XA_STRING) || (xType == XG_TEXT))
|
||||||
|
{
|
||||||
|
data = [s dataUsingEncoding: NSISOLatin1StringEncoding];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// FIXME: Add support for more types. See: xpbs.m
|
||||||
|
|
||||||
|
if (data != nil)
|
||||||
|
{
|
||||||
|
DndClass dnd = xdnd();
|
||||||
|
|
||||||
|
// Send the data to the other process
|
||||||
|
xdnd_selection_send(&dnd, &xEvent.xselectionrequest,
|
||||||
|
(unsigned char *)[data bytes], [data length]);
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// We shouldn't get here unless we forgot to trap an event above
|
// We shouldn't get here unless we forgot to trap an event above
|
||||||
|
|
Loading…
Reference in a new issue