mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 05:39:14 +02:00
gtk2,gtk3: gtk should always send LM_SETFOCUS before mouse messages, like Qt and Win32 does. issue #31900
git-svn-id: trunk@55062 -
This commit is contained in:
parent
47e4060861
commit
09f9152b29
@ -2114,22 +2114,26 @@ begin
|
|||||||
|
|
||||||
MessI.Result:=0;
|
MessI.Result:=0;
|
||||||
|
|
||||||
{always send LM_SETFOCUS first}
|
{Gtk2 should always send LM_SETFOCUS first, as qt and win32 does. issues #24308, #31900}
|
||||||
if ((MessI.Msg = LM_LBUTTONDOWN) or (MessI.Msg = LM_RBUTTONDOWN) or
|
if ((MessI.Msg = LM_LBUTTONDOWN) or (MessI.Msg = LM_RBUTTONDOWN) or
|
||||||
(MessI.Msg = LM_MBUTTONDOWN) or (MessI.Msg = LM_LBUTTONDBLCLK) or
|
(MessI.Msg = LM_MBUTTONDOWN) or (MessI.Msg = LM_LBUTTONDBLCLK) or
|
||||||
(MessI.Msg = LM_XBUTTONDOWN)) and
|
(MessI.Msg = LM_XBUTTONDOWN)) and
|
||||||
not AWinControl.Focused and AWinControl.CanFocus and
|
not AWinControl.Focused and AWinControl.CanFocus and
|
||||||
not (csDesigning in AWinControl.ComponentState) and (AWinControl is TCustomEdit) then
|
not (csDesigning in AWinControl.ComponentState) then
|
||||||
begin
|
begin
|
||||||
AClipText := '';
|
if (AWinControl is TCustomEdit) then
|
||||||
AClip := gtk_clipboard_get(GDK_SELECTION_PRIMARY);
|
begin
|
||||||
if gtk_clipboard_get_owner(AClip) = AClip then
|
AClipText := '';
|
||||||
AClip := nil;
|
AClip := gtk_clipboard_get(GDK_SELECTION_PRIMARY);
|
||||||
if (AClip <> nil) and gtk_clipboard_wait_is_text_available(AClip) then
|
if gtk_clipboard_get_owner(AClip) = AClip then
|
||||||
AClipText := gtk_clipboard_wait_for_text(AClip);
|
AClip := nil;
|
||||||
LCLIntf.SetFocus(AWinControl.Handle);
|
if (AClip <> nil) and gtk_clipboard_wait_is_text_available(AClip) then
|
||||||
if Assigned(AClip) then
|
AClipText := gtk_clipboard_wait_for_text(AClip);
|
||||||
gtk_clipboard_set_text(AClip, PgChar(AClipText), length(AClipText));
|
LCLIntf.SetFocus(AWinControl.Handle);
|
||||||
|
if Assigned(AClip) then
|
||||||
|
gtk_clipboard_set_text(AClip, PgChar(AClipText), length(AClipText));
|
||||||
|
end else
|
||||||
|
LCLIntf.SetFocus(AWinControl.Handle);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// send the message directly to the LCL
|
// send the message directly to the LCL
|
||||||
|
@ -2130,6 +2130,15 @@ begin
|
|||||||
Msg.Msg := LM_MBUTTONUP;
|
Msg.Msg := LM_MBUTTONUP;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{Issues #24308,#21900. Gtk should always send LM_SETFOCUS before LM_XXXX - mouse click}
|
||||||
|
if ((Msg.Msg = LM_LBUTTONDOWN) or (Msg.Msg = LM_RBUTTONDOWN) or
|
||||||
|
(Msg.Msg = LM_MBUTTONDOWN) or (Msg.Msg = LM_LBUTTONDBLCLK) or
|
||||||
|
(Msg.Msg = LM_XBUTTONDOWN)) and Assigned(LCLObject) and
|
||||||
|
not LCLObject.Focused and LCLObject.CanFocus and
|
||||||
|
not (csDesigning in LCLObject.ComponentState) then
|
||||||
|
LCLIntf.SetFocus(LCLObject.Handle);
|
||||||
|
|
||||||
{$IF DEFINED(GTK3DEBUGEVENTS) OR DEFINED(GTK3DEBUGMOUSE)}
|
{$IF DEFINED(GTK3DEBUGEVENTS) OR DEFINED(GTK3DEBUGMOUSE)}
|
||||||
DebugLn('TGtk3Widget.GtkEventMouse ',dbgsName(LCLObject),
|
DebugLn('TGtk3Widget.GtkEventMouse ',dbgsName(LCLObject),
|
||||||
' msg=',dbgs(msg.Msg), ' point=',dbgs(Msg.XPos),',',dbgs(Msg.YPos));
|
' msg=',dbgs(msg.Msg), ' point=',dbgs(Msg.XPos),',',dbgs(Msg.YPos));
|
||||||
|
Loading…
Reference in New Issue
Block a user