mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-04 15:38:18 +02:00
Gtk2: reset LastWFPResult used by WindowFromPoint() in case when shown/hidden,enabled/disabled,moved,resized widget overlaps current cache.Fixes issue #17389
git-svn-id: trunk@28288 -
This commit is contained in:
parent
db41426263
commit
9815e521d3
@ -690,6 +690,26 @@ begin
|
||||
Result := Info^.ChangeLock;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Reset cached LastWFPResult used by WindowFromPoint.LastWFPResult should be
|
||||
invalidated when some control at LastWFPMousePos is hidden, shown, enabled,
|
||||
disabled, moved.
|
||||
------------------------------------------------------------------------------}
|
||||
procedure InvalidateLastWFPResult(AControl: TWinControl; const ABounds: TRect);
|
||||
begin
|
||||
if PtInRect(ABounds, LastWFPMousePos) and
|
||||
GTK_IS_OBJECT(Pointer(LastWFPResult)) then
|
||||
begin
|
||||
if (AControl <> nil) and (AControl.Handle = LastWFPResult) and
|
||||
AControl.Enabled and AControl.Visible then
|
||||
exit;
|
||||
g_signal_handlers_disconnect_by_func(GPointer(LastWFPResult),
|
||||
TGTKSignalFunc(@DestroyWindowFromPointCB), nil);
|
||||
LastWFPResult := 0;
|
||||
LastWFPMousePos := Point(High(Integer), High(Integer));
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure SetFormShowInTaskbar(AForm: TCustomForm;
|
||||
const AValue: TShowInTaskbar);
|
||||
var
|
||||
|
@ -310,6 +310,7 @@ function WidgetIsDestroyingHandle(Widget: PGtkWidget): boolean;
|
||||
procedure SetWidgetIsDestroyingHandle(Widget: PGtkWidget);
|
||||
function ComponentIsDestroyingHandle(AWinControl: TWinControl): boolean;
|
||||
function LockOnChange(GtkObject: PGtkObject; LockOffset: integer): integer;
|
||||
procedure InvalidateLastWFPResult(AControl: TWinControl; const ABounds: TRect);
|
||||
|
||||
// glib
|
||||
procedure MoveGListLinkBehind(First, Item, After: PGList);
|
||||
|
@ -2677,6 +2677,7 @@ begin
|
||||
begin
|
||||
Result := not GTK_WIDGET_SENSITIVE(PGtkWidget(HWND));
|
||||
gtk_widget_set_sensitive(PGtkWidget(hWnd), bEnable);
|
||||
InvalidateLastWFPResult(nil, RectFromGdkRect(PGtkWidget(HWND)^.allocation));
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -591,6 +591,7 @@ class procedure TGtk2WSWinControl.ShowHide(const AWinControl: TWinControl);
|
||||
begin
|
||||
// other methods use ShowHide also, can't move code
|
||||
Gtk2WidgetSet.SetVisible(AWinControl, AWinControl.HandleObjectShouldBeVisible);
|
||||
InvalidateLastWFPResult(AWinControl, AWinControl.BoundsRect);
|
||||
end;
|
||||
|
||||
class procedure TGtk2WSWinControl.SetBounds(const AWinControl: TWinControl;
|
||||
@ -600,6 +601,7 @@ begin
|
||||
then Exit;
|
||||
|
||||
ResizeHandle(AWinControl);
|
||||
InvalidateLastWFPResult(AWinControl, Rect(ALeft, ATop, AWidth, AHeight));
|
||||
end;
|
||||
|
||||
|
||||
|
@ -620,6 +620,7 @@ begin
|
||||
GtkWindowShowModal(GtkWindow);
|
||||
end else
|
||||
Gtk2WidgetSet.SetVisible(AWinControl, AForm.HandleObjectShouldBeVisible);
|
||||
InvalidateLastWFPResult(AWinControl, AWinControl.BoundsRect);
|
||||
end;
|
||||
|
||||
class procedure TGtk2WSCustomForm.ShowModal(const AForm: TCustomForm);
|
||||
|
Loading…
Reference in New Issue
Block a user