From 98adfa332a4123cb0a0a77e28e655f22a3a39728 Mon Sep 17 00:00:00 2001 From: mjk Date: Fri, 25 Feb 2022 23:06:57 +0000 Subject: [PATCH] OMEMO: Make QR code "scalable" in accordance with GDK_SCALE The QR code is now generated at the required resolution instead of being stretched for display with linear filtering. --- plugins/omemo/src/ui/contact_details_dialog.vala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/omemo/src/ui/contact_details_dialog.vala b/plugins/omemo/src/ui/contact_details_dialog.vala index 18884784..04694637 100644 --- a/plugins/omemo/src/ui/contact_details_dialog.vala +++ b/plugins/omemo/src/ui/contact_details_dialog.vala @@ -95,8 +95,10 @@ public class ContactDetailsDialog : Gtk.Dialog { const int QUIET_ZONE_MODULES = 4; // MUST be at least 4 const int MODULE_SIZE_PX = 4; // arbitrary - Pixbuf qr_pixbuf = new QRcode(@"xmpp:$(account.bare_jid)?omemo-sid-$(sid)=$(fingerprint)", 2).to_pixbuf(MODULE_SIZE_PX); - qrcode_image.set_from_pixbuf(qr_pixbuf); + var qr_pixbuf = new QRcode(@"xmpp:$(account.bare_jid)?omemo-sid-$(sid)=$(fingerprint)", 2) + .to_pixbuf(MODULE_SIZE_PX * qrcode_image.scale_factor); + qrcode_image.set_from_surface( + Gdk.cairo_surface_create_from_pixbuf(qr_pixbuf,0,get_window())); qrcode_image.margin = QUIET_ZONE_MODULES*MODULE_SIZE_PX; qrcode_popover.get_style_context().add_class("qrcode-container");