diff options
author | Christian Persch <chpe@src.gnome.org> | 2022-08-05 21:23:02 +0200 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2022-08-05 21:23:02 +0200 |
commit | 66b69471ffda807cd6549dd9ae63e96fd8dd7a0a (patch) | |
tree | a310af11930dda8732c6eec0f74bc63c774f7bdd | |
parent | d90b9d1139c3ce413670f34588506741673919bb (diff) | |
download | vte-66b69471ffda807cd6549dd9ae63e96fd8dd7a0a.tar.gz |
widget: Defer alignment API to next cycle
This API is untested and can possibly be improved, so don't freeze it now.
(cherry picked from commit be0ca2a79414d3db2a991631148db63937c1a93e)
-rw-r--r-- | src/app/app.cc | 43 | ||||
-rw-r--r-- | src/vte/vteterminal.h | 28 | ||||
-rw-r--r-- | src/vtegtk.cc | 274 | ||||
-rw-r--r-- | src/vtegtk.hh | 4 |
4 files changed, 0 insertions, 349 deletions
diff --git a/src/app/app.cc b/src/app/app.cc index 90d958bd..6ad12150 100644 --- a/src/app/app.cc +++ b/src/app/app.cc @@ -121,8 +121,6 @@ public: VteCursorBlinkMode cursor_blink_mode{VTE_CURSOR_BLINK_SYSTEM}; VteCursorShape cursor_shape{VTE_CURSOR_SHAPE_BLOCK}; VteTextBlinkMode text_blink_mode{VTE_TEXT_BLINK_ALWAYS}; - VteAlign xalign{VteAlign(-1)}; - VteAlign yalign{VteAlign(-1)}; vte::glib::RefPtr<GtkCssProvider> css{}; #if VTE_GTK == 3 @@ -477,28 +475,6 @@ private: return true; } - static gboolean - parse_xalign(char const* option, char const* value, void* data, GError** error) - { - auto const that = static_cast<Options*>(data); - auto v = int{}; - auto const rv = that->parse_enum(VTE_TYPE_ALIGN, value, v, error); - if (rv) - that->xalign = VteAlign(v); - return rv; - } - - static gboolean - parse_yalign(char const* option, char const* value, void* data, GError** error) - { - auto const that = static_cast<Options*>(data); - auto v = int{}; - auto const rv = that->parse_enum(VTE_TYPE_ALIGN, value, v, error); - if (rv) - that->yalign = VteAlign(v); - return rv; - } - public: double get_alpha() const @@ -687,17 +663,6 @@ public: #endif { "use-theme-colors", 0, 0, G_OPTION_ARG_NONE, &use_theme_colors, "Use foreground and background colors from the gtk+ theme", nullptr }, - - { "xalign", 0, 0, G_OPTION_ARG_CALLBACK, (void*)parse_xalign, - "Horizontal alignment (start|end|center)", "ALIGN" }, - { "yalign", 0, 0, G_OPTION_ARG_CALLBACK, (void*)parse_yalign, - "Vertical alignment (fill|start|end|center)", "ALIGN" }, - { "no-xfill", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &no_xfill, - "No horizontal fillment", nullptr }, - { "no-yfill", 0, 0, G_OPTION_ARG_NONE, &no_yfill, - "No vertical fillment", nullptr }, - - #if VTE_GTK == 3 { "no-argb-visual", 0, 0, G_OPTION_ARG_NONE, &no_argb_visual, "Don't use an ARGB visual", nullptr }, @@ -2573,14 +2538,6 @@ vteapp_window_constructed(GObject *object) vte_terminal_set_scroll_unit_is_pixels(window->terminal, options.scroll_unit_is_pixels); vte_terminal_set_scrollback_lines(window->terminal, options.scrollback_lines); vte_terminal_set_text_blink_mode(window->terminal, options.text_blink_mode); - if (options.xalign != VteAlign(-1)) - vte_terminal_set_xalign(window->terminal, options.xalign); - if (options.yalign != VteAlign(-1)) - vte_terminal_set_yalign(window->terminal, options.yalign); - if (options.no_xfill) - vte_terminal_set_xfill(window->terminal, false); - if (options.no_yfill) - vte_terminal_set_yfill(window->terminal, false); /* Style */ if (options.font_string != nullptr) { diff --git a/src/vte/vteterminal.h b/src/vte/vteterminal.h index 688f3aa0..78176f97 100644 --- a/src/vte/vteterminal.h +++ b/src/vte/vteterminal.h @@ -584,34 +584,6 @@ void vte_terminal_set_enable_sixel(VteTerminal *terminal, _VTE_PUBLIC gboolean vte_terminal_get_enable_sixel(VteTerminal *terminal) _VTE_CXX_NOEXCEPT _VTE_GNUC_NONNULL(1); -_VTE_PUBLIC -void vte_terminal_set_xalign(VteTerminal* terminal, - VteAlign align) _VTE_CXX_NOEXCEPT _VTE_GNUC_NONNULL(1); - -_VTE_PUBLIC -VteAlign vte_terminal_get_xalign(VteTerminal* terminal) _VTE_CXX_NOEXCEPT _VTE_GNUC_NONNULL(1); - -_VTE_PUBLIC -void vte_terminal_set_yalign(VteTerminal* terminal, - VteAlign align) _VTE_CXX_NOEXCEPT _VTE_GNUC_NONNULL(1); - -_VTE_PUBLIC -VteAlign vte_terminal_get_yalign(VteTerminal* terminal) _VTE_CXX_NOEXCEPT _VTE_GNUC_NONNULL(1); - -_VTE_PUBLIC -void vte_terminal_set_xfill(VteTerminal* terminal, - gboolean fill) _VTE_CXX_NOEXCEPT _VTE_GNUC_NONNULL(1); - -_VTE_PUBLIC -gboolean vte_terminal_get_xfill(VteTerminal* terminal) _VTE_CXX_NOEXCEPT _VTE_GNUC_NONNULL(1); - -_VTE_PUBLIC -void vte_terminal_set_yfill(VteTerminal* terminal, - gboolean fill) _VTE_CXX_NOEXCEPT _VTE_GNUC_NONNULL(1); - -_VTE_PUBLIC -gboolean vte_terminal_get_yfill(VteTerminal* terminal) _VTE_CXX_NOEXCEPT _VTE_GNUC_NONNULL(1); - G_DEFINE_AUTOPTR_CLEANUP_FUNC(VteTerminal, g_object_unref) G_END_DECLS diff --git a/src/vtegtk.cc b/src/vtegtk.cc index d029085f..3945ba67 100644 --- a/src/vtegtk.cc +++ b/src/vtegtk.cc @@ -1024,22 +1024,6 @@ try g_value_set_string (value, vte_terminal_get_word_char_exceptions (terminal)); break; - case PROP_XALIGN: - g_value_set_enum(value, vte_terminal_get_xalign(terminal)); - break; - - case PROP_YALIGN: - g_value_set_enum(value, vte_terminal_get_yalign(terminal)); - break; - - case PROP_XFILL: - g_value_set_boolean(value, vte_terminal_get_xfill(terminal)); - break; - - case PROP_YFILL: - g_value_set_boolean(value, vte_terminal_get_yfill(terminal)); - break; - default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); return; @@ -1158,22 +1142,6 @@ try vte_terminal_set_word_char_exceptions (terminal, g_value_get_string (value)); break; - case PROP_XALIGN: - vte_terminal_set_xalign(terminal, VteAlign(g_value_get_enum(value))); - break; - - case PROP_YALIGN: - vte_terminal_set_yalign(terminal, VteAlign(g_value_get_enum(value))); - break; - - case PROP_XFILL: - vte_terminal_set_xfill(terminal, g_value_get_boolean(value)); - break; - - case PROP_YFILL: - vte_terminal_set_yfill(terminal, g_value_get_boolean(value)); - break; - /* Not writable */ case PROP_CURRENT_DIRECTORY_URI: case PROP_CURRENT_FILE_URI: @@ -2368,56 +2336,6 @@ vte_terminal_class_init(VteTerminalClass *klass) NULL, (GParamFlags) (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY)); - /** - * VteTerminal:xalign: - * - * The horizontal alignment of @terminal within its allocation. - * - * Since: 0.72 - */ - pspecs[PROP_XALIGN] = - g_param_spec_enum("xalign", nullptr, nullptr, - VTE_TYPE_ALIGN, - VTE_ALIGN_START, - GParamFlags(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY)); - - /** - * VteTerminal:yalign: - * - * The vertical alignment of @terminal within its allocation - * - * Since: 0.72 - */ - pspecs[PROP_YALIGN] = - g_param_spec_enum("yalign", nullptr, nullptr, - VTE_TYPE_ALIGN, - VTE_ALIGN_START, - GParamFlags(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY)); - - /** - * VteTerminal:xfill: - * - * The horizontal fillment of @terminal within its allocation. - * - * Since: 0.72 - */ - pspecs[PROP_XFILL] = - g_param_spec_boolean("xfill", nullptr, nullptr, - TRUE, - GParamFlags(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY)); - - /** - * VteTerminal:yfill: - * - * The vertical fillment of @terminal within its allocation - * - * Since: 0.72 - */ - pspecs[PROP_YFILL] = - g_param_spec_boolean("yfill", nullptr, nullptr, - TRUE, - GParamFlags(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY)); - g_object_class_install_properties(gobject_class, LAST_PROP, pspecs); #if VTE_GTK == 3 @@ -6499,195 +6417,3 @@ constexpr bool check_enum_value<VteAlign>(VteAlign value) noexcept return false; } } - -/** - * vte_terminal_set_xalign: - * @terminal: a #VteTerminal - * @align: alignment value from #VteAlign - * - * Sets the horizontal alignment of @terminal within its allocation. - * - * Note: %VTE_ALIGN_START_FILL is not supported, and will be treated - * like %VTE_ALIGN_START. - * - * Since: 0.72 - */ -void -vte_terminal_set_xalign(VteTerminal* terminal, - VteAlign align) noexcept -try -{ - g_return_if_fail(VTE_IS_TERMINAL(terminal)); - g_return_if_fail(check_enum_value(align)); - - if (WIDGET(terminal)->set_xalign(align)) - g_object_notify_by_pspec(G_OBJECT(terminal), pspecs[PROP_XALIGN]); -} -catch (...) -{ - vte::log_exception(); -} - -/** - * vte_terminal_get_xalign: - * @terminal: a #VteTerminal - * - * Returns: the horizontal alignment of @terminal within its allocation - * - * Since: 0.72 - */ -VteAlign -vte_terminal_get_xalign(VteTerminal* terminal) noexcept -try -{ - g_return_val_if_fail(VTE_IS_TERMINAL(terminal), VTE_ALIGN_START); - - return WIDGET(terminal)->xalign(); -} -catch (...) -{ - vte::log_exception(); - return VTE_ALIGN_START; -} - -/** - * vte_terminal_set_yalign: - * @terminal: a #VteTerminal - * @align: alignment value from #VteAlign - * - * Sets the vertical alignment of @terminal within its allocation. - * - * Since: 0.72 - */ -void -vte_terminal_set_yalign(VteTerminal* terminal, - VteAlign align) noexcept -try -{ - g_return_if_fail(VTE_IS_TERMINAL(terminal)); - g_return_if_fail(check_enum_value(align)); - - if (WIDGET(terminal)->set_yalign(align)) - g_object_notify_by_pspec(G_OBJECT(terminal), pspecs[PROP_YALIGN]); -} -catch (...) -{ - vte::log_exception(); -} - -/** - * vte_terminal_get_yalign: - * @terminal: a #VteTerminal - * - * Returns: the vertical alignment of @terminal within its allocation - * - * Since: 0.72 - */ -VteAlign -vte_terminal_get_yalign(VteTerminal* terminal) noexcept -try -{ - g_return_val_if_fail(VTE_IS_TERMINAL(terminal), VTE_ALIGN_START); - - return WIDGET(terminal)->yalign(); -} -catch (...) -{ - vte::log_exception(); - return VTE_ALIGN_START; -} - -/** - * vte_terminal_set_xfill: - * @terminal: a #VteTerminal - * @fill: fillment value from #VteFill - * - * Sets the horizontal fillment of @terminal within its allocation. - * - * Note: %VTE_FILL_START_FILL is not supported, and will be treated - * like %VTE_FILL_START. - * - * Since: 0.72 - */ -void -vte_terminal_set_xfill(VteTerminal* terminal, - gboolean fill) noexcept -try -{ - g_return_if_fail(VTE_IS_TERMINAL(terminal)); - - if (WIDGET(terminal)->set_xfill(fill != false)) - g_object_notify_by_pspec(G_OBJECT(terminal), pspecs[PROP_XFILL]); -} -catch (...) -{ - vte::log_exception(); -} - -/** - * vte_terminal_get_xfill: - * @terminal: a #VteTerminal - * - * Returns: the horizontal fillment of @terminal within its allocation - * - * Since: 0.72 - */ -gboolean -vte_terminal_get_xfill(VteTerminal* terminal) noexcept -try -{ - g_return_val_if_fail(VTE_IS_TERMINAL(terminal), true); - - return WIDGET(terminal)->xfill(); -} -catch (...) -{ - vte::log_exception(); - return true; -} - -/** - * vte_terminal_set_yfill: - * @terminal: a #VteTerminal - * @fill: fillment value from #VteFill - * - * Sets the vertical fillment of @terminal within its allocation. - * - * Since: 0.72 - */ -void -vte_terminal_set_yfill(VteTerminal* terminal, - gboolean fill) noexcept -try -{ - g_return_if_fail(VTE_IS_TERMINAL(terminal)); - - if (WIDGET(terminal)->set_yfill(fill != false)) - g_object_notify_by_pspec(G_OBJECT(terminal), pspecs[PROP_YFILL]); -} -catch (...) -{ - vte::log_exception(); -} - -/** - * vte_terminal_get_yfill: - * @terminal: a #VteTerminal - * - * Returns: the vertical fillment of @terminal within its allocation - * - * Since: 0.72 - */ -gboolean -vte_terminal_get_yfill(VteTerminal* terminal) noexcept -try -{ - g_return_val_if_fail(VTE_IS_TERMINAL(terminal), true); - - return WIDGET(terminal)->yfill(); -} -catch (...) -{ - vte::log_exception(); - return true; -} diff --git a/src/vtegtk.hh b/src/vtegtk.hh index 778b555a..6b7a1ea2 100644 --- a/src/vtegtk.hh +++ b/src/vtegtk.hh @@ -92,10 +92,6 @@ enum { PROP_TEXT_BLINK_MODE, PROP_WINDOW_TITLE, PROP_WORD_CHAR_EXCEPTIONS, - PROP_XALIGN, - PROP_YALIGN, - PROP_XFILL, - PROP_YFILL, LAST_PROP, /* override properties */ |