Private
Public Access
1
0

gtk: image sizing fix

This commit is contained in:
2026-02-22 00:19:43 -08:00
parent 335ded4752
commit b9ece534d2
4 changed files with 18 additions and 8 deletions

View File

@@ -37,7 +37,7 @@ Priority: optional
Architecture: ${ARCH}
Maintainer: James Magahern <james@magahern.com>
Installed-Size: ${INSTALLED_SIZE_KB}
Depends: libgtk-4-1, libadwaita-1-0, libglib2.0-0, libgee-0.8-2, libsecret-1-0, kordophoned (>= 1.0.0)
Depends: libgtk-4-1, libadwaita-1-0, libglib2.0-0, libgee-0.8-2, libsecret-1-0, kordophoned (>= 1.3.0)
Description: GTK4/Libadwaita client for Kordophone
A GTK4/Libadwaita Linux client for the Kordophone client daemon.
EOF

View File

@@ -23,7 +23,7 @@ Requires: libadwaita
Requires: glib2
Requires: libgee
Requires: libsecret
Requires: kordophoned >= 1.0.0
Requires: kordophoned >= 1.3.0
%description
A GTK4/Libadwaita Linux Client for the Kordophone client daemon.

View File

@@ -60,22 +60,31 @@ private class ImageBubbleLayout : BubbleLayout
this.is_downloaded = false;
this.cached_texture = TextureCache.get_instance().get_texture(attachment_guid);
if (this.cached_texture != null) {
this.image_size = Graphene.Size() {
width = (float)this.cached_texture.get_width(),
height = (float)this.cached_texture.get_height()
};
SizeCache.get_instance().set_size(attachment_guid, this.image_size);
return;
}
// Calculate image dimensions for layout
calculate_image_dimensions(image_size);
}
private void calculate_image_dimensions(Graphene.Size? image_size) {
if (image_size != null) {
this.image_size = image_size;
return;
}
var cached_size = SizeCache.get_instance().get_size(attachment_guid);
if (cached_size != null) {
this.image_size = cached_size;
return;
}
if (image_size != null) {
this.image_size = image_size;
return;
}
this.image_size = Graphene.Size() { width = 200.0f, height = 150.0f };
}

View File

@@ -328,6 +328,7 @@ private class TranscriptDrawingArea : Widget
private void recompute_message_layouts() {
var container_width = get_width();
float max_width = container_width * 0.90f;
float image_max_width = max_width * 0.75f;
DateTime? last_date = null;
string? last_sender = null;
@@ -371,7 +372,7 @@ private class TranscriptDrawingArea : Widget
};
}
var image_layout = new ImageBubbleLayout(attachment.guid, message.from_me, this, max_width, image_size);
var image_layout = new ImageBubbleLayout(attachment.guid, message.from_me, this, image_max_width, image_size);
image_layout.id = @"image-$(attachment.guid)";
if (animate) {