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.grandin@collabora.co.uk>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Jenkins
diff --git a/vcl/unx/gtk3/gtk3gtkdata.cxx b/vcl/unx/gtk3/gtk3gtkdata.cxx
index 619a57bb..58109aa 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;
}