View Issue Details

IDProjectCategoryView StatusLast Update
0036826LazarusLCLpublic2020-04-27 14:45
ReporterChris Rorden Assigned To 
Status newResolutionopen 
Product Version2.1 (SVN) 
Summary0036826: GTK3 AutoSize TCheckListBox
DescriptionLatest SVN shows good progress on GTK3. This project shows issues with TCheckListBox where its size is not considered by widgets where position is set by anchor editor. Screenshot shows larger program that shows how this can make GTK3 unusable.
TagsNo tags attached.
Fixed in Revisionr62916
WidgetsetGTK 3
Attached Files


related to 0036744 closedJuha Manninen gtk3: First approach in implementing pattern brush 
related to 0036942 new GTK3: Anchor autosizing 


Chris Rorden

2020-03-25 15:55

reporter (109,798 bytes)
gtk_autosz.png (34,090 bytes)   
gtk_autosz.png (34,090 bytes)   

Anton Kavalenka

2020-03-25 16:22

reporter   ~0121710

Nothing wrong with TCheckListBox. The example slightly different from screenshot.

I see only jumping offsets of TLabel and wrong TButton size accounting.

Chris Rorden

2020-03-25 21:48

reporter   ~0121713

Anton, Thanks for looking at this. Please try out the new project that has one GroupBox with a CheckList and the other without. On lo-DPI the spacing looks fine without the CheckList, but both group both GroupBoxes are wrong on Hi-DPI. I redownloaded trunk and did 'make bigide', and updated Ubuntu 18.04. (109,877 bytes)
hi_dpi.png (48,508 bytes)   
hi_dpi.png (48,508 bytes)   
lo_dpi.png (54,357 bytes)   
lo_dpi.png (54,357 bytes)   

Anton Kavalenka

2020-04-07 18:25

reporter   ~0122007

This patch prevents label jumping (wrong paint offset) when buttons pressed.
gtk3widgets.diff (2,315 bytes)   
Index: lcl/interfaces/gtk3/gtk3widgets.pas
--- lcl/interfaces/gtk3/gtk3widgets.pas	(revision 62904)
+++ lcl/interfaces/gtk3/gtk3widgets.pas	(working copy)
@@ -1458,7 +1458,7 @@
   Msg.SizeType := Msg.SizeType or Size_SourceIsInterface;
-  if ACtl is TGtk3Window then
+  if {ACtl is TGtk3Window} ACtl.WidgetType*[wtWindow,wtDialog]<>[] then
     Msg.Width := Word(;
     Msg.Height := Word(;
@@ -1771,7 +1771,6 @@
   Msg: TLMPaint;
   AStruct: TPaintStruct;
-  P: TPoint;
   AClipRect: TGdkRectangle;
@@ -1810,39 +1809,6 @@
   Msg.PaintStruct^.rcPaint := PaintData.ClipRect^;
   Msg.PaintStruct^.hdc := FContext;
-  // P := Point(0, 0);
-  P := Self.getClientOffset;
-  if wtCustomControl in WidgetType then
-  begin
-    // ofsetting
-    P := Point(0, 0);
-    //TGtk3DeviceContext(Msg.DC).TranslateCairoToDevice;
-    //P.X := Round(TGtk3CustomControl(Self).getHorizontalScrollbar^.get_adjustment^.get_value);
-    //P.Y := Round(TGtk3CustomControl(Self).getVerticalScrollbar^.get_adjustment^.get_value);
-  end else
-  if wtScrollingWinControl in WidgetType then
-  begin
-    P := Point(0, 0);
-    //DebugLn('GtkEventPaint Scrollable ScrollX=',dbgs(TGtk3ScrollableWin(Self).ScrollX),
-    //  ' scrollY=',dbgs(TGtk3ScrollableWin(Self).ScrollY),' P=',dbgs(P));
-    //Inc(P.X, TGtk3ScrollableWin(Self).ScrollX);
-    //Inc(P.Y, TGtk3ScrollableWin(Self).ScrollY);
-    // cairo_surface_get_device_offset(cairo_get_target(AContext), @dx, @dy);
-    // TGtk3DeviceContext(Msg.DC).TranslateCairoToDevice;
-  end else
-  if wtGroupBox in WidgetType then
-  begin
-    // why is gtk3 so crazy about parent/child relation ?!?
-    // in this case child PGtkFixed has same top (+top caption) as parent TGtkFrame ... crap
-    // debugln('groupbox paint offset ',dbgs(p));
-    TGtk3DeviceContext(Msg.DC).TranslateCairoToDevice;
-    P := Point(0, 0);
-  end;
-  {$NOTE Currently TGtk3DeviceContext(Msg.DC).Translate(P) is creating incorrect offsets inside TPages for TLabel and maybe others}
-  TGtk3DeviceContext(Msg.DC).Translate(P);
       // DebugLn('**** Sending paint event to ',dbgsName(LCLObject),' clipRect=',dbgs(PaintData.ClipRect^),' P=',dbgs(P));
gtk3widgets.diff (2,315 bytes)   

Juha Manninen

2020-04-08 17:00

developer   ~0122035

I applied the patch in r62916 although it made no difference in my tests. At least it simplifies the code and doesn't seem to break anything.
I see for example BottomBox overlapping Button2 just like in the screenshots.

Anton Kavalenka

2020-04-08 17:06

reporter   ~0122036

The patch does not fix alignment and autosizing, it prevents unnecessary coordinate translation which break TLabel painting

Chris Rorden

2020-04-09 19:55

reporter   ~0122050

Anton, thanks for the patch. It does eliminate the flickering of components. I will keep this issue open as you have fixed a different issue. However, I appreciate your great work. I would be happy to provide a few bounties to fix these issues if it would help prioritize the development of GTK3. Over the last year, Dmitry has done a great job improving the Cocoa widgetset and Zeljan has recently resolved a lot of QT5 issues. While GTK3 holds great promise, it seems to need a lead maintainer to provide attention to detail. I would be happy to provide a small financial bonus to encourage Anton to take this role.

Therefore, I make the following commitment:
 1. $200 bounty to resolve this issue (auto sizing).
 2. $100 bounty to resolve issue 0036416
 3. $50 to resolve issue 36348
 4. $100 There are also some issues with GTK3 displaying panels where visible is set to false or showing components that should be hidden by closer objects. I am happy to provide demos for this, but these issues may be related to the current issue.

Juha Manninen

2020-04-25 09:53

developer   ~0122401

Chris, can you please add your bounty offer here:
I understood Anton will not have time for GTK3 bug fixing as much as he had recently. The bounty should be advertised for everybody.

BTW, I changed "Gtk_bounties" into "Gtk3_bounties" in the wiki page. Nobody will offer bounties for GTK2 any more.

Chris Rorden

2020-04-27 13:54

reporter   ~0122469

Juha, I have added the bounties. They have changed slightly as Anton has submitted patches to resolve some of the issues. Anton graciously donated his bounties to the Free Pascal and Lazarus foundation.

Zeljan Rikalo

2020-04-27 14:45

developer   ~0122471

@Chris, then please mention Qt/Qt5 bounties from the past, not because of mentioning me but because ppl should see transparently all donations to lazarus/fpc.

Issue History

Date Modified Username Field Change
2020-03-25 15:55 Chris Rorden New Issue
2020-03-25 15:55 Chris Rorden File Added:
2020-03-25 15:55 Chris Rorden File Added: gtk_autosz.png
2020-03-25 16:22 Anton Kavalenka File Added: Здымак экрана, 2020-03-25 18-20-08.png
2020-03-25 16:22 Anton Kavalenka Note Added: 0121710
2020-03-25 21:48 Chris Rorden File Added:
2020-03-25 21:48 Chris Rorden File Added: hi_dpi.png
2020-03-25 21:48 Chris Rorden File Added: lo_dpi.png
2020-03-25 21:48 Chris Rorden Note Added: 0121713
2020-04-07 18:25 Anton Kavalenka File Added: gtk3widgets.diff
2020-04-07 18:25 Anton Kavalenka Note Added: 0122007
2020-04-08 17:00 Juha Manninen Note Added: 0122035
2020-04-08 17:01 Juha Manninen Fixed in Revision => r62916
2020-04-08 17:01 Juha Manninen LazTarget => -
2020-04-08 17:01 Juha Manninen Widgetset GTK 3 => GTK 3
2020-04-08 17:06 Juha Manninen Relationship added related to 0036744
2020-04-08 17:06 Anton Kavalenka Note Added: 0122036
2020-04-09 19:55 Chris Rorden Note Added: 0122050
2020-04-21 16:26 Juha Manninen Relationship added related to 0036942
2020-04-25 09:53 Juha Manninen Note Added: 0122401
2020-04-27 13:54 Chris Rorden Note Added: 0122469
2020-04-27 14:45 Zeljan Rikalo Note Added: 0122471