mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 19:59:17 +02:00
Gtk: fixed wrong result in TGtkWidgetSet.ClientToScreen() and TGtkWidgetSet.InvalidateRect() in case of TScrollingWinControl
git-svn-id: trunk@35882 -
This commit is contained in:
parent
c19754b22d
commit
47ff29d2a7
@ -248,14 +248,41 @@ end;
|
|||||||
function TGtkWidgetSet.ClientToScreen(Handle : HWND; var P : TPoint) : Boolean;
|
function TGtkWidgetSet.ClientToScreen(Handle : HWND; var P : TPoint) : Boolean;
|
||||||
var
|
var
|
||||||
Position: TPoint;
|
Position: TPoint;
|
||||||
Begin
|
LCLObject: TObject;
|
||||||
if Handle = 0
|
List: PGList;
|
||||||
then begin
|
i: Integer;
|
||||||
|
Pt: TPoint;
|
||||||
|
Adjustment: PGtkAdjustment;
|
||||||
|
Scrolled: PGtkScrolledWindow;
|
||||||
|
begin
|
||||||
|
if Handle = 0 then
|
||||||
|
begin
|
||||||
Position.X := 0;
|
Position.X := 0;
|
||||||
Position.Y := 0;
|
Position.Y := 0;
|
||||||
end
|
end else
|
||||||
else begin
|
begin
|
||||||
Position:=GetWidgetClientOrigin(PGtkWidget(Handle));
|
Position := GetWidgetClientOrigin(PGtkWidget(Handle));
|
||||||
|
LCLObject:=GetLCLObject(PGtkWidget(Handle));
|
||||||
|
if (LCLObject <> nil) and (LCLObject is TScrollingWinControl) then
|
||||||
|
begin
|
||||||
|
List := gtk_container_children(PGtkContainer(PGtkWidget(Handle)));
|
||||||
|
if (g_list_length(List) > 0) and
|
||||||
|
GTK_IS_SCROLLED_WINDOW(g_list_nth_data(List, 0)) then
|
||||||
|
begin
|
||||||
|
Scrolled := PGtkScrolledWindow(g_list_nth_data(List, 0));
|
||||||
|
Pt := Point(0, 0);
|
||||||
|
Adjustment := gtk_scrolled_window_get_vadjustment(Scrolled);
|
||||||
|
if Adjustment <> nil then
|
||||||
|
Pt.Y := Round(Adjustment^.value);
|
||||||
|
|
||||||
|
Adjustment := gtk_scrolled_window_get_hadjustment(Scrolled);
|
||||||
|
if Adjustment <> nil then
|
||||||
|
Pt.X := Round(Adjustment^.value);
|
||||||
|
dec(Position.X, Pt.X);
|
||||||
|
dec(Position.Y, Pt.Y);
|
||||||
|
end;
|
||||||
|
glib.g_list_free(List);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Inc(P.X, Position.X);
|
Inc(P.X, Position.X);
|
||||||
@ -6718,10 +6745,12 @@ var
|
|||||||
gdkRect : TGDKRectangle;
|
gdkRect : TGDKRectangle;
|
||||||
Widget, PaintWidget: PGtkWidget;
|
Widget, PaintWidget: PGtkWidget;
|
||||||
LCLObject: TObject;
|
LCLObject: TObject;
|
||||||
{$IfNDef GTK1}
|
|
||||||
WidgetInfo: PWidgetInfo;
|
|
||||||
{$ENDIF}
|
|
||||||
r: TRect;
|
r: TRect;
|
||||||
|
List: PGList;
|
||||||
|
i: Integer;
|
||||||
|
Pt: TPoint;
|
||||||
|
Adjustment: PGtkAdjustment;
|
||||||
|
Scrolled: PGtkScrolledWindow;
|
||||||
begin
|
begin
|
||||||
// DebugLn(format('Rect = %d,%d,%d,%d',[rect^.left,rect^.top,rect^.Right,rect^.Bottom]));
|
// DebugLn(format('Rect = %d,%d,%d,%d',[rect^.left,rect^.top,rect^.Right,rect^.Bottom]));
|
||||||
Widget:=PGtkWidget(aHandle);
|
Widget:=PGtkWidget(aHandle);
|
||||||
@ -6761,20 +6790,26 @@ begin
|
|||||||
gdkRect.Width := (Rect^.Right - Rect^.Left);
|
gdkRect.Width := (Rect^.Right - Rect^.Left);
|
||||||
gdkRect.Height := (Rect^.Bottom - Rect^.Top);
|
gdkRect.Height := (Rect^.Bottom - Rect^.Top);
|
||||||
|
|
||||||
{$IfNDef GTK1}
|
if LCLObject is TScrollingWinControl then
|
||||||
if (PaintWidget<>nil) and GTK_WIDGET_NO_WINDOW(PaintWidget)
|
begin
|
||||||
and (not GtkWidgetIsA(PGTKWidget(PaintWidget),GTKAPIWidget_GetType))
|
List := gtk_container_children(PGtkContainer(Widget));
|
||||||
and (Rect<>nil)
|
if (g_list_length(List) > 0) and
|
||||||
then begin
|
GTK_IS_SCROLLED_WINDOW(g_list_nth_data(List, 0)) then
|
||||||
Inc(gdkRect.X, PaintWidget^.Allocation.x);
|
begin
|
||||||
Inc(gdkRect.Y, PaintWidget^.Allocation.y);
|
Scrolled := PGtkScrolledWindow(g_list_nth_data(List, 0));
|
||||||
|
Pt := Point(0, 0);
|
||||||
|
Adjustment := gtk_scrolled_window_get_vadjustment(Scrolled);
|
||||||
|
if Adjustment <> nil then
|
||||||
|
Pt.Y := Round(Adjustment^.value);
|
||||||
|
|
||||||
|
Adjustment := gtk_scrolled_window_get_hadjustment(Scrolled);
|
||||||
|
if Adjustment <> nil then
|
||||||
|
Pt.X := Round(Adjustment^.value);
|
||||||
|
dec(gdkRect.X, Pt.X);
|
||||||
|
dec(gdkRect.Y, Pt.Y);
|
||||||
|
end;
|
||||||
|
g_list_free(List);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
WidgetInfo := GetWidgetInfo(Widget, False); // True ??
|
|
||||||
if WidgetInfo <> nil then
|
|
||||||
UnionRect(WidgetInfo^.UpdateRect, WidgetInfo^.UpdateRect, Rect^);
|
|
||||||
{$EndIf}
|
|
||||||
|
|
||||||
if bErase then
|
if bErase then
|
||||||
gtk_widget_queue_clear_area(PaintWidget,
|
gtk_widget_queue_clear_area(PaintWidget,
|
||||||
gdkRect.X,gdkRect.Y,gdkRect.Width,gdkRect.Height);
|
gdkRect.X,gdkRect.Y,gdkRect.Width,gdkRect.Height);
|
||||||
|
Loading…
Reference in New Issue
Block a user