aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormjk <yuubi-san@users.noreply.github.com>2022-02-25 23:06:57 +0000
committermjk <yuubi-san@users.noreply.github.com>2022-02-25 23:20:05 +0000
commit98adfa332a4123cb0a0a77e28e655f22a3a39728 (patch)
tree747cf828d41aad53b4956fd5689448afcb1e2e0c
parentd3ae541673b279d9ebeb84194d029625783aa724 (diff)
downloaddino-98adfa332a4123cb0a0a77e28e655f22a3a39728.tar.gz
dino-98adfa332a4123cb0a0a77e28e655f22a3a39728.zip
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.
-rw-r--r--plugins/omemo/src/ui/contact_details_dialog.vala6
1 files 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");