mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-08 09:38:12 +02:00
Clipboard: fix trailing null issue for gtk2. Issue #0021453
git-svn-id: trunk@58530 -
This commit is contained in:
parent
0b86f592a2
commit
c3fff83320
@ -438,6 +438,7 @@ end;
|
||||
|
||||
procedure TClipboard.SetAsText(const Value: string);
|
||||
var s: string;
|
||||
i: Integer;
|
||||
begin
|
||||
//DebugLn('[TClipboard.SetAsText] A ',ClipboardTypeName[ClipboardType],' "',Value,'"');
|
||||
if Assigned(FOnRequest) then exit;
|
||||
@ -446,7 +447,10 @@ begin
|
||||
else
|
||||
s:=#0;
|
||||
Clear;
|
||||
SetBuffer(PredefinedClipboardFormat(pcfText),s[1],length(Value)+1);
|
||||
i := Length(Value);
|
||||
if ClipboardFormatNeedsNullByte(pcfText) then
|
||||
i := i + 1;
|
||||
SetBuffer(PredefinedClipboardFormat(pcfText),s[1],i);
|
||||
//DebugLn('[TClipboard.SetAsText] END ',ClipboardTypeName[ClipboardType],' "',Value,'"');
|
||||
end;
|
||||
|
||||
|
@ -90,6 +90,12 @@ begin
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
function TWidgetSet.ClipboardFormatNeedsNullByte(
|
||||
const AFormat: TPredefinedClipboardFormat): Boolean;
|
||||
begin
|
||||
Result := AFormat = pcfText;
|
||||
end;
|
||||
|
||||
//todo: remove ?
|
||||
function TWidgetSet.CreateEmptyRegion: hRGN;
|
||||
begin
|
||||
|
@ -91,6 +91,11 @@ begin
|
||||
Result := WidgetSet.ClipboardRegisterFormat(AMimeType);
|
||||
end;
|
||||
|
||||
function ClipboardFormatNeedsNullByte(const AFormat: TPredefinedClipboardFormat): Boolean;
|
||||
begin
|
||||
Result := WidgetSet.ClipboardFormatNeedsNullByte(AFormat);
|
||||
end;
|
||||
|
||||
function CreateEmptyRegion: hRGN;
|
||||
begin
|
||||
Result := WidgetSet.CreateEmptyRegion;
|
||||
|
@ -48,6 +48,7 @@ function ClipboardGetOwnerShip(ClipboardType: TClipboardType;
|
||||
OnRequestProc: TClipboardRequestEvent; FormatCount: integer;
|
||||
Formats: PClipboardFormat): boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
function ClipboardRegisterFormat(const AMimeType: string): TClipboardFormat; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
function ClipboardFormatNeedsNullByte(const AFormat: TPredefinedClipboardFormat): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
function CreateEmptyRegion: hRGN; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
function CreatePixmapIndirect(const Data: Pointer; const TransColor: Longint): HBITMAP; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
function CreateRegionCopy(SrcRGN: hRGN): hRGN; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||
|
@ -720,6 +720,12 @@ begin
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
function TGtk2WidgetSet.ClipboardFormatNeedsNullByte(
|
||||
const AFormat: TPredefinedClipboardFormat): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: ClipboardRegisterFormat
|
||||
Params: AMimeType
|
||||
|
@ -47,6 +47,7 @@ function ClipboardGetFormats(ClipboardType: TClipboardType;
|
||||
function ClipboardGetOwnerShip(ClipboardType: TClipboardType;
|
||||
OnRequestProc: TClipboardRequestEvent; FormatCount: integer;
|
||||
Formats: PClipboardFormat): boolean; override;
|
||||
function ClipboardFormatNeedsNullByte(const AFormat: TPredefinedClipboardFormat): Boolean; override;
|
||||
function ClipboardRegisterFormat(const AMimeType: string): TClipboardFormat; override;
|
||||
|
||||
function CombineRgn(Dest, Src1, Src2 : HRGN; fnCombineMode : Longint) : Longint; override;
|
||||
|
Loading…
Reference in New Issue
Block a user