gtk2: fix PaintTo (bug #0014201)

git-svn-id: trunk@20984 -
This commit is contained in:
paul 2009-07-28 04:02:20 +00:00
parent 19fef0b2ee
commit e97576c1c7

View File

@ -30,7 +30,7 @@ interface
uses
{$IFDEF GTK2}
Gtk2, Glib2, Gdk2,
Gtk2, Glib2, Gdk2, Gdk2Pixbuf,
{$ELSE}
Gtk, Glib, Gdk,
{$ENDIF}
@ -683,10 +683,22 @@ var
procedure PaintWindow(AWindow: PGdkWindow; AOffset: TPoint);
var
W, H: gint;
{$ifndef gtk1}
Pixbuf: PGdkPixbuf;
{$endif}
begin
gdk_window_get_size(AWindow, @W, @H);
{$ifdef gtk1}
gdk_window_copy_area(DC.Drawable, DC.GC, X, Y, AWindow,
AOffset.X, AOffset.Y, W, H);
{$else}
// for some reason gdk_window_copy_area does not work
Pixbuf := gdk_pixbuf_get_from_drawable(nil, AWindow, nil,
AOffset.X, AOffset.Y, 0, 0, W, H);
gdk_pixbuf_render_to_drawable(Pixbuf, DC.Drawable, DC.GC, 0, 0, X, Y,
-1, -1, GDK_RGB_DITHER_NONE, 0, 0);
gdk_pixbuf_unref(Pixbuf);
{$endif}
end;
procedure PaintWidget(AWidget: PGtkWidget);
@ -694,7 +706,7 @@ var
AOffset: TPoint;
AWindow: PGdkWindow;
begin
AWindow := AWidget^.window;
AWindow := GetControlWindow(AWidget);
AOffset := Point(AWidget^.allocation.x, AWidget^.allocation.y);
if AWindow <> nil then
@ -704,8 +716,7 @@ var
begin
if not WSCheckHandleAllocated(AWinControl, 'PaintTo')
then Exit;
PaintWidget(PGtkWidget(AWinControl.Handle));
PaintWidget(GetFixedWidget(PGtkWidget(AWinControl.Handle)));
end;
{ helper/common routines }