vcl/unx/gtk3/gtk3gtkdata.cxx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
New commits: commit 71f6e3862afc460536085582d3f9e9401096c24a Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Oct 27 15:17:01 2020 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Tue Oct 27 20:33:05 2020 +0100 tdf#133950 scale hotspot to sync with scaled cursors keep aspect ratio as well Change-Id: Ia3c7f84e377ebb952be0a56e9e532fb260f83459 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104890 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Jenkins diff --git a/vcl/unx/gtk3/gtk3gtkdata.cxx b/vcl/unx/gtk3/gtk3gtkdata.cxx index 619a57bb1d8b..58109aae148a 100644 --- a/vcl/unx/gtk3/gtk3gtkdata.cxx +++ b/vcl/unx/gtk3/gtk3gtkdata.cxx @@ -131,10 +131,18 @@ GdkCursor* GtkSalDisplay::getFromSvg(OUString const & name, int nXHot, int nYHot assert(pPixBuf && "missing image?"); if (!pPixBuf) return nullptr; + guint nDefaultCursorSize = gdk_display_get_default_cursor_size( m_pGdkDisplay ); - GdkPixbuf* pScaledPixBuf = gdk_pixbuf_scale_simple(pPixBuf, nDefaultCursorSize, nDefaultCursorSize, GDK_INTERP_HYPER); + int nPixWidth = gdk_pixbuf_get_width(pPixBuf); + int nPixHeight = gdk_pixbuf_get_height(pPixBuf); + double fScalefactor = static_cast<double>(nDefaultCursorSize) / std::max(nPixWidth, nPixHeight); + GdkPixbuf* pScaledPixBuf = gdk_pixbuf_scale_simple(pPixBuf, + nPixWidth * fScalefactor, + nPixHeight * fScalefactor, + GDK_INTERP_HYPER); g_object_unref(pPixBuf); - GdkCursor* pCursor = gdk_cursor_new_from_pixbuf( m_pGdkDisplay, pScaledPixBuf, nXHot, nYHot); + GdkCursor* pCursor = gdk_cursor_new_from_pixbuf(m_pGdkDisplay, pScaledPixBuf, + nXHot * fScalefactor, nYHot * fScalefactor); return pCursor; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits