sw/source/uibase/docvw/HeaderFooterWin.cxx | 9 ++++- vcl/unx/gtk3/gtkframe.cxx | 46 +++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 2 deletions(-)
New commits: commit b5480ea6c55ff550390ac8d146a2996f7234712e Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Jan 17 16:56:57 2023 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Tue Jan 17 21:04:52 2023 +0000 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 <caol...@redhat.com> 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,7 +1002,11 @@ 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); commit a21258c86e7fd1c64b11216a809f430627a06476 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Jan 17 10:25:54 2023 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Tue Jan 17 21:04:39 2023 +0000 Resolves: tdf#153059 after ChangeHeaderOrFooter the control can be disposed If the cursor is still on page one then when a header, via a control on another page, is added it jumps back to that page, so the widget on the now hidden page is removed, but the click handler hasn't completed so the follow up action to change it from a "plus" button to a dropdown menubutton was on a disposed widget. Change-Id: I981126412a0ee6a667d77fb97a3db2f2b0a0363c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145665 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/uibase/docvw/HeaderFooterWin.cxx b/sw/source/uibase/docvw/HeaderFooterWin.cxx index 0e79e1481012..539a310b08aa 100644 --- a/sw/source/uibase/docvw/HeaderFooterWin.cxx +++ b/sw/source/uibase/docvw/HeaderFooterWin.cxx @@ -549,8 +549,13 @@ IMPL_LINK_NOARG(SwHeaderFooterWin, ClickHdl, weld::Button&, void) const SwPageFrame* pPageFrame = SwFrameMenuButtonBase::GetPageFrame(m_pFrame); const OUString& rStyleName = pPageFrame->GetPageDesc()->GetName(); - rSh.ChangeHeaderOrFooter( rStyleName, m_bIsHeader, true, false ); - + { + VclPtr<SwHeaderFooterWin> xThis(this); + rSh.ChangeHeaderOrFooter( rStyleName, m_bIsHeader, true, false ); + //tdf#153059 after ChangeHeaderOrFooter is it possible that "this" is disposed + if (xThis->isDisposed()) + return; + } m_xPushButton->hide(); m_xMenuButton->show(); PaintButton();