[vte/vte-0-62] widget: Implement GtkScrollableInterface::get_border
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/vte-0-62] widget: Implement GtkScrollableInterface::get_border
- Date: Sat, 3 Oct 2020 12:15:55 +0000 (UTC)
commit 62c4908953e3fea8e0771fa82212462157d46d4f
Author: Christian Persch <chpe src gnome org>
Date: Sat Oct 3 14:15:37 2020 +0200
widget: Implement GtkScrollableInterface::get_border
https://gitlab.gnome.org/GNOME/vte/-/issues/283
(cherry picked from commit a7b863a6fcfc7f3bf4f96ce6baffaa240c5830f2)
src/vtegtk.cc | 26 ++++++++++++++++++++++++--
src/vteinternal.hh | 1 +
src/widget.hh | 1 +
3 files changed, 26 insertions(+), 2 deletions(-)
---
diff --git a/src/vtegtk.cc b/src/vtegtk.cc
index dcc9d612..f7a65f72 100644
--- a/src/vtegtk.cc
+++ b/src/vtegtk.cc
@@ -79,6 +79,8 @@ struct _VteTerminalClassPrivate {
GtkStyleProvider *style_provider;
};
+static void vte_terminal_scrollable_iface_init(GtkScrollableInterface* iface) noexcept;
+
#ifdef VTE_DEBUG
G_DEFINE_TYPE_WITH_CODE(VteTerminal, vte_terminal, GTK_TYPE_WIDGET,
{
@@ -86,7 +88,7 @@ G_DEFINE_TYPE_WITH_CODE(VteTerminal, vte_terminal, GTK_TYPE_WIDGET,
g_type_add_instance_private(g_define_type_id,
sizeof(vte::platform::Widget));
}
g_type_add_class_private (g_define_type_id, sizeof (VteTerminalClassPrivate));
- G_IMPLEMENT_INTERFACE(GTK_TYPE_SCROLLABLE, NULL)
+ G_IMPLEMENT_INTERFACE(GTK_TYPE_SCROLLABLE, vte_terminal_scrollable_iface_init)
if (_vte_debug_on(VTE_DEBUG_LIFECYCLE)) {
g_printerr("vte_terminal_get_type()\n");
})
@@ -97,7 +99,7 @@ G_DEFINE_TYPE_WITH_CODE(VteTerminal, vte_terminal, GTK_TYPE_WIDGET,
g_type_add_instance_private(g_define_type_id,
sizeof(vte::platform::Widget));
}
g_type_add_class_private (g_define_type_id, sizeof (VteTerminalClassPrivate));
- G_IMPLEMENT_INTERFACE(GTK_TYPE_SCROLLABLE, NULL))
+ G_IMPLEMENT_INTERFACE(GTK_TYPE_SCROLLABLE, vte_terminal_scrollable_iface_init))
#endif
static inline
@@ -2039,6 +2041,26 @@ vte_terminal_class_init(VteTerminalClass *klass)
#endif
}
+static gboolean
+vte_terminal_scrollable_get_border(GtkScrollable* scrollable,
+ GtkBorder* border) noexcept
+try
+{
+ *border = *WIDGET(VTE_TERMINAL(scrollable))->padding();
+ return true;
+}
+catch (...)
+{
+ vte::log_exception();
+ return false;
+}
+
+static void
+vte_terminal_scrollable_iface_init(GtkScrollableInterface* iface) noexcept
+{
+ iface->get_border = vte_terminal_scrollable_get_border;
+}
+
/* public API */
/**
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index bc75888e..333f858c 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -958,6 +958,7 @@ public:
/* Style stuff */
GtkBorder m_padding{1, 1, 1, 1};
+ auto padding() const noexcept { return &m_padding; }
vte::glib::RefPtr<GtkAdjustment> m_vadjustment{};
auto vadjustment() noexcept { return m_vadjustment.get(); }
diff --git a/src/widget.hh b/src/widget.hh
index 0025d5bb..3f7f8e36 100644
--- a/src/widget.hh
+++ b/src/widget.hh
@@ -108,6 +108,7 @@ public:
void set_vscroll_policy(GtkScrollablePolicy policy) noexcept { m_vscroll_policy = policy; }
auto hscroll_policy() const noexcept { return m_hscroll_policy; }
auto vscroll_policy() const noexcept { return m_vscroll_policy; }
+ auto padding() const noexcept { return terminal()->padding(); }
bool set_cursor_blink_mode(VteCursorBlinkMode mode) { return
terminal()->set_cursor_blink_mode(vte::terminal::Terminal::CursorBlinkMode(mode)); }
auto cursor_blink_mode() const noexcept { return
VteCursorBlinkMode(terminal()->cursor_blink_mode()); }
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]