LCL-GTK3: Fix TPanel paint. Issue #38562, patch from Anton Kavalenka.

git-svn-id: trunk@64740 -
This commit is contained in:
juha 2021-03-03 15:45:13 +00:00
parent bb79fd08da
commit aa364c1cfc
3 changed files with 29 additions and 6 deletions

View File

@ -693,6 +693,8 @@ begin
Height := R.Bottom - R.Top;
end;
WorkMask:=nil;
if (Width = Image.Width) and (Height = Image.Height) then
begin
WorkImage := Image;
@ -745,6 +747,7 @@ begin
if InvertPixels then
WorkMask.invertPixels(QImageInvertRGB);
*)
if WorkMask.bits<>nil then
Move(WorkMask.bits^, ARawImage.Mask^, ARawImage.MaskSize);
// if InvertPixels then
// WorkMask.invertPixels(QImageInvertRGB);

View File

@ -1712,11 +1712,14 @@ begin
Result := False;
FillChar(Msg, SizeOf(Msg), #0);
if Event^.type_ = GDK_ENTER_NOTIFY then
Msg.Msg := LM_MOUSEENTER
begin
Msg.Msg := LM_MOUSEENTER;
NotifyApplicationUserInput(LCLObject, Msg.Msg);
end
else
Msg.Msg := LM_MOUSELEAVE;
NotifyApplicationUserInput(LCLObject, Msg.Msg);
//NotifyApplicationUserInput(LCLObject, Msg.Msg);
Result := DeliverMessage(Msg, True) <> 0;
{$IFDEF GTK3DEBUGCORE}
MousePos.X := Round(Event^.crossing.x);
@ -2838,6 +2841,12 @@ var
Alloc: TGtkAllocation;
AMinSize, ANaturalSize: gint;
begin
if Self is TGtk3Button then
begin
dec(Awidth,4);
dec(Aheight,4);
end;
ARect.x := ALeft;
ARect.y := ATop;
ARect.width := AWidth;
@ -2855,6 +2864,9 @@ begin
Widget^.get_preferred_width(@AMinSize, @ANaturalSize);
Widget^.get_preferred_height(@AMinSize, @ANaturalSize);
Widget^.set_size_request(AWidth,AHeight);
Widget^.size_allocate(@ARect);
Widget^.set_allocation(@Alloc);
if LCLObject.Parent <> nil then
@ -3106,12 +3118,19 @@ var
begin
FHasPaint := True;
FBorderStyle := bsNone;
// wtLayout = using GtkLayout
// FWidgetType := [wtWidget, wtLayout];
// Result := TGtkLayout.new(nil, nil);
FWidgetType := [wtWidget, wtContainer];
Result := TGtkFixed.new;
Result := TGtkFixed.new();
Result^.set_has_window(True);
// as GtkFixed have no child control here - nobody triggers resizing
// GNOME takes care of it, but other WM - not
// this is here to make TGtk3Panel shown under Plasma
Result^.set_size_request(LCLObject.Width,LCLObject.Height);
// AColor := Result^.style^.bg[0];
// writeln('BG COLOR R=',AColor.red,' G=',AColor.green,' B=',AColor.blue);
// now we make panel completely transparent.
@ -3184,7 +3203,7 @@ begin
fWidgetRGBA[0].Alpha:=0.7;
PgtkFrame(Result)^.override_color(GTK_STATE_NORMAL,@Self.FWidgetRGBA[0]);}
// nil resets color to gtk default
FWidget^.override_background_color(GTK_STATE_FLAG_NORMAL, nil);
//FWidget^.override_background_color(GTK_STATE_FLAG_NORMAL, nil);
end;
function TGtk3GroupBox.getText: String;
@ -7085,7 +7104,7 @@ begin
if not Assigned(LCLObject.Parent) then
begin
Result := TGtkWindow.new(GTK_WINDOW_TOPLEVEL);
Result^.set_size_request(0,0);
//Result^.set_size_request(0,0);
gtk_widget_realize(Result);
decor:=decoration_flags(AForm);
gdk_window_set_decorations(Result^.window, decor);

View File

@ -3199,6 +3199,7 @@ begin
Result := AWidget <> nil;
if Result then
begin
if AWidget.Widget = nil then exit;
if AWidget.GetContainerWidget^.has_grab then
gtk_grab_remove(AWidget.GetContainerWidget)
else
@ -3418,7 +3419,7 @@ begin
if IsValidHandle(AHandle) then
begin
TGtk3Widget(AHandle).SetCapture;
if (Result <> 0) then
//if (Result <> 0) then
begin
Message.Msg := 0;
FillChar(Message, SizeOf(Message), 0);