diff options
author | Caolán McNamara <caolanm@redhat.com> | 2023-01-17 16:56:57 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2023-01-17 21:04:52 +0000 |
commit | b5480ea6c55ff550390ac8d146a2996f7234712e (patch) | |
tree | e501a350b7f463bcc9c7d8d1b873ca2f5ce9c1f1 /vcl/unx/gtk3/gtkframe.cxx | |
parent | a21258c86e7fd1c64b11216a809f430627a06476 (diff) |
gtk4: some basis for experimenting on a11y support
4.10 makes GtkAccessible public
Change-Id: Ib6ec27f9db9c9b87ff775fdc5a075b5b26a16b22
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145679
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/unx/gtk3/gtkframe.cxx')
-rw-r--r-- | vcl/unx/gtk3/gtkframe.cxx | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/vcl/unx/gtk3/gtkframe.cxx b/vcl/unx/gtk3/gtkframe.cxx index 864e8934c7ad..d8c48891e757 100644 --- a/vcl/unx/gtk3/gtkframe.cxx +++ b/vcl/unx/gtk3/gtkframe.cxx @@ -832,6 +832,48 @@ void GtkSalFrame::resizeWindow( tools::Long nWidth, tools::Long nHeight ) window_resize(nWidth, nHeight); } +#if GTK_CHECK_VERSION(4,9,0) + +#define LO_TYPE_DRAWING_AREA (lo_drawing_area_get_type()) +#define LO_DRAWING_AREA(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LO_TYPE_DRAWING_AREA, LODrawingArea)) +#define LO_IS_DRAWING_AREA(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LO_TYPE_DRAWING_AREA)) + +struct LODrawingArea +{ + GtkDrawingArea parent_instance; +}; + +struct LODrawingAreaClass +{ + GtkDrawingAreaClass parent_class; +}; + +static void lo_drawing_area_accessible_init(GtkAccessibleInterface *iface) +{ + // doesn't actually do anything useful yet, just forward back to base impl for now + GtkAccessibleInterface *parent_iface = static_cast<GtkAccessibleInterface*>(g_type_interface_peek_parent(iface)); + iface->get_at_context = parent_iface->get_at_context; + iface->get_platform_state = parent_iface->get_platform_state; +} + +G_DEFINE_TYPE_WITH_CODE(LODrawingArea, lo_drawing_area, GTK_TYPE_DRAWING_AREA, + G_IMPLEMENT_INTERFACE(GTK_TYPE_ACCESSIBLE, lo_drawing_area_accessible_init)) + +static void lo_drawing_area_class_init(LODrawingAreaClass* /*klass*/) +{ +} + +static void lo_drawing_area_init(LODrawingArea* /*area*/) +{ +} + +GtkWidget* lo_drawing_area_new() +{ + return GTK_WIDGET(g_object_new(LO_TYPE_DRAWING_AREA, nullptr)); +} + +#endif + #if !GTK_CHECK_VERSION(4,0,0) // tdf#124694 GtkFixed takes the max size of all its children as its // preferred size, causing it to not clip its child, but grow instead. @@ -960,8 +1002,12 @@ void GtkSalFrame::InitCommon() #else m_pOverlay = GTK_OVERLAY(gtk_overlay_new()); m_pFixedContainer = GTK_FIXED(gtk_fixed_new()); +#if GTK_CHECK_VERSION(4,9,0) + m_pDrawingArea = GTK_DRAWING_AREA(lo_drawing_area_new()); +#else m_pDrawingArea = GTK_DRAWING_AREA(gtk_drawing_area_new()); #endif +#endif gtk_widget_set_can_focus(GTK_WIDGET(m_pFixedContainer), true); gtk_widget_set_size_request(GTK_WIDGET(m_pFixedContainer), 1, 1); #if !GTK_CHECK_VERSION(4,0,0) |