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 765421 - Overscaled GtkImage in Wayland
Overscaled GtkImage in Wayland
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Wayland
3.20.x
Other Windows
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2016-04-22 10:31 UTC by Cédric Bellegarde
Modified: 2016-04-22 12:38 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Cédric Bellegarde 2016-04-22 10:31:17 UTC
In lollypop, I set GtkImage using a GdkPixbuf.

I do this:
- Load pixbuf at size * scale_factor
- Put pixbuf in a cairo surface
- Set GtkImage from surface

In Xorg, with GDK_SCALE=1 or GDK_SCALE=2, it works as expected.

In wayland, it seems GtkImage is resized to Pixbuf size

https://github.com/gnumdk/lollypop/issues/582
Comment 1 Timm Bäder 2016-04-22 10:36:18 UTC
You put the GdkPixbuf in a cairo surface of what scale factor?
Comment 2 Cédric Bellegarde 2016-04-22 10:45:14 UTC
Cairo surface knows screen scale factor, no?
Comment 3 Cédric Bellegarde 2016-04-22 11:07:24 UTC
Here code example:

import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, GdkPixbuf, Gdk

image = Gtk.Image()
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size("/usr/share/icons/Adwaita/256x256/apps/web-browser.png", 100*image.get_scale_factor(), 100*image.get_scale_factor())
surface = Gdk.cairo_surface_create_from_pixbuf(pixbuf, 0, None)
image.set_from_surface(surface)
win = Gtk.Window()
win.connect("delete-event", Gtk.main_quit)
win.add(image)
win.show_all()
Gtk.main()
Comment 4 Timm Bäder 2016-04-22 11:18:37 UTC
But you're not passing a GdkWindow to Gdk.cairo_surface_create_from_pixbuf, it doesn't know what scale factor to use for 0. Try passing a window as last argument or your image.get_scale_factor() as second to last.
Comment 5 Cédric Bellegarde 2016-04-22 11:31:11 UTC
Why does it work on Xorg?

Will try but can't test as GDK_SCALE doesn't work here on Fedora + Gnome 3.18 and ArchLinux + Gnome 3.20, any idea?
Comment 6 Cédric Bellegarde 2016-04-22 12:29:27 UTC
Passing the GdkWindow doesn't change the issue.

Here what is happening with previous example.

Xorg:
- GDK_SCALE=1 => image is 100px
- GDK_SCALE=2 => image is 200px

Wayland:
- GDK_SCALE=1 => image is 100px
- GDK_SCALE=2 => image is 400px
Comment 7 Cédric Bellegarde 2016-04-22 12:38:02 UTC
Passing the scale factor works...