changeset 31745:6973fe71f6c5

assume QScreen::devicePixelRatio is available The QScreen::devicePixelRatio function as introduced in Qt 5.5. * acinclude.m4 (OCTAVE_CHECK_FUNC_QSCREEN_DEVICEPIXELRATIO): Delete. (OCTAVE_CHECK_QT_VERSION): Delete use. * Figure.cc: Don't check HAVE_QSCREEN_DEVICEPIXELRATIO. Eliminate code to work around the absence of QScreen::devicePixelRatio.
author John W. Eaton <jwe@octave.org>
date Tue, 17 Jan 2023 09:45:55 -0500
parents 9cc509a00b54
children 28177dcaefad
files libgui/graphics/Figure.cc m4/acinclude.m4
diffstat 2 files changed, 2 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/graphics/Figure.cc	Tue Jan 17 09:42:15 2023 -0500
+++ b/libgui/graphics/Figure.cc	Tue Jan 17 09:45:55 2023 -0500
@@ -43,10 +43,8 @@
 #include <QtDebug>
 #include <QTimer>
 #include <QToolBar>
-#if defined (HAVE_QSCREEN_DEVICEPIXELRATIO)
-#  include <QWindow>
-#  include <QScreen>
-#endif
+#include <QWindow>
+#include <QScreen>
 
 #include "Canvas.h"
 #include "Container.h"
@@ -854,7 +852,6 @@
   void
   Figure::figureWindowShown ()
   {
-#if defined (HAVE_QSCREEN_DEVICEPIXELRATIO)
     QWindow *window = qWidget<QMainWindow> ()->windowHandle ();
     QScreen *screen = window->screen ();
 
@@ -866,13 +863,11 @@
     fp.set___device_pixel_ratio__ (screen->devicePixelRatio ());
 
     connect (window, &QWindow::screenChanged, this, &Figure::screenChanged);
-#endif
   }
 
   void
   Figure::screenChanged (QScreen *screen)
   {
-#if defined (HAVE_QSCREEN_DEVICEPIXELRATIO)
     gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
     octave::autolock guard (gh_mgr.graphics_lock ());
@@ -888,9 +883,6 @@
         // from the GUI thread does not necessarily trigger a redraw.  Force it.
         redraw ();
       }
-#else
-    octave_unused_parameter (screen);
-#endif
   }
 
   void
--- a/m4/acinclude.m4	Tue Jan 17 09:42:15 2023 -0500
+++ b/m4/acinclude.m4	Tue Jan 17 09:45:55 2023 -0500
@@ -681,36 +681,6 @@
   fi
 ])
 dnl
-dnl Check whether the Qt class QScreen has the devicePixelRatio member function.
-dnl This member function was introduced in Qt 5.5.
-dnl
-AC_DEFUN([OCTAVE_CHECK_FUNC_QSCREEN_DEVICEPIXELRATIO], [
-  AC_CACHE_CHECK([for QScreen::devicePixelRatio in <QScreen>],
-    [octave_cv_func_qscreen_devicepixelratio],
-    [AC_LANG_PUSH(C++)
-    ac_octave_save_CPPFLAGS="$CPPFLAGS"
-    ac_octave_save_CXXFLAGS="$CXXFLAGS"
-    CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
-    CXXFLAGS="$CXXPICFLAG $CXXFLAGS"
-    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-        #include <QApplication>
-        #include <QScreen>
-        ]], [[
-        QScreen *screen = QApplication::primaryScreen ();
-        qreal ratio = screen->devicePixelRatio ();
-        ]])],
-      octave_cv_func_qscreen_devicepixelratio=yes,
-      octave_cv_func_qscreen_devicepixelratio=no)
-    CPPFLAGS="$ac_octave_save_CPPFLAGS"
-    CXXFLAGS="$ac_octave_save_CXXFLAGS"
-    AC_LANG_POP(C++)
-  ])
-  if test $octave_cv_func_qscreen_devicepixelratio = yes; then
-    AC_DEFINE(HAVE_QSCREEN_DEVICEPIXELRATIO, 1,
-      [Define to 1 if you have the `QScreen::devicePixelRatio' member function.])
-  fi
-])
-dnl
 dnl Check whether the Qt class QWheelEvent has the position member function.
 dnl This member function was introduced in Qt 5.14.
 dnl
@@ -2250,7 +2220,6 @@
     OCTAVE_CHECK_NEW_QHELPINDEXWIDGET_API
     OCTAVE_CHECK_FUNC_QLIST_ITERATOR_CONSTRUCTOR
     OCTAVE_CHECK_FUNC_QMAINWINDOW_RESIZEDOCKS
-    OCTAVE_CHECK_FUNC_QSCREEN_DEVICEPIXELRATIO
     OCTAVE_CHECK_FUNC_QHELPENGINE_DOCUMENTSFORIDENTIFIER
     OCTAVE_CHECK_FUNC_QWHEELEVENT_POSITION
     OCTAVE_CHECK_FUNC_QPAINTER_SETRENDERHINT_LOSSLESS