Commit 62c49089 authored by Christian Persch's avatar Christian Persch

widget: Implement GtkScrollableInterface::get_border

#283
(cherry picked from commit a7b863a6)
parent bd7909c9
......@@ -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 */
/**
......
......@@ -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(); }
......
......@@ -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()); }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment