diff options
author | Graeme Geldenhuys <graemeg@gmail.com> | 2010-09-23 00:01:16 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-09-23 16:24:42 +0200 |
commit | 3947adbf908d2f76c9b966f71eceda23ee430c8a (patch) | |
tree | 97038af2e8259ed016cb4fbb07fe1fd0dc11a88f /src | |
parent | 7e1fc68c8697935f4401cd4b0ac5484ba5245657 (diff) | |
download | fpGUI-3947adbf908d2f76c9b966f71eceda23ee430c8a.tar.xz |
HandleSelectionRequest now correctly returns 'html' or 'plain text' data.
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/x11/fpg_x11.pas | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/corelib/x11/fpg_x11.pas b/src/corelib/x11/fpg_x11.pas index e7a74db5..f0cfe82a 100644 --- a/src/corelib/x11/fpg_x11.pas +++ b/src/corelib/x11/fpg_x11.pas @@ -3328,6 +3328,7 @@ end; procedure TfpgX11Drag.HandleSelectionRequest(ev: TXEvent); var e: TXSelectionEvent; + s: string; begin e._type := SelectionNotify; e.requestor := ev.xselectionrequest.requestor; @@ -3336,8 +3337,24 @@ begin e.time := ev.xselectionrequest.time; e._property := ev.xselectionrequest._property; - XChangeProperty(xapplication.Display, e.requestor, e._property, e.target, - 8, PropModeReplace, PByte(@FMimeData.Text[1]), Length(FMimeData.Text)); + s := XGetAtomName(xapplication.Display, e.target); + if FMimeData.HasFormat(s) then + begin + if s = 'text/plain' then + XChangeProperty(xapplication.Display, e.requestor, e._property, e.target, + 8, PropModeReplace, PByte(@FMimeData.Text[1]), Length(FMimeData.Text)) + else if s = 'text/html' then + begin + XChangeProperty(xapplication.Display, e.requestor, e._property, e.target, + 8, PropModeReplace, PByte(@FMimeData.HTML[1]), Length(FMimeData.HTML)) + + end + else + { TODO: for now we immediately fall back to text/plain type } + XChangeProperty(xapplication.Display, e.requestor, e._property, e.target, + 8, PropModeReplace, PByte(@FMimeData.Text[1]), Length(FMimeData.Text)) + + end; XSendEvent(xapplication.Display, e.requestor, false, NoEventMask, @e ); end; |