Open egmontkob opened 8 years ago
Do you have links to that commits? Btw. i noticed that with fedora 24 (vte291-0.44.2) using a background setting from gtk+ theme does not work anymore, same with gnome-terminal. Ie. such a setting is still ignored, but not not if i fire up gtk3-inspector on mate-terminal, than this setting works. https://github.com/mate-desktop/mate-themes/blob/master/desktop-themes/Blue-Submarine/gtk-3.0/mate-applications.css#L637 Any ideas about this? Btw. we are 5 secs before making m-t gtk3 only. https://github.com/mate-desktop/mate-terminal/pull/118
https://github.com/gnunn1/terminix/commit/6bac6ed62000d5b1f5a00dd31e0bb21c742c0589 and some followup improvements: https://github.com/gnunn1/terminix/commit/f24dc1e594cfab084fe7b4e0aa237ba72e5ae5f1 https://github.com/gnunn1/terminix/commit/3ba862370bcd13fad2c5e021a462a0403718baf5 and the ones from https://github.com/gnunn1/terminix/issues/352
No clue about your other question, sorry.
Any chance of a pull request for this? You know we 're a small team which works on all packages, and my day does not have 72 hours. A PR will speed up the process.
Nope, sorry, and I sure won't have time to work on this. I just gave you pointers that I hope you'll find useful, the rest of the story (when and how, and whether to address this issue at all) is up to you.
That looks like a lot of code to port... but we better do this before 1.16 as mate-terminal is GTK+3 only now, so users might consider this issue a regression from 1.14.
I don't think it's that much. The main thing is the Gtk+ magic which is at the bottom of the first Terminix change (inside onDraw()). The rest is pretty straightforward boilerplate, plus the art of doing it right (that is: scale the image once on every window resize and reuse it on each paint, rather than rescaling on each paint which is slow as hell and is a resource hog).
(Please note that Terminix has a different license than m-t, and I'm not sure how much they're compatible. So don't just take code from Terminix and 1:1 map it from D to C. Instead, I recommend you to study Terminix to see how this issue can be solved, and then solve it on your own. IANAL though. :P )
I'm the author of Terminix, feel free to make use of anything you wish that's useful for this with my blessings.
I have implemented the functionality using the feature of @gnunn1's patched vte3 described here. The key API is vte_terminal_set_disable_bg_draw, which allows VTE to let us draw our background instead of its own. My patch does not implement transparency, nor does it support "scrolling backgrounds" but it's a start. https://github.com/jpcima/mate-terminal/commit/98038f9085d4092753d0010806a7c3d2a2655f9b
@jpcima Thanks for your efforts!
I've completely lost track long ago with this hacking around VTE (actually never really understood what was going on), but there's one thing I'm pretty sure about: The patched VTE you're talking about is not necessary. Tilix is able to present a background image without the patch (i.e. with mainstream VTE), and so is xfce4-terminal. It might be easier to implement with this patch, dunno.
Requiring a patched VTE has the disadvantage that the feature is pretty unlikely to reach users of major Linux distributions, it'll only reach a few enthusiastic users who care enough to compile it for themselves.
The tilix source code loses me a bit and I don't find the relevant drawing code. I'll give it a second look tomorrow with a clearer mind.
This is the second attempt for background images, without the need of patching VTE. The strategy taken from Tilix is to override draw, invoke the terminal widget's draw method on a temporary cairo surface, and redraw this temporary surface on top of the background. https://github.com/jpcima/mate-terminal/commit/3f9bb6bbd52cb3fd31a0dffe95974b002b93e715 Is this good?
EDIT: null check, and let the draw happen when the image is not found. style fixes
Works for me, cool!
I guess you should probably also add options to tile / stretch / scale / center the background to fit, whatever options you can think of, or whatever options used to exist in gnome2-terminal. The obvious trick here is that you should be careful to resize the background once only on load and when VTE's size changes and then cache it, not on every draw because that would be painfully slow.
I'm not a Mate user, let alone a Mate developere, so I'm out of here now, let Mate developers say if they like it. I truly hope they'll like it and include it in the next version.
Thanks again! :)
I opened the PR. I don't see these background modes as very useful but if some people request them I'm OK to try adding them.
I just commented in PR. I am not sure about the need to resize the window or switching the options to see the image. Because this will generate Bug reports and it looks a bit half backed. So does the image work on top of vte-terminal in widget queue?
Just FYI: VTE in git master just yesterday received a new feature which might make it easier to implement bg support.
I like the PR very much as it gives me another solution to override the very bad default by vte upstream maintainer for official fedora vte package. Vte don't allow a gtk theme to change the background, and we have a boring black on white background. For no reason vte-maintainer blocks this report and waits for testers from ubuntu. https://bugzilla.gnome.org/show_bug.cgi?id=740123 But Ubuntu use this fix already since a long time.
From eb417f9c8fa081ae75d7719fd250e36fadd65212 Mon Sep 17 00:00:00 2001
From: Iain Lane <iain@orangesquash.org.uk>
Date: Thu, 16 Jul 2015 10:32:38 +0100
Subject: [PATCH] Add the style context provider with FALLBACK priority
Let's try again. This time we have two style providers. One of them is at
APPLICATION priority and cannot be overridden by the theme. It sets the padding
on VteTerminal widgets. The other one is at FALLBACK priority and is for
colours. This can be overridden by the theme.
This reverts commit bd86e7637d89a55941674756e3e223c82aee2305.
Well , maybe it's possible to stretch the image to current terminal size if you resize the terminal?
fixed with https://github.com/mate-desktop/mate-terminal/commit/8c0cb6d5faef66548644f0289bfe7c1c84b9cb19 @jpcima Before i close this report, is it's possible to stretch the image to current terminal size if you resize the terminal?
@raveit65 I imagine you may have tested this by now, especially considering you've apparently pushed v1.20 to the latest Fedora releases, but to answer your question, no, currently images can't be stretched by resizing.
I'm on m-t v1.20.0 on fc27 and background images are tiled by default with no other placement options available. The background also "follows" the term window, so dragging the window across won't reveal any portion of the background image that's not already visible. Resizing the window to be larger than the background image shows multiple tiles of the image.
The groundwork is laid if someone wants to add the standard placement options (including stretching) mentioned by @egmontkob above. Recent (/vte-2.91-based) releases of xfce4-terminal have all of these options, and a few cursory tests suggest that they work pretty cleanly, so it's at least doable.
I don't use background images myself, but if anyone does want to develop this further, it might also be worth exploring the possibility of adjusting background image transparency. Alternatively, xfce4-terminal has a "shading" option to mix the bg image and terminal bg color.
@jpcima You should claim the open bounty at https://www.bountysource.com/issues/34609051-gtk3-resurrect-background-image-support
The work is incomplete and I've shifted priorities for a while and not looked into this again. (see @marcxjo 's comment) I've not contributed to this in interest for the bounty, just for a feature I was interested to have personally. Please redirect the reward at the person who will complete the work. (please reopen?)
TODO:
ok, another report where nobody works on......
Gnome2's terminal used to support background image.
Even though libvte-2.91 (vte tarball >= 0.38) no longer explicitly supports background image, it is possible to work it around with a bit of Gtk+ magic, by drawing behind a transparent (or translucent) vte widget.
See the Terminix project which has already implemented this.