View Issue Details

IDProjectCategoryView StatusLast Update
0036256LazarusWidgetsetpublic2020-03-25 15:02
ReporterCudaText man Assigned ToJuha Manninen  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformUbuntu 19 x64 
Product Version2.1 (SVN) 
Summary0036256: gtk3: TSplitter works badly
DescriptionDemo added.
expected: it paints 2 colored panels (olive + magenta colors) with splitter in between.
reality on gtk3: splitter position is wrong, panels aren't colored, splitter cannot move.
screenshots.

TagsNo tags attached.
Fixed in Revisionr62694
LazTarget-
WidgetsetGTK 3
Attached Files

Relationships

related to 0034473 closedJuha Manninen GTK3 autosize SpinEdits 

Activities

CudaText man

2019-11-03 18:55

reporter  

expected.png (6,652 bytes)   
expected.png (6,652 bytes)   
reality.png (6,707 bytes)   
reality.png (6,707 bytes)   
tst-gtk3-splitter.zip (3,897 bytes)

Anton Kavalenka

2019-11-08 17:29

reporter   ~0119166

Problem is not in splitter but in TGtk3Window which refuses to get smaller than designed, when aligned as alBottom

Anton Kavalenka

2020-03-04 17:28

reporter   ~0121368

When LCL does not agree with GTK3 size_allocate message, instead using own adjusted width and height - it gets better with LCL resizing.
Looks like in that case splitter works properly.
gtk3widgets.diff (650 bytes)   
Index: /projects/lazarus/lcl/interfaces/gtk3/gtk3widgets.pas
===================================================================
--- /projects/lazarus/lcl/interfaces/gtk3/gtk3widgets.pas	(revision 62689)
+++ /projects/lazarus/lcl/interfaces/gtk3/gtk3widgets.pas	(working copy)
@@ -1457,8 +1457,8 @@
   Msg.SizeType := SIZE_RESTORED;
 
   Msg.SizeType := Msg.SizeType or Size_SourceIsInterface;
-  Msg.Width := Word(NewSize.cx);
-  Msg.Height := Word(NewSize.cy);
+  Msg.Width := ACtl.LCLObject.Width;//Word(NewSize.cx);
+  Msg.Height := ACtl.LCLObject.Height;//Word(NewSize.cy);
   ACtl.DeliverMessage(Msg);
 
   if (wtWindow in ACtl.WidgetType) and
gtk3widgets.diff (650 bytes)   

Anton Kavalenka

2020-03-04 17:47

reporter   ~0121369

2nd patch even better. It looks like size_allocate is for containers only
https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-size-allocate
gtk3widgets-2.diff (799 bytes)   
Index: /projects/lazarus/lcl/interfaces/gtk3/gtk3widgets.pas
===================================================================
--- /projects/lazarus/lcl/interfaces/gtk3/gtk3widgets.pas	(revision 62689)
+++ /projects/lazarus/lcl/interfaces/gtk3/gtk3widgets.pas	(working copy)
@@ -1457,8 +1457,16 @@
   Msg.SizeType := SIZE_RESTORED;
 
   Msg.SizeType := Msg.SizeType or Size_SourceIsInterface;
-  Msg.Width := Word(NewSize.cx);
-  Msg.Height := Word(NewSize.cy);
+
+  if ACtl is TGtk3Window then
+  begin
+    Msg.Width := Word(NewSize.cx);
+    Msg.Height := Word(NewSize.cy);
+  end else
+  begin
+    Msg.Width := ACtl.LCLObject.Width;//Word(NewSize.cx);
+    Msg.Height := ACtl.LCLObject.Height;//Word(NewSize.cy);
+  end;
   ACtl.DeliverMessage(Msg);
 
   if (wtWindow in ACtl.WidgetType) and
gtk3widgets-2.diff (799 bytes)   

CudaText man

2020-03-04 17:50

reporter   ~0121370

Confirm, it's solved now

Juha Manninen

2020-03-05 12:29

developer   ~0121396

I applied the second patch. Thanks!

Issue History

Date Modified Username Field Change
2019-11-03 18:55 CudaText man New Issue
2019-11-03 18:55 CudaText man File Added: expected.png
2019-11-03 18:55 CudaText man File Added: reality.png
2019-11-03 18:55 CudaText man File Added: tst-gtk3-splitter.zip
2019-11-08 17:29 Anton Kavalenka Note Added: 0119166
2020-03-04 17:28 Anton Kavalenka File Added: gtk3widgets.diff
2020-03-04 17:28 Anton Kavalenka Note Added: 0121368
2020-03-04 17:47 Anton Kavalenka File Added: gtk3widgets-2.diff
2020-03-04 17:47 Anton Kavalenka Note Added: 0121369
2020-03-04 17:50 CudaText man Note Added: 0121370
2020-03-05 12:29 Juha Manninen Assigned To => Juha Manninen
2020-03-05 12:29 Juha Manninen Status new => resolved
2020-03-05 12:29 Juha Manninen Resolution open => fixed
2020-03-05 12:29 Juha Manninen Fixed in Revision => r62694
2020-03-05 12:29 Juha Manninen LazTarget => -
2020-03-05 12:29 Juha Manninen Widgetset GTK 3 => GTK 3
2020-03-05 12:29 Juha Manninen Note Added: 0121396
2020-03-25 15:02 Juha Manninen Relationship added related to 0034473