1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-11-23 21:34:53 +02:00

Update to CEF 132.3.2

This commit is contained in:
Salvador Díaz Fau
2025-02-04 15:00:27 +01:00
parent f0f4de8b3b
commit 9e25a062b0
5 changed files with 114 additions and 13 deletions

View File

@@ -16,6 +16,7 @@ uses
{$IFDEF MSWINDOWS}Windows, imm, {$ENDIF} Classes, Forms, Controls, Graphics,
{$IFDEF FPC}
LCLProc, LCLType, LCLIntf, LResources, LMessages, InterfaceBase, {$IFDEF MSWINDOWS}Win32Extra,{$ENDIF}
{$IFDEF LINUXFPC}Messages,{$ENDIF}
{$ELSE}
Messages,
{$ENDIF}
@@ -26,6 +27,10 @@ uses
type
TOnIMECommitTextEvent = procedure(Sender: TObject; const aText : ustring; const replacement_range : PCefRange; relative_cursor_pos : integer) of object;
TOnIMESetCompositionEvent = procedure(Sender: TObject; const aText : ustring; const underlines : TCefCompositionUnderlineDynArray; const replacement_range, selection_range : TCefRange) of object;
{$IFDEF LINUXFPC}
TOnIMEPreEditChangedEvent = procedure(Sender: TObject; aFlag: cardinal; const aPreEditText: ustring) of object;
TOnIMECommitEvent = procedure(Sender: TObject; const aCommitText: ustring) of object;
{$ENDIF}
{$IFDEF MSWINDOWS}
TOnHandledMessageEvent = procedure(Sender: TObject; var aMessage: TMessage; var aHandled : boolean) of object;
{$ENDIF}
@@ -61,6 +66,12 @@ type
{$ELSE}
FSyncObj : TCriticalSection;
{$ENDIF}
{$IFDEF LINUXFPC}
FOnIMEPreEditStart : TNotifyEvent;
FOnIMEPreEditEnd : TNotifyEvent;
FOnIMEPreEditChanged : TOnIMEPreEditChangedEvent;
FOnIMECommit : TOnIMECommitEvent;
{$ENDIF}
procedure CreateSyncObj;
@@ -106,6 +117,9 @@ type
procedure DoOnIMECommitText(const aText : ustring; const replacement_range : PCefRange; relative_cursor_pos : integer); virtual;
procedure DoOnIMESetComposition(const aText : ustring; const underlines : TCefCompositionUnderlineDynArray; const replacement_range, selection_range : TCefRange); virtual;
{$ENDIF}
{$IFDEF LINUXFPC}
procedure WMIMEComposition(var aMessage: TMessage); message LM_IM_COMPOSITION;
{$ENDIF}
public
constructor Create(AOwner: TComponent); override;
@@ -319,6 +333,52 @@ type
/// </remarks>
property OnPointerUpdate : TOnHandledMessageEvent read FOnPointerUpdate write FOnPointerUpdate;
{$ENDIF}
{$IFDEF LINUXFPC}
/// <summary>
/// The preedit-start signal is emitted when a new preediting sequence starts.
/// </summary>
/// <remarks>
/// <para><see href="https://docs.gtk.org/gtk4/class.IMContext.html">See the GtkIMContext article.</see></para>
/// <para><see href="https://docs.gtk.org/gtk4/signal.IMContext.preedit-start.html">See the preedit-start article.</see></para>
/// <para>This event is only triggered by Lazarus in GTK2 when WITH_GTK2_IM is defined.</para>
/// <para>You need to open IDE dialog "Tools / Configure 'Build Lazarus'", and there enable the define: WITH_GTK2_IM; then recompile the IDE.</para>
/// </remarks>
property OnIMEPreEditStart : TNotifyEvent read FOnIMEPreEditStart write FOnIMEPreEditStart;
/// <summary>
/// The preedit-end signal is emitted when a preediting sequence has been completed or canceled.
/// </summary>
/// <remarks>
/// <para><see href="https://docs.gtk.org/gtk4/class.IMContext.html">See the GtkIMContext article.</see></para>
/// <para><see href="https://docs.gtk.org/gtk4/signal.IMContext.preedit-end.html">See the preedit-end article.</see></para>
/// <para>This event is only triggered by Lazarus in GTK2 when WITH_GTK2_IM is defined.</para>
/// <para>You need to open IDE dialog "Tools / Configure 'Build Lazarus'", and there enable the define: WITH_GTK2_IM; then recompile the IDE.</para>
/// </remarks>
property OnIMEPreEditEnd : TNotifyEvent read FOnIMEPreEditEnd write FOnIMEPreEditEnd;
/// <summary>
/// The preedit-changed signal is emitted whenever the preedit sequence currently being entered has changed.
/// It is also emitted at the end of a preedit sequence, in which case gtk_im_context_get_preedit_string() returns the empty string.
/// </summary>
/// <remarks>
/// <para><see href="https://docs.gtk.org/gtk4/class.IMContext.html">See the GtkIMContext article.</see></para>
/// <para><see href="https://docs.gtk.org/gtk4/signal.IMContext.preedit-changed.html">See the preedit-changed article.</see></para>
/// <para>This event is only triggered by Lazarus in GTK2 when WITH_GTK2_IM is defined.</para>
/// <para>You need to open IDE dialog "Tools / Configure 'Build Lazarus'", and there enable the define: WITH_GTK2_IM; then recompile the IDE.</para>
/// </remarks>
property OnIMEPreEditChanged : TOnIMEPreEditChangedEvent read FOnIMEPreEditChanged write FOnIMEPreEditChanged;
/// <summary>
/// The commit signal is emitted when a complete input sequence has been entered by the user.
/// If the commit comes after a preediting sequence, the commit signal is emitted after preedit-end.
/// This can be a single character immediately after a key press or the final result of preediting.
/// Default handler: The default handler is called after the handlers added via g_signal_connect().
/// </summary>
/// <remarks>
/// <para><see href="https://docs.gtk.org/gtk4/class.IMContext.html">See the GtkIMContext article.</see></para>
/// <para><see href="https://docs.gtk.org/gtk4/signal.IMContext.commit.html">See the preedit-start article.</see></para>
/// <para>This event is only triggered by Lazarus in GTK2 when WITH_GTK2_IM is defined.</para>
/// <para>You need to open IDE dialog "Tools / Configure 'Build Lazarus'", and there enable the define: WITH_GTK2_IM; then recompile the IDE.</para>
/// </remarks>
property OnIMECommit : TOnIMECommitEvent read FOnIMECommit write FOnIMECommit;
{$ENDIF}
/// <summary>
/// Event triggered before the AlphaBlend call that transfer the web contents from the
/// bitmap buffer to the panel when the Transparent property is True.
@@ -486,6 +546,12 @@ begin
FSyncObj := nil;
FMustInitBuffer := True;
{$ENDIF}
{$IFDEF LINUXFPC}
FOnIMEPreEditStart := nil;
FOnIMEPreEditEnd := nil;
FOnIMEPreEditChanged := nil;
FOnIMECommit := nil;
{$ENDIF}
end;
destructor TBufferPanel.Destroy;
@@ -995,6 +1061,41 @@ begin
end;
{$ENDIF}
{$IFDEF LINUXFPC}
// The LM_IM_COMPOSITION message is only used by Lazarus in GTK2 when WITH_GTK2_IM is defined.
// You need to open IDE dialog "Tools / Configure 'Build Lazarus'", and there enable the define: WITH_GTK2_IM; then recompile the IDE.
procedure TBufferPanel.WMIMEComposition(var aMessage: TMessage);
var
TempText : ustring;
TempCommit : string;
begin
case aMessage.WPARAM of
GTK_IM_FLAG_START :
if assigned(FOnIMEPreEditStart) then
FOnIMEPreEditStart(self);
GTK_IM_FLAG_END :
if assigned(FOnIMEPreEditEnd) then
FOnIMEPreEditEnd(self);
GTK_IM_FLAG_COMMIT :
if assigned(FOnIMECommit) then
begin
TempCommit := pchar(aMessage.LPARAM);
TempText := UTF8Decode(TempCommit);
FOnIMECommit(self, TempText);
end;
else
if assigned(FOnIMEPreEditChanged) then
begin
TempText := UTF8Decode(pchar(aMessage.LPARAM));
FOnIMEPreEditChanged(self, aMessage.WPARAM, TempText);
end;
end;
end;
{$ENDIF}
function TBufferPanel.GetBufferBits : pointer;
begin
if (FBuffer <> nil) and (FBuffer.Height <> 0) then