After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 763269 - HiDPI cairo patch breaks gtk 2 builds
HiDPI cairo patch breaks gtk 2 builds
Status: RESOLVED FIXED
Product: gtk-osx
Classification: Other
Component: modulesets
2.0.x
Other Mac OS
: Normal normal
: ---
Assigned To: GTK Mac Integration Maintainers
GTK Mac Integration Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-03-07 21:30 UTC by Jiri Techet
Modified: 2016-03-17 23:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Screenshot (188.71 KB, image/png)
2016-03-07 23:00 UTC, Jiri Techet
  Details
Fix gtk+2 breakage on retina introduced by the recent hidpi fixes. (9.46 KB, patch)
2016-03-16 19:29 UTC, Christoph Reiter (lazka)
committed Details | Review

Description Jiri Techet 2016-03-07 21:30:50 UTC
The hidpi patch applied to cairo here

https://github.com/jralls/gtk-osx-build/commit/a3826210aa38d15f0c5df13ab9e7c725a3d73890

is applied not only for gtk3 builds but also gtk2 builds and gkt2 doesn't expect that - the result is a completely broken GUI under gtk2. gkt2 builds should be made without the patch.
Comment 1 John Ralls 2016-03-07 22:39:42 UTC
Looks OK to me, at least on non-retina. Is your problem on retina? Can you attach a screenshot showing the breakage?
Comment 2 Jiri Techet 2016-03-07 23:00:49 UTC
Created attachment 323330 [details]
Screenshot
Comment 3 Jiri Techet 2016-03-07 23:05:00 UTC
Yes, it is retina in my case - it makes sense it makes no difference on non-retina because when you have a look at the patch, scale=1 for non-retina and it basically just multiplies by 1 which makes no difference.

When I comment-out the patch, everything looks and works fine. With the patch some of the GUI elements are drawn half the size and the whole GUI is broken. For reference, the correct appearance is something like this

http://wiki.geany.org/_media/howtos/osx/geany-osx.png
Comment 4 John Ralls 2016-03-07 23:12:46 UTC
I was afraid of that.

What happens if instead of restoring the two lines to ... you instead add
them to _gdk_windowing_create_cairo_surface in gdk/quartz/gdkdrawable-quartz.c?
Comment 5 Jiri Techet 2016-03-08 00:12:13 UTC
That doesn't help - neither when using

CGContextScaleCTM(cg_context, 1/scale.width, 1/scale.height);

nor

CGContextScaleCTM(cg_context, scale.width, scale.height);
Comment 6 John Ralls 2016-03-08 00:25:45 UTC
Oh, duh, I was thinking backwards. We need to move that from cairo into gtk3.
Comment 7 Christoph Reiter (lazka) 2016-03-08 09:15:06 UTC
I'll have a look.
Comment 8 Jiri Techet 2016-03-08 11:04:38 UTC
I must say I don't understand the logic behind the patches - cairo already takes display densities into account - now the cairo patch undos that. Afterwards, in gtk, this is re-done again by doubling the surface size. What's the logic behind this?

Note that indeed without this patch I get some views pixelated in gtk3 but this doesn't seem to be the right approach to me. IMO there should be no such a patch needed for cairo, it seems gtk should be fixed in this respect.
Comment 9 Christoph Reiter (lazka) 2016-03-08 12:16:28 UTC
Afair display density isn't taken into account for image surfaces, which are widely used in gtk+3 for caching. To get correct image surfaces you have to tell cairo the device scale, which is also applied to the non-image surface, which in turn conflicts with the osx internal scaling.
Comment 10 Jiri Techet 2016-03-08 17:44:18 UTC
OK, thanks for the explanation
Comment 11 Christoph Reiter (lazka) 2016-03-16 19:29:20 UTC
Created attachment 324136 [details] [review]
Fix gtk+2 breakage on retina introduced by the recent hidpi fixes.

Well, I take that back, a gtk+3 only fix was possible as you said. Sorry for breaking gtk2 and for taking so long.
Comment 12 Jiri Techet 2016-03-16 20:15:38 UTC
Great to hear, thanks!
Comment 13 John Ralls 2016-03-17 23:36:14 UTC
Pushed, thanks.