View Issue Details

IDProjectCategoryView StatusLast Update
0038062LazarusLCLpublic2021-01-24 09:59
ReporterDavid Assigned ToJuha Manninen  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformLinuxOSUbuntu 
Product Version2.1 (SVN) 
Summary0038062: TListView (and others ?) not drawing text on uncover
DescriptionThere is a problem in Trunk with TListView's ownerdraw, I expect it would also apply to similar components. Lines of text that are 'covered' are not (re)drawn when uncovered.

The problem applies only to GTK2 does not exist in Fixes or 2.0.10. Qt5 and GTk3 are not affected.

It dates back to revision 63436, June 2020, 0037219 changes made to gtk2winapi.inc. Reverting that file make the problem go away. I am a bit unsure exactly what that fix was fixing, it perhaps related to not drawing where it was deemed unnecessary ?

Davo
Steps To ReproduceThe attached demo illustrates the issue, compile on current trunk, gtk2, press button1 and scroll down ...
TagsNo tags attached.
Fixed in Revisionr64130
LazTarget-
WidgetsetGTK 2
Attached Files

Relationships

related to 0037219 closedJuha Manninen GTK2: TextRect and regions 

Activities

David

2020-11-11 04:06

reporter  

project1.zip (131,041 bytes)

Joeny Ang

2020-11-12 08:24

reporter   ~0126847

Hi,

Tried the test project in a revision prior to the patch in issue 0037219 and
the problem persists. After clicking the button, the last line is always
blank, and scrolling by mouse or via scrollbar yields different areas not
being repainted.

Setting TListView.ShowColumnHeader to False does not exhibit this behavior.

The problem is found to be in TGtk2WidgetSet.ExtSelectClipRGN(). When using
TextRect() without TTextStyle, clipping will be True by default, and the
Rect parameter will be ANDed with the current region of the DC, and then
selected back to the DC. Usually, the DC will not have a region selected, and
what ExtSelectClipRGN() does is to create a temporary region from the DC using
the dimensions returned by GDK_Window_Get_Size(). In a TListView, if the
header is visible (ShowColumnHeader=True), the returned height will be 1 row
less than the whole window, thus the last line will be clipped.

Proposed solution is to use the DC's Offset property to adjust the region's
dimensions.
gtk2-tlistview-with-header-region-draw-fix.patch (454 bytes)   
--- lcl/interfaces/gtk2/gtk2winapi.inc.64098
+++ lcl/interfaces/gtk2/gtk2winapi.inc
@@ -3776,7 +3776,7 @@
               Clip:=CreateEmptyRegion
             else begin
               GDK_Window_Get_Size(Drawable, @X, @Y);
-              Clip := CreateRectRGN(0, 0, X, Y);
+              Clip := CreateRectRGN(-Offset.X, -Offset.Y, X - Offset.X, Y - Offset.Y);
             end;
             // create target clip
             Tmp := CreateEmptyRegion;

David

2020-11-12 23:50

reporter   ~0126867

I applied Joeny's patch to 64129 and, yep, it seems to fix the problem using my tests.

Joeny, are you saying that you could demonstrate the problem using trunk prior to the issue 0037219, that is < r63436 ? I could not and I ran a lot of tests !

Davo

Joeny Ang

2020-11-13 02:14

reporter   ~0126868

Last edited: 2020-11-13 02:15

View 2 revisions

Davo, yes. I attached some screenshots of the test project running at r63435. To trigger the behavior, I positioned the mouse over the header or over the vertical scrollbar before scrolling using the scroll wheel.
screenshot-01.png (59,077 bytes)   
screenshot-01.png (59,077 bytes)   

David

2020-11-13 05:24

reporter   ~0126870

Hmm, I cannot duplicate that, perhaps because I am not using a real mouse, just a touch pad.
I hope we are not looking at two issues here, the one I reported has a clear cut off at r63435.

Juha Manninen

2020-11-13 10:41

developer   ~0126873

Applied, thanks. Resolving ...

David

2020-11-14 11:20

reporter   ~0126912

OK, test, all good.

Thanks Juha and Joeny.

(pretty amazing how quickly things can be tracked down and fixed around here!)

Issue History

Date Modified Username Field Change
2020-11-11 04:06 David New Issue
2020-11-11 04:06 David File Added: project1.zip
2020-11-11 09:55 Juha Manninen Relationship added related to 0037219
2020-11-11 09:55 Juha Manninen Assigned To => Juha Manninen
2020-11-11 09:55 Juha Manninen Status new => assigned
2020-11-12 08:24 Joeny Ang Note Added: 0126847
2020-11-12 08:24 Joeny Ang File Added: gtk2-tlistview-with-header-region-draw-fix.patch
2020-11-12 23:50 David Note Added: 0126867
2020-11-13 02:14 Joeny Ang Note Added: 0126868
2020-11-13 02:14 Joeny Ang File Added: 0038062-screenshot-01.png
2020-11-13 02:15 Joeny Ang Note Edited: 0126868 View Revisions
2020-11-13 05:24 David Note Added: 0126870
2020-11-13 10:41 Juha Manninen Status assigned => resolved
2020-11-13 10:41 Juha Manninen Resolution open => fixed
2020-11-13 10:41 Juha Manninen Fixed in Revision => r64130
2020-11-13 10:41 Juha Manninen LazTarget => -
2020-11-13 10:41 Juha Manninen Widgetset GTK 2 => GTK 2
2020-11-13 10:41 Juha Manninen Note Added: 0126873
2020-11-14 11:20 David Status resolved => closed
2020-11-14 11:20 David Note Added: 0126912