gtk4: Require GTK >= 4.10

For the gtk4 VCL plugin, require GTK version >= 4.10
and drop code for older versions.

This simplifies maintenance, in particular since
requiring 4.10 ensures that the basic GtkAccessible API
is available.

GTK 4.10 was released on 2023-03-04 [1], so it
will be almost 2 years by the time that LO 25.2
will be released.

Given that the gtk4 VCL plugin is still experimental,
providing support for older GTK 4 releases shouldn't
have to be a concern.

[1] https://gitlab.gnome.org/GNOME/gtk/-/blob/4.10.0/NEWS?ref_type=tags

Change-Id: I6f361b533391225d0e74c174e0479b767b9d827a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169324
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
This commit is contained in:
Michael Weghorn 2024-06-21 09:22:07 +02:00 committed by Caolán McNamara
parent 0e3394f712
commit 5bf58785ba
7 changed files with 5 additions and 38 deletions

View file

@ -343,11 +343,7 @@ uno::Reference<::media::XPlayerWindow>
return nullptr;
m_pVideo = gtk_picture_new_for_paintable(GDK_PAINTABLE(m_pStream));
#if GTK_CHECK_VERSION(4, 7, 2)
gtk_picture_set_content_fit(GTK_PICTURE(m_pVideo), GTK_CONTENT_FIT_FILL);
#else
gtk_picture_set_keep_aspect_ratio(GTK_PICTURE(m_pVideo), false);
#endif
gtk_widget_set_can_target(m_pVideo, false);
gtk_widget_set_vexpand(m_pVideo, true);
gtk_widget_set_hexpand(m_pVideo, true);

View file

@ -12125,7 +12125,7 @@ if test "$test_gtk4" = yes -a "x$enable_gtk4" = "xyes"; then
add_warning 'Non-system cairo combined with gtk4 is assumed to cause trouble; proceed at your own risk.'
fi
: ${with_system_cairo:=yes}
PKG_CHECK_MODULES(GTK4, gtk4 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo atk)
PKG_CHECK_MODULES(GTK4, gtk4 >= 4.10 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo atk)
GTK4_CFLAGS=$(printf '%s' "$GTK4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
GTK4_CFLAGS="$GTK4_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
FilterLibs "${GTK4_LIBS}"

View file

@ -992,11 +992,7 @@ void GtkSalFrame::InitCommon()
m_pDrawingArea = m_pFixedContainer;
#else
m_pOverlay = GTK_OVERLAY(gtk_overlay_new());
#if GTK_CHECK_VERSION(4,9,0)
m_pFixedContainer = GTK_FIXED(g_object_new( ooo_fixed_get_type(), nullptr ));
#else
m_pFixedContainer = GTK_FIXED(gtk_fixed_new());
#endif
m_pDrawingArea = GTK_DRAWING_AREA(gtk_drawing_area_new());
#endif
if (GTK_IS_WINDOW(m_pWindow))

View file

@ -11236,15 +11236,10 @@ public:
}
g_list_free(pChildren);
#else
GtkWidget* pChild;
if (gtk_check_version(4, 5, 0) == nullptr)
{
pChild = gtk_widget_get_first_child(GTK_WIDGET(m_pMenuButton));
GtkWidget* pChild = gtk_widget_get_first_child(GTK_WIDGET(m_pMenuButton));
pChild = gtk_widget_get_first_child(pChild);
pChild = gtk_widget_get_first_child(pChild);
}
else
pChild = gtk_widget_get_last_child(GTK_WIDGET(m_pMenuButton));
g_object_ref(pChild);
gtk_widget_unparent(pChild);
gtk_button_set_child(GTK_BUTTON(m_pToggleButton), pChild);

View file

@ -19,8 +19,6 @@
#include <gtk/gtk.h>
#include <o3tl/string_view.hxx>
#if GTK_CHECK_VERSION(4, 9, 0)
#include "a11y.hxx"
#include "gtkaccessibleeventlistener.hxx"
#include "gtkaccessibleregistry.hxx"
@ -465,10 +463,8 @@ struct LoAccessibleClass
GObjectClass parent_class;
};
#if GTK_CHECK_VERSION(4, 10, 0)
static void lo_accessible_range_init(gpointer iface_, gpointer);
static gboolean lo_accessible_range_set_current_value(GtkAccessibleRange* self, double fNewValue);
#endif
extern "C" {
typedef GType (*GetGIfaceType)();
@ -484,10 +480,8 @@ const struct
{ "Text", lo_accessible_text_init, gtk_accessible_text_get_type,
cppu::UnoType<css::accessibility::XAccessibleText>::get },
#endif
#if GTK_CHECK_VERSION(4, 10, 0)
{ "Value", lo_accessible_range_init, gtk_accessible_range_get_type,
cppu::UnoType<css::accessibility::XAccessibleValue>::get },
#endif
};
static bool isOfType(css::uno::XInterface* xInterface, const css::uno::Type& rType)
@ -628,13 +622,11 @@ static void lo_accessible_accessible_init(GtkAccessibleInterface* iface)
iface->get_platform_state = lo_accessible_get_platform_state;
}
#if GTK_CHECK_VERSION(4, 10, 0)
static void lo_accessible_range_init(gpointer iface_, gpointer)
{
auto const iface = static_cast<GtkAccessibleRangeInterface*>(iface_);
iface->set_current_value = lo_accessible_range_set_current_value;
}
#endif
// silence loplugin:unreffun
#ifdef __GNUC__
@ -815,7 +807,6 @@ static gboolean lo_accessible_get_platform_state(GtkAccessible* self,
return false;
}
#if GTK_CHECK_VERSION(4, 10, 0)
static gboolean lo_accessible_range_set_current_value(GtkAccessibleRange* self, double fNewValue)
{
// return 'true' in any case, since otherwise no proper AT-SPI DBus reply gets sent
@ -856,7 +847,6 @@ static gboolean lo_accessible_range_set_current_value(GtkAccessibleRange* self,
xValue->setCurrentValue(aValue);
return true;
}
#endif
static void lo_accessible_init(LoAccessible* /*iface*/) {}
@ -930,6 +920,4 @@ static void ooo_fixed_init(OOoFixed* /*area*/) {}
GtkWidget* ooo_fixed_new() { return GTK_WIDGET(g_object_new(OOO_TYPE_FIXED, nullptr)); }
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */

View file

@ -15,8 +15,6 @@
#include "gtkaccessibleeventlistener.hxx"
#include "gtkaccessibleregistry.hxx"
#if GTK_CHECK_VERSION(4, 9, 0)
GtkAccessibleEventListener::GtkAccessibleEventListener(LoAccessible* pLoAccessible)
: m_pLoAccessible(pLoAccessible)
{
@ -107,6 +105,4 @@ void GtkAccessibleEventListener::notifyEvent(
}
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -12,8 +12,6 @@
#include <cassert>
#if GTK_CHECK_VERSION(4, 9, 0)
std::map<css::accessibility::XAccessible*, LoAccessible*> GtkAccessibleRegistry::m_aMapping = {};
LoAccessible*
@ -56,6 +54,4 @@ void GtkAccessibleRegistry::remove(css::uno::Reference<css::accessibility::XAcce
m_aMapping.erase(xAcc.get());
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */