Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 489383

Summary: [GTK3] Real fix for bug 446075 / broken GC#setClipping(Rectangle)
Product: [Eclipse Project] Platform Reporter: Markus Keller <markus.kell.r>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: akurtakov, ericwill, snjezana.peco, udo.walker
Version: 4.6Keywords: triaged
Target Milestone: ---   
Hardware: PC   
OS: Linux   
See Also: https://git.eclipse.org/r/68275
Whiteboard:
Bug Depends on: 446075    
Bug Blocks:    

Description Markus Keller CLA 2016-03-10 14:45:59 EST
Remove the hacks added with http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=01234cea8bf0b04b381a8eb47a28ba41d0fd4c3e

The commit comment includes a link to
https://developer.gnome.org/gtk3/stable/ch25s02.html#id-1.6.3.4.11
but that document doesn't explain what would be broken.

The bug in the SWT/GTK3 port may be that setClipping uses a wrong coordinate system. If that's the case, then the coordinates need to be transformed and the hacks can be removed.

It looks like the problem only appears when the Table/Tree has scroll bars. Not sure why that is.

Note that this commit in the slakkimsetti/HighDPIChangesforNeon branch has already fixed GC#setClipping(Rectangle) for all widgets other than Table and Tree, and has added explanatory comments that refer to bug 446075: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=4ff972b78809d2996835d862e322900e0334ebc9
Comment 1 Eclipse Genie CLA 2016-03-12 12:28:56 EST
New Gerrit change created: https://git.eclipse.org/r/68275
Comment 2 Snjezana Peco CLA 2016-03-12 12:30:51 EST
I have reviewed the patch (https://git.eclipse.org/r/44286) with GTK 3.10, GTK 3.14, GTK 3.16 and GTK 3.18.
We can remove the part of the patch related to GC. Clipping seems to be fixed in some commit  in the meanwhile.
However, if we remove the remaining parts of the patch, we will get a lot of empty views (Package Explorer, Open Type, EGit History ...)
The patch is based on the following blog: 

https://blogs.gnome.org/alexl/2013/11/04/the-modern-gtk-drawing-model/. 

The most important sentence for this patch is:

"Normally there is only a single cairo context which is used in the entire repaint, rather than one per GdkWindow. This means you have to respect (and not reset) existing clip and transformations set on it."

The patch uses the existing cairo object instead of creating a new one.
Comment 3 Eric Williams CLA 2016-04-21 10:23:26 EDT
(In reply to Eclipse Genie from comment #1)
> New Gerrit change created: https://git.eclipse.org/r/68275

Snjezana, is this correct patch for this issue then?

If I understand correctly, this issue has been fixed with the commit for the DPI work?
http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=4ff972b78809d2996835d862e322900e0334ebc9
Comment 4 Markus Keller CLA 2016-04-21 12:02:49 EDT
(In reply to Eric Williams from comment #3)
> > New Gerrit change created: https://git.eclipse.org/r/68275

This causes clipping errors in owner-draw Trees again, at least on Ubuntu 14.04 / GTK 3.10.8. E.g. long labels in the Package Explorer like those inside the JRE System Library again start bleeding into adjacent controls.

My commit restricted the problem in setClipping(..) to Table/Tree widgets. I'm not aware of practical problems with the current solution, although you can probably construct a problem if a PaintItem listener wants to set a custom clipping region.

The remaining issue is cosmetic and doesn't need to be addressed for 4.7.
Comment 5 Eric Williams CLA 2016-04-21 16:14:36 EDT
(In reply to Markus Keller from comment #4)
> This causes clipping errors in owner-draw Trees again, at least on Ubuntu
> 14.04 / GTK 3.10.8. E.g. long labels in the Package Explorer like those
> inside the JRE System Library again start bleeding into adjacent controls.
> 
> My commit restricted the problem in setClipping(..) to Table/Tree widgets.
> I'm not aware of practical problems with the current solution, although you
> can probably construct a problem if a PaintItem listener wants to set a
> custom clipping region.
> 
> The remaining issue is cosmetic and doesn't need to be addressed for 4.7.

Alright, makes sense. Thanks for the clarification.
Comment 6 Markus Keller CLA 2016-04-22 06:45:29 EDT
(In reply to Markus Keller from comment #4)
> The remaining issue is cosmetic and doesn't need to be addressed for 4.7.

Not for 4.6, I meant. Snjezana, if https://git.eclipse.org/r/68275 was just incomplete and you have a better solution, you would be most welcome to update the Gerrit, so that we can consider it for 4.7.
Comment 7 Snjezana Peco CLA 2016-04-22 12:20:27 EDT
(In reply to Markus Keller from comment #6)
> (In reply to Markus Keller from comment #4)
> > The remaining issue is cosmetic and doesn't need to be addressed for 4.7.
> 
> Not for 4.6, I meant. Snjezana, if https://git.eclipse.org/r/68275 was just
> incomplete and you have a better solution, you would be most welcome to
> update the Gerrit, so that we can consider it for 4.7.

Your solution seems to be ok.
Comment 8 Alexander Kurtakov CLA 2018-10-19 08:37:21 EDT
Eric, is there anything pending here?
Comment 9 Eric Williams CLA 2018-10-19 08:39:14 EDT
(In reply to Alexander Kurtakov from comment #8)
> Eric, is there anything pending here?

I don't think so, closing it now.