SynEdit: Correctly set CaretRespondToFocus for gtk / workaround for QT

git-svn-id: trunk@27168 -
This commit is contained in:
martin 2010-08-22 22:54:14 +00:00
parent ccaef9ff49
commit bdcfa05b81
2 changed files with 6 additions and 20 deletions

View File

@ -7111,10 +7111,8 @@ begin
// (un)register HWND as drop target // (un)register HWND as drop target
if (eoDropFiles in ChangedOptions) and not (csDesigning in ComponentState) and HandleAllocated then if (eoDropFiles in ChangedOptions) and not (csDesigning in ComponentState) and HandleAllocated then
; // ToDo DragAcceptFiles ; // ToDo DragAcceptFiles
if (eoPersistentCaret in ChangedOptions) and HandleAllocated then begin if (eoPersistentCaret in ChangedOptions) and HandleAllocated then
FScreenCaret.PersistentCaret := eoPersistentCaret in fOptions;
UpdateCaret; UpdateCaret;
end;
if (eoShowSpecialChars in ChangedOptions) and HandleAllocated then if (eoShowSpecialChars in ChangedOptions) and HandleAllocated then
Invalidate; Invalidate;

View File

@ -273,7 +273,6 @@ type
{$IFDeF SynCaretDebug} {$IFDeF SynCaretDebug}
FDebugShowCount: Integer; FDebugShowCount: Integer;
{$ENDIF} {$ENDIF}
FPersistentCaret: Boolean;
FPixelWidth, FPixelHeight: Integer; FPixelWidth, FPixelHeight: Integer;
FOffsetX, FOffsetY: Integer; FOffsetX, FOffsetY: Integer;
FCurrentPosX, FCurrentPosY: Integer; FCurrentPosX, FCurrentPosY: Integer;
@ -286,7 +285,6 @@ type
procedure SetClipRect(const AValue: TRect); procedure SetClipRect(const AValue: TRect);
procedure SetClipTop(const AValue: Integer); procedure SetClipTop(const AValue: Integer);
procedure SetHandle(const AValue: HWND); procedure SetHandle(const AValue: HWND);
procedure SetPersistentCaret(const AValue: Boolean);
procedure UpdateDisplayType; procedure UpdateDisplayType;
procedure UpdateDisplay; procedure UpdateDisplay;
procedure ShowCaret; procedure ShowCaret;
@ -312,7 +310,6 @@ type
property ExtraLineChars: Integer read FExtraLineChars; // Extend the longest line by x chars property ExtraLineChars: Integer read FExtraLineChars; // Extend the longest line by x chars
property OnExtraLineCharsChanged: TNotifyEvent property OnExtraLineCharsChanged: TNotifyEvent
read FOnExtraLineCharsChanged write FOnExtraLineCharsChanged; read FOnExtraLineCharsChanged write FOnExtraLineCharsChanged;
property PersistentCaret: Boolean read FPersistentCaret write SetPersistentCaret;
end; end;
implementation implementation
@ -1554,7 +1551,6 @@ end;
constructor TSynEditScreenCaret.Create(AHandle: HWND); constructor TSynEditScreenCaret.Create(AHandle: HWND);
begin begin
inherited Create; inherited Create;
FPersistentCaret := False;
FHandle := AHandle; FHandle := AHandle;
FVisible := False; FVisible := False;
FCurrentVisible := False; FCurrentVisible := False;
@ -1700,18 +1696,6 @@ begin
UpdateDisplay; UpdateDisplay;
end; end;
procedure TSynEditScreenCaret.SetPersistentCaret(const AValue: Boolean);
begin
(* Do nothing, keep Value always False.
Most Widgetsets do not even implement it. SynEdit handles it in WMSetFocus/WMKillFocus
QT goes weird, if it is set
*)
//if FPersistentCaret = AValue then exit;
//FPersistentCaret := AValue;
//if FCurrentCreated then
// SetCaretRespondToFocus(Handle, not FPersistentCaret);
end;
procedure TSynEditScreenCaret.SetClipBottom(const AValue: Integer); procedure TSynEditScreenCaret.SetClipBottom(const AValue: Integer);
begin begin
if FClipBottom = AValue then exit; if FClipBottom = AValue then exit;
@ -1789,7 +1773,11 @@ begin
FCurrentVisible := False; FCurrentVisible := False;
FCurrentClippedWidth := w; FCurrentClippedWidth := w;
FCurrentPosX := x - 1; FCurrentPosX := x - 1;
SetCaretRespondToFocus(Handle, not FPersistentCaret); {$IFDEF LCLQT}
SetCaretRespondToFocus(Handle, True); // See bug 17173
{$ELSE}
SetCaretRespondToFocus(Handle, False); // Only for GTK
{$ENDIF}
end; end;
if (x <> FCurrentPosX) or (y <> FCurrentPosY) then begin if (x <> FCurrentPosX) or (y <> FCurrentPosY) then begin
{$IFDeF SynCaretDebug} {$IFDeF SynCaretDebug}