View Issue Details

IDProjectCategoryView StatusLast Update
0030385LazarusWidgetsetpublic2020-10-23 08:17
ReporterAnton Kavalenka Assigned ToMattias Gaertner  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformx86_64 GTK2OSDebian GNU/Linux 
Product Version1.7 (SVN) 
Summary0030385: gtk2: Setting the form shape requires at least one TWinControl on form
DescriptionDocumentation
http://wiki.lazarus.freepascal.org/LCL_Tips#Creating_a_non-rectangular_window_or_control

says - just call set SetWindowRgn(Handle,Rgn,true) on form Handle or call SetShape(HRGN) and will get a shaped form

GTK2 widgetset relies on presence in Widget structure non-null field .Window to set the form region properly

Window := GetControlWindow(Widget);
  if Window = nil then
    Exit(0);
Steps To ReproduceRun the attached test.
Should be round-corner shaped form.

Reparent all the controls to the Form from the TPanel, run the test -
Form become generic rectangular-shaped
TagsNo tags attached.
Fixed in Revisionr63897, 64054.
LazTarget-
WidgetsetGTK 2
Attached Files

Relationships

related to 0037073 closedMattias Gaertner gtk2: SVN r63143 broke setting the form shape 
related to 0037924 closedJuha Manninen GTK "critical" messages generated by TabControl Tabs 

Activities

Anton Kavalenka

2016-07-18 15:57

reporter  

laztest91.zip (129,586 bytes)

Anton Kavalenka

2016-07-18 15:58

reporter   ~0093756

Reproducibility => always

Juha Manninen

2020-05-15 23:59

developer   ~0122828

If the test application is wrong as mentioned in related 0030385 then please remove it.

Anton Kavalenka

2020-09-17 08:41

reporter   ~0125587

Obvious fix provided with new test application.
gtk2region.diff (461 bytes)   
Index: lcl/interfaces/gtk2/gtk2proc.inc
===================================================================
--- lcl/interfaces/gtk2/gtk2proc.inc	(revision 63883)
+++ lcl/interfaces/gtk2/gtk2proc.inc	(working copy)
@@ -4067,6 +4067,7 @@
 begin
   if Widget <> nil then 
   begin
+    gtk_widget_realize(Widget); // associate with window
     If not GTKWidgetIsA(PGTKWidget(Widget), GTK_Layout_Get_Type) then
       Result := PGTKWidget(Widget)^.Window
     else
gtk2region.diff (461 bytes)   
laztest118.zip (109,155 bytes)

Anton Kavalenka

2020-09-20 08:40

reporter   ~0125651

ping @Juha Manninen

Juha Manninen

2020-09-20 11:57

developer   ~0125655

Applied, thanks.

Mattias Gaertner

2020-10-22 16:50

manager   ~0126461

Improved.

Anton Kavalenka

2020-10-22 18:05

reporter   ~0126466

r64050 does not work

Anton Kavalenka

2020-10-22 18:11

reporter   ~0126467

Last edited: 2020-10-22 18:11

View 2 revisions

Patch based on recent findings
See https://bugs.freepascal.org/view.php?id=37924#c126440
gtk2winrgn.diff (581 bytes)   
Index: lcl/interfaces/gtk2/gtk2winapi.inc
===================================================================
--- lcl/interfaces/gtk2/gtk2winapi.inc	(revision 64053)
+++ lcl/interfaces/gtk2/gtk2winapi.inc	(working copy)
@@ -9411,7 +9411,8 @@
   end;
   if Widget = nil then
     Exit(0);
-  if GTKWidgetIsA(Widget, GTK_Layout_Get_Type) then
+  if GtkWidgetIsA(gtk_widget_get_toplevel(Widget), gtk_window_get_type) and
+    not gtk_widget_realized(Widget) then
     gtk_widget_realize(Widget); // associate with window
   Window := GetControlWindow(Widget);
   if Window = nil then
gtk2winrgn.diff (581 bytes)   

Mattias Gaertner

2020-10-22 20:31

manager   ~0126469

Thanks! Applied.

Issue History

Date Modified Username Field Change
2016-07-18 15:57 Anton Kavalenka New Issue
2016-07-18 15:57 Anton Kavalenka File Added: laztest91.zip
2016-07-18 15:58 Anton Kavalenka Note Added: 0093756
2020-05-15 23:47 Juha Manninen Relationship added related to 0037073
2020-05-15 23:59 Juha Manninen Note Added: 0122828
2020-05-16 00:00 Juha Manninen Reproducibility have not tried => always
2020-05-16 00:00 Juha Manninen LazTarget => -
2020-05-16 00:00 Juha Manninen Widgetset GTK 2 => GTK 2
2020-09-17 08:41 Anton Kavalenka Note Added: 0125587
2020-09-17 08:41 Anton Kavalenka File Added: gtk2region.diff
2020-09-17 08:41 Anton Kavalenka File Added: laztest118.zip
2020-09-20 08:40 Anton Kavalenka Note Added: 0125651
2020-09-20 08:52 Juha Manninen Assigned To => Juha Manninen
2020-09-20 08:52 Juha Manninen Status new => assigned
2020-09-20 11:57 Juha Manninen Status assigned => resolved
2020-09-20 11:57 Juha Manninen Resolution open => fixed
2020-09-20 11:57 Juha Manninen Fixed in Revision => r63897
2020-09-20 11:57 Juha Manninen Widgetset GTK 2 => GTK 2
2020-09-20 11:57 Juha Manninen Note Added: 0125655
2020-09-21 09:12 Anton Kavalenka Status resolved => closed
2020-10-14 15:53 Juha Manninen Relationship added related to 0037924
2020-10-22 16:50 Mattias Gaertner Note Added: 0126461
2020-10-22 18:05 Anton Kavalenka Status closed => assigned
2020-10-22 18:05 Anton Kavalenka Resolution fixed => open
2020-10-22 18:05 Anton Kavalenka Note Added: 0126466
2020-10-22 18:11 Anton Kavalenka Note Added: 0126467
2020-10-22 18:11 Anton Kavalenka File Added: gtk2winrgn.diff
2020-10-22 18:11 Anton Kavalenka Note Edited: 0126467 View Revisions
2020-10-22 20:29 Mattias Gaertner Assigned To Juha Manninen => Mattias Gaertner
2020-10-22 20:31 Mattias Gaertner Status assigned => resolved
2020-10-22 20:31 Mattias Gaertner Resolution open => fixed
2020-10-22 20:31 Mattias Gaertner Fixed in Revision r63897 => r63897, 64054.
2020-10-22 20:31 Mattias Gaertner Widgetset GTK 2 => GTK 2
2020-10-22 20:31 Mattias Gaertner Note Added: 0126469
2020-10-23 08:17 Anton Kavalenka Status resolved => closed