[gnome-terminal] profile: Add pref to enable SIXEL
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-terminal] profile: Add pref to enable SIXEL
- Date: Sat, 8 Aug 2020 20:03:10 +0000 (UTC)
commit 0acb0d1d8da957ab43d73cb51d3142fc99c28ca7
Author: Christian Persch <chpe src gnome org>
Date: Sat Aug 8 21:57:15 2020 +0200
profile: Add pref to enable SIXEL
When VTE was built with SIXEL support, show a checkbox in
the compatibility prefs to enable it.
https://gitlab.gnome.org/GNOME/vte/-/issues/253
src/org.gnome.Terminal.gschema.xml | 5 +++++
src/preferences.ui | 20 ++++++++++++++++++--
src/profile-editor.c | 6 ++++++
src/terminal-schemas.h | 1 +
src/terminal-screen.c | 4 ++++
5 files changed, 34 insertions(+), 2 deletions(-)
---
diff --git a/src/org.gnome.Terminal.gschema.xml b/src/org.gnome.Terminal.gschema.xml
index 926be042..be00aa2d 100644
--- a/src/org.gnome.Terminal.gschema.xml
+++ b/src/org.gnome.Terminal.gschema.xml
@@ -204,6 +204,11 @@
<summary>Whether to perform Arabic shaping</summary>
<description>If true, shape Arabic text.</description>
</key>
+ <key name="enable-sixel" type="b">
+ <default>false</default>
+ <summary>Whether to enable SIXEL images</summary>
+ <description>If true, SIXEL sequences are parsed and images are rendered.</description>
+ </key>
<key name="bold-is-bright" type="b">
<default>false</default>
<summary>Whether bold is also bright</summary>
diff --git a/src/preferences.ui b/src/preferences.ui
index fef8fec8..d1aca7b2 100644
--- a/src/preferences.ui
+++ b/src/preferences.ui
@@ -2200,6 +2200,22 @@
<property name="left_attach">1</property>
</packing>
</child>
+ <child>
+ <object class="GtkCheckButton" id="enable-sixel-checkbutton">
+ <property name="label" translatable="yes">Enable _SIXEL images</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="top_attach">4</property>
+ <property name="left_attach">0</property>
+ <property name="width">2</property>
+ </packing>
+ </child>
<child>
<object class="GtkButton" id="reset-compat-defaults-button">
<property name="label" translatable="yes">_Reset Compatibility Options to
Defaults</property>
@@ -2211,7 +2227,7 @@
<property name="halign">start</property>
</object>
<packing>
- <property name="top_attach">4</property>
+ <property name="top_attach">5</property>
<property name="left_attach">0</property>
<property name="width">2</property>
</packing>
@@ -2434,4 +2450,4 @@
</object>
</child>
</object>
-</interface>
\ No newline at end of file
+</interface>
diff --git a/src/profile-editor.c b/src/profile-editor.c
index 6ce73c29..4098f90b 100644
--- a/src/profile-editor.c
+++ b/src/profile-editor.c
@@ -613,6 +613,7 @@ reset_compat_defaults_cb (GtkWidget *button,
g_settings_reset (profile, TERMINAL_PROFILE_BACKSPACE_BINDING_KEY);
g_settings_reset (profile, TERMINAL_PROFILE_ENCODING_KEY);
g_settings_reset (profile, TERMINAL_PROFILE_CJK_UTF8_AMBIGUOUS_WIDTH_KEY);
+ g_settings_reset (profile, TERMINAL_PROFILE_ENABLE_SIXEL_KEY);
}
static gboolean
@@ -1425,6 +1426,11 @@ profile_prefs_load (const char *uuid, GSettings *profile)
w,
"active-id",
G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
+
+ w = (GtkWidget *) gtk_builder_get_object (builder, "enable-sixel-checkbutton");
+ profile_prefs_settings_bind (profile, TERMINAL_PROFILE_ENABLE_SIXEL_KEY, w,
+ "active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
+ gtk_widget_set_visible (w, (vte_get_feature_flags() & VTE_FEATURE_FLAG_SIXEL) != 0);
}
/* Called once per Preferences window, to destroy stuff that doesn't depend on the profile being edited */
diff --git a/src/terminal-schemas.h b/src/terminal-schemas.h
index 05e9f819..cffc4ed8 100644
--- a/src/terminal-schemas.h
+++ b/src/terminal-schemas.h
@@ -50,6 +50,7 @@ G_BEGIN_DECLS
#define TERMINAL_PROFILE_DELETE_BINDING_KEY "delete-binding"
#define TERMINAL_PROFILE_ENABLE_BIDI_KEY "enable-bidi"
#define TERMINAL_PROFILE_ENABLE_SHAPING_KEY "enable-shaping"
+#define TERMINAL_PROFILE_ENABLE_SIXEL_KEY "enable-sixel"
#define TERMINAL_PROFILE_ENCODING_KEY "encoding"
#define TERMINAL_PROFILE_EXIT_ACTION_KEY "exit-action"
#define TERMINAL_PROFILE_FONT_KEY "font"
diff --git a/src/terminal-screen.c b/src/terminal-screen.c
index 9becee1e..f20c5d0f 100644
--- a/src/terminal-screen.c
+++ b/src/terminal-screen.c
@@ -1108,6 +1108,10 @@ terminal_screen_profile_changed_cb (GSettings *profile,
vte_terminal_set_enable_shaping (vte_terminal,
g_settings_get_boolean (profile, TERMINAL_PROFILE_ENABLE_SHAPING_KEY));
+ if (!prop_name || prop_name == I_(TERMINAL_PROFILE_ENABLE_SIXEL_KEY))
+ vte_terminal_set_enable_sixel (vte_terminal,
+ g_settings_get_boolean (profile, TERMINAL_PROFILE_ENABLE_SIXEL_KEY));
+
if (!prop_name || prop_name == I_(TERMINAL_PROFILE_BOLD_IS_BRIGHT_KEY))
vte_terminal_set_bold_is_bright (vte_terminal,
g_settings_get_boolean (profile, TERMINAL_PROFILE_BOLD_IS_BRIGHT_KEY));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]