summaryrefslogtreecommitdiff
path: root/avmedia
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2022-08-25 09:12:11 +0200
committerCaolán McNamara <caolanm@redhat.com>2022-08-25 09:49:49 +0200
commit53b5b720d33b93b2d05a845b28dbc7709eb4d9e1 (patch)
tree1a9ff0dff32964dcb0ea580e07114c051aa76bdd /avmedia
parentb1b2083ec2ebde32d2c3f7ee2f2e3d2cc75721d8 (diff)
avmedia gtk: Fix build for Gtk >= 4.7.2 ('-Werror=deprecated-declarations')
Failed like this: .../libreoffice/avmedia/source/gtk/gtkplayer.cxx: In member function ‘virtual com::sun::star::uno::Reference<com::sun::star::media::XPlayerWindow> avmedia::gtk::GtkPlayer::createPlayerWindow(const com::sun::star::uno::Sequence<com::sun::star::uno::Any>&)’: .../libreoffice/avmedia/source/gtk/gtkplayer.cxx:346:38: error: ‘void gtk_picture_set_keep_aspect_ratio(GtkPicture*, gboolean)’ is deprecated: Use 'gtk_picture_set_content_fit' instead [-Werror=deprecated-declarations] 346 | gtk_picture_set_keep_aspect_ratio(GTK_PICTURE(m_pVideo), false); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/gtk-4.0/gtk/gtk.h:196, from .../libreoffice/avmedia/source/gtk/gtkplayer.cxx:28: /usr/include/gtk-4.0/gtk/gtkpicture.h:73:17: note: declared here 73 | void gtk_picture_set_keep_aspect_ratio (GtkPicture *self, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1plus: all warnings being treated as errors make[1]: *** [.../libreoffice/solenv/gbuild/LinkTarget.mk:337: .../libreoffice/workdir/CxxObject/avmedia/source/gtk/gtkplayer.o] Error 1 make: *** [Makefile:289: build] Error 2 Corresponding Gtk commit [1]: commit d8a73cbd03118e94bd75f5fa183a646fecb053ce Author: Marco Melorio <marco.melorio@protonmail.com> Date: Fri Jul 15 18:18:26 2022 +0200 picture: Add content-fit property It allows to specify the resize mode of the paintable inside the GtkPicture allocation. This also deprecates the keep-aspect-ratio property. Fixes #5027. While the doc [2] says its deprecated for 4.8, that sems to refer to stable Gtk version only and it's already the case for the unstable version 4.7.2 (as packaged in Debian testing now): $ git tag --contains d8a73cbd03118e94bd75f5fa183a646fecb053ce 4.7.2 Use `gtk_picture_set_content_fit` with `GTK_CONTENT_FIT_FILL` that results in the same behavior for Gtk >= 4.7.2. [1] https://gitlab.gnome.org/GNOME/gtk/-/commit/d8a73cbd03118e94bd75f5fa183a646fecb053ce [2] https://docs.gtk.org/gtk4/method.Picture.set_keep_aspect_ratio.html Change-Id: I9fc527e6674cb8e4774adbe7d14cce2a264a5a67 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138797 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'avmedia')
-rw-r--r--avmedia/source/gtk/gtkplayer.cxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/avmedia/source/gtk/gtkplayer.cxx b/avmedia/source/gtk/gtkplayer.cxx
index bf73f4732c4a..08b5f10c5b6d 100644
--- a/avmedia/source/gtk/gtkplayer.cxx
+++ b/avmedia/source/gtk/gtkplayer.cxx
@@ -343,7 +343,11 @@ 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);