[Libreoffice-commits] core.git: 12 commits - configure.ac include/sal vcl/CustomTarget_kde5_moc.mk vcl/inc vcl/Library_vclplug_kde5.mk vcl/Module_vcl.mk vcl/unx
Katarina Behrens
Katarina.Behrens at cib.de
Wed Oct 25 01:27:12 UTC 2017
configure.ac | 147 +++
include/sal/log-areas.dox | 1
vcl/CustomTarget_kde5_moc.mk | 23
vcl/Library_vclplug_kde5.mk | 98 ++
vcl/Module_vcl.mk | 6
vcl/inc/unx/gendata.hxx | 3
vcl/unx/kde5/FPServiceInfo.hxx | 28
vcl/unx/kde5/KDE5Data.cxx | 73 +
vcl/unx/kde5/KDE5Data.hxx | 45 +
vcl/unx/kde5/KDE5SalDisplay.cxx | 98 ++
vcl/unx/kde5/KDE5SalDisplay.hxx | 47 +
vcl/unx/kde5/KDE5SalFrame.cxx | 401 ++++++++++
vcl/unx/kde5/KDE5SalFrame.hxx | 117 ++
vcl/unx/kde5/KDE5SalGraphics.cxx | 1027 ++++++++++++++++++++++++++
vcl/unx/kde5/KDE5SalGraphics.hxx | 60 +
vcl/unx/kde5/KDE5SalInstance.cxx | 70 +
vcl/unx/kde5/KDE5SalInstance.hxx | 51 +
vcl/unx/kde5/KDE5XLib.cxx | 409 ++++++++++
vcl/unx/kde5/KDE5XLib.hxx | 101 ++
vcl/unx/kde5/VCLKDE5Application.cxx | 76 +
vcl/unx/kde5/VCLKDE5Application.hxx | 42 +
vcl/unx/kde5/main.cxx | 88 ++
vcl/unx/kde5/tst_exclude_posted_events.hxx | 67 +
vcl/unx/kde5/tst_exclude_socket_notifiers.hxx | 80 ++
24 files changed, 3157 insertions(+), 1 deletion(-)
New commits:
commit a555163e57e1a402ccd2a708304aabf212013706
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Fri Oct 20 18:49:00 2017 +0200
kde5: make VCLKDE5Application build again
Change-Id: Ia1f4d1254583d04d1993e9a0ce8ad1f1aaa868d3
diff --git a/vcl/Library_vclplug_kde5.mk b/vcl/Library_vclplug_kde5.mk
index cfd6beb524ce..1fe5c784831f 100644
--- a/vcl/Library_vclplug_kde5.mk
+++ b/vcl/Library_vclplug_kde5.mk
@@ -83,6 +83,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_kde5,\
vcl/unx/kde5/KDE5SalGraphics \
vcl/unx/kde5/KDE5SalInstance \
vcl/unx/kde5/KDE5XLib \
+ vcl/unx/kde5/VCLKDE5Application \
vcl/unx/kde5/main \
))
diff --git a/vcl/unx/kde5/KDE5XLib.hxx b/vcl/unx/kde5/KDE5XLib.hxx
index 152bba357f3b..4bd99ab3bbd7 100644
--- a/vcl/unx/kde5/KDE5XLib.hxx
+++ b/vcl/unx/kde5/KDE5XLib.hxx
@@ -22,6 +22,7 @@
#include <memory>
#include <unx/saldisp.hxx>
+#include <unx/salinst.h>
//#include <fixx11h.h>
//
@@ -31,16 +32,14 @@
#include <QtCore/QTimer>
#include <QtCore/QAbstractNativeEventFilter>
-#include <unx/salinst.h>
-
-class VCLKDEApplication;
+class VCLKDE5Application;
class KDE5XLib : public QObject, public QAbstractNativeEventFilter, public SalXLib
{
Q_OBJECT
private:
bool m_bStartupDone;
- std::unique_ptr<VCLKDEApplication> m_pApplication;
+ std::unique_ptr<VCLKDE5Application> m_pApplication;
std::unique_ptr<char*[]> m_pFreeCmdLineArgs;
std::unique_ptr<char*[]> m_pAppCmdLineArgs;
int m_nFakeCmdLineArgs;
diff --git a/vcl/unx/kde5/VCLKDE5Application.cxx b/vcl/unx/kde5/VCLKDE5Application.cxx
index 15ff9a2dfdac..981a98a51399 100644
--- a/vcl/unx/kde5/VCLKDE5Application.cxx
+++ b/vcl/unx/kde5/VCLKDE5Application.cxx
@@ -24,8 +24,8 @@
#include "KDE5SalDisplay.hxx"
-VCLKDE5Application::VCLKDE5Application() :
- QApplication()
+VCLKDE5Application::VCLKDE5Application( int argc, char** argv) :
+ QApplication( argc, argv)
{
}
@@ -53,7 +53,8 @@ void VCLKDE5Application::postDialogCleanup()
// (such as the auto-extension flag), but that doesn't update KGlobal::config()
// (which is probably a KDE bug), so force reading the new configuration,
// otherwise the next opening of the dialog would use the old settings.
- KGlobal::config()->reparseConfiguration();
+ KConfig config;
+ config.reparseConfiguration();
// HACK: If Qt owns clipboard or selection, give up on their ownership now. Otherwise
// LO core might ask for the contents, but it would block while doing so (i.e. it
// doesn't seem to have an equivalent of QClipboard's "useEventLoopWhenWaiting"),
diff --git a/vcl/unx/kde5/VCLKDE5Application.hxx b/vcl/unx/kde5/VCLKDE5Application.hxx
index 6d2b6f2fdae1..c9526d4e15b6 100644
--- a/vcl/unx/kde5/VCLKDE5Application.hxx
+++ b/vcl/unx/kde5/VCLKDE5Application.hxx
@@ -24,13 +24,15 @@
#include <QtWidgets/QApplication>
#include <QtCore/QAbstractNativeEventFilter>
+#include <KConfigCore/kconfig.h>
+
#undef Region
-class VCLKDEApplication : public QApplication, public QAbstractNativeEventFilter
+class VCLKDE5Application : public QApplication, public QAbstractNativeEventFilter
{
public:
- VCLKDEApplication();
+ VCLKDE5Application( int argv, char** argc);
static void preDialogSetup();
static void postDialogCleanup();
};
commit 05daba4a7ebc5ceccf6f5c811f5eff151e420734
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Thu Oct 19 22:25:49 2017 +0200
kde5: fix glib detection for KF5
Change-Id: Ibd25502384cd248f1070d26266222e18fb9e2e47
diff --git a/configure.ac b/configure.ac
index a47fc48f10e8..eb47dfbc83ca 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10834,6 +10834,153 @@ AC_SUBST(KDE4_GLIB_LIBS)
AC_SUBST(KDE4_HAVE_GLIB)
dnl ===================================================================
+dnl KDE5 Integration
+dnl ===================================================================
+
+KF5_CFLAGS=""
+KF5_LIBS=""
+QMAKE5="qmake"
+KF5_CONFIG="kf5-config"
+MOC5="moc"
+KF5_GLIB_CFLAGS=""
+KF5_GLIB_LIBS=""
+KF5_HAVE_GLIB=""
+if test "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE"; then
+ qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
+ qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
+
+ kf5_incdirs="$KF5INC /usr/include /usr/include/KF5 $x_includes"
+ kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $x_libraries"
+
+ if test -n "$supports_multilib"; then
+ qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
+ kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
+ fi
+
+ qt5_test_include="QtWidgets/qapplication.h"
+ qt5_test_library="libQt5Widgets.so"
+ kf5_test_include="kcoreaddons_version.h"
+ kf5_test_library="libKF5CoreAddons.so"
+
+ dnl Check for qmake
+ AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH] )
+ if test "$QMAKE5" != "no"; then
+ qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
+ qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
+ fi
+
+ AC_MSG_CHECKING([for Qt5 headers])
+ qt5_incdir="no"
+ for inc_dir in $qt5_incdirs; do
+ if test -r "$inc_dir/$qt5_test_include"; then
+ qt5_incdir="$inc_dir"
+ break
+ fi
+ done
+ AC_MSG_RESULT([$qt5_incdir])
+ if test "x$qt5_incdir" = "xno"; then
+ AC_MSG_ERROR([Qt5 headers not found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
+ fi
+
+ AC_MSG_CHECKING([for Qt5 libraries])
+ qt5_libdir="no"
+ for lib_dir in $qt5_libdirs; do
+ if test -r "$lib_dir/$qt5_test_library"; then
+ qt5_libdir="$lib_dir"
+ break
+ fi
+ done
+ AC_MSG_RESULT([$qt5_libdir])
+ if test "x$qt5_libdir" = "xno"; then
+ AC_MSG_ERROR([Qt5 libraries not found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
+ fi
+ kf5_libdirs="$qt5_libdir $kf5_libdirs"
+
+ dnl Check for Meta Object Compiler
+
+ AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH] )
+ if test "$MOC5" = "no"; then
+ AC_MSG_ERROR([Qt Meta Object Compiler not found. Please specify
+the root of your Qt installation by exporting QT5DIR before running "configure".])
+ fi
+
+ dnl kf5 KDE4 support compatibility installed
+ AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
+ if test "$KF5_CONFIG" != "no"; then
+ kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
+ kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
+ fi
+
+ dnl Check for KF5 headers
+ AC_MSG_CHECKING([for KF5 headers])
+ kf5_incdir="no"
+ for kf5_check in $kf5_incdirs; do
+ if test -r "$kf5_check/$kf5_test_include"; then
+ kf5_incdir="$kf5_check"
+ break
+ fi
+ done
+ AC_MSG_RESULT([$kf5_incdir])
+ if test "x$kf5_incdir" = "xno"; then
+ AC_MSG_ERROR([KF5 headers not found. Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
+ fi
+
+ dnl Check for KF5 libraries
+ AC_MSG_CHECKING([for KF5 libraries])
+ kf5_libdir="no"
+ for kf5_check in $kf5_libdirs; do
+ if test -r "$kf5_check/$kf5_test_library"; then
+ kf5_libdir="$kf5_check"
+ break
+ fi
+ done
+
+ AC_MSG_RESULT([$kf5_libdir])
+ if test "x$kf5_libdir" = "xno"; then
+ AC_MSG_ERROR([KF5 libraries not found. Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
+ fi
+
+ PKG_CHECK_MODULES(KF5_XCB,[xcb],,[AC_MSG_ERROR([XCB not installed])])
+
+ KF5_CFLAGS="-I$kf5_incdir -I$kf5_incdir/KCoreAddons -I$kf5_incdir/KI18n -I$kf5_incdir/KConfigCore -I$kf5_incdir/KWindowSystem -I$kf5_incdir/KIOCore -I$qt5_incdir -I$qt5_incdir/QtCore -I$qt5_incdir/QtGui -I$qt5_incdir/QtWidgets -I$qt5_incdir/QtNetwork -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT $KF5_XCB_CFLAGS"
+ KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network -lQt5X11Extras $KF5_XCB_LIBS"
+ KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
+
+ AC_LANG_PUSH([C++])
+ save_CXXFLAGS=$CXXFLAGS
+ CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
+ AC_MSG_CHECKING([whether KDE is >= 5.0])
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
+#include <kcoreaddons_version.h>
+
+int main(int argc, char **argv) {
+ if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
+ else return 1;
+}
+]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE5 version too old])],[])
+ CXXFLAGS=$save_CXXFLAGS
+ AC_LANG_POP([C++])
+
+ # Glib is needed for properly handling Qt event loop with Qt's Glib integration enabled.
+ # Sets also KF5_GLIB_CFLAGS/KF5_GLIB_LIBS if successful.
+ PKG_CHECK_MODULES(KF5_GLIB,[glib-2.0 >= 2.4],
+ [
+ KF5_HAVE_GLIB=TRUE
+ AC_DEFINE(KF5_HAVE_GLIB,1)
+ KF5_GLIB_CFLAGS=$(printf '%s' "$KF5_GLIB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
+ FilterLibs "${KF5_GLIB_LIBS}"
+ KF5_GLIB_LIBS="${filteredlibs}"
+ ],
+ AC_MSG_WARN([[No Glib found, KDE5 support will not use native file pickers!]]))
+fi
+AC_SUBST(KF5_CFLAGS)
+AC_SUBST(KF5_LIBS)
+AC_SUBST(MOC5)
+AC_SUBST(KF5_GLIB_CFLAGS)
+AC_SUBST(KF5_GLIB_LIBS)
+AC_SUBST(KF5_HAVE_GLIB)
+
+dnl ===================================================================
dnl Test whether to include Evolution 2 support
dnl ===================================================================
AC_MSG_CHECKING([whether to enable evolution 2 support])
diff --git a/vcl/unx/kde5/KDE5XLib.cxx b/vcl/unx/kde5/KDE5XLib.cxx
index d9b8e747f3c8..32a80ad8644a 100644
--- a/vcl/unx/kde5/KDE5XLib.cxx
+++ b/vcl/unx/kde5/KDE5XLib.cxx
@@ -397,7 +397,7 @@ uno::Reference< ui::dialogs::XFilePicker2 > KDE5XLib::createFilePicker(
SalYieldMutexReleaser aReleaser;
return Q_EMIT createFilePickerSignal( xMSF );
}
- return uno::Reference< ui::dialogs::XFilePicker2 >( new KDE4FilePicker( xMSF ) );
+ //return uno::Reference< ui::dialogs::XFilePicker2 >( new KDE4FilePicker( xMSF ) );
#else
(void)xMSF;
return NULL;
commit 637bbffa3082d22d110740553ed52ad5182dd1f5
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Wed Oct 4 21:57:56 2017 +0200
kde5: avoid crash with null surface
Change-Id: Ie63e62995bee0fd950cea0668f5ae06c903b25a3
diff --git a/vcl/unx/kde5/KDE5SalFrame.cxx b/vcl/unx/kde5/KDE5SalFrame.cxx
index a58c2d3723f1..5a15b6fb2592 100644
--- a/vcl/unx/kde5/KDE5SalFrame.cxx
+++ b/vcl/unx/kde5/KDE5SalFrame.cxx
@@ -340,7 +340,8 @@ void KDE5SalFrame::ReleaseGraphics( SalGraphics *pGraphics )
if( m_aGraphics[i].pGraphics.get() == pGraphics )
{
m_aGraphics[i].bInUse = false;
- cairo_surface_destroy( m_aGraphics[i].pSurface );
+ if ( m_aGraphics[i].pSurface != nullptr )
+ cairo_surface_destroy( m_aGraphics[i].pSurface );
break;
}
}
commit 72c28fb1be61a464e45bfbbe91f1e383accfc7b2
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Wed Oct 4 21:20:15 2017 +0200
kde5: implement getCairoContext
Change-Id: Ib39ca1e1d73ad4dc91c70ac3f4cdd1bdd24c2b29
diff --git a/vcl/unx/kde5/KDE5SalFrame.cxx b/vcl/unx/kde5/KDE5SalFrame.cxx
index 1e405ef629d1..a58c2d3723f1 100644
--- a/vcl/unx/kde5/KDE5SalFrame.cxx
+++ b/vcl/unx/kde5/KDE5SalFrame.cxx
@@ -383,4 +383,18 @@ SalGraphics* KDE5SalFrame::AcquireGraphics()
return nullptr;
}
+cairo_t* KDE5SalFrame::getCairoContext() const
+{
+ for( int i = 0; i < nMaxGraphics; i++ )
+ {
+ if( ! m_aGraphics[i].bInUse )
+ {
+ cairo_t* cr = cairo_create( m_aGraphics[i].pSurface );
+ assert(cr);
+ return cr;
+ }
+ }
+}
+
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde5/KDE5SalFrame.hxx b/vcl/unx/kde5/KDE5SalFrame.hxx
index ab98ee933c2a..7cc2a8e97662 100644
--- a/vcl/unx/kde5/KDE5SalFrame.hxx
+++ b/vcl/unx/kde5/KDE5SalFrame.hxx
@@ -111,6 +111,7 @@ class KDE5SalFrame : public SalFrame
virtual void Flush() override { return; }
+ cairo_t* getCairoContext() const;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit a8c16e7c42bc19579f56f9d0ec3d05d70a48481a
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Wed Oct 4 20:45:28 2017 +0200
kde5: get/setLib works again
Change-Id: Icc007d5c08f88ffdeb6e2d033615dccb140862ea
diff --git a/vcl/unx/kde5/KDE5Data.hxx b/vcl/unx/kde5/KDE5Data.hxx
index 1106663d3910..6feedbe81734 100644
--- a/vcl/unx/kde5/KDE5Data.hxx
+++ b/vcl/unx/kde5/KDE5Data.hxx
@@ -35,6 +35,8 @@ class KDE5Data //: public X11SalData
virtual void Init() ;
virtual void initNWF() ;
virtual void deInitNWF() ;
+
+ KDE5XLib* GetLib() { return pXLib_; }
private:
KDE5XLib *pXLib_;
QApplication* qMyApp;
diff --git a/vcl/unx/kde5/KDE5SalInstance.hxx b/vcl/unx/kde5/KDE5SalInstance.hxx
index e6169256020e..54f2798dc65e 100644
--- a/vcl/unx/kde5/KDE5SalInstance.hxx
+++ b/vcl/unx/kde5/KDE5SalInstance.hxx
@@ -23,6 +23,7 @@
class SalYieldMutex;
class SalFrame;
+class KDE5XLib;
class KDE5SalInstance : public SvpSalInstance
{
@@ -41,6 +42,10 @@ public:
css::uno::XComponentContext >& ) override;
virtual bool IsMainThread() const override;
+ void SetLib( KDE5XLib *pXLib ) { m_pXLib = pXLib; }
+
+private:
+ KDE5XLib *m_pXLib;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde5/main.cxx b/vcl/unx/kde5/main.cxx
index c26d2ab25c4f..654a9d654ee8 100644
--- a/vcl/unx/kde5/main.cxx
+++ b/vcl/unx/kde5/main.cxx
@@ -79,7 +79,7 @@ extern "C" {
KDE5Data *salData = new KDE5Data( pInstance );
salData->Init();
salData->initNWF();
- //pInstance->SetLib(salData->GetLib());
+ pInstance->SetLib(salData->GetLib());
return pInstance;
}
commit 187324751d27dcc96c5e2cc17ad9bc38bc7d8480
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Fri Sep 29 17:26:26 2017 +0200
kde5: add cairo surface to KDE5SalFrames
Change-Id: I0778ecffe5dbc5fdfe24705d37511e197a4a1ce4
diff --git a/vcl/Library_vclplug_kde5.mk b/vcl/Library_vclplug_kde5.mk
index 7775fbf9a71a..cfd6beb524ce 100644
--- a/vcl/Library_vclplug_kde5.mk
+++ b/vcl/Library_vclplug_kde5.mk
@@ -52,6 +52,7 @@ $(eval $(call gb_Library_use_libraries,vclplug_kde5,\
$(eval $(call gb_Library_use_externals,vclplug_kde5,\
boost_headers \
+ cairo \
icuuc \
kde5 \
epoxy \
diff --git a/vcl/unx/kde5/KDE5SalFrame.cxx b/vcl/unx/kde5/KDE5SalFrame.cxx
index 1cdc503ff4f8..1e405ef629d1 100644
--- a/vcl/unx/kde5/KDE5SalFrame.cxx
+++ b/vcl/unx/kde5/KDE5SalFrame.cxx
@@ -340,6 +340,7 @@ void KDE5SalFrame::ReleaseGraphics( SalGraphics *pGraphics )
if( m_aGraphics[i].pGraphics.get() == pGraphics )
{
m_aGraphics[i].bInUse = false;
+ cairo_surface_destroy( m_aGraphics[i].pSurface );
break;
}
}
@@ -359,6 +360,7 @@ SalGraphics* KDE5SalFrame::AcquireGraphics()
{
if( GetWindow() )
{
+ basegfx::B2IVector aSize( 142, 142 );
for( int i = 0; i < nMaxGraphics; i++ )
{
if( ! m_aGraphics[i].bInUse )
@@ -367,6 +369,10 @@ SalGraphics* KDE5SalFrame::AcquireGraphics()
if( ! m_aGraphics[i].pGraphics )
{
m_aGraphics[i].pGraphics.reset( new KDE5SalGraphics( this, m_pWindow ) );
+
+ //FIXME: those parameters are completely arbitrary, IDK what the right ones should be yet
+ m_aGraphics[i].pSurface = cairo_image_surface_create( CAIRO_FORMAT_ARGB32, aSize.getX(), aSize.getY() );
+ m_aGraphics[i].pGraphics->setSurface( m_aGraphics[i].pSurface, aSize );
//m_aGraphics[i].pGraphics->Init( this, GetWindow(), GetScreenNumber() );
}
return m_aGraphics[i].pGraphics.get();
diff --git a/vcl/unx/kde5/KDE5SalFrame.hxx b/vcl/unx/kde5/KDE5SalFrame.hxx
index 7d0fa51d2eb6..ab98ee933c2a 100644
--- a/vcl/unx/kde5/KDE5SalFrame.hxx
+++ b/vcl/unx/kde5/KDE5SalFrame.hxx
@@ -20,6 +20,7 @@
#pragma once
#include <memory>
+#include <cairo.h>
#include <unx/saldisp.hxx>
#include <unx/salframe.h>
@@ -39,8 +40,9 @@ class KDE5SalFrame : public SalFrame
{
std::unique_ptr<KDE5SalGraphics> pGraphics;
bool bInUse;
+ cairo_surface_t* pSurface;
- GraphicsHolder() : bInUse( false ) {}
+ GraphicsHolder() : bInUse( false ), pSurface(nullptr) {}
};
GraphicsHolder m_aGraphics[ nMaxGraphics ];
commit c375c585142ba7636e9a21c0249365f75224ecc1
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Thu Sep 28 11:56:55 2017 +0200
kde5: convert X11SalFrame to SalFrame
this is WIP and crashes and leaks left'n'right
Change-Id: If4be8cf6d426b705b5dbb5893a18cdbce2aa541a
diff --git a/vcl/unx/kde5/KDE5Data.cxx b/vcl/unx/kde5/KDE5Data.cxx
index b066c7d9f955..66bcde41210e 100644
--- a/vcl/unx/kde5/KDE5Data.cxx
+++ b/vcl/unx/kde5/KDE5Data.cxx
@@ -35,7 +35,10 @@ void KDE5Data::Init()
{
pXLib_ = new KDE5XLib();
pXLib_->Init();
- SetDisplay( SalKDE5Display::self() );
+ //SetDisplay( SalKDE5Display::self() );
+
+ int argc = 1;
+ qMyApp = new QApplication(argc, nullptr);
}
void KDE5Data::initNWF()
@@ -52,7 +55,8 @@ void KDE5Data::initNWF()
pSVData->maNWFData.mbNoFocusRects = true;
// Styled menus need additional space
- QStyle *style = QApplication::style();
+ //QStyle *style = QApplication::style();
+ QStyle *style = qMyApp->style();
pSVData->maNWFData.mnMenuFormatBorderX =
style->pixelMetric( QStyle::PM_MenuPanelWidth ) +
style->pixelMetric( QStyle::PM_MenuHMargin );
@@ -63,6 +67,7 @@ void KDE5Data::initNWF()
void KDE5Data::deInitNWF()
{
+ delete qMyApp;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde5/KDE5Data.hxx b/vcl/unx/kde5/KDE5Data.hxx
index 9791089ce57d..1106663d3910 100644
--- a/vcl/unx/kde5/KDE5Data.hxx
+++ b/vcl/unx/kde5/KDE5Data.hxx
@@ -22,16 +22,22 @@
#include <unx/saldisp.hxx>
#include <unx/saldata.hxx>
-class KDE5Data : public X11SalData
+class KDE5SalInstance;
+class KDE5XLib;
+
+class KDE5Data //: public X11SalData
{
public:
- explicit KDE5Data( SalInstance *pInstance )
- : X11SalData( SAL_DATA_KDE5, pInstance ) {}
- virtual ~KDE5Data() override;
+ explicit KDE5Data( SalInstance *pInstance ) {}
+ // : X11SalData( SAL_DATA_KDE5, pInstance ) {}
+ virtual ~KDE5Data();
- virtual void Init() override;
- virtual void initNWF() override;
- virtual void deInitNWF() override;
+ virtual void Init() ;
+ virtual void initNWF() ;
+ virtual void deInitNWF() ;
+ private:
+ KDE5XLib *pXLib_;
+ QApplication* qMyApp;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde5/KDE5SalFrame.cxx b/vcl/unx/kde5/KDE5SalFrame.cxx
index 2419da16e4d4..1cdc503ff4f8 100644
--- a/vcl/unx/kde5/KDE5SalFrame.cxx
+++ b/vcl/unx/kde5/KDE5SalFrame.cxx
@@ -47,20 +47,19 @@
#include <boost/optional.hpp>
-KDE5SalFrame::KDE5SalFrame( SalFrame* pParent, SalFrameStyleFlags nState ) :
- X11SalFrame( pParent, nState )
+KDE5SalFrame::KDE5SalFrame( SalFrame* pParent, SalFrameStyleFlags nState )
{
}
void KDE5SalFrame::Show( bool bVisible, bool bNoActivate )
{
- if ( !GetParent() && ! (GetStyle() & SalFrameStyleFlags::INTRO) )
+ if ( !GetParent() /*&& ! (GetStyle() & SalFrameStyleFlags::INTRO)*/ )
{
- KDE5XLib* pXLib = static_cast<KDE5XLib*>(GetDisplay()->GetXLib());
+ KDE5XLib* pXLib = new KDE5XLib();//static_cast<KDE5XLib*>(GetDisplay()->GetXLib());
pXLib->doStartup();
}
- X11SalFrame::Show( bVisible, bNoActivate );
+ //X11SalFrame::Show( bVisible, bNoActivate );
}
/** Helper function to convert colors.
@@ -348,7 +347,7 @@ void KDE5SalFrame::ReleaseGraphics( SalGraphics *pGraphics )
void KDE5SalFrame::updateGraphics( bool bClear )
{
- Drawable aDrawable = bClear ? None : GetWindow();
+ vcl::Window* pWindow = GetWindow();
for( int i = 0; i < nMaxGraphics; i++ )
{
/*if( m_aGraphics[i].bInUse )
diff --git a/vcl/unx/kde5/KDE5SalFrame.hxx b/vcl/unx/kde5/KDE5SalFrame.hxx
index 01539a458abe..7d0fa51d2eb6 100644
--- a/vcl/unx/kde5/KDE5SalFrame.hxx
+++ b/vcl/unx/kde5/KDE5SalFrame.hxx
@@ -30,7 +30,7 @@
class QWidget;
class KDE5SalGraphics;
-class KDE5SalFrame : public X11SalFrame
+class KDE5SalFrame : public SalFrame
{
private:
static const int nMaxGraphics = 2;
@@ -52,9 +52,63 @@ class KDE5SalFrame : public X11SalFrame
virtual SalGraphics* AcquireGraphics() override;
virtual void ReleaseGraphics( SalGraphics *pGraphics ) override;
- virtual void updateGraphics( bool bClear ) override;
+ void updateGraphics( bool bClear );
virtual void UpdateSettings( AllSettings& rSettings ) override;
virtual void Show( bool bVisible, bool bNoActivate = false ) override;
+
+ virtual bool PostEvent(ImplSVEvent* pData) override { return false; }
+
+ virtual void SetTitle( const OUString& rTitle ) override { return; }
+ virtual void SetIcon( sal_uInt16 nIcon ) override { return; }
+
+ virtual void SetMenu( SalMenu *pSalMenu ) override { return; }
+ virtual void DrawMenuBar() override { return; }
+
+ virtual void SetExtendedFrameStyle( SalExtStyle nExtStyle ) override { return; }
+ virtual void SetMinClientSize( long nWidth, long nHeight ) override { return; }
+ virtual void SetMaxClientSize( long nWidth, long nHeight ) override { return; }
+
+ virtual void SetPosSize( long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags ) override { return; }
+ virtual void GetClientSize( long& rWidth, long& rHeight ) override { return; }
+ virtual void GetWorkArea( tools::Rectangle& rRect ) override { return; }
+ virtual SalFrame* GetParent() const override { return nullptr; }
+ virtual void SetWindowState( const SalFrameState* pState ) override { return; }
+ virtual bool GetWindowState( SalFrameState* pState ) override { return false; }
+ virtual void ShowFullScreen( bool bFullScreen, sal_Int32 nDisplay ) override { return; }
+ virtual void StartPresentation( bool bStart ) override { return; }
+ virtual void SetAlwaysOnTop( bool bOnTop ) override { return; }
+
+ virtual void ToTop( SalFrameToTop nFlags ) override { return; }
+ virtual void SetPointer( PointerStyle ePointerStyle ) override { return; }
+ virtual void CaptureMouse( bool bMouse ) override { return; }
+ virtual void SetPointerPos( long nX, long nY ) override { return; }
+
+ virtual void SetInputContext( SalInputContext* pContext ) override { return; }
+ virtual void EndExtTextInput( EndExtTextInputFlags nFlags ) override { return; }
+ virtual OUString GetKeyName( sal_uInt16 nKeyCode ) override { return OUString(); }
+ virtual bool MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, vcl::KeyCode& rKeyCode ) override { return false; }
+
+ virtual LanguageType GetInputLanguage() override { return LANGUAGE_SYSTEM; }
+ virtual void Beep() override { return; }
+ virtual const SystemEnvData* GetSystemData() const override { return nullptr; }
+ virtual SalPointerState GetPointerState() override { return SalPointerState(); }
+ virtual KeyIndicatorState GetIndicatorState() override { return KeyIndicatorState(); }
+ virtual void SimulateKeyPress( sal_uInt16 nKeyCode ) override { return; }
+
+ // set new parent window
+ virtual void SetParent( SalFrame* pNewParent ) override { return; }
+ virtual bool SetPluginParent( SystemParentData* pNewParent ) override { return false; }
+
+ virtual void SetScreenNumber( unsigned int ) override { return; }
+ virtual void SetApplicationID( const OUString &rWMClass ) override { return; }
+
+ virtual void ResetClipRegion() override { return; }
+ virtual void BeginSetClipRegion( sal_uLong nRects ) override { return; }
+ virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) override { return; }
+ virtual void EndSetClipRegion() override { return; }
+
+ virtual void Flush() override { return; }
+
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde5/KDE5SalInstance.hxx b/vcl/unx/kde5/KDE5SalInstance.hxx
index 5c0247518246..e6169256020e 100644
--- a/vcl/unx/kde5/KDE5SalInstance.hxx
+++ b/vcl/unx/kde5/KDE5SalInstance.hxx
@@ -26,8 +26,9 @@ class SalFrame;
class KDE5SalInstance : public SvpSalInstance
{
+
protected:
-// virtual SalX11Display* CreateDisplay() const override;
+ //SalX11Display* CreateDisplay() const;
public:
explicit KDE5SalInstance(SalYieldMutex* pMutex);
diff --git a/vcl/unx/kde5/KDE5XLib.cxx b/vcl/unx/kde5/KDE5XLib.cxx
index 2c85ab7fa3f9..d9b8e747f3c8 100644
--- a/vcl/unx/kde5/KDE5XLib.cxx
+++ b/vcl/unx/kde5/KDE5XLib.cxx
@@ -235,7 +235,9 @@ bool KDE5XLib::nativeEventFilter(const QByteArray &eventType, void *message, lon
void KDE5XLib::setupEventLoop()
{
- QAbstractEventDispatcher::instance()->installNativeEventFilter( this );
+ QAbstractEventDispatcher *qDispatcher = QAbstractEventDispatcher::instance();
+
+ //qDispatcher->installNativeEventFilter( this );
#if KF5_HAVE_GLIB
if( m_isGlibEventLoopType )
{
diff --git a/vcl/unx/kde5/main.cxx b/vcl/unx/kde5/main.cxx
index 654a9d654ee8..c26d2ab25c4f 100644
--- a/vcl/unx/kde5/main.cxx
+++ b/vcl/unx/kde5/main.cxx
@@ -79,7 +79,7 @@ extern "C" {
KDE5Data *salData = new KDE5Data( pInstance );
salData->Init();
salData->initNWF();
- pInstance->SetLib(salData->GetLib());
+ //pInstance->SetLib(salData->GetLib());
return pInstance;
}
commit 74b0d908a41eddb3bc210fa0cae3f17be124a0fe
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Wed Sep 27 17:00:58 2017 +0200
kde5: convert KDE5SalInstance to SvpSalInstance
Change-Id: I72da846525128a689d92598b64e6a70062ff1c69
diff --git a/vcl/unx/kde5/KDE5SalInstance.cxx b/vcl/unx/kde5/KDE5SalInstance.cxx
index b8d3471a44c6..38629113295c 100644
--- a/vcl/unx/kde5/KDE5SalInstance.cxx
+++ b/vcl/unx/kde5/KDE5SalInstance.cxx
@@ -34,7 +34,7 @@
using namespace com::sun::star;
KDE5SalInstance::KDE5SalInstance(SalYieldMutex* pMutex)
- : X11SalInstance(pMutex)
+ :SvpSalInstance( pMutex )
{
ImplSVData* pSVData = ImplGetSVData();
delete pSVData->maAppData.mpToolkitName;
@@ -54,13 +54,13 @@ uno::Reference< ui::dialogs::XFilePicker2 > KDE5SalInstance::createFilePicker(
return uno::Reference< ui::dialogs::XFilePicker2 >(
kdeXLib->createFilePicker(xMSF) );
else*/
- return X11SalInstance::createFilePicker( xMSF );
+ return SalInstance::createFilePicker( xMSF );
}
-SalX11Display* KDE5SalInstance::CreateDisplay() const
+/*SalX11Display* KDE5SalInstance::CreateDisplay() const
{
return new SalKDE5Display( QX11Info::display() );
-}
+}*/
bool KDE5SalInstance::IsMainThread() const
{
diff --git a/vcl/unx/kde5/KDE5SalInstance.hxx b/vcl/unx/kde5/KDE5SalInstance.hxx
index 233d6fd7430b..5c0247518246 100644
--- a/vcl/unx/kde5/KDE5SalInstance.hxx
+++ b/vcl/unx/kde5/KDE5SalInstance.hxx
@@ -19,15 +19,15 @@
#pragma once
-#include <unx/salinst.h>
+#include <headless/svpinst.hxx>
class SalYieldMutex;
class SalFrame;
-class KDE5SalInstance : public X11SalInstance
+class KDE5SalInstance : public SvpSalInstance
{
protected:
- virtual SalX11Display* CreateDisplay() const override;
+// virtual SalX11Display* CreateDisplay() const override;
public:
explicit KDE5SalInstance(SalYieldMutex* pMutex);
commit b899ba17b83ca46ce198bb6c0d98cb735e6cefd1
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Mon Sep 25 14:00:31 2017 +0200
kde5: convert KDE5SalGraphics to SvpSalGraphics
Change-Id: Id30494fa1b01510e300f39b985b3a49ea58d81bc
diff --git a/vcl/unx/kde5/KDE5SalFrame.cxx b/vcl/unx/kde5/KDE5SalFrame.cxx
index 73eb097bacc9..2419da16e4d4 100644
--- a/vcl/unx/kde5/KDE5SalFrame.cxx
+++ b/vcl/unx/kde5/KDE5SalFrame.cxx
@@ -351,8 +351,8 @@ void KDE5SalFrame::updateGraphics( bool bClear )
Drawable aDrawable = bClear ? None : GetWindow();
for( int i = 0; i < nMaxGraphics; i++ )
{
- if( m_aGraphics[i].bInUse )
- m_aGraphics[i].pGraphics->SetDrawable( aDrawable, GetScreenNumber() );
+ /*if( m_aGraphics[i].bInUse )
+ m_aGraphics[i].pGraphics->SetDrawable( aDrawable, GetScreenNumber() );*/
}
}
@@ -367,8 +367,8 @@ SalGraphics* KDE5SalFrame::AcquireGraphics()
m_aGraphics[i].bInUse = true;
if( ! m_aGraphics[i].pGraphics )
{
- m_aGraphics[i].pGraphics.reset( new KDE5SalGraphics );
- m_aGraphics[i].pGraphics->Init( this, GetWindow(), GetScreenNumber() );
+ m_aGraphics[i].pGraphics.reset( new KDE5SalGraphics( this, m_pWindow ) );
+ //m_aGraphics[i].pGraphics->Init( this, GetWindow(), GetScreenNumber() );
}
return m_aGraphics[i].pGraphics.get();
}
diff --git a/vcl/unx/kde5/KDE5SalFrame.hxx b/vcl/unx/kde5/KDE5SalFrame.hxx
index dc77ec6daae5..01539a458abe 100644
--- a/vcl/unx/kde5/KDE5SalFrame.hxx
+++ b/vcl/unx/kde5/KDE5SalFrame.hxx
@@ -25,6 +25,11 @@
#include <unx/salframe.h>
#include <unx/salgdi.h>
+#include "KDE5SalGraphics.hxx"
+
+class QWidget;
+class KDE5SalGraphics;
+
class KDE5SalFrame : public X11SalFrame
{
private:
@@ -32,7 +37,7 @@ class KDE5SalFrame : public X11SalFrame
struct GraphicsHolder
{
- std::unique_ptr<X11SalGraphics> pGraphics;
+ std::unique_ptr<KDE5SalGraphics> pGraphics;
bool bInUse;
GraphicsHolder() : bInUse( false ) {}
@@ -40,6 +45,8 @@ class KDE5SalFrame : public X11SalFrame
GraphicsHolder m_aGraphics[ nMaxGraphics ];
+ QWidget* m_pWindow;
+
public:
KDE5SalFrame( SalFrame* pParent, SalFrameStyleFlags nStyle );
diff --git a/vcl/unx/kde5/KDE5SalGraphics.cxx b/vcl/unx/kde5/KDE5SalGraphics.cxx
index 9419dff1e018..a22a695955e2 100644
--- a/vcl/unx/kde5/KDE5SalGraphics.cxx
+++ b/vcl/unx/kde5/KDE5SalGraphics.cxx
@@ -26,7 +26,7 @@
#undef Region
-#include "KDE5SalGraphics.hxx"
+#include "KDE5SalFrame.hxx"
#include "KDE5SalInstance.hxx"
#include <vcl/settings.hxx>
@@ -70,6 +70,13 @@ QRect region2QRect( const tools::Rectangle& rControlRegion )
return QRect(rControlRegion.Left(), rControlRegion.Top(), rControlRegion.GetWidth(), rControlRegion.GetHeight());
}
+KDE5SalGraphics::KDE5SalGraphics( KDE5SalFrame *pFrame, QWidget *pWindow )
+ : SvpSalGraphics(),
+ m_pWindow( pWindow ),
+ m_pFrame( pFrame )
+{
+}
+
bool KDE5SalGraphics::IsNativeControlSupported( ControlType type, ControlPart part )
{
switch (type)
diff --git a/vcl/unx/kde5/KDE5SalGraphics.hxx b/vcl/unx/kde5/KDE5SalGraphics.hxx
index 811e4953c323..298d2100fe0f 100644
--- a/vcl/unx/kde5/KDE5SalGraphics.hxx
+++ b/vcl/unx/kde5/KDE5SalGraphics.hxx
@@ -24,15 +24,19 @@
#include <rtl/string.hxx>
#include <unx/saldisp.hxx>
#include <unx/salgdi.h>
+#include <headless/svpgdi.hxx>
#include <QtGui/QImage>
+class KDE5SalFrame;
+
/**
* Handles native graphics requests and performs the needed drawing operations.
*/
-class KDE5SalGraphics : public X11SalGraphics
+class KDE5SalGraphics : public SvpSalGraphics
{
public:
+ KDE5SalGraphics( KDE5SalFrame *pFrame, QWidget *pWindow);
virtual bool IsNativeControlSupported( ControlType, ControlPart ) override;
virtual bool hitTestNativeControl( ControlType, ControlPart,
@@ -46,6 +50,9 @@ public:
const OUString&, tools::Rectangle&, tools::Rectangle& ) override;
private:
+ QWidget *m_pWindow;
+ KDE5SalFrame *m_pFrame;
+
std::unique_ptr<QImage> m_image;
QRect lastPopupRect;
};
commit 941373f56aabd5ee42615e7334a2c8ecb333fc92
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Fri Sep 22 15:24:30 2017 +0200
kde5: rename KDESalGraphics too
Change-Id: I1a1625428cca0be7ece5fb4604aaacef4967a405
diff --git a/vcl/unx/kde5/KDE5SalFrame.cxx b/vcl/unx/kde5/KDE5SalFrame.cxx
index 28f47f860015..73eb097bacc9 100644
--- a/vcl/unx/kde5/KDE5SalFrame.cxx
+++ b/vcl/unx/kde5/KDE5SalFrame.cxx
@@ -367,7 +367,7 @@ SalGraphics* KDE5SalFrame::AcquireGraphics()
m_aGraphics[i].bInUse = true;
if( ! m_aGraphics[i].pGraphics )
{
- m_aGraphics[i].pGraphics.reset( new KDESalGraphics );
+ m_aGraphics[i].pGraphics.reset( new KDE5SalGraphics );
m_aGraphics[i].pGraphics->Init( this, GetWindow(), GetScreenNumber() );
}
return m_aGraphics[i].pGraphics.get();
diff --git a/vcl/unx/kde5/KDE5SalGraphics.cxx b/vcl/unx/kde5/KDE5SalGraphics.cxx
index 85642f6f91df..9419dff1e018 100644
--- a/vcl/unx/kde5/KDE5SalGraphics.cxx
+++ b/vcl/unx/kde5/KDE5SalGraphics.cxx
@@ -70,7 +70,7 @@ QRect region2QRect( const tools::Rectangle& rControlRegion )
return QRect(rControlRegion.Left(), rControlRegion.Top(), rControlRegion.GetWidth(), rControlRegion.GetHeight());
}
-bool KDESalGraphics::IsNativeControlSupported( ControlType type, ControlPart part )
+bool KDE5SalGraphics::IsNativeControlSupported( ControlType type, ControlPart part )
{
switch (type)
{
@@ -197,7 +197,7 @@ static QRegion XRegionToQRegion( Region xr )
}
#endif
-bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
+bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
const tools::Rectangle& rControlRegion, ControlState nControlState,
const ImplControlValue& value,
const OUString& )
@@ -661,7 +661,7 @@ bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
return returnVal;
}
-bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part,
+bool KDE5SalGraphics::getNativeControlRegion( ControlType type, ControlPart part,
const tools::Rectangle& controlRegion, ControlState controlState,
const ImplControlValue& val,
const OUString&,
@@ -974,7 +974,7 @@ bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part,
aPos was or was not inside the native widget specified by the
nType/nPart combination.
*/
-bool KDESalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart,
+bool KDE5SalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart,
const tools::Rectangle& rControlRegion, const Point& rPos,
bool& rIsInside )
{
diff --git a/vcl/unx/kde5/KDE5SalGraphics.hxx b/vcl/unx/kde5/KDE5SalGraphics.hxx
index eb513388f369..811e4953c323 100644
--- a/vcl/unx/kde5/KDE5SalGraphics.hxx
+++ b/vcl/unx/kde5/KDE5SalGraphics.hxx
@@ -30,7 +30,7 @@
/**
* Handles native graphics requests and performs the needed drawing operations.
*/
-class KDESalGraphics : public X11SalGraphics
+class KDE5SalGraphics : public X11SalGraphics
{
public:
virtual bool IsNativeControlSupported( ControlType, ControlPart ) override;
commit 8b52adcad3f129606dc48025afafe2cbf80cdd7e
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Thu Sep 7 16:18:31 2017 +0200
kde5: rename classes and other relevant data: KDE[4]->KDE5
add log area too
Change-Id: I187c04c8646ec9c9264d84938e1ccf3a1cbd62f1
diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox
index 8c0db9de0809..4bc8e66d7995 100644
--- a/include/sal/log-areas.dox
+++ b/include/sal/log-areas.dox
@@ -454,6 +454,7 @@ certain functionality.
@li @c vcl.icontest
@li @c vcl.kde - KDE
@li @c vcl.kde4 - KDE4
+ at li @c vcl.kde5 - KDE5
@li @c vcl.layout - Widget layout
@li @c vcl.lazydelete
@li @c vcl.opengl
diff --git a/vcl/inc/unx/gendata.hxx b/vcl/inc/unx/gendata.hxx
index 55a9aaf4ba8c..4088985678a6 100644
--- a/vcl/inc/unx/gendata.hxx
+++ b/vcl/inc/unx/gendata.hxx
@@ -20,7 +20,8 @@ class SalGenericDisplay;
namespace psp { class PrintFontManager; }
enum GenericUnixSalDataType { SAL_DATA_GTK, SAL_DATA_GTK3,
- SAL_DATA_TDE3, SAL_DATA_KDE3, SAL_DATA_KDE4,
+ SAL_DATA_TDE3,
+ SAL_DATA_KDE3,SAL_DATA_KDE4, SAL_DATA_KDE5,
SAL_DATA_UNX, SAL_DATA_SVP,
SAL_DATA_ANDROID, SAL_DATA_IOS,
SAL_DATA_HEADLESS };
diff --git a/vcl/unx/kde5/KDE5Data.cxx b/vcl/unx/kde5/KDE5Data.cxx
index 487a0b254af3..b066c7d9f955 100644
--- a/vcl/unx/kde5/KDE5Data.cxx
+++ b/vcl/unx/kde5/KDE5Data.cxx
@@ -27,18 +27,18 @@
#include "KDE5XLib.hxx"
#include "KDE5SalDisplay.hxx"
-KDEData::~KDEData()
+KDE5Data::~KDE5Data()
{
}
-void KDEData::Init()
+void KDE5Data::Init()
{
- pXLib_ = new KDEXLib();
+ pXLib_ = new KDE5XLib();
pXLib_->Init();
- SetDisplay( SalKDEDisplay::self() );
+ SetDisplay( SalKDE5Display::self() );
}
-void KDEData::initNWF()
+void KDE5Data::initNWF()
{
ImplSVData *pSVData = ImplGetSVData();
@@ -61,7 +61,7 @@ void KDEData::initNWF()
style->pixelMetric( QStyle::PM_MenuVMargin );
}
-void KDEData::deInitNWF()
+void KDE5Data::deInitNWF()
{
}
diff --git a/vcl/unx/kde5/KDE5Data.hxx b/vcl/unx/kde5/KDE5Data.hxx
index 4efd23a7df34..9791089ce57d 100644
--- a/vcl/unx/kde5/KDE5Data.hxx
+++ b/vcl/unx/kde5/KDE5Data.hxx
@@ -22,12 +22,12 @@
#include <unx/saldisp.hxx>
#include <unx/saldata.hxx>
-class KDEData : public X11SalData
+class KDE5Data : public X11SalData
{
public:
- explicit KDEData( SalInstance *pInstance )
- : X11SalData( SAL_DATA_KDE4, pInstance ) {}
- virtual ~KDEData() override;
+ explicit KDE5Data( SalInstance *pInstance )
+ : X11SalData( SAL_DATA_KDE5, pInstance ) {}
+ virtual ~KDE5Data() override;
virtual void Init() override;
virtual void initNWF() override;
diff --git a/vcl/unx/kde5/KDE5SalDisplay.cxx b/vcl/unx/kde5/KDE5SalDisplay.cxx
index eddac063048f..319f475317eb 100644
--- a/vcl/unx/kde5/KDE5SalDisplay.cxx
+++ b/vcl/unx/kde5/KDE5SalDisplay.cxx
@@ -28,9 +28,9 @@
#include <assert.h>
-SalKDEDisplay* SalKDEDisplay::selfptr = nullptr;
+SalKDE5Display* SalKDE5Display::selfptr = nullptr;
-SalKDEDisplay::SalKDEDisplay( Display* pDisp )
+SalKDE5Display::SalKDE5Display( Display* pDisp )
: SalX11Display( pDisp )
{
assert( selfptr == nullptr );
@@ -38,10 +38,10 @@ SalKDEDisplay::SalKDEDisplay( Display* pDisp )
xim_protocol = XInternAtom( pDisp_, "_XIM_PROTOCOL", False );
}
-SalKDEDisplay::~SalKDEDisplay()
+SalKDE5Display::~SalKDE5Display()
{
// in case never a frame opened
- static_cast<KDEXLib*>(GetXLib())->doStartup();
+ static_cast<KDE5XLib*>(GetXLib())->doStartup();
// clean up own members
doDestruct();
selfptr = nullptr;
@@ -49,7 +49,7 @@ SalKDEDisplay::~SalKDEDisplay()
pDisp_ = nullptr;
}
-void SalKDEDisplay::Yield()
+void SalKDE5Display::Yield()
{
if( DispatchInternalEvent() )
return;
@@ -60,7 +60,7 @@ void SalKDEDisplay::Yield()
DBG_ASSERT( static_cast<SalYieldMutex*>(GetSalData()->m_pInstance->GetYieldMutex())->GetThreadId() ==
osl::Thread::getCurrentIdentifier(),
- "will crash soon since solar mutex not locked in SalKDEDisplay::Yield" );
+ "will crash soon since solar mutex not locked in SalKDE5Display::Yield" );
/*XEvent event;
XNextEvent( pDisp_, &event );
@@ -77,7 +77,7 @@ void SalKDEDisplay::Yield()
// completely. Skipped events are KeyPress, KeyRelease and also _XIM_PROTOCOL client message
// (seems to be necessary too, hopefully there are not other internal XIM messages that
// would need this handling).
-bool SalKDEDisplay::checkDirectInputEvent( xcb_generic_event_t* ev )
+bool SalKDE5Display::checkDirectInputEvent( xcb_generic_event_t* ev )
{
switch (ev->response_type & ~0x80)
{
diff --git a/vcl/unx/kde5/KDE5SalDisplay.hxx b/vcl/unx/kde5/KDE5SalDisplay.hxx
index 0a31dcedc10d..8cd18d4ed813 100644
--- a/vcl/unx/kde5/KDE5SalDisplay.hxx
+++ b/vcl/unx/kde5/KDE5SalDisplay.hxx
@@ -26,20 +26,20 @@
#undef CursorShape
#endif
-class SalKDEDisplay : public SalX11Display
+class SalKDE5Display : public SalX11Display
{
public:
- explicit SalKDEDisplay( Display* pDisp );
- virtual ~SalKDEDisplay() override;
- static SalKDEDisplay* self();
+ explicit SalKDE5Display( Display* pDisp );
+ virtual ~SalKDE5Display() override;
+ static SalKDE5Display* self();
virtual void Yield() override;
bool checkDirectInputEvent( xcb_generic_event_t* ev );
private:
Atom xim_protocol;
- static SalKDEDisplay* selfptr;
+ static SalKDE5Display* selfptr;
};
-inline SalKDEDisplay* SalKDEDisplay::self()
+inline SalKDE5Display* SalKDE5Display::self()
{
return selfptr;
}
diff --git a/vcl/unx/kde5/KDE5SalFrame.cxx b/vcl/unx/kde5/KDE5SalFrame.cxx
index 090abbc240d1..28f47f860015 100644
--- a/vcl/unx/kde5/KDE5SalFrame.cxx
+++ b/vcl/unx/kde5/KDE5SalFrame.cxx
@@ -47,16 +47,16 @@
#include <boost/optional.hpp>
-KDESalFrame::KDESalFrame( SalFrame* pParent, SalFrameStyleFlags nState ) :
+KDE5SalFrame::KDE5SalFrame( SalFrame* pParent, SalFrameStyleFlags nState ) :
X11SalFrame( pParent, nState )
{
}
-void KDESalFrame::Show( bool bVisible, bool bNoActivate )
+void KDE5SalFrame::Show( bool bVisible, bool bNoActivate )
{
if ( !GetParent() && ! (GetStyle() & SalFrameStyleFlags::INTRO) )
{
- KDEXLib* pXLib = static_cast<KDEXLib*>(GetDisplay()->GetXLib());
+ KDE5XLib* pXLib = static_cast<KDE5XLib*>(GetDisplay()->GetXLib());
pXLib->doStartup();
}
@@ -120,12 +120,12 @@ static vcl::Font toFont( const QFont &rQFont, const css::lang::Locale& rLocale )
else
aInfo.m_eWidth = WIDTH_ULTRA_EXPANDED;
- SAL_INFO( "vcl.kde4", "font name BEFORE system match: \"" << aInfo.m_aFamilyName << "\"" );
+ SAL_INFO( "vcl.kde5", "font name BEFORE system match: \"" << aInfo.m_aFamilyName << "\"" );
// match font to e.g. resolve "Sans"
psp::PrintFontManager::get().matchFont( aInfo, rLocale );
- SAL_INFO( "vcl.kde4", "font match " <<
+ SAL_INFO( "vcl.kde5", "font match " <<
(aInfo.m_nID != 0 ? "succeeded" : "failed") <<
", name AFTER: \"" << aInfo.m_aFamilyName << "\"" );
@@ -150,7 +150,7 @@ static vcl::Font toFont( const QFont &rQFont, const css::lang::Locale& rLocale )
/** Implementation of KDE integration's main method.
*/
-void KDESalFrame::UpdateSettings( AllSettings& rSettings )
+void KDE5SalFrame::UpdateSettings( AllSettings& rSettings )
{
StyleSettings style( rSettings.GetStyleSettings() );
bool bSetTitleFont = false;
@@ -334,7 +334,7 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings )
rSettings.SetStyleSettings( style );
}
-void KDESalFrame::ReleaseGraphics( SalGraphics *pGraphics )
+void KDE5SalFrame::ReleaseGraphics( SalGraphics *pGraphics )
{
for( int i = 0; i < nMaxGraphics; i++ )
{
@@ -346,7 +346,7 @@ void KDESalFrame::ReleaseGraphics( SalGraphics *pGraphics )
}
}
-void KDESalFrame::updateGraphics( bool bClear )
+void KDE5SalFrame::updateGraphics( bool bClear )
{
Drawable aDrawable = bClear ? None : GetWindow();
for( int i = 0; i < nMaxGraphics; i++ )
@@ -356,7 +356,7 @@ void KDESalFrame::updateGraphics( bool bClear )
}
}
-SalGraphics* KDESalFrame::AcquireGraphics()
+SalGraphics* KDE5SalFrame::AcquireGraphics()
{
if( GetWindow() )
{
diff --git a/vcl/unx/kde5/KDE5SalFrame.hxx b/vcl/unx/kde5/KDE5SalFrame.hxx
index 114cd49bd8d2..dc77ec6daae5 100644
--- a/vcl/unx/kde5/KDE5SalFrame.hxx
+++ b/vcl/unx/kde5/KDE5SalFrame.hxx
@@ -25,7 +25,7 @@
#include <unx/salframe.h>
#include <unx/salgdi.h>
-class KDESalFrame : public X11SalFrame
+class KDE5SalFrame : public X11SalFrame
{
private:
static const int nMaxGraphics = 2;
@@ -41,7 +41,7 @@ class KDESalFrame : public X11SalFrame
GraphicsHolder m_aGraphics[ nMaxGraphics ];
public:
- KDESalFrame( SalFrame* pParent, SalFrameStyleFlags nStyle );
+ KDE5SalFrame( SalFrame* pParent, SalFrameStyleFlags nStyle );
virtual SalGraphics* AcquireGraphics() override;
virtual void ReleaseGraphics( SalGraphics *pGraphics ) override;
diff --git a/vcl/unx/kde5/KDE5SalInstance.cxx b/vcl/unx/kde5/KDE5SalInstance.cxx
index 5d4bc5eec5dd..b8d3471a44c6 100644
--- a/vcl/unx/kde5/KDE5SalInstance.cxx
+++ b/vcl/unx/kde5/KDE5SalInstance.cxx
@@ -33,20 +33,20 @@
using namespace com::sun::star;
-KDESalInstance::KDESalInstance(SalYieldMutex* pMutex)
+KDE5SalInstance::KDE5SalInstance(SalYieldMutex* pMutex)
: X11SalInstance(pMutex)
{
ImplSVData* pSVData = ImplGetSVData();
delete pSVData->maAppData.mpToolkitName;
- pSVData->maAppData.mpToolkitName = new OUString("kde4");
+ pSVData->maAppData.mpToolkitName = new OUString("kde5");
}
-SalFrame* KDESalInstance::CreateFrame( SalFrame *pParent, SalFrameStyleFlags nState )
+SalFrame* KDE5SalInstance::CreateFrame( SalFrame *pParent, SalFrameStyleFlags nState )
{
- return new KDESalFrame( pParent, nState );
+ return new KDE5SalFrame( pParent, nState );
}
-uno::Reference< ui::dialogs::XFilePicker2 > KDESalInstance::createFilePicker(
+uno::Reference< ui::dialogs::XFilePicker2 > KDE5SalInstance::createFilePicker(
const uno::Reference< uno::XComponentContext >& xMSF )
{
/*KDEXLib* kdeXLib = static_cast<KDEXLib*>( mpXLib );
@@ -57,12 +57,12 @@ uno::Reference< ui::dialogs::XFilePicker2 > KDESalInstance::createFilePicker(
return X11SalInstance::createFilePicker( xMSF );
}
-SalX11Display* KDESalInstance::CreateDisplay() const
+SalX11Display* KDE5SalInstance::CreateDisplay() const
{
- return new SalKDEDisplay( QX11Info::display() );
+ return new SalKDE5Display( QX11Info::display() );
}
-bool KDESalInstance::IsMainThread() const
+bool KDE5SalInstance::IsMainThread() const
{
return qApp->thread() == QThread::currentThread();
}
diff --git a/vcl/unx/kde5/KDE5SalInstance.hxx b/vcl/unx/kde5/KDE5SalInstance.hxx
index 7b7417caaaf1..233d6fd7430b 100644
--- a/vcl/unx/kde5/KDE5SalInstance.hxx
+++ b/vcl/unx/kde5/KDE5SalInstance.hxx
@@ -24,13 +24,13 @@
class SalYieldMutex;
class SalFrame;
-class KDESalInstance : public X11SalInstance
+class KDE5SalInstance : public X11SalInstance
{
protected:
virtual SalX11Display* CreateDisplay() const override;
public:
- explicit KDESalInstance(SalYieldMutex* pMutex);
+ explicit KDE5SalInstance(SalYieldMutex* pMutex);
virtual SalFrame* CreateFrame( SalFrame* pParent, SalFrameStyleFlags nStyle ) override;
virtual bool hasNativeFileSelection() const override { return true; }
diff --git a/vcl/unx/kde5/KDE5XLib.cxx b/vcl/unx/kde5/KDE5XLib.cxx
index b05e8e6ed047..2c85ab7fa3f9 100644
--- a/vcl/unx/kde5/KDE5XLib.cxx
+++ b/vcl/unx/kde5/KDE5XLib.cxx
@@ -51,7 +51,7 @@
#include "tst_exclude_posted_events.moc"
#endif
-KDEXLib::KDEXLib() :
+KDE5XLib::KDE5XLib() :
SalXLib(), m_bStartupDone(false),
m_nFakeCmdLineArgs( 0 ),
m_isGlibEventLoopType(false), m_allowKdeDialogs(false),
@@ -84,7 +84,7 @@ KDEXLib::KDEXLib() :
Qt::BlockingQueuedConnection );
}
-KDEXLib::~KDEXLib()
+KDE5XLib::~KDE5XLib()
{
// free the faked cmdline arguments no longer needed by KApplication
@@ -94,7 +94,7 @@ KDEXLib::~KDEXLib()
}
}
-void KDEXLib::Init()
+void KDE5XLib::Init()
{
m_pInputMethod = new SalI18N_InputMethod;
m_pInputMethod->SetLocale();
@@ -218,22 +218,22 @@ static bool qt_event_filter( void* m )
{
if( old_qt_event_filter != nullptr && old_qt_event_filter( m ))
return true;
- if( SalKDEDisplay::self() && SalKDEDisplay::self()->checkDirectInputEvent( static_cast< XEvent* >( m )))
+ if( SalKDE5Display::self() && SalKDE5Display::self()->checkDirectInputEvent( static_cast< XEvent* >( m )))
return true;
return false;
}*/
-bool KDEXLib::nativeEventFilter(const QByteArray &eventType, void *message, long *)
+bool KDE5XLib::nativeEventFilter(const QByteArray &eventType, void *message, long *)
{
if (eventType == "xcb_generic_event_t") {
xcb_generic_event_t* ev = static_cast<xcb_generic_event_t *>(message);
- if( SalKDEDisplay::self() && SalKDEDisplay::self()->checkDirectInputEvent( ev ))
+ if( SalKDE5Display::self() && SalKDE5Display::self()->checkDirectInputEvent( ev ))
return true;
}
return false;
}
-void KDEXLib::setupEventLoop()
+void KDE5XLib::setupEventLoop()
{
QAbstractEventDispatcher::instance()->installNativeEventFilter( this );
#if KF5_HAVE_GLIB
@@ -248,7 +248,7 @@ void KDEXLib::setupEventLoop()
#endif
}
-void KDEXLib::Insert( int fd, void* data, YieldFunc pending, YieldFunc queued, YieldFunc handle )
+void KDE5XLib::Insert( int fd, void* data, YieldFunc pending, YieldFunc queued, YieldFunc handle )
{
if( !m_isGlibEventLoopType )
return SalXLib::Insert( fd, data, pending, queued, handle );
@@ -263,7 +263,7 @@ void KDEXLib::Insert( int fd, void* data, YieldFunc pending, YieldFunc queued, Y
socketData[ fd ] = sdata;
}
-void KDEXLib::Remove( int fd )
+void KDE5XLib::Remove( int fd )
{
if( !m_isGlibEventLoopType )
return SalXLib::Remove( fd );
@@ -271,13 +271,13 @@ void KDEXLib::Remove( int fd )
delete sdata.notifier;
}
-void KDEXLib::socketNotifierActivated( int fd )
+void KDE5XLib::socketNotifierActivated( int fd )
{
const SocketData& sdata = socketData[ fd ];
sdata.handle( fd, sdata.data );
}
-bool KDEXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
+bool KDE5XLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
{
if( !m_isGlibEventLoopType )
{
@@ -312,7 +312,7 @@ bool KDEXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
* Quoting the Qt docs: [QAbstractEventDispatcher::processEvents] processes
* pending events that match flags until there are no more events to process.
*/
-bool KDEXLib::processYield( bool bWait, bool )
+bool KDE5XLib::processYield( bool bWait, bool )
{
QAbstractEventDispatcher* dispatcher = QAbstractEventDispatcher::instance( qApp->thread());
bool wasEvent = false;
@@ -323,7 +323,7 @@ bool KDEXLib::processYield( bool bWait, bool )
return wasEvent;
}
-void KDEXLib::StartTimer( sal_uLong nMS )
+void KDE5XLib::StartTimer( sal_uLong nMS )
{
if( !m_isGlibEventLoopType )
return SalXLib::StartTimer( nMS );
@@ -335,47 +335,47 @@ void KDEXLib::StartTimer( sal_uLong nMS )
Q_EMIT startTimeoutTimerSignal();
}
-void KDEXLib::startTimeoutTimer()
+void KDE5XLib::startTimeoutTimer()
{
timeoutTimer.start();
}
-void KDEXLib::StopTimer()
+void KDE5XLib::StopTimer()
{
if( !m_isGlibEventLoopType )
return SalXLib::StopTimer();
timeoutTimer.stop();
}
-void KDEXLib::timeoutActivated()
+void KDE5XLib::timeoutActivated()
{
// don't potentially wait in timeout, as QTimer is non-recursive
QApplication::postEvent(this, new QEvent(QEvent::Type( m_timerEventId )));
}
-void KDEXLib::customEvent(QEvent* e)
+void KDE5XLib::customEvent(QEvent* e)
{
if( e->type() == m_timerEventId )
X11SalData::Timeout();
else if( e->type() == m_postUserEventId )
- SalKDEDisplay::self()->DispatchInternalEvent();
+ SalKDE5Display::self()->DispatchInternalEvent();
}
-void KDEXLib::Wakeup()
+void KDE5XLib::Wakeup()
{
if( !m_isGlibEventLoopType )
return SalXLib::Wakeup();
QAbstractEventDispatcher::instance( qApp->thread())->wakeUp(); // main thread event loop
}
-void KDEXLib::PostUserEvent()
+void KDE5XLib::PostUserEvent()
{
if( !m_isGlibEventLoopType )
return SalXLib::PostUserEvent();
QApplication::postEvent(this, new QEvent(QEvent::Type( m_postUserEventId )));
}
-void KDEXLib::doStartup()
+void KDE5XLib::doStartup()
{
if( ! m_bStartupDone )
{
@@ -387,7 +387,7 @@ void KDEXLib::doStartup()
using namespace com::sun::star;
-uno::Reference< ui::dialogs::XFilePicker2 > KDEXLib::createFilePicker(
+uno::Reference< ui::dialogs::XFilePicker2 > KDE5XLib::createFilePicker(
const uno::Reference< uno::XComponentContext >& xMSF )
{
#if KF5_HAVE_GLIB
diff --git a/vcl/unx/kde5/KDE5XLib.hxx b/vcl/unx/kde5/KDE5XLib.hxx
index cb506edea1c6..152bba357f3b 100644
--- a/vcl/unx/kde5/KDE5XLib.hxx
+++ b/vcl/unx/kde5/KDE5XLib.hxx
@@ -35,7 +35,7 @@
class VCLKDEApplication;
-class KDEXLib : public QObject, public QAbstractNativeEventFilter, public SalXLib
+class KDE5XLib : public QObject, public QAbstractNativeEventFilter, public SalXLib
{
Q_OBJECT
private:
@@ -75,8 +75,8 @@ class KDEXLib : public QObject, public QAbstractNativeEventFilter, public SalXLi
createFilePickerSignal( const css::uno::Reference< css::uno::XComponentContext >& );
public:
- KDEXLib();
- virtual ~KDEXLib() override;
+ KDE5XLib();
+ virtual ~KDE5XLib() override;
virtual void Init() override;
virtual bool Yield( bool bWait, bool bHandleAllCurrentEvents ) override;
diff --git a/vcl/unx/kde5/VCLKDE5Application.cxx b/vcl/unx/kde5/VCLKDE5Application.cxx
index cea68a3321f8..15ff9a2dfdac 100644
--- a/vcl/unx/kde5/VCLKDE5Application.cxx
+++ b/vcl/unx/kde5/VCLKDE5Application.cxx
@@ -24,14 +24,14 @@
#include "KDE5SalDisplay.hxx"
-VCLKDEApplication::VCLKDEApplication() :
- KApplication()
+VCLKDE5Application::VCLKDE5Application() :
+ QApplication()
{
}
// various hacks to be performed before re-entering Qt's event loop
// because of showing a Qt dialog
-void VCLKDEApplication::preDialogSetup()
+void VCLKDE5Application::preDialogSetup()
{
// KFileDialog integration requires using event loop with QClipboard.
// Opening the KDE file dialog here can lead to QClipboard
@@ -47,7 +47,7 @@ void VCLKDEApplication::preDialogSetup()
}
// various hacks to be performed after a Qt dialog has been closed
-void VCLKDEApplication::postDialogCleanup()
+void VCLKDE5Application::postDialogCleanup()
{
// HACK: KFileDialog uses KConfig("kdeglobals") for saving some settings
// (such as the auto-extension flag), but that doesn't update KGlobal::config()
diff --git a/vcl/unx/kde5/main.cxx b/vcl/unx/kde5/main.cxx
index 96af86e54607..654a9d654ee8 100644
--- a/vcl/unx/kde5/main.cxx
+++ b/vcl/unx/kde5/main.cxx
@@ -54,7 +54,7 @@ extern "C" {
#if QT_VERSION < 0x050000
// Qt 4.x support needs >= 4.1.0
OString aVersion( qVersion() );
- SAL_INFO( "vcl.kde4", "qt version string is " << aVersion );
+ SAL_INFO( "vcl.kde5", "qt version string is " << aVersion );
sal_Int32 nIndex = 0, nMajor = 0, nMinor = 0;
nMajor = aVersion.getToken( 0, '.', nIndex ).toInt32();
@@ -66,17 +66,17 @@ extern "C" {
sal_Int32 nMicro = 0;
if( nIndex > 0 )
nMicro = aVersion.getToken( 0, '.', nIndex ).toInt32();
- SAL_INFO( "vcl.kde4", "unsuitable qt version " << nMajor << "." << nMinor << "." << nMicro );
+ SAL_INFO( "vcl.kde5", "unsuitable qt version " << nMajor << "." << nMinor << "." << nMicro );
#endif
return nullptr;
}
#endif
- KDESalInstance* pInstance = new KDESalInstance( new SalYieldMutex() );
- SAL_INFO( "vcl.kde4", "created KDESalInstance " << &pInstance );
+ KDE5SalInstance* pInstance = new KDE5SalInstance( new SalYieldMutex() );
+ SAL_INFO( "vcl.kde5", "created KDE5SalInstance " << &pInstance );
// initialize SalData
- KDEData *salData = new KDEData( pInstance );
+ KDE5Data *salData = new KDE5Data( pInstance );
salData->Init();
salData->initNWF();
pInstance->SetLib(salData->GetLib());
commit dd7a3147f160813022d1c2724bbdf7fc46ffcc59
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Mon Aug 28 18:29:20 2017 +0200
kde5: copy basic kde4 blocks -> kde5 and build againt qt5/kf5 libs
Change-Id: I70f0c4147721a20459e1183ff40cf0ac8adf49e6
diff --git a/vcl/CustomTarget_kde5_moc.mk b/vcl/CustomTarget_kde5_moc.mk
new file mode 100644
index 000000000000..2c8540cb065a
--- /dev/null
+++ b/vcl/CustomTarget_kde5_moc.mk
@@ -0,0 +1,23 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_CustomTarget_CustomTarget,vcl/unx/kde5))
+
+$(call gb_CustomTarget_get_target,vcl/unx/kde5) : \
+ $(call gb_CustomTarget_get_workdir,vcl/unx/kde5)/KDE5XLib.moc \
+ $(call gb_CustomTarget_get_workdir,vcl/unx/kde5)/tst_exclude_socket_notifiers.moc \
+ $(call gb_CustomTarget_get_workdir,vcl/unx/kde5)/tst_exclude_posted_events.moc
+
+$(call gb_CustomTarget_get_workdir,vcl/unx/kde5)/%.moc : \
+ $(SRCDIR)/vcl/unx/kde5/%.hxx \
+ | $(call gb_CustomTarget_get_workdir,vcl/unx/kde5)/.dir
+ $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),MOC,1)
+ $(MOC5) $< -o $@
+
+# vim: set noet sw=4:
diff --git a/vcl/Library_vclplug_kde5.mk b/vcl/Library_vclplug_kde5.mk
new file mode 100644
index 000000000000..7775fbf9a71a
--- /dev/null
+++ b/vcl/Library_vclplug_kde5.mk
@@ -0,0 +1,96 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# This file incorporates work covered by the following license notice:
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed
+# with this work for additional information regarding copyright
+# ownership. The ASF licenses this file to you under the Apache
+# License, Version 2.0 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.apache.org/licenses/LICENSE-2.0 .
+#
+
+$(eval $(call gb_Library_Library,vclplug_kde5))
+
+$(eval $(call gb_Library_use_custom_headers,vclplug_kde5,vcl/unx/kde5))
+
+$(eval $(call gb_Library_set_include,vclplug_kde5,\
+ $$(INCLUDE) \
+ -I$(SRCDIR)/vcl/inc \
+))
+
+$(eval $(call gb_Library_add_defs,vclplug_kde5,\
+ -DVCLPLUG_KDE5_IMPLEMENTATION \
+))
+
+$(eval $(call gb_Library_use_sdk_api,vclplug_kde5))
+
+$(eval $(call gb_Library_use_libraries,vclplug_kde5,\
+ vclplug_gen \
+ vcl \
+ tl \
+ utl \
+ sot \
+ ucbhelper \
+ basegfx \
+ comphelper \
+ cppuhelper \
+ i18nlangtag \
+ i18nutil \
+ $(if $(ENABLE_JAVA), \
+ jvmaccess) \
+ cppu \
+ sal \
+))
+
+$(eval $(call gb_Library_use_externals,vclplug_kde5,\
+ boost_headers \
+ icuuc \
+ kde5 \
+ epoxy \
+))
+
+$(eval $(call gb_Library_add_libs,vclplug_kde5,\
+ -lX11 \
+ -lXext \
+ -lSM \
+ -lICE \
+))
+
+ifneq ($(KF5_HAVE_GLIB),)
+$(eval $(call gb_Library_add_defs,vclplug_kde5,\
+ $(KF5_GLIB_CFLAGS) \
+))
+
+$(eval $(call gb_Library_add_libs,vclplug_kde5,\
+ $(KF5_GLIB_LIBS) \
+))
+endif
+
+
+$(eval $(call gb_Library_add_exception_objects,vclplug_kde5,\
+ vcl/unx/kde5/KDE5Data \
+ vcl/unx/kde5/KDE5SalDisplay \
+ vcl/unx/kde5/KDE5SalFrame \
+ vcl/unx/kde5/KDE5SalGraphics \
+ vcl/unx/kde5/KDE5SalInstance \
+ vcl/unx/kde5/KDE5XLib \
+ vcl/unx/kde5/main \
+))
+
+ifeq ($(OS),LINUX)
+$(eval $(call gb_Library_add_libs,vclplug_kde5,\
+ -lm \
+ -ldl \
+ -lpthread \
+))
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index c3b001fff442..a9cd5e158f13 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -81,6 +81,12 @@ $(eval $(call gb_Module_add_targets,vcl,\
Library_vclplug_kde4 \
))
endif
+ifneq ($(ENABLE_KDE5),)
+$(eval $(call gb_Module_add_targets,vcl,\
+ CustomTarget_kde5_moc \
+ Library_vclplug_kde5 \
+))
+endif
endif
ifeq ($(OS),MACOSX)
diff --git a/vcl/unx/kde5/FPServiceInfo.hxx b/vcl/unx/kde5/FPServiceInfo.hxx
new file mode 100644
index 000000000000..fdb285144343
--- /dev/null
+++ b/vcl/unx/kde5/FPServiceInfo.hxx
@@ -0,0 +1,28 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+// the service names
+#define FILE_PICKER_SERVICE_NAME "com.sun.star.ui.dialogs.KDE4FilePicker"
+
+// the implementation names
+#define FILE_PICKER_IMPL_NAME "com.sun.star.ui.dialogs.KDE4FilePicker"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde5/KDE5Data.cxx b/vcl/unx/kde5/KDE5Data.cxx
new file mode 100644
index 000000000000..487a0b254af3
--- /dev/null
+++ b/vcl/unx/kde5/KDE5Data.cxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <QtWidgets/QStyle>
+#include <QtWidgets/QApplication>
+
+#undef Region
+
+#include "KDE5Data.hxx"
+
+#include "KDE5XLib.hxx"
+#include "KDE5SalDisplay.hxx"
+
+KDEData::~KDEData()
+{
+}
+
+void KDEData::Init()
+{
+ pXLib_ = new KDEXLib();
+ pXLib_->Init();
+ SetDisplay( SalKDEDisplay::self() );
+}
+
+void KDEData::initNWF()
+{
+ ImplSVData *pSVData = ImplGetSVData();
+
+ // draw toolbars on separate lines
+ pSVData->maNWFData.mbDockingAreaSeparateTB = true;
+ // no borders for menu, theming does that
+ pSVData->maNWFData.mbFlatMenu = true;
+ // Qt theme engines may support a rollover menubar
+ pSVData->maNWFData.mbRolloverMenubar = true;
+
+ pSVData->maNWFData.mbNoFocusRects = true;
+
+ // Styled menus need additional space
+ QStyle *style = QApplication::style();
+ pSVData->maNWFData.mnMenuFormatBorderX =
+ style->pixelMetric( QStyle::PM_MenuPanelWidth ) +
+ style->pixelMetric( QStyle::PM_MenuHMargin );
+ pSVData->maNWFData.mnMenuFormatBorderY =
+ style->pixelMetric( QStyle::PM_MenuPanelWidth ) +
+ style->pixelMetric( QStyle::PM_MenuVMargin );
+}
+
+void KDEData::deInitNWF()
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde5/KDE5Data.hxx b/vcl/unx/kde5/KDE5Data.hxx
new file mode 100644
index 000000000000..4efd23a7df34
--- /dev/null
+++ b/vcl/unx/kde5/KDE5Data.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <unx/saldisp.hxx>
+#include <unx/saldata.hxx>
+
+class KDEData : public X11SalData
+{
+ public:
+ explicit KDEData( SalInstance *pInstance )
+ : X11SalData( SAL_DATA_KDE4, pInstance ) {}
+ virtual ~KDEData() override;
+
+ virtual void Init() override;
+ virtual void initNWF() override;
+ virtual void deInitNWF() override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde5/KDE5SalDisplay.cxx b/vcl/unx/kde5/KDE5SalDisplay.cxx
new file mode 100644
index 000000000000..eddac063048f
--- /dev/null
+++ b/vcl/unx/kde5/KDE5SalDisplay.cxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "VCLKDE5Application.hxx"
+#include "KDE5SalDisplay.hxx"
+
+#ifdef Bool
+#undef Bool
+#endif
+
+#include "KDE5XLib.hxx"
+
+#include <assert.h>
+
+SalKDEDisplay* SalKDEDisplay::selfptr = nullptr;
+
+SalKDEDisplay::SalKDEDisplay( Display* pDisp )
+ : SalX11Display( pDisp )
+{
+ assert( selfptr == nullptr );
+ selfptr = this;
+ xim_protocol = XInternAtom( pDisp_, "_XIM_PROTOCOL", False );
+}
+
+SalKDEDisplay::~SalKDEDisplay()
+{
+ // in case never a frame opened
+ static_cast<KDEXLib*>(GetXLib())->doStartup();
+ // clean up own members
+ doDestruct();
+ selfptr = nullptr;
+ // prevent SalDisplay from closing KApplication's display
+ pDisp_ = nullptr;
+}
+
+void SalKDEDisplay::Yield()
+{
+ if( DispatchInternalEvent() )
+ return;
+
+ // Prevent blocking from Drag'n'Drop events, which may have already have processed the event
+ if (XEventsQueued( pDisp_, QueuedAfterReading ) == 0)
+ return;
+
+ DBG_ASSERT( static_cast<SalYieldMutex*>(GetSalData()->m_pInstance->GetYieldMutex())->GetThreadId() ==
+ osl::Thread::getCurrentIdentifier(),
+ "will crash soon since solar mutex not locked in SalKDEDisplay::Yield" );
+
+ /*XEvent event;
+ XNextEvent( pDisp_, &event );
+ if( checkDirectInputEvent( &event ))
+ return;
+ qApp->x11ProcessEvent( &event );*/
+}
+
+// HACK: When using Qt event loop, input methods (japanese, etc.) will get broken because
+// of XFilterEvent() getting called twice, once by Qt, once by LO (bnc#665112).
+// This function is therefore called before any XEvent is passed to Qt event handling
+// and if it is a keyboard event and no Qt widget is the active window (i.e. we are
+// processing events for some LO window), then feed the event only to LO directly and skip Qt
+// completely. Skipped events are KeyPress, KeyRelease and also _XIM_PROTOCOL client message
+// (seems to be necessary too, hopefully there are not other internal XIM messages that
+// would need this handling).
+bool SalKDEDisplay::checkDirectInputEvent( xcb_generic_event_t* ev )
+{
+ switch (ev->response_type & ~0x80)
+ {
+ case XCB_CLIENT_MESSAGE:
+ case XCB_KEY_PRESS:
+ case XCB_KEY_RELEASE:
+ if( QApplication::activeWindow() == nullptr )
+ {
+// Dispatch(ev);
+ return true;
+ }
+ break;
+ }
+ return false;
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde5/KDE5SalDisplay.hxx b/vcl/unx/kde5/KDE5SalDisplay.hxx
new file mode 100644
index 000000000000..0a31dcedc10d
--- /dev/null
+++ b/vcl/unx/kde5/KDE5SalDisplay.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <unx/saldisp.hxx>
+#include <xcb/xcb.h>
+
+#ifdef CursorShape
+#undef CursorShape
+#endif
+
+class SalKDEDisplay : public SalX11Display
+{
+ public:
+ explicit SalKDEDisplay( Display* pDisp );
+ virtual ~SalKDEDisplay() override;
+ static SalKDEDisplay* self();
+ virtual void Yield() override;
+ bool checkDirectInputEvent( xcb_generic_event_t* ev );
+ private:
+ Atom xim_protocol;
+ static SalKDEDisplay* selfptr;
+};
+
+inline SalKDEDisplay* SalKDEDisplay::self()
+{
+ return selfptr;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde5/KDE5SalFrame.cxx b/vcl/unx/kde5/KDE5SalFrame.cxx
new file mode 100644
index 000000000000..090abbc240d1
--- /dev/null
+++ b/vcl/unx/kde5/KDE5SalFrame.cxx
@@ -0,0 +1,381 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <memory>
+#include <QtGui/QColor>
+#include <QtWidgets/QStyle>
+#include <QtCore/QDebug>
+#include <QtWidgets/QToolTip>
+#include <QtWidgets/QApplication>
+#include <QtWidgets/QMenuBar>
+
+#include <KConfig>
+#include <KConfigGroup>
+#include <KSharedConfig>
+
+#undef Region
+
+#include "KDE5SalFrame.hxx"
+#include "KDE5XLib.hxx"
+#include "KDE5SalGraphics.hxx"
+
+#include <tools/color.hxx>
+
+#include <vcl/font.hxx>
+#include <vcl/settings.hxx>
+
+#include "unx/fontmanager.hxx"
+
+#include <svdata.hxx>
+
+#include <boost/optional.hpp>
+
+
+KDESalFrame::KDESalFrame( SalFrame* pParent, SalFrameStyleFlags nState ) :
+ X11SalFrame( pParent, nState )
+{
+}
+
+void KDESalFrame::Show( bool bVisible, bool bNoActivate )
+{
+ if ( !GetParent() && ! (GetStyle() & SalFrameStyleFlags::INTRO) )
+ {
+ KDEXLib* pXLib = static_cast<KDEXLib*>(GetDisplay()->GetXLib());
+ pXLib->doStartup();
+ }
+
+ X11SalFrame::Show( bVisible, bNoActivate );
+}
+
+/** Helper function to convert colors.
+*/
+static Color toColor( const QColor &rColor )
+{
+ return Color( rColor.red(), rColor.green(), rColor.blue() );
+}
+
+
+/** Helper function to add information to Font from QFont.
+
+ Mostly grabbed from the Gtk+ vclplug (salnativewidgets-gtk.cxx).
+*/
+static vcl::Font toFont( const QFont &rQFont, const css::lang::Locale& rLocale )
+{
+ psp::FastPrintFontInfo aInfo;
+ QFontInfo qFontInfo( rQFont );
+
+ // set family name
+ aInfo.m_aFamilyName = OUString( static_cast<const char *>(rQFont.family().toUtf8()), strlen( static_cast<const char *>(rQFont.family().toUtf8()) ), RTL_TEXTENCODING_UTF8 );
+
+ // set italic
+ aInfo.m_eItalic = ( qFontInfo.italic()? ITALIC_NORMAL: ITALIC_NONE );
+
+ // set weight
+ int nWeight = qFontInfo.weight();
+ if ( nWeight <= QFont::Light )
+ aInfo.m_eWeight = WEIGHT_LIGHT;
+ else if ( nWeight <= QFont::Normal )
+ aInfo.m_eWeight = WEIGHT_NORMAL;
+ else if ( nWeight <= QFont::DemiBold )
+ aInfo.m_eWeight = WEIGHT_SEMIBOLD;
+ else if ( nWeight <= QFont::Bold )
+ aInfo.m_eWeight = WEIGHT_BOLD;
+ else
+ aInfo.m_eWeight = WEIGHT_ULTRABOLD;
+
+ // set width
+ int nStretch = rQFont.stretch();
+ if ( nStretch <= QFont::UltraCondensed )
+ aInfo.m_eWidth = WIDTH_ULTRA_CONDENSED;
+ else if ( nStretch <= QFont::ExtraCondensed )
+ aInfo.m_eWidth = WIDTH_EXTRA_CONDENSED;
+ else if ( nStretch <= QFont::Condensed )
+ aInfo.m_eWidth = WIDTH_CONDENSED;
+ else if ( nStretch <= QFont::SemiCondensed )
+ aInfo.m_eWidth = WIDTH_SEMI_CONDENSED;
+ else if ( nStretch <= QFont::Unstretched )
+ aInfo.m_eWidth = WIDTH_NORMAL;
+ else if ( nStretch <= QFont::SemiExpanded )
+ aInfo.m_eWidth = WIDTH_SEMI_EXPANDED;
+ else if ( nStretch <= QFont::Expanded )
+ aInfo.m_eWidth = WIDTH_EXPANDED;
+ else if ( nStretch <= QFont::ExtraExpanded )
+ aInfo.m_eWidth = WIDTH_EXTRA_EXPANDED;
+ else
+ aInfo.m_eWidth = WIDTH_ULTRA_EXPANDED;
+
+ SAL_INFO( "vcl.kde4", "font name BEFORE system match: \"" << aInfo.m_aFamilyName << "\"" );
+
+ // match font to e.g. resolve "Sans"
+ psp::PrintFontManager::get().matchFont( aInfo, rLocale );
+
+ SAL_INFO( "vcl.kde4", "font match " <<
+ (aInfo.m_nID != 0 ? "succeeded" : "failed") <<
+ ", name AFTER: \"" << aInfo.m_aFamilyName << "\"" );
+
+ // font height
+ int nPointHeight = qFontInfo.pointSize();
+ if ( nPointHeight <= 0 )
+ nPointHeight = rQFont.pointSize();
+
+ // Create the font
+ vcl::Font aFont( aInfo.m_aFamilyName, Size( 0, nPointHeight ) );
+ if( aInfo.m_eWeight != WEIGHT_DONTKNOW )
+ aFont.SetWeight( aInfo.m_eWeight );
+ if( aInfo.m_eWidth != WIDTH_DONTKNOW )
+ aFont.SetWidthType( aInfo.m_eWidth );
+ if( aInfo.m_eItalic != ITALIC_DONTKNOW )
+ aFont.SetItalic( aInfo.m_eItalic );
+ if( aInfo.m_ePitch != PITCH_DONTKNOW )
+ aFont.SetPitch( aInfo.m_ePitch );
+
+ return aFont;
+}
+
+/** Implementation of KDE integration's main method.
+*/
+void KDESalFrame::UpdateSettings( AllSettings& rSettings )
+{
+ StyleSettings style( rSettings.GetStyleSettings() );
+ bool bSetTitleFont = false;
+
+ // General settings
+ QPalette pal = QApplication::palette();
+
+ style.SetToolbarIconSize( ToolbarIconSize::Large );
+
+ style.SetActiveColor(toColor(pal.color(QPalette::Active, QPalette::Window)));
+ style.SetDeactiveColor(toColor(pal.color(QPalette::Inactive, QPalette::Window)));
+
+ style.SetActiveTextColor(toColor(pal.color(QPalette::Active, QPalette::WindowText)));
+ style.SetDeactiveTextColor(toColor(pal.color(QPalette::Inactive, QPalette::WindowText)));
+
+ // WM settings
+ /*KConfig *pConfig = KGlobal::config().data();
+ if ( pConfig )
+ {
+ const char *pKey;
+
+ {
+ KConfigGroup aWMGroup = pConfig->group( "WM" );
+
+ pKey = "titleFont";
+ if (aWMGroup.hasKey(pKey))
+ {
+ vcl::Font aFont = toFont(aWMGroup.readEntry(pKey, QFont()),
+ rSettings.GetUILanguageTag().getLocale());
+ style.SetTitleFont( aFont );
+ bSetTitleFont = true;
+ }
+ }
+
+ KConfigGroup aIconsGroup = pConfig->group("Icons");
+
+ pKey = "Theme";
+ if (aIconsGroup.hasKey(pKey))
+ style.SetPreferredIconTheme( readEntryUntranslated(&aIconsGroup, pKey));
+
+ //toolbar
+ pKey = "toolbarFont";
+ if (aIconsGroup.hasKey(pKey))
+ {
+ vcl::Font aFont = toFont(aIconsGroup.readEntry(pKey, QFont()),
+ rSettings.GetUILanguageTag().getLocale());
+ style.SetToolFont( aFont );
+ }
+ }*/
+
+ Color aFore = toColor( pal.color( QPalette::Active, QPalette::WindowText ) );
+ Color aBack = toColor( pal.color( QPalette::Active, QPalette::Window ) );
+ Color aText = toColor( pal.color( QPalette::Active, QPalette::Text ) );
+ Color aBase = toColor( pal.color( QPalette::Active, QPalette::Base ) );
+ Color aButn = toColor( pal.color( QPalette::Active, QPalette::ButtonText ) );
+ Color aMid = toColor( pal.color( QPalette::Active, QPalette::Mid ) );
+ Color aHigh = toColor( pal.color( QPalette::Active, QPalette::Highlight ) );
+ Color aHighText = toColor( pal.color( QPalette::Active, QPalette::HighlightedText ) );
+
+ style.SetSkipDisabledInMenus( true );
+
+ // Foreground
+ style.SetRadioCheckTextColor( aFore );
+ style.SetLabelTextColor( aFore );
+ style.SetDialogTextColor( aFore );
+ style.SetGroupTextColor( aFore );
+
+ // Text
+ style.SetFieldTextColor( aText );
+ style.SetFieldRolloverTextColor( aText );
+ style.SetWindowTextColor( aText );
+ style.SetToolTextColor( aText );
+
+ // Base
+ style.SetFieldColor( aBase );
+ style.SetWindowColor( aBase );
+ style.SetActiveTabColor( aBase );
+
+ // Buttons
+ style.SetButtonTextColor( aButn );
+ style.SetButtonRolloverTextColor( aButn );
+
+ // Tabs
+ style.SetTabTextColor( aButn );
+ style.SetTabRolloverTextColor( aButn );
+ style.SetTabHighlightTextColor( aButn );
+
+ // Disable color
+ style.SetDisableColor( toColor( pal.color( QPalette::Disabled, QPalette::WindowText ) ) );
+
+ // Workspace
+ style.SetWorkspaceColor( aMid );
+
+ // Background
+ style.Set3DColors( aBack );
+ style.SetFaceColor( aBack );
+ style.SetInactiveTabColor( aBack );
+ style.SetDialogColor( aBack );
+ style.SetCheckedColorSpecialCase( );
+
+ // Selection
+ style.SetHighlightColor( aHigh );
+ style.SetHighlightTextColor( aHighText );
+
+ // Tooltip
+ style.SetHelpColor( toColor( QToolTip::palette().color( QPalette::Active, QPalette::ToolTipBase )));
+ style.SetHelpTextColor( toColor( QToolTip::palette().color( QPalette::Active, QPalette::ToolTipText )));
+
+ // Font
+ vcl::Font aFont = toFont( QApplication::font(), rSettings.GetUILanguageTag().getLocale() );
+
+ style.SetAppFont( aFont );
+
+ style.SetMenuFont( aFont ); // will be changed according to pMenuBar
+ style.SetLabelFont( aFont );
+ style.SetRadioCheckFont( aFont );
+ style.SetPushButtonFont( aFont );
+ style.SetFieldFont( aFont );
+ style.SetIconFont( aFont );
+ style.SetTabFont( aFont );
+ style.SetGroupFont( aFont );
+
+ aFont.SetWeight( WEIGHT_BOLD );
+ if( !bSetTitleFont )
+ {
+ style.SetTitleFont( aFont );
+ }
+ style.SetFloatTitleFont( aFont );
+
+ style.SetHelpFont( toFont( QToolTip::font(), rSettings.GetUILanguageTag().getLocale()));
+
+ int flash_time = QApplication::cursorFlashTime();
+ style.SetCursorBlinkTime( flash_time != 0 ? flash_time/2 : STYLE_CURSOR_NOBLINKTIME );
+
+ // Menu
+ std::unique_ptr<QMenuBar> pMenuBar = std::unique_ptr<QMenuBar>( new QMenuBar() );
+ QPalette qMenuCG = pMenuBar->palette();
+
+ // Menu text and background color, theme specific
+ Color aMenuFore = toColor( qMenuCG.color( QPalette::WindowText ) );
+ Color aMenuBack = toColor( qMenuCG.color( QPalette::Window ) );
+
+ style.SetMenuTextColor( aMenuFore );
+ style.SetMenuBarTextColor( style.GetPersonaMenuBarTextColor().get_value_or( aMenuFore ) );
+ style.SetMenuColor( aMenuBack );
+ style.SetMenuBarColor( aMenuBack );
+ style.SetMenuHighlightColor( toColor ( qMenuCG.color( QPalette::Highlight ) ) );
+ style.SetMenuHighlightTextColor( toColor ( qMenuCG.color( QPalette::HighlightedText ) ) );
+
+ // set special menubar highlight text color
+ if ( QApplication::style()->inherits( "HighContrastStyle" ) )
+ ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor = toColor( qMenuCG.color( QPalette::HighlightedText ) );
+ else
+ ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor = aMenuFore;
+
+ // set menubar rollover color
+ if ( pMenuBar->style()->styleHint( QStyle::SH_MenuBar_MouseTracking ) )
+ {
+ style.SetMenuBarRolloverColor( toColor ( qMenuCG.color( QPalette::Highlight ) ) );
+ style.SetMenuBarRolloverTextColor( ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor );
+ }
+ else
+ {
+ style.SetMenuBarRolloverColor( aMenuBack );
+ style.SetMenuBarRolloverTextColor( aMenuFore );
+ }
+ style.SetMenuBarHighlightTextColor(style.GetMenuHighlightTextColor());
+
+ // Font
+ aFont = toFont( pMenuBar->font(), rSettings.GetUILanguageTag().getLocale() );
+ style.SetMenuFont( aFont );
+
+ // Scroll bar size
+ style.SetScrollBarSize( QApplication::style()->pixelMetric( QStyle::PM_ScrollBarExtent ) );
+ style.SetMinThumbSize( QApplication::style()->pixelMetric( QStyle::PM_ScrollBarSliderMin ));
+
+ // These colors are used for the ruler text and marks
+ style.SetShadowColor(toColor(pal.color(QPalette::Disabled, QPalette::WindowText)));
+ style.SetDarkShadowColor(toColor(pal.color(QPalette::Inactive, QPalette::WindowText)));
+
+ rSettings.SetStyleSettings( style );
+}
+
+void KDESalFrame::ReleaseGraphics( SalGraphics *pGraphics )
+{
+ for( int i = 0; i < nMaxGraphics; i++ )
+ {
+ if( m_aGraphics[i].pGraphics.get() == pGraphics )
+ {
+ m_aGraphics[i].bInUse = false;
+ break;
+ }
+ }
+}
+
+void KDESalFrame::updateGraphics( bool bClear )
+{
+ Drawable aDrawable = bClear ? None : GetWindow();
+ for( int i = 0; i < nMaxGraphics; i++ )
+ {
+ if( m_aGraphics[i].bInUse )
+ m_aGraphics[i].pGraphics->SetDrawable( aDrawable, GetScreenNumber() );
+ }
+}
+
+SalGraphics* KDESalFrame::AcquireGraphics()
+{
+ if( GetWindow() )
+ {
+ for( int i = 0; i < nMaxGraphics; i++ )
+ {
+ if( ! m_aGraphics[i].bInUse )
+ {
+ m_aGraphics[i].bInUse = true;
+ if( ! m_aGraphics[i].pGraphics )
+ {
+ m_aGraphics[i].pGraphics.reset( new KDESalGraphics );
+ m_aGraphics[i].pGraphics->Init( this, GetWindow(), GetScreenNumber() );
+ }
+ return m_aGraphics[i].pGraphics.get();
+ }
+ }
+ }
+
+ return nullptr;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde5/KDE5SalFrame.hxx b/vcl/unx/kde5/KDE5SalFrame.hxx
new file mode 100644
index 000000000000..114cd49bd8d2
--- /dev/null
+++ b/vcl/unx/kde5/KDE5SalFrame.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <memory>
+
+#include <unx/saldisp.hxx>
+#include <unx/salframe.h>
+#include <unx/salgdi.h>
+
+class KDESalFrame : public X11SalFrame
+{
+ private:
+ static const int nMaxGraphics = 2;
+
+ struct GraphicsHolder
+ {
+ std::unique_ptr<X11SalGraphics> pGraphics;
+ bool bInUse;
+
+ GraphicsHolder() : bInUse( false ) {}
+ };
+
+ GraphicsHolder m_aGraphics[ nMaxGraphics ];
+
+ public:
+ KDESalFrame( SalFrame* pParent, SalFrameStyleFlags nStyle );
+
+ virtual SalGraphics* AcquireGraphics() override;
+ virtual void ReleaseGraphics( SalGraphics *pGraphics ) override;
+ virtual void updateGraphics( bool bClear ) override;
+ virtual void UpdateSettings( AllSettings& rSettings ) override;
+ virtual void Show( bool bVisible, bool bNoActivate = false ) override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde5/KDE5SalGraphics.cxx b/vcl/unx/kde5/KDE5SalGraphics.cxx
new file mode 100644
index 000000000000..85642f6f91df
--- /dev/null
+++ b/vcl/unx/kde5/KDE5SalGraphics.cxx
@@ -0,0 +1,1020 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <QtGui/QPainter>
+#include <QtWidgets/QApplication>
+#include <QtWidgets/QStyle>
+#include <QtWidgets/QStyleOption>
+#include <QtWidgets/QFrame>
+#include <QtWidgets/QLabel>
+
+#undef Region
+
+#include "KDE5SalGraphics.hxx"
+#include "KDE5SalInstance.hxx"
+
+#include <vcl/settings.hxx>
+#include <vcl/decoview.hxx>
+#include <rtl/ustrbuf.hxx>
+
+/**
+ Conversion function between VCL ControlState together with
+ ImplControlValue and Qt state flags.
+ @param nControlState State of the widget (default, focused, ...) in Native Widget Framework.
+ @param aValue Value held by the widget (on, off, ...)
+*/
+QStyle::State vclStateValue2StateFlag( ControlState nControlState,
+ const ImplControlValue& aValue )
+{
+ QStyle::State nState =
+ ( (nControlState & ControlState::ENABLED)? QStyle::State_Enabled: QStyle::State_None ) |
+ ( (nControlState & ControlState::FOCUSED)? QStyle::State_HasFocus: QStyle::State_None ) |
+ ( (nControlState & ControlState::PRESSED)? QStyle::State_Sunken: QStyle::State_None ) |
+ ( (nControlState & ControlState::SELECTED)? QStyle::State_Selected : QStyle::State_None ) |
+ ( (nControlState & ControlState::ROLLOVER)? QStyle::State_MouseOver: QStyle::State_None );
+
+ switch ( aValue.getTristateVal() )
+ {
+ case ButtonValue::On: nState |= QStyle::State_On; break;
+ case ButtonValue::Off: nState |= QStyle::State_Off; break;
+ case ButtonValue::Mixed: nState |= QStyle::State_NoChange; break;
+ default: break;
+ }
+
+ return nState;
+}
+
+/**
+ Convert tools::Rectangle to QRect.
+ @param rControlRegion The tools::Rectangle to convert.
+ @return The matching QRect
+*/
+QRect region2QRect( const tools::Rectangle& rControlRegion )
+{
+ return QRect(rControlRegion.Left(), rControlRegion.Top(), rControlRegion.GetWidth(), rControlRegion.GetHeight());
+}
+
+bool KDESalGraphics::IsNativeControlSupported( ControlType type, ControlPart part )
+{
+ switch (type)
+ {
+ case ControlType::Pushbutton:
+ case ControlType::Radiobutton:
+ case ControlType::Checkbox:
+ case ControlType::Tooltip:
+ case ControlType::Progress:
+ case ControlType::ListNode:
+ return (part == ControlPart::Entire);
+
+ case ControlType::Menubar:
+ case ControlType::MenuPopup:
+ case ControlType::Editbox:
+ case ControlType::MultilineEditbox:
+ case ControlType::Combobox:
+ case ControlType::Toolbar:
+ case ControlType::Frame:
+ case ControlType::Scrollbar:
+ case ControlType::WindowBackground:
+ case ControlType::Fixedline:
+ return true;
+
+ case ControlType::Listbox:
+ return (part == ControlPart::Entire || part == ControlPart::HasBackgroundTexture);
+
+ case ControlType::Spinbox:
+ return (part == ControlPart::Entire || part == ControlPart::HasBackgroundTexture);
+
+ case ControlType::Slider:
+ return (part == ControlPart::TrackHorzArea || part == ControlPart::TrackVertArea);
+
+ default:
+ break;
+ }
+
+ return false;
+}
+
+/// helper drawing methods
+namespace
+{
+ void draw( QStyle::ControlElement element, QStyleOption* option, QImage* image, QStyle::State const & state, QRect rect = QRect())
+ {
+ option->state |= state;
+ option->rect = !rect.isNull() ? rect : image->rect();
+
+ QPainter painter(image);
+ QApplication::style()->drawControl(element, option, &painter);
+ }
+
+ void draw( QStyle::PrimitiveElement element, QStyleOption* option, QImage* image, QStyle::State const & state, QRect rect = QRect())
+ {
+ option->state |= state;
+ option->rect = !rect.isNull() ? rect : image->rect();
+
+ QPainter painter(image);
+ QApplication::style()->drawPrimitive(element, option, &painter);
+ }
+
+ void draw( QStyle::ComplexControl element, QStyleOptionComplex* option, QImage* image, QStyle::State const & state )
+ {
+ option->state |= state;
+ option->rect = image->rect();
+
+ QPainter painter(image);
+ QApplication::style()->drawComplexControl(element, option, &painter);
+ }
+
+ void lcl_drawFrame( QStyle::PrimitiveElement element, QImage* image, QStyle::State const & state,
+ QStyle::PixelMetric eLineMetric = QStyle::PM_DefaultFrameWidth )
+ {
+ #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) )
+ QStyleOptionFrameV3 option;
+ option.frameShape = QFrame::StyledPanel;
+ option.state = QStyle::State_Sunken;
+ option.lineWidth = QApplication::style()->pixelMetric( eLineMetric );
+ #else
+ QStyleOptionFrame option;
+
+ QFrame aFrame( nullptr );
+ aFrame.setFrameRect( QRect(0, 0, image->width(), image->height()) );
+ aFrame.setFrameStyle( QFrame::StyledPanel | QFrame::Sunken );
+ aFrame.ensurePolished();
+
+ option.initFrom( &aFrame );
+ option.lineWidth = aFrame.lineWidth();
+ option.midLineWidth = aFrame.midLineWidth();
+ #endif
+ draw(element, &option, image, state);
+ }
+}
+
+#if QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 )
+#define IMAGE_BASED_PAINTING
+#else
+#undef IMAGE_BASED_PAINTING
+#endif
+
+#ifdef IMAGE_BASED_PAINTING
+// There is a small catch with this function, although hopefully only philosophical.
+// Officially Xlib's vcl::Region is an opaque data type, with only functions for manipulating it.
+// However, whoever designed it apparently didn't give it that much thought, as it's impossible
+// to find out what exactly a region actually is (except for really weird ways like XClipBox()
+// and repeated XPointInRegion(), which would be awfully slow). Fortunately, the header file
+// describing the structure actually happens to be installed too, and there's at least one
+// widely used software using it (Compiz). So access the data directly too and assume that
+// everybody who compiles with Qt4 support has Xlib new enough and good enough to support this.
+// In case this doesn't work for somebody, try #include <X11/region.h> instead, or build
+// without IMAGE_BASED_PAINTING (in which case QApplication::setGraphicsSystem( "native" ) may
+// be needed too).
+#include <X11/Xregion.h>
+static QRegion XRegionToQRegion( Region xr )
+{
+ QRegion qr;
+ for( long i = 0;
+ i < xr->numRects;
+ ++i )
+ {
+ BOX& b = xr->rects[ i ];
+ qr |= QRect( b.x1, b.y1, b.x2 - b.x1, b.y2 - b.y1 ); // x2,y2 is outside, not the bottom-right corner
+ }
+ return qr;
+}
+#endif
+
+bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
+ const tools::Rectangle& rControlRegion, ControlState nControlState,
+ const ImplControlValue& value,
+ const OUString& )
+{
+ bool nativeSupport = IsNativeControlSupported( type, part );
+ if( ! nativeSupport ) {
+ assert( ! nativeSupport && "drawNativeControl called without native support!" );
+ return false;
+ }
+
+ if( lastPopupRect.isValid() && ( type != ControlType::MenuPopup || part != ControlPart::MenuItem ))
+ lastPopupRect = QRect();
+
+ bool returnVal = true;
+
+ QRect widgetRect = region2QRect(rControlRegion);
+
+ //if no image, or resized, make a new image
+ if (!m_image || m_image->size() != widgetRect.size())
+ {
+ m_image.reset(new QImage( widgetRect.width(), widgetRect.height(), QImage::Format_ARGB32 ) );
+ }
+
+ // Default image color - just once
+ switch (type)
+ {
+ case ControlType::MenuPopup:
+ if( part == ControlPart::MenuItemCheckMark || part == ControlPart::MenuItemRadioMark )
+ {
+ // it is necessary to fill the background transparently first, as this
+ // is painted after menuitem highlight, otherwise there would be a grey area
+ m_image->fill( Qt::transparent );
+ break;
+ }
+ SAL_FALLTHROUGH; // QPalette::Window
+ case ControlType::Menubar:
+ case ControlType::WindowBackground:
+ m_image->fill( QApplication::palette().color(QPalette::Window).rgb() );
+ break;
+ case ControlType::Tooltip:
+ m_image->fill(QApplication::palette().color(QPalette::ToolTipBase).rgb());
+ break;
+ case ControlType::Pushbutton:
+ m_image->fill(QApplication::palette().color(QPalette::Button).rgb());
+ break;
+ case ControlType::Scrollbar:
+ if ((part == ControlPart::DrawBackgroundVert)
+ || (part == ControlPart::DrawBackgroundHorz))
+ {
+ m_image->fill( QApplication::palette().color(QPalette::Window).rgb() );
+ break;
+ }
+ SAL_FALLTHROUGH; // Qt::transparent
+ default:
+ m_image->fill( Qt::transparent );
+ break;
+ }
+
+ QRegion* localClipRegion = nullptr;
+
+ if (type == ControlType::Pushbutton)
+ {
+ QStyleOptionButton option;
+ draw( QStyle::CE_PushButton, &option, m_image.get(),
+ vclStateValue2StateFlag(nControlState, value) );
+ }
+ else if (type == ControlType::Menubar)
+ {
+ if (part == ControlPart::MenuItem)
+ {
+ QStyleOptionMenuItem option;
+ if ( ( nControlState & ControlState::ROLLOVER )
+ && QApplication::style()->styleHint( QStyle::SH_MenuBar_MouseTracking ) )
+ option.state |= QStyle::State_Selected;
+
+ if ( nControlState & ControlState::SELECTED ) // Passing State_Sunken is currently not documented.
+ option.state |= QStyle::State_Sunken; // But some kinds of QStyle interpret it.
+
+ draw( QStyle::CE_MenuBarItem, &option, m_image.get(),
+ vclStateValue2StateFlag(nControlState, value) );
+ }
+ else if (part == ControlPart::Entire)
+ {
+ QStyleOptionMenuItem option;
+ draw( QStyle::CE_MenuBarEmptyArea, &option, m_image.get(),
+ vclStateValue2StateFlag(nControlState, value) );
+ }
+ else
+ {
+ returnVal = false;
+ }
+ }
+ else if (type == ControlType::MenuPopup)
+ {
+ OSL_ASSERT( part == ControlPart::MenuItem ? lastPopupRect.isValid() : !lastPopupRect.isValid());
+ if( part == ControlPart::MenuItem )
+ {
+ QStyleOptionMenuItem option;
+ draw( QStyle::CE_MenuItem, &option, m_image.get(),
+ vclStateValue2StateFlag(nControlState, value) );
+ // HACK: LO core first paints the entire popup and only then it paints menu items,
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list