[Xfce4-commits] [apps/xfce4-terminal] 01/01: Add option to control text blinking
noreply at xfce.org
noreply at xfce.org
Sat Jan 6 19:31:12 CET 2018
This is an automated email from the git hooks/post-receive script.
f 2 4 0 4 p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository apps/xfce4-terminal.
commit 324e1a45d360f74557169fec4a2285d64a6e7072
Author: Igor <f2404 at yandex.ru>
Date: Sat Jan 6 13:30:20 2018 -0500
Add option to control text blinking
Available since vte 0.51.3.
See bug #14127
---
terminal/terminal-preferences-dialog.c | 10 +++++-
terminal/terminal-preferences.c | 44 ++++++++++++++---------
terminal/terminal-preferences.glade | 66 +++++++++++++++++++++++++++++++++-
terminal/terminal-preferences.h | 8 +++++
terminal/terminal-screen.c | 40 +++++++++++++++++++++
5 files changed, 150 insertions(+), 18 deletions(-)
diff --git a/terminal/terminal-preferences-dialog.c b/terminal/terminal-preferences-dialog.c
index 7713326..bdbd509 100644
--- a/terminal/terminal-preferences-dialog.c
+++ b/terminal/terminal-preferences-dialog.c
@@ -145,7 +145,8 @@ terminal_preferences_dialog_init (TerminalPreferencesDialog *dialog)
"scrolling-on-keystroke", "scrolling-bar",
"scrolling-unlimited", "misc-cursor-shape",
"misc-cursor-blinks", "font-allow-bold",
- "font-use-system", "misc-menubar-default",
+ "font-use-system", "text-blink-mode",
+ "misc-menubar-default",
"misc-toolbar-default", "misc-borders-default",
"misc-tab-close-middle-click", "misc-middle-click-opens-uri",
"misc-mouse-autohide", "misc-rewrap-on-resize",
@@ -266,6 +267,13 @@ error:
gtk_widget_hide (GTK_WIDGET (object));
#endif
+#if !VTE_CHECK_VERSION (0, 51, 3)
+ /* hide "Text blinks" if vte doesn't support it */
+ object = gtk_builder_get_object (GTK_BUILDER (dialog), "box-text-blink");
+ terminal_return_if_fail (G_IS_OBJECT (object));
+ gtk_widget_hide (GTK_WIDGET (object));
+#endif
+
/* run custom command button */
object = gtk_builder_get_object (GTK_BUILDER (dialog), "run-custom-command");
object2 = gtk_builder_get_object (GTK_BUILDER (dialog), "hbox3");
diff --git a/terminal/terminal-preferences.c b/terminal/terminal-preferences.c
index bebafc4..0e84088 100644
--- a/terminal/terminal-preferences.c
+++ b/terminal/terminal-preferences.c
@@ -123,6 +123,7 @@ enum
PROP_WORD_CHARS,
PROP_TAB_ACTIVITY_COLOR,
PROP_TAB_ACTIVITY_TIMEOUT,
+ PROP_TEXT_BLINK_MODE,
N_PROPERTIES,
};
@@ -267,6 +268,18 @@ static void
terminal_preferences_class_init (TerminalPreferencesClass *klass)
{
GObjectClass *gobject_class;
+ GType enum_types[] = {
+ GTK_TYPE_POSITION_TYPE,
+ TERMINAL_TYPE_BACKGROUND_STYLE,
+ TERMINAL_TYPE_BACKGROUND,
+ TERMINAL_TYPE_SCROLLBAR,
+ TERMINAL_TYPE_TITLE,
+ TERMINAL_TYPE_ERASE_BINDING,
+ TERMINAL_TYPE_AMBIGUOUS_WIDTH_BINDING,
+ TERMINAL_TYPE_CURSOR_SHAPE,
+ TERMINAL_TYPE_TEXT_BLINK_MODE
+ };
+ guint i;
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->dispose = terminal_preferences_dispose;
@@ -285,22 +298,10 @@ terminal_preferences_class_init (TerminalPreferencesClass *klass)
g_value_register_transform_func (G_TYPE_STRING, G_TYPE_DOUBLE, transform_string_to_double);
if (!g_value_type_transformable (G_TYPE_STRING, G_TYPE_UINT))
g_value_register_transform_func (G_TYPE_STRING, G_TYPE_UINT, transform_string_to_uint);
- if (!g_value_type_transformable (G_TYPE_STRING, GTK_TYPE_POSITION_TYPE))
- g_value_register_transform_func (G_TYPE_STRING, GTK_TYPE_POSITION_TYPE, transform_string_to_enum);
- if (!g_value_type_transformable (G_TYPE_STRING, TERMINAL_TYPE_BACKGROUND_STYLE))
- g_value_register_transform_func (G_TYPE_STRING, TERMINAL_TYPE_BACKGROUND_STYLE, transform_string_to_enum);
- if (!g_value_type_transformable (G_TYPE_STRING, TERMINAL_TYPE_BACKGROUND))
- g_value_register_transform_func (G_TYPE_STRING, TERMINAL_TYPE_BACKGROUND, transform_string_to_enum);
- if (!g_value_type_transformable (G_TYPE_STRING, TERMINAL_TYPE_SCROLLBAR))
- g_value_register_transform_func (G_TYPE_STRING, TERMINAL_TYPE_SCROLLBAR, transform_string_to_enum);
- if (!g_value_type_transformable (G_TYPE_STRING, TERMINAL_TYPE_TITLE))
- g_value_register_transform_func (G_TYPE_STRING, TERMINAL_TYPE_TITLE, transform_string_to_enum);
- if (!g_value_type_transformable (G_TYPE_STRING, TERMINAL_TYPE_ERASE_BINDING))
- g_value_register_transform_func (G_TYPE_STRING, TERMINAL_TYPE_ERASE_BINDING, transform_string_to_enum);
- if (!g_value_type_transformable (G_TYPE_STRING, TERMINAL_TYPE_AMBIGUOUS_WIDTH_BINDING))
- g_value_register_transform_func (G_TYPE_STRING, TERMINAL_TYPE_AMBIGUOUS_WIDTH_BINDING, transform_string_to_enum);
- if (!g_value_type_transformable (G_TYPE_STRING, TERMINAL_TYPE_CURSOR_SHAPE))
- g_value_register_transform_func (G_TYPE_STRING, TERMINAL_TYPE_CURSOR_SHAPE, transform_string_to_enum);
+ /* enum types */
+ for (i = 0; i < sizeof(enum_types) / sizeof (GType); ++i)
+ if (!g_value_type_transformable (G_TYPE_STRING, enum_types[i]))
+ g_value_register_transform_func (G_TYPE_STRING, enum_types[i], transform_string_to_enum);
/**
* TerminalPreferences:background-mode:
@@ -1138,6 +1139,17 @@ terminal_preferences_class_init (TerminalPreferencesClass *klass)
"-A-Za-z0-9,./?%&#:_=+@~",
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+ /**
+ * TerminalPreferences:text-blink-mode:
+ **/
+ preferences_props[PROP_TEXT_BLINK_MODE] =
+ g_param_spec_enum ("text-blink-mode",
+ NULL,
+ "TextBlinkMode",
+ TERMINAL_TYPE_TEXT_BLINK_MODE,
+ TERMINAL_TEXT_BLINK_ALWAYS,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
/* install all properties */
g_object_class_install_properties (gobject_class, N_PROPERTIES, preferences_props);
}
diff --git a/terminal/terminal-preferences.glade b/terminal/terminal-preferences.glade
index 1b72d74..3baf826 100644
--- a/terminal/terminal-preferences.glade
+++ b/terminal/terminal-preferences.glade
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
+<!-- Generated with glade 3.20.2 -->
<interface>
<requires lib="gtk+" version="3.14"/>
<requires lib="libxfce4ui" version="4.12"/>
@@ -211,6 +211,26 @@
</row>
</data>
</object>
+ <object class="GtkListStore" id="liststore9">
+ <columns>
+ <!-- column-name title -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes">Never</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">When focused</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">When unfocused</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Always</col>
+ </row>
+ </data>
+ </object>
<object class="GtkAdjustment" id="scrolling-line">
<property name="lower">1</property>
<property name="upper">5242880</property>
@@ -1470,6 +1490,50 @@ Opacity setting is not available.</property>
<property name="position">2</property>
</packing>
</child>
+ <child>
+ <object class="GtkBox" id="box-text-blink">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkLabel" id="text-blink-label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Text blinks:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">trans-scale</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="text-blink-mode">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="model">liststore9</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext11"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
</object>
</child>
</object>
diff --git a/terminal/terminal-preferences.h b/terminal/terminal-preferences.h
index d90575c..128a92e 100644
--- a/terminal/terminal-preferences.h
+++ b/terminal/terminal-preferences.h
@@ -87,6 +87,14 @@ typedef enum /*< enum,prefix=TERMINAL_CURSOR_SHAPE >*/
TERMINAL_CURSOR_SHAPE_UNDERLINE
} TerminalCursorShape;
+typedef enum /*< enum,prefix=TERMINAL_TEXT_BLINK >*/
+{
+ TERMINAL_TEXT_BLINK_NEVER,
+ TERMINAL_TEXT_BLINK_FOCUSED,
+ TERMINAL_TEXT_BLINK_UNFOCUSED,
+ TERMINAL_TEXT_BLINK_ALWAYS
+} TerminalTextBlinkMode;
+
GType terminal_preferences_get_type (void) G_GNUC_CONST;
TerminalPreferences *terminal_preferences_get (void);
diff --git a/terminal/terminal-screen.c b/terminal/terminal-screen.c
index 44a03f4..fa7e31b 100644
--- a/terminal/terminal-screen.c
+++ b/terminal/terminal-screen.c
@@ -125,6 +125,7 @@ static void terminal_screen_update_misc_rewrap_on_resize (TerminalScreen
static void terminal_screen_update_scrolling_lines (TerminalScreen *screen);
static void terminal_screen_update_scrolling_on_output (TerminalScreen *screen);
static void terminal_screen_update_scrolling_on_keystroke (TerminalScreen *screen);
+static void terminal_screen_update_text_blink_mode (TerminalScreen *screen);
static void terminal_screen_update_title (TerminalScreen *screen);
static void terminal_screen_update_word_chars (TerminalScreen *screen);
static void terminal_screen_vte_child_exited (VteTerminal *terminal,
@@ -324,6 +325,7 @@ terminal_screen_init (TerminalScreen *screen)
terminal_screen_update_scrolling_lines (screen);
terminal_screen_update_scrolling_on_output (screen);
terminal_screen_update_scrolling_on_keystroke (screen);
+ terminal_screen_update_text_blink_mode (screen);
terminal_screen_update_word_chars (screen);
terminal_screen_update_background (screen);
terminal_screen_update_colors (screen);
@@ -599,6 +601,8 @@ terminal_screen_preferences_changed (TerminalPreferences *preferences,
terminal_screen_update_scrolling_on_output (screen);
else if (strcmp ("scrolling-on-keystroke", name) == 0)
terminal_screen_update_scrolling_on_keystroke (screen);
+ else if (strcmp ("text-blink-mode", name) == 0)
+ terminal_screen_update_text_blink_mode (screen);
else if (strncmp ("title-", name, strlen ("title-")) == 0)
terminal_screen_update_title (screen);
else if (strcmp ("word-chars", name) == 0)
@@ -1212,6 +1216,42 @@ terminal_screen_update_scrolling_on_keystroke (TerminalScreen *screen)
static void
+terminal_screen_update_text_blink_mode (TerminalScreen *screen)
+{
+ TerminalTextBlinkMode val;
+ VteTextBlinkMode mode = VTE_TEXT_BLINK_ALWAYS;
+
+ g_object_get (G_OBJECT (screen->preferences), "text-blink-mode", &val, NULL);
+
+ switch (val)
+ {
+ case VTE_TEXT_BLINK_ALWAYS:
+ break;
+
+ case TERMINAL_TEXT_BLINK_NEVER:
+ mode = VTE_TEXT_BLINK_NEVER;
+ break;
+
+ case TERMINAL_TEXT_BLINK_FOCUSED:
+ mode = VTE_TEXT_BLINK_FOCUSED;
+ break;
+
+ case TERMINAL_TEXT_BLINK_UNFOCUSED:
+ mode = VTE_TEXT_BLINK_UNFOCUSED;
+ break;
+
+ default:
+ terminal_assert_not_reached ();
+ }
+
+#if VTE_CHECK_VERSION (0, 51, 3)
+ vte_terminal_set_text_blink_mode (VTE_TERMINAL (screen->terminal), mode);
+#endif
+}
+
+
+
+static void
terminal_screen_update_title (TerminalScreen *screen)
{
g_object_notify (G_OBJECT (screen), "title");
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list