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

View File

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

View File

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