[vte/vte-0-66: 2/5] widget: Defer alignment API to next cycle
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/vte-0-66: 2/5] widget: Defer alignment API to next cycle
- Date: Sat, 14 Aug 2021 19:48:11 +0000 (UTC)
commit 0857ff7dd555d2f5e0c6627a7723ce6dee7d24d7
Author: Christian Persch <chpe src gnome org>
Date: Sat Aug 14 21:45:46 2021 +0200
widget: Defer alignment API to next cycle
This API is untested and can possibly be improved, so don't freeze it now.
doc/reference/vte-sections.txt.in | 5 --
src/app/app.cc | 33 --------
src/vte/vteenums.h | 24 ------
src/vte/vteterminal.h | 14 ----
src/vtegtk.cc | 153 --------------------------------------
src/vtegtk.hh | 2 -
src/widget.cc | 4 +-
src/widget.hh | 26 -------
8 files changed, 2 insertions(+), 259 deletions(-)
---
diff --git a/doc/reference/vte-sections.txt.in b/doc/reference/vte-sections.txt.in
index 4e3a7e3e..1180f972 100644
--- a/doc/reference/vte-sections.txt.in
+++ b/doc/reference/vte-sections.txt.in
@@ -2,7 +2,6 @@
<FILE>vte-terminal</FILE>
<TITLE>VteTerminal</TITLE>
VteTerminal
-VteAlign
VteCursorBlinkMode
VteCursorShape
VteEraseBinding
@@ -104,10 +103,6 @@ vte_terminal_search_set_wrap_around
vte_terminal_event_check_regex_array
vte_terminal_event_check_regex_simple
#endif /* VTE_GTK */
-vte_terminal_get_xalign
-vte_terminal_set_xalign
-vte_terminal_get_yalign
-vte_terminal_set_yalign
<SUBSECTION>
VteFeatureFlags
diff --git a/src/app/app.cc b/src/app/app.cc
index 620410c4..eb1e880a 100644
--- a/src/app/app.cc
+++ b/src/app/app.cc
@@ -119,8 +119,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
@@ -475,28 +473,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
@@ -689,11 +665,6 @@ public:
{ "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 (fill|start|end|center)", "ALIGN" },
- { "yalign", 0, 0, G_OPTION_ARG_CALLBACK, (void*)parse_yalign,
- "Vertical alignment (fill|start|end|center)", "ALIGN" },
-
#if VTE_GTK == 3
{ "no-argb-visual", 0, 0, G_OPTION_ARG_NONE, &no_argb_visual,
"Don't use an ARGB visual", nullptr },
@@ -2575,10 +2546,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);
/* Style */
if (options.font_string != nullptr) {
diff --git a/src/vte/vteenums.h b/src/vte/vteenums.h
index c13228ac..e6de6622 100644
--- a/src/vte/vteenums.h
+++ b/src/vte/vteenums.h
@@ -196,28 +196,4 @@ typedef enum /*< skip >*/ {
VTE_FEATURE_FLAGS_MASK = 0xFFFFFFFFFFFFFFFFULL, /* force enum to 64 bit */
} VteFeatureFlags;
-
-/**
- * VteAlign:
- * @VTE_ALIGN_START: align to left/top
- * @VTE_ALIGN_CENTER: align to centre
- * @VTE_ALIGN_END: align to right/bottom
- * @VTE_ALIGN_FILL: fill available space
- *
- * An enumeration type that can be used to specify how the terminal
- * uses extra allocated space.
- *
- * Since: 0.66
- */
-typedef enum {
- VTE_ALIGN_START = 0U,
- VTE_ALIGN_CENTER = 1U,
- /* VTE_ALIGN_BASELINE = 2U, */
- VTE_ALIGN_END = 3U,
- VTE_ALIGN_FILL = 4U, /*< skip >*/ /* flag */
- VTE_ALIGN_START_FILL = 4U,
- /* VTE_ALIGN_CENTER_FILL = 5U, */
- /* VTE_ALIGN_END_FILL = 6U, */
-} VteAlign;
-
G_END_DECLS
diff --git a/src/vte/vteterminal.h b/src/vte/vteterminal.h
index b59f55f5..05f6674f 100644
--- a/src/vte/vteterminal.h
+++ b/src/vte/vteterminal.h
@@ -545,20 +545,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);
-
G_DEFINE_AUTOPTR_CLEANUP_FUNC(VteTerminal, g_object_unref)
G_END_DECLS
diff --git a/src/vtegtk.cc b/src/vtegtk.cc
index 8d17e666..5917d74d 100644
--- a/src/vtegtk.cc
+++ b/src/vtegtk.cc
@@ -1015,14 +1015,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;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
return;
@@ -1141,14 +1133,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;
-
/* Not writable */
case PROP_CURRENT_DIRECTORY_URI:
case PROP_CURRENT_FILE_URI:
@@ -2347,32 +2331,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.66
- */
- 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.66
- */
- pspecs[PROP_YALIGN] =
- g_param_spec_enum("yalign", nullptr, nullptr,
- VTE_TYPE_ALIGN,
- VTE_ALIGN_START_FILL,
- 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
@@ -6187,117 +6145,6 @@ catch (...)
return false;
}
-template<>
-constexpr bool check_enum_value<VteAlign>(VteAlign value) noexcept
-{
- switch (value) {
- case VTE_ALIGN_START:
- case VTE_ALIGN_CENTER:
- case VTE_ALIGN_END:
- case VTE_ALIGN_START_FILL:
- return true;
- default:
- 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.66
- */
-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.66
- */
-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.66
- */
-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.66
- */
-VteAlign
-vte_terminal_get_yalign(VteTerminal* terminal) noexcept
-try
-{
- g_return_val_if_fail(VTE_IS_TERMINAL(terminal), VTE_ALIGN_START_FILL);
-
- return WIDGET(terminal)->yalign();
-}
-catch (...)
-{
- vte::log_exception();
- return VTE_ALIGN_START_FILL;
-}
-
namespace vte {
using namespace std::literals;
diff --git a/src/vtegtk.hh b/src/vtegtk.hh
index e32430be..6b7a1ea2 100644
--- a/src/vtegtk.hh
+++ b/src/vtegtk.hh
@@ -92,8 +92,6 @@ enum {
PROP_TEXT_BLINK_MODE,
PROP_WINDOW_TITLE,
PROP_WORD_CHAR_EXCEPTIONS,
- PROP_XALIGN,
- PROP_YALIGN,
LAST_PROP,
/* override properties */
diff --git a/src/widget.cc b/src/widget.cc
index 3b2c9755..eea34cb8 100644
--- a/src/widget.cc
+++ b/src/widget.cc
@@ -1857,8 +1857,8 @@ Widget::size_allocate(GtkAllocation* allocation)
m_terminal->widget_size_allocate(allocation->x, allocation->y,
allocation->width, allocation->height,
-1,
- vte::terminal::Terminal::Alignment(m_xalign),
- vte::terminal::Terminal::Alignment(m_yalign));
+ vte::terminal::Terminal::Alignment::START,
+ vte::terminal::Terminal::Alignment::START_FILL);
gtk_widget_set_allocation(gtk(), allocation);
diff --git a/src/widget.hh b/src/widget.hh
index 828f686c..f821a342 100644
--- a/src/widget.hh
+++ b/src/widget.hh
@@ -475,29 +475,6 @@ public:
bool set_sixel_enabled(bool enabled) noexcept { return m_terminal->set_sixel_enabled(enabled); }
bool sixel_enabled() const noexcept { return m_terminal->sixel_enabled(); }
- constexpr auto xalign() const noexcept { return m_xalign; }
- constexpr auto yalign() const noexcept { return m_yalign; }
-
- bool set_xalign(VteAlign align) noexcept
- {
- if (align == m_xalign)
- return false;
-
- m_xalign = VteAlign(align & ~VTE_ALIGN_FILL);
- gtk_widget_queue_allocate(gtk());
- return true;
- }
-
- bool set_yalign(VteAlign align) noexcept
- {
- if (align == m_yalign)
- return false;
-
- m_yalign = align;
- gtk_widget_queue_allocate(gtk());
- return true;
- }
-
protected:
enum class CursorType {
@@ -607,9 +584,6 @@ private:
unsigned m_vscroll_policy:1{GTK_SCROLL_NATURAL};
unsigned m_scroll_unit_is_pixels:1{false};
unsigned m_changing_scroll_position:1{false};
-
- VteAlign m_xalign{VTE_ALIGN_START};
- VteAlign m_yalign{VTE_ALIGN_START_FILL};
};
} // namespace platform
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]