Fixes #336. You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/1181
-- Commit Summary --
* VTE: use proper accessor for the vertical adjustment * VTE: stop using vte_terminal_set_font_from_string() * VTE: drop support for selecting the emulated terminal * VTE: add support for vte_terminal_spawn_sync() * VTE: add debugging info to known which library was actually loaded * VTE: don't hard-require vte_terminal_set_word_chars() * VTE: Add support for 2.91 GdkRGBA API variant * VTE: Don't hard-require vte_terminal_im_append_menuitems() * VTE: Don't require vte_terminal_set_background_image_file() * VTE: add VTE 2.91 DSO names
-- File Changes --
M doc/geany.txt (3) M src/keyfile.c (3) M src/vte.c (292) M src/vte.h (1)
-- Patch Links --
https://github.com/geany/geany/pull/1181.patch https://github.com/geany/geany/pull/1181.diff
- {
GError *error = NULL;
background_image_pixbuf = gdk_pixbuf_new_from_file(path, &error);
if (! background_image_pixbuf)
{
g_warning("Failed to load VTE background image: %s", error->message);
g_error_free(error);
}
/* alter the background color to add alpha to it */
else if (vf->vte_terminal_set_color_background_rgba)
{
GdkRGBA bg;
/* default VTE "saturation" value is 0.4: 1.0 - 0.4 = 0.6 */
rgba_from_color(&bg, &vc->colour_back, 0.6);
apparently this is wrong, and VTE doesn't use the background color to perform the blend, but black instead.
IMO the implementation here is better as it's more flexible at very little cost, but if we want to get exact same behavior we should use `GdkRGBA bg = { 0, 0, 0, 0.6 }`.
@@ -221,6 +224,78 @@ WRAP_RGBA_SETTER(vte_terminal_set_color_foreground) #endif
+#if GTK_CHECK_VERSION(3, 0, 0) +static void default_vte_terminal_set_background_image_file(VteTerminal *terminal, const char *path) +{
- if (background_image_pixbuf)
- {
g_object_unref(background_image_pixbuf);
background_image_pixbuf = NULL;
- }
- if (path != NULL)
Should allow for an empty `path` as none, as the setting will be the empty string rather than NULL, so this will lead to try and open file `""` and lead to a warning.
BTW, apparently VTE's implementation of this fails silently when the file can't be open/open as an image. Warning is better for us I suppose, though.
+static void default_vte_terminal_set_background_image_file(VteTerminal *terminal, const char *path) +{
- if (background_image_pixbuf)
- {
g_object_unref(background_image_pixbuf);
background_image_pixbuf = NULL;
- }
- if (path != NULL)
- {
GError *error = NULL;
background_image_pixbuf = gdk_pixbuf_new_from_file(path, &error);
if (! background_image_pixbuf)
{
g_warning("Failed to load VTE background image: %s", error->message);
BTW, apparently VTE's implementation of this fails silently when the file can't be open/isn't an image. Warning is better for us I suppose, though.
@b4n pushed 3 commits.
e6ead40 VTE: Properly handle empty path in background image support for 2.91 72ea547 VTE: Optimize our fallback background image drawing code fc61d92 VTE: Handle transparent images and blending the same as VTE < 2.91
Looks like a good idea to revive this pull request (especially when https://github.com/geany/geany/pull/1182 gets merged which looks like a good idea to me too) as e.g. Ubuntu 16.04 has only vte 2.91 for GTK3.
@techee that's a good point.
I'd personally drop the background image feature completely - it's just silly. It's similarly stupid like if we wanted to add a background image to the Scintilla editor.
People for some reason seem to configure their terminals in a very non-ergonomic ways by e.g. adding transparency to the window so the text in the terminal overlaps with whatever other text is behind the window. Nobody would do anything like that with any other application.
I'd definitively not include any custom background image implementation. For VTE versions that support it natively, and we already have UI prefs for, it seems OK to leave it, but for newer VTEs it seems better to just guard it out.
I'd definitively not include any custom background image implementation. For VTE versions that support it natively, and we already have UI prefs for, it seems OK to leave it, but for newer VTEs it seems better to just guard it out.
IMO it would be worth dropping completely everywhere to reduce the amount of ifdef checks. There will be half of them if this gets removed and this mis-feature isn't worth cluttering the code.
IMO it would be worth dropping completely everywhere to reduce the amount of ifdef checks. There will be half of them if this gets removed and this mis-feature isn't worth cluttering the code.
I don't know if half of them is correct, but I agree. We should just drop this, it's not like #85 gave a real motivation for it.
I don't know if half of them is correct, but I agree.
Its about one half of the newly-introduced ones (5 out of 11 are related to the background image).
Also shouldn't the use of `vte_terminal_im_append_menuitems()` be just dropped? I would say we should offer the subset of VTE features that is available everywhere and drop anything that is VTE version specific.
@techee that sounds like a plan. The only stuff that needs two lots of support is the RGBA stuff IIUC, otherwise we cut off all old or all new versions.
@elextr I think it's only `vte_terminal_im_append_menuitems()` and the background image that could be dropped - other API changes like vte_terminal_fork_command () rename to vte_terminal_spawn_sync(), the color API change you mentioned etc. have to be dealt with so the terminal works.
@techee ok, I havn't examined the API in detail, but yeah sure changes like that, which are needed to actually make it work, need to be handled too. But your point is for this PR to support the common functionality across versions. Anything thats new or was removed should be dropped at this stage.
If there are fancy new features in new versions that people want to use that can be separate PRs later and simulating functionality from old versions thats missing can also be added later.
Lets keep it simple for now.
Also shouldn't the use of `vte_terminal_im_append_menuitems()` be just dropped?
I'm not sure. At least on GTK2 I think widgets were supposed to display a way to select the input method -- just right click on any GtkEntry from a GTK2 app and you'll see the item. Apparently it was [removed from GTK 3.10 somehow](https://developer.gnome.org/gtk3/stable/GtkSettings.html#GtkSettings--gtk-sh...), but I have no idea hos it works now -- well, nor before, I don't know anything about input methods. But if it's something the widget has to implement another way (say, an interface so GTK can do some magic on its side), we'd need to be sure not to remove the element from a VTE that doesn't have that other thing.
Basically, as said in my first comment on #336 I don't really know hot to deal with this removal, and while it seems that on recent GTK3 version it's not needed (or not displayed?), I wouldn't remove it on other VTE versions unless I actually *knew* what I was changing. And no, commit that removes this on the VTE repo isn't clear: [2da7058c57fd27bb8a8955b50a7a5b2ae8e6d50f deprecated it](https://git.gnome.org/browse/vte/commit/?id=2da7058c57fd27bb8a8955b50a7a5b2a...) and [985fd375c25345933bcd864d4c8be302c3a54eb8 removed it](https://git.gnome.org/browse/vte/commit/?id=985fd375c25345933bcd864d4c8be302...).
Writing this, I dug in GTK docs, and I'd think that since 3.10 widgets aren't supposed to show a way of switching the input method, and I guess instead the DE is supposed to handle that globally somehow. But that's still a guess.
Possibly we should show this item on GTK < 3.10, and surely not show it if [`gtk-show-input-method-menu`](https://developer.gnome.org/gtk3/stable/GtkSettings.html#GtkSettings--gtk-sh...) is set to `FALSE`.
@b4n IIUC now ctrl+space or super+space is the default binding to select an input method for the desktop. Assuming your dekstop is set up with multiple input methods and languages and ibus or another one of the methods supported by your desktop is running the keybinding should get you the input method menu for any widget. Not sure if Geany keybindings would steal those bindings from VTE though?
@b4n pushed 2 commits.
8aebe88 VTE: Remove support for background image 90cc03a VTE: Respect GTK setting for whether to show the IM method menu
@elextr no idea, and I probably don't have many input method configured. Or maybe I do, I have absolutely no idea actually.
Anyway, I tried to make us respect the GTK settings in 90cc03a58d7a084929ad34a9d98adf344b136352 when we have VTE API for it (and I guess it's all fine because VTE 2.91 might depend on GTK >= 3.10). It's not so hard and should be the Right Thing™.
Or maybe I do, I have absolutely no idea actually.
Well at least Cinnamon its just `preferences->input methods` where I can see I have none set up, which is not surprising for an ASCII speaker :)
@b4n OK, makes sense.
Updated to fix merge conflict and remove the intermediate patches for custom background image support.
Should be ready now, it didn't change anything apart that (well, yes, I undone making `alpha` and argument to `rgba_from_color()` as it wasn"t used anymore now the custom background image code is gone).
I didn't review this yet, but I think it's important that it's in the next release in any case.
Merged #1181.
@codebrainz please test on master ;)
@b4n a quick test show terminal now works with GTK+ 3 build, nice work.
github-comments@lists.geany.org