mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-05 02:37:37 +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;
|
Result := Info^.ChangeLock;
|
||||||
end;
|
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;
|
procedure SetFormShowInTaskbar(AForm: TCustomForm;
|
||||||
const AValue: TShowInTaskbar);
|
const AValue: TShowInTaskbar);
|
||||||
var
|
var
|
||||||
|
@ -310,6 +310,7 @@ function WidgetIsDestroyingHandle(Widget: PGtkWidget): boolean;
|
|||||||
procedure SetWidgetIsDestroyingHandle(Widget: PGtkWidget);
|
procedure SetWidgetIsDestroyingHandle(Widget: PGtkWidget);
|
||||||
function ComponentIsDestroyingHandle(AWinControl: TWinControl): boolean;
|
function ComponentIsDestroyingHandle(AWinControl: TWinControl): boolean;
|
||||||
function LockOnChange(GtkObject: PGtkObject; LockOffset: integer): integer;
|
function LockOnChange(GtkObject: PGtkObject; LockOffset: integer): integer;
|
||||||
|
procedure InvalidateLastWFPResult(AControl: TWinControl; const ABounds: TRect);
|
||||||
|
|
||||||
// glib
|
// glib
|
||||||
procedure MoveGListLinkBehind(First, Item, After: PGList);
|
procedure MoveGListLinkBehind(First, Item, After: PGList);
|
||||||
|
@ -2677,6 +2677,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
Result := not GTK_WIDGET_SENSITIVE(PGtkWidget(HWND));
|
Result := not GTK_WIDGET_SENSITIVE(PGtkWidget(HWND));
|
||||||
gtk_widget_set_sensitive(PGtkWidget(hWnd), bEnable);
|
gtk_widget_set_sensitive(PGtkWidget(hWnd), bEnable);
|
||||||
|
InvalidateLastWFPResult(nil, RectFromGdkRect(PGtkWidget(HWND)^.allocation));
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -591,6 +591,7 @@ class procedure TGtk2WSWinControl.ShowHide(const AWinControl: TWinControl);
|
|||||||
begin
|
begin
|
||||||
// other methods use ShowHide also, can't move code
|
// other methods use ShowHide also, can't move code
|
||||||
Gtk2WidgetSet.SetVisible(AWinControl, AWinControl.HandleObjectShouldBeVisible);
|
Gtk2WidgetSet.SetVisible(AWinControl, AWinControl.HandleObjectShouldBeVisible);
|
||||||
|
InvalidateLastWFPResult(AWinControl, AWinControl.BoundsRect);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TGtk2WSWinControl.SetBounds(const AWinControl: TWinControl;
|
class procedure TGtk2WSWinControl.SetBounds(const AWinControl: TWinControl;
|
||||||
@ -600,6 +601,7 @@ begin
|
|||||||
then Exit;
|
then Exit;
|
||||||
|
|
||||||
ResizeHandle(AWinControl);
|
ResizeHandle(AWinControl);
|
||||||
|
InvalidateLastWFPResult(AWinControl, Rect(ALeft, ATop, AWidth, AHeight));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@ -620,6 +620,7 @@ begin
|
|||||||
GtkWindowShowModal(GtkWindow);
|
GtkWindowShowModal(GtkWindow);
|
||||||
end else
|
end else
|
||||||
Gtk2WidgetSet.SetVisible(AWinControl, AForm.HandleObjectShouldBeVisible);
|
Gtk2WidgetSet.SetVisible(AWinControl, AForm.HandleObjectShouldBeVisible);
|
||||||
|
InvalidateLastWFPResult(AWinControl, AWinControl.BoundsRect);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TGtk2WSCustomForm.ShowModal(const AForm: TCustomForm);
|
class procedure TGtk2WSCustomForm.ShowModal(const AForm: TCustomForm);
|
||||||
|
Loading…
Reference in New Issue
Block a user