diff --git a/lcl/interfaces/gtk/gtkdevicecontext.inc b/lcl/interfaces/gtk/gtkdevicecontext.inc index f8cca72a9c..05d796e58f 100644 --- a/lcl/interfaces/gtk/gtkdevicecontext.inc +++ b/lcl/interfaces/gtk/gtkdevicecontext.inc @@ -50,7 +50,7 @@ end; ------------------------------------------------------------------------------} function TGtkDeviceContext.GetOffset: TPoint; var - Fixed : Pointer; + Fixed: Pointer; Adjustment: PGtkAdjustment; begin if Self = nil @@ -61,20 +61,26 @@ begin end; Result := FOrigin; - {$ifdef GTK2} - if (FWidget <> nil) - and GTK_WIDGET_NO_WINDOW(FWidget) - and not GtkWidgetIsA(FWidget, GTKAPIWidget_GetType) - then begin - Inc(Result.X, FWidget^.Allocation.x); - Inc(Result.y, FWidget^.Allocation.y); + {$ifndef gtk1} + if (FWidget <> nil) then + begin + Fixed := GetFixedWidget(FWidget); + if GTK_WIDGET_NO_WINDOW(FWidget) and + GTK_WIDGET_NO_WINDOW(Fixed) and + not GtkWidgetIsA(FWidget, GTKAPIWidget_GetType) then + begin + Inc(Result.X, FWidget^.Allocation.x); + Inc(Result.y, FWidget^.Allocation.y); + end; end; - {$endIf} + {$endif} if not FSpecialOrigin then Exit; if FWidget = nil then Exit; + {$ifdef gtk1} Fixed := GetFixedWidget(FWidget); + {$endif} if not GtkWidgetIsA(Fixed, GTK_LAYOUT_GET_TYPE) then Exit; Adjustment := gtk_layout_get_hadjustment(Fixed); diff --git a/lcl/interfaces/gtk/gtkproc.inc b/lcl/interfaces/gtk/gtkproc.inc index 40d0dac803..3ab8511e05 100644 --- a/lcl/interfaces/gtk/gtkproc.inc +++ b/lcl/interfaces/gtk/gtkproc.inc @@ -3957,9 +3957,10 @@ end; Get the gdkwindow of a widget. ------------------------------------------------------------------------------} -Function GetControlWindow(Widget: Pointer) : PGDKWindow; +function GetControlWindow(Widget: Pointer) : PGDKWindow; begin - If Widget <> nil then begin + if Widget <> nil then + begin If not GTKWidgetIsA(PGTKWidget(Widget), GTK_Layout_Get_Type) then Result := PGTKWidget(Widget)^.Window else @@ -3973,8 +3974,6 @@ begin end; - - {------------------------------------------------------------------------------ function CreateWidgetInfo(const AWidget: Pointer): PWidgetInfo; @@ -7006,7 +7005,7 @@ begin {$IFDEF Gtk2} if (Widget^.parent<>nil) and GtkWidgetIsA(Widget^.parent,GTK_TYPE_FIXED) - and not gtk_fixed_get_has_window(PGtkFixed(Widget^.parent)) + and GTK_WIDGET_NO_WINDOW(Widget^.parent) then begin inc(LCLLeft, Widget^.parent^.allocation.x); inc(LCLTop, Widget^.parent^.allocation.y); @@ -7117,7 +7116,7 @@ begin else if (aWidget^.parent<>nil) and GtkWidgetIsA(aWidget^.parent,GTK_TYPE_FIXED) - and not gtk_fixed_get_has_window(PGtkFixed(aWidget^.parent)) + and GTK_WIDGET_NO_WINDOW(aWidget^.parent) then begin // widget on a fixed, but fixed w/o window Dec(Left, PGtkWidget(aWidget^.parent)^.allocation.x); diff --git a/lcl/interfaces/gtk/gtkwidgetset.inc b/lcl/interfaces/gtk/gtkwidgetset.inc index ded9a579e7..6ca9264109 100644 --- a/lcl/interfaces/gtk/gtkwidgetset.inc +++ b/lcl/interfaces/gtk/gtkwidgetset.inc @@ -3195,7 +3195,7 @@ begin if ALCLObject is TCustomListBox then gMouse:=gMain; {$ELSE} - if GTK_IS_FIXED(gMouse) and not gtk_fixed_get_has_window(PGtkFixed(gMouse)) then + if GTK_IS_FIXED(gMouse) and GTK_WIDGET_NO_WINDOW(gMouse) then begin gTemp := PGtkObject(gtk_widget_get_parent(PGtkWidget(gMouse))); //DebugLn(gtk_type_name(g_object_type(gMouse)) + ' => ' + gtk_type_name(g_object_type(gTemp)));