diff --git a/configure.ac b/configure.ac index 6d53e10626b7..215ea9e53b4f 100644 --- a/configure.ac +++ b/configure.ac @@ -1117,6 +1117,7 @@ darwin*) # macOS mac_sanitize_path AC_MSG_NOTICE([sanitized the PATH to $PATH]) fi + test_qt6=yes _os=Darwin INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app INSTROOTCONTENTSUFFIX=/Contents @@ -14140,7 +14141,7 @@ then if test "$QMAKE6" = "no"; then AC_MSG_ERROR([Qmake not found. Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".]) else - qmake6_test_ver="`$QMAKE6 -v 2>&1 | $SED -n -e 's/^Using Qt version \(6\.[[0-9.]]\+\).*$/\1/p'`" + qmake6_test_ver="`$QMAKE6 -v 2>&1 | $SED -n -e 's/^Using Qt version \(6\..*\) in.*$/\1/p'`" if test -z "$qmake6_test_ver"; then AC_MSG_ERROR([Wrong qmake for Qt6 found. Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".]) fi @@ -14175,18 +14176,26 @@ then CPPFLAGS=$save_CPPFLAGS AC_LANG_POP([C++]) - if test "$_os" = "Emscripten"; then + case "$_os" in + Emscripten) qt6_library_prefix="lib" qt6_library_suffixes=".a" - elif test "$_os" = "WINNT"; then + ;; + WINNT) qt6_library_prefix="" # file names of libraries built in debug mode have an additional # "d" suffix in the file name, e.g. "Qt6Widgetsd.lib" qt6_library_suffixes=".lib d.lib" - else + ;; + Darwin) + qt6_library_prefix="lib" + qt6_library_suffixes=".dylib" + ;; + *) qt6_library_prefix="lib" qt6_library_suffixes=".so" - fi + ;; + esac qt6_test_library="Qt6Widgets" AC_MSG_CHECKING([for Qt6 libraries]) @@ -14219,6 +14228,8 @@ then QT6_CFLAGS=$(printf '%s' "$QT6_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g") if test "$_os" = "WINNT"; then QT6_LIBS="-LIBPATH:${qt6_libdir} Qt6Core${qt6_library_suffix} Qt6Gui${qt6_library_suffix} Qt6Widgets${qt6_library_suffix}" + elif test "$_os" = "Darwin"; then + QT6_LIBS="-rpath ${qt6_libdir} -L${qt6_libdir} -lQt6Core -lQt6Gui -lQt6Widgets" else QT6_LIBS="-L$qt6_libdir -lQt6Core -lQt6Gui -lQt6Widgets" fi diff --git a/include/vcl/Platform.hxx b/include/vcl/Platform.hxx index 279fdf760f78..08ec1be1c19a 100644 --- a/include/vcl/Platform.hxx +++ b/include/vcl/Platform.hxx @@ -15,6 +15,7 @@ enum class Platform Xcb, WASM, Windows, + Mac, Other }; diff --git a/vcl/Library_vclplug_qt6.mk b/vcl/Library_vclplug_qt6.mk index c46a4997d1c1..db7b3c8e42c9 100644 --- a/vcl/Library_vclplug_qt6.mk +++ b/vcl/Library_vclplug_qt6.mk @@ -173,6 +173,23 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt6,\ ) \ )) +ifeq ($(OS),MACOSX) +$(eval $(call gb_Library_use_system_darwin_frameworks,vclplug_qt6,\ + ApplicationServices \ + Cocoa \ + Carbon \ + CoreFoundation \ +)) + +$(eval $(call gb_Library_add_cxxflags,vclplug_qt6,\ + $(gb_OBJCXXFLAGS) \ +)) + +$(eval $(call gb_Library_use_libraries,vclplug_qt6,\ + vclplug_osx \ +)) +endif + ifeq ($(OS),LINUX) $(eval $(call gb_Library_add_libs,vclplug_qt6,\ -lm \ diff --git a/vcl/inc/osx/MacInstance.hxx b/vcl/inc/osx/MacInstance.hxx index 628d2316f88a..b4bdf78ed5e6 100644 --- a/vcl/inc/osx/MacInstance.hxx +++ b/vcl/inc/osx/MacInstance.hxx @@ -21,12 +21,14 @@ #include +#include +#include #include #include #include -class MacInstance : public SalInstance +class VCLPLUG_OSX_PUBLIC MacInstance : public SalInstance { public: OUString maDefaultPrinter; diff --git a/vcl/inc/osx/saldata.hxx b/vcl/inc/osx/saldata.hxx index 3a2a6fc5e7b5..7462e7e9de28 100644 --- a/vcl/inc/osx/saldata.hxx +++ b/vcl/inc/osx/saldata.hxx @@ -28,6 +28,7 @@ #include #include +#include #include #include @@ -59,7 +60,7 @@ class SystemFontList; // Singleton, instantiated from Application::Application() in // vcl/source/app/svapp.cxx. -class SalData +class VCLPLUG_OSX_PUBLIC SalData { public: SALTIMERPROC mpTimerProc; // timer callback proc diff --git a/vcl/inc/osx/salprn.h b/vcl/inc/osx/salprn.h index e08d9dd2cbe8..f1e119565a66 100644 --- a/vcl/inc/osx/salprn.h +++ b/vcl/inc/osx/salprn.h @@ -21,6 +21,8 @@ #include +#include + #include #include @@ -32,7 +34,7 @@ class AquaSalGraphics; -class AquaSalInfoPrinter : public SalInfoPrinter +class VCLPLUG_OSX_PUBLIC AquaSalInfoPrinter : public SalInfoPrinter { /// Printer graphics AquaSalGraphics* mpGraphics; @@ -119,7 +121,7 @@ class AquaSalInfoPrinter : public SalInfoPrinter }; -class AquaSalPrinter : public SalPrinter +class VCLPLUG_OSX_PUBLIC AquaSalPrinter : public SalPrinter { AquaSalInfoPrinter* mpInfoPrinter; // pointer to the compatible InfoPrinter public: diff --git a/vcl/inc/qt5/QtInstance.hxx b/vcl/inc/qt5/QtInstance.hxx index 53b8112d3f13..ad4cc7fafa5a 100644 --- a/vcl/inc/qt5/QtInstance.hxx +++ b/vcl/inc/qt5/QtInstance.hxx @@ -30,6 +30,8 @@ #include #ifdef _WIN32 #include +#elif defined MACOSX +#include #else #include #endif @@ -81,6 +83,8 @@ class VCLPLUG_QT_PUBLIC QtInstance : public QObject, #ifndef Q_MOC_RUN #ifdef _WIN32 public WindowsInstance, +#elif defined MACOSX + public MacInstance, #else public SalGenericInstance, #endif diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx index d1f78cf5a37e..c6351c2a9885 100644 --- a/vcl/qt5/QtFrame.cxx +++ b/vcl/qt5/QtFrame.cxx @@ -220,6 +220,7 @@ QWindow* QtFrame::windowHandle() const case Platform::Wayland: case Platform::Windows: case Platform::Xcb: + case Platform::Mac: pChild->setAttribute(Qt::WA_NativeWindow); break; case Platform::Other: diff --git a/vcl/qt5/QtInstance.cxx b/vcl/qt5/QtInstance.cxx index 8fec94a11d92..6204c24ffe7b 100644 --- a/vcl/qt5/QtInstance.cxx +++ b/vcl/qt5/QtInstance.cxx @@ -278,6 +278,8 @@ QtInstance::QtInstance() #else : WindowsInstance(std::make_unique(), new SalData) #endif +#elif defined MACOSX + : MacInstance() #else : SalGenericInstance(std::make_unique(), new GenericUnixSalData) #endif @@ -647,6 +649,8 @@ Platform QtInstance::GetPlatform() const return Platform::WASM; if (sPlatformName == u"windows") return Platform::Windows; + if (sPlatformName == u"cocoa") + return Platform::Mac; assert(false && "Unsupported qt VCL platform"); return Platform::Other; diff --git a/vcl/qt5/QtMainWindow.cxx b/vcl/qt5/QtMainWindow.cxx index 7914e48ec429..521efb528bb5 100644 --- a/vcl/qt5/QtMainWindow.cxx +++ b/vcl/qt5/QtMainWindow.cxx @@ -24,6 +24,7 @@ QtMainWindow::QtMainWindow(QtFrame& rFrame, Qt::WindowFlags f) #ifndef __EMSCRIPTEN__ QAccessible::installFactory(QtAccessibleWidget::customFactory); #endif + setUnifiedTitleAndToolBarOnMac(true); } void QtMainWindow::closeEvent(QCloseEvent* pEvent)