bleakgrey / tootle

GTK-based Mastodon client for Linux
GNU General Public License v3.0
401 stars 61 forks source link

Resize non-Mastodon image attachments #49

Closed lanodan closed 6 years ago

lanodan commented 6 years ago

I don’t know if it’s because pleroma doesn’t do thumbnails (it probably happens on mastodon with a small window anyway). But scaling down the pictures would be neat, so I don’t have to make the window wider to see it full size or so it doesn’t take up a huge part of the window.

Edit: Added client version

bleakgrey commented 6 years ago

It doesn't happen on Masto instances since they provide a small preview version which I use so Tootle don't have to resize them. I'm not sure whether I want to implement this just for Pleroma :/

null-von-sushi commented 6 years ago

I second this, it would be really nice if this was implemented somehow. I know "me too" posts are not really productive, but I just wanna say that there's a lot of pleroma instances out there, and they seem to be gaining traction. It would be really nice if you could implement this.

PS: Thanks for the client anyhow, even without this feature it's pretty great. A native app (Corebird) was the only reason I was still using twitter~

lanodan commented 6 years ago

Well maybe if the author doesn’t want to work on it it would have to be done with a PR. Sadly I have absolutely no skills with GTK or vala.

Also It would probably also benefit users of High DPI screens on mastodon so they don’t end up with blurry or too small images.

bleakgrey commented 6 years ago

I'll see what I can do. Also I'm not quite sure how scaling images even further down on HDPI displays would prevent blurry images :/

null-von-sushi commented 6 years ago

Thanks! Also, I guess technically adding an option to use full-res images even on mastodon, and then just scaling them to fit inside the client would be the best way for High-DPI? Not sure how much work that would be though. Either way, images would need to actually be scaled.

bleakgrey commented 6 years ago

The thing is that GTK isn't HTML with full CSS support. I can't make the images go like "oh hey the user is resizing the window, guess I'll just resize myself too to fit in". Instead what it makes is something like "oh so you need to resize me? how about 5 seconds freeze while you're resizing me through CSS or a huge memory clog if you dare enough to do it manually".

I'm working with the second option and I try to refrain from rescaling images where possible. Pleroma's whim about supplying the original URL for a thumbnail doesn't make me happy. But I guess that's what you get when dealing with federated instances.

bleakgrey commented 6 years ago

This should about do it. Can anyone test the master branch to see if it's okay now?

lanodan commented 6 years ago

Looks like it works now. Thanks a lot!

null-von-sushi commented 6 years ago

Uh, not sure if I misunderstood the issue, but it doesn't seem to work for me? I cloned the git and compiled it, images are still way too large. a1

Even if I resize the window beyond my display's size, things still look....off a3

lanodan commented 6 years ago

Can’t reproduce here… screen

I guess this might help in case it’s something from a particular version…

 * dependency graph for net-im/tootle-9999
 `--  net-im/tootle-9999  ~amd64
   `--  dev-libs/glib-2.52.3  (dev-libs/glib) amd64
   `--  dev-libs/granite-0.5.0  (dev-libs/granite) ~amd64
   `--  dev-libs/json-glib-1.2.8  (dev-libs/json-glib) amd64
   `--  net-libs/libsoup-2.58.2  (net-libs/libsoup) amd64
   `--  x11-libs/gtk+-3.22.29  (x11-libs/gtk+) amd64
   `--  dev-util/meson-0.46.1  (>=dev-util/meson-0.40.0) amd64
   `--  dev-util/ninja-1.8.2  (>=dev-util/ninja-1.7.2) amd64
   `--  sys-apps/sed-4.5  (>=sys-apps/sed-4) amd64
   `--  dev-vcs/git-2.16.4  (>=dev-vcs/git-1.8.2.1) amd64  [curl]
bleakgrey commented 6 years ago

Have you been fiddling with dconf by any chance? Resizing doesn't work properly with cache turned on yet.

null-von-sushi commented 6 years ago

I am not sure where you got a 'dependency graph' from. Here is a list of dependencies and their version which I manually typed out, in case it helps..

gtk3 3.22.30-1
hicolor-icon-theme 0.17-1
vala 0.40.7-1
libsoup 2.62.2-1
granite 5.0-1
json-glib 1.4.2-2-1

Have you been fiddling with dconf by any chance? Resizing doesn't work properly with cache turned on yet.

In general yes, since settings are disappearing from GNOME GUIs at a rapid rate. However nothing to do with tootle. I haven't touched it's dconf entry. In tootle, under settings, I see no entry for caching.

bleakgrey commented 6 years ago

Honestly I don't think this has something to do with dependencies. The code for resizing is almost pure GTK and GLib.

Can you try reinstalling Tootle completely? Uninstall it with

sudo ninja uninstall

and then follow the instructions from README.md

null-von-sushi commented 6 years ago

Dunno how or why, but it works now. Weird. Thank you very much for fixing this though. I just want to mention that while resizing does indeed work now, the last image might get cropped if you have your client ridiculously narrow, but everything works a-ok when it's fullscreen or at a normal width.

a1 a2