[Libreoffice-commits] core.git: Branch 'private/jmux/kf5' - config_host/config_vclplug.h.in config_host.mk.in configure.ac cui/Library_cui.mk cui/source include/sal RepositoryExternal.mk Repository.mk scp2/InstallScript_setup_osl.mk scp2/Module_scp2.mk shell/Module_shell.mk solenv/gbuild sysui/CustomTarget_share.mk vcl/inc vcl/Module_vcl.mk vcl/unx

Jan-Marek Glogowski glogow at fbihome.de
Tue Oct 24 08:15:28 UTC 2017


Rebased ref, commits from common ancestor:
commit 2b011984473e689af8530a9b7c5ec18d81807457
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Mon Oct 23 21:33:19 2017 +0200

    KF5 various fixes
    
    Change-Id: Iaeb380ac37d080b1ae9ef61d9847c1b0cfb356a4

diff --git a/Repository.mk b/Repository.mk
index 4fd902e693ee..ea55f9624a3e 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -287,10 +287,8 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,gnome, \
 
 $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,kde, \
 	$(if $(ENABLE_KDE4),kde4be1) \
-	$(if $(ENABLE_KDE5),kde5be1) \
 	$(if $(USING_X11), \
 		$(if $(ENABLE_KDE4),vclplug_kde4) \
-		$(if $(ENABLE_KDE5),vclplug_kde5) \
         $(if $(ENABLE_KF5),vclplug_kf5) \
 	) \
 ))
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 3be5be420fb4..b275d8e5658a 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -3066,9 +3066,9 @@ endef
 
 endif # ENABLE_KDE4
 
-ifeq ($(ENABLE_KDE5),TRUE)
+ifeq ($(ENABLE_KF5),TRUE)
 
-define gb_LinkTarget__use_kde5
+define gb_LinkTarget__use_kf5
 $(call gb_LinkTarget_set_include,$(1),\
 	$(subst -isystem/,-isystem /,$(filter -I% -isystem%,$(subst -isystem /,-isystem/,$(KF5_CFLAGS)))) \
 	$$(INCLUDE) \
@@ -3090,13 +3090,13 @@ endif
 
 endef
 
-else # !ENABLE_KDE5
+else # !ENABLE_KF5
 
-define gb_LinkTarget__use_kde5
+define gb_LinkTarget__use_kf5
 
 endef
 
-endif # ENABLE_KDE5
+endif # ENABLE_KF5
 
 # PYTHON
 # extra python_headers external because pyuno wrapper must not link python
diff --git a/config_host.mk.in b/config_host.mk.in
index d73c5acefca6..2e94e299339b 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -142,7 +142,6 @@ export ENABLE_GTK_PRINT=@ENABLE_GTK_PRINT@
 export ENABLE_HEADLESS=@ENABLE_HEADLESS@
 export ENABLE_JAVA=@ENABLE_JAVA@
 export ENABLE_KDE4=@ENABLE_KDE4@
-export ENABLE_KDE5=@ENABLE_KDE5@
 export ENABLE_KF5=@ENABLE_KF5@
 export ENABLE_LPSOLVE=@ENABLE_LPSOLVE@
 export ENABLE_LTO=@ENABLE_LTO@
diff --git a/config_host/config_vclplug.h.in b/config_host/config_vclplug.h.in
index b7b9624cdf79..4654afa66d70 100644
--- a/config_host/config_vclplug.h.in
+++ b/config_host/config_vclplug.h.in
@@ -9,6 +9,6 @@ Settings about which X11 desktops have support enabled.
 
 #define ENABLE_GTK 0
 #define ENABLE_KDE4 0
-#define ENABLE_KDE5 0
+#define ENABLE_KF5 0
 
 #endif
diff --git a/configure.ac b/configure.ac
index 6c72739017a1..18d9c433780f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -571,7 +571,6 @@ linux-gnu*|k*bsd*-gnu*)
     build_gstreamer_1_0=yes
     build_gstreamer_0_10=yes
     test_kde4=yes
-    test_kde5=yes
     test_qt5=yes
     test_kf5=yes
     if test "$enable_fuzzers" != yes; then
@@ -668,7 +667,6 @@ freebsd*)
     build_gstreamer_0_10=yes
     test_kde4=yes
     test_qt5=yes
-    test_kde5=yes
     test_kf5=yes
     test_freetype=yes
     AC_MSG_CHECKING([the FreeBSD operating system release])
@@ -699,7 +697,6 @@ freebsd*)
     build_gstreamer_0_10=yes
     test_kde4=yes
     test_qt5=yes
-    test_kde5=yes
     test_kf5=yes
     test_freetype=yes
     PTHREAD_LIBS="-pthread -lpthread"
@@ -727,7 +724,6 @@ dragonfly*)
     build_gstreamer_0_10=yes
     test_kde4=yes
     test_qt5=yes
-    test_kde5=yes
     test_kf5=yes
     test_freetype=yes
     PTHREAD_LIBS="-pthread"
@@ -753,7 +749,6 @@ linux-android*)
     test_gtk=no
     test_kde4=no
     test_qt5=yes
-    test_kde5=no
     test_kf5=yes
     test_randr=no
     test_xrender=no
@@ -1204,12 +1199,6 @@ AC_ARG_ENABLE(kf5,
          KF5 are available.]),
 ,)
 
-AC_ARG_ENABLE(kde5,
-    AS_HELP_STRING([--enable-kde5],
-        [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
-         KF5 are available.]),
-,)
-
 libo_FUZZ_ARG_ENABLE(gui,
     AS_HELP_STRING([--disable-gui],
         [Disable use of X11 or Wayland to reduce dependencies. Not related to the --headless
@@ -4563,7 +4552,7 @@ if test "$USING_X11" != TRUE; then
     build_gstreamer_1_0=no
     build_gstreamer_0_10=no
     test_kde4=no
-    test_kde5=no
+    test_kf5=no
     enable_cairo_canvas=no
 fi
 
@@ -9794,14 +9783,6 @@ if test "x$enable_qt5" = "xyes"; then
 fi
 AC_SUBST(ENABLE_QT5)
 
-ENABLE_KDE5=""
-if test "x$enable_kde5" = "xyes"; then
-    ENABLE_KDE5="TRUE"
-    AC_DEFINE(ENABLE_KDE5)
-    R="$R kde5"
-fi
-AC_SUBST(ENABLE_KDE5)
-
 ENABLE_KF5=""
 if test "x$enable_kf5" = "xyes"; then
     ENABLE_KF5="TRUE"
@@ -10901,8 +10882,7 @@ MOC5="moc"
 QT5_GLIB_CFLAGS=""
 QT5_GLIB_LIBS=""
 QT5_HAVE_GLIB=""
-if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
-        \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
+if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \)
 then
     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
@@ -10991,7 +10971,7 @@ the root of your Qt installation by exporting QT5DIR before running "configure".
             AC_MSG_CHECKING([whether Qt has fixed ExcludeSocketNotifiers])
             # Prepare meta object data
             TSTBASE="tst_exclude_socket_notifiers"
-            TSTMOC="${SRC_ROOT}/vcl/unx/kde5/${TSTBASE}"
+            TSTMOC="${SRC_ROOT}/vcl/unx/kf5/${TSTBASE}"
             ln -fs "${TSTMOC}.hxx"
             $MOC5 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
 
@@ -11023,7 +11003,7 @@ int main(int argc, char *argv[])
             AC_MSG_CHECKING([whether Qt avoids QClipboard recursion caused by posted events])
             # Prepare meta object data
             TSTBASE="tst_exclude_posted_events"
-            TSTMOC="${SRC_ROOT}/vcl/unx/kde5/${TSTBASE}"
+            TSTMOC="${SRC_ROOT}/vcl/unx/kf5/${TSTBASE}"
             ln -fs "${TSTMOC}.hxx"
             $MOC5 "${TSTBASE}.hxx" -o "${TSTBASE}.moc"
 
@@ -11078,8 +11058,7 @@ dnl ===================================================================
 KF5_CFLAGS=""
 KF5_LIBS=""
 KF5_CONFIG="kf5-config"
-if test \( "$test_kde5" = "yes" -a "$ENABLE_KDE5" = "TRUE" \) -o \
-        \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \)
+if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \)
 then
     kf5_incdirs="$KF5INC /usr/include /usr/include/KF5 $x_includes"
     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $x_libraries"
diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk
index b8112e7f48db..c18e04d37174 100644
--- a/cui/Library_cui.mk
+++ b/cui/Library_cui.mk
@@ -22,7 +22,7 @@ $(eval $(call gb_Library_set_precompiled_header,cui,$(SRCDIR)/cui/inc/pch/precom
 $(eval $(call gb_Library_add_defs,cui,\
     $(if $(filter TRUE,$(ENABLE_GTK)),-DENABLE_GTK) \
     $(if $(filter TRUE,$(ENABLE_KDE4)),-DENABLE_KDE4) \
-    $(if $(filter TRUE,$(ENABLE_KDE5)),-DENABLE_KDE5) \
+    $(if $(filter TRUE,$(ENABLE_KF5)),-DENABLE_KF5) \
 ))
 
 $(eval $(call gb_Library_use_custom_headers,cui,\
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 62a557e126e3..e34c7e7a35c6 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -207,15 +207,7 @@ namespace
         {
             const OUString &rDesktopEnvironment = Application::GetDesktopEnvironment();
 
-            if ( rDesktopEnvironment.equalsIgnoreAsciiCase("kde5") )
-            {
-                #if ENABLE_KDE5
-                return OUString("com.sun.star.ui.dialogs.KDE5FilePicker" );
-                #else
-                return OUString();
-                #endif
-            }
-            else if ( rDesktopEnvironment.equalsIgnoreAsciiCase("kde4") )
+            if ( rDesktopEnvironment.equalsIgnoreAsciiCase("kde4") )
             {
                 #if ENABLE_KDE4
                 return OUString("com.sun.star.ui.dialogs.KDE4FilePicker" );
diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox
index 8c0db9de0809..33b9c25f4d16 100644
--- a/include/sal/log-areas.dox
+++ b/include/sal/log-areas.dox
@@ -452,8 +452,8 @@ certain functionality.
 @li @c vcl.headless - bitmap-based backend
 @li @c vcl.helper
 @li @c vcl.icontest
- at li @c vcl.kde - KDE
 @li @c vcl.kde4 - KDE4
+ at li @c vcl.kf5 - KF5
 @li @c vcl.layout - Widget layout
 @li @c vcl.lazydelete
 @li @c vcl.opengl
diff --git a/scp2/InstallScript_setup_osl.mk b/scp2/InstallScript_setup_osl.mk
index 6a472238acc3..a5b28135c62a 100644
--- a/scp2/InstallScript_setup_osl.mk
+++ b/scp2/InstallScript_setup_osl.mk
@@ -35,7 +35,7 @@ $(eval $(call gb_InstallScript_use_modules,setup_osl,\
 	$(if $(filter TRUE,$(ENABLE_EVOAB2) $(ENABLE_GIO) $(ENABLE_GTK) $(ENABLE_GTK3)),\
 		scp2/gnome \
 	) \
-	$(if $(filter TRUE,$(ENABLE_KDE4) $(ENABLE_KDE5)),\
+	$(if $(filter TRUE,$(ENABLE_KDE4) $(ENABLE_KF5)),\
 		scp2/kde \
 	) \
 	$(if $(filter TRUE,$(ENABLE_ONLINE_UPDATE)),\
diff --git a/scp2/Module_scp2.mk b/scp2/Module_scp2.mk
index daabb5b8ea68..f8a7fb0669fe 100644
--- a/scp2/Module_scp2.mk
+++ b/scp2/Module_scp2.mk
@@ -39,7 +39,7 @@ $(eval $(call gb_Module_add_targets,scp2,\
 	$(if $(filter TRUE,$(ENABLE_EVOAB2) $(ENABLE_GIO) $(ENABLE_GTK) $(ENABLE_GTK3)),\
 		InstallModule_gnome \
 	) \
-	$(if $(filter TRUE,$(ENABLE_KDE4) $(ENABLE_KDE5)),\
+	$(if $(filter TRUE,$(ENABLE_KDE4) $(ENABLE_KF5)),\
 		InstallModule_kde \
 	) \
 ))
diff --git a/shell/Module_shell.mk b/shell/Module_shell.mk
index 5da2416b6662..d1a54b9cf9ea 100644
--- a/shell/Module_shell.mk
+++ b/shell/Module_shell.mk
@@ -36,12 +36,6 @@ $(eval $(call gb_Module_add_targets,shell,\
 ))
 endif
 
-ifeq ($(ENABLE_KDE5),TRUE)
-$(eval $(call gb_Module_add_targets,shell,\
-	Library_kde5be \
-))
-endif
-
 ifeq ($(OS),WNT)
 
 $(eval $(call gb_Module_add_targets,shell,\
diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk
index c1a0547fc4bb..dbcbc97a9701 100644
--- a/solenv/gbuild/CppunitTest.mk
+++ b/solenv/gbuild/CppunitTest.mk
@@ -227,7 +227,7 @@ $(call gb_CppunitTest_get_target,$(1)) : $(if $(filter $(2),$(true)),, \
         $(if $(ENABLE_GTK),$(call gb_Library_get_target,vclplug_gtk)) \
         $(if $(ENABLE_GTK3),$(call gb_Library_get_target,vclplug_gtk3)) \
         $(if $(ENABLE_KDE4),$(call gb_Library_get_target,vclplug_kde4)) \
-        $(if $(ENABLE_KDE5),$(call gb_Library_get_target,vclplug_kde5)) \
+        $(if $(ENABLE_KF5),$(call gb_Library_get_target,vclplug_kf5)) \
 	 )
 endif
 
diff --git a/sysui/CustomTarget_share.mk b/sysui/CustomTarget_share.mk
index 88ac5d0a480c..079c04686658 100644
--- a/sysui/CustomTarget_share.mk
+++ b/sysui/CustomTarget_share.mk
@@ -14,7 +14,7 @@ ifeq ($(ENABLE_GIO),TRUE)
 	brand_URIPARAM := --urls
 else ifeq ($(ENABLE_KDE4),TRUE)
 	brand_URIPARAM := --urls
-else ifeq ($(ENABLE_KDE5),TRUE)
+else ifeq ($(ENABLE_KF5),TRUE)
 	brand_URIPARAM := --urls
 else
 	brand_URIPARAM :=
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index 2e7d505bf35d..fa1fcca5d775 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -81,12 +81,6 @@ $(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
 ifneq ($(ENABLE_KF5),)
 $(eval $(call gb_Module_add_targets,vcl,\
     CustomTarget_kf5_moc \
diff --git a/vcl/inc/unx/gendata.hxx b/vcl/inc/unx/gendata.hxx
index a7e96b1a975d..910eb091af5b 100644
--- a/vcl/inc/unx/gendata.hxx
+++ b/vcl/inc/unx/gendata.hxx
@@ -23,7 +23,7 @@ enum GenericUnixSalDataType { SAL_DATA_GTK, SAL_DATA_GTK3,
                               SAL_DATA_TDE3, SAL_DATA_KDE3, SAL_DATA_KDE4,
                               SAL_DATA_UNX, SAL_DATA_SVP,
                               SAL_DATA_ANDROID, SAL_DATA_IOS,
-                              SAL_DATA_HEADLESS, SAL_DATA_KDE5, SAL_DATA_KF5 };
+                              SAL_DATA_HEADLESS, SAL_DATA_KF5 };
 
 class VCL_DLLPUBLIC GenericUnixSalData : public SalData
 {
diff --git a/vcl/inc/vclpluginapi.h b/vcl/inc/vclpluginapi.h
index 3e20be8adf69..d55498f779b0 100644
--- a/vcl/inc/vclpluginapi.h
+++ b/vcl/inc/vclpluginapi.h
@@ -41,12 +41,6 @@
 #define VCLPLUG_KDE4_PUBLIC SAL_DLLPUBLIC_IMPORT
 #endif
 
-#if defined VCLPLUG_KDE5_IMPLEMENTATION
-#define VCLPLUG_KDE5_PUBLIC SAL_DLLPUBLIC_EXPORT
-#else
-#define VCLPLUG_KDE5_PUBLIC SAL_DLLPUBLIC_IMPORT
-#endif
-
 #if defined VCLPLUG_KF5_IMPLEMENTATION
 #define VCLPLUG_KF5_PUBLIC SAL_DLLPUBLIC_EXPORT
 #else
diff --git a/vcl/unx/generic/plugadapt/salplug.cxx b/vcl/unx/generic/plugadapt/salplug.cxx
index 09c708e9ab09..73cd9d289877 100644
--- a/vcl/unx/generic/plugadapt/salplug.cxx
+++ b/vcl/unx/generic/plugadapt/salplug.cxx
@@ -167,9 +167,8 @@ static SalInstance* autodetect_plugin()
 {
     static const char* const pKDEFallbackList[] =
     {
-#if ENABLE_KDE5
+#if ENABLE_KF5
         "kf5",
-        "kde5",
 #endif
 #if ENABLE_KDE4
         "kde4",
diff --git a/vcl/unx/kf5/Kf5Bitmap.cxx b/vcl/unx/kf5/Kf5Bitmap.cxx
index e72750963b69..79a872458925 100644
--- a/vcl/unx/kf5/Kf5Bitmap.cxx
+++ b/vcl/unx/kf5/Kf5Bitmap.cxx
@@ -41,9 +41,38 @@ Kf5Bitmap::~Kf5Bitmap()
 bool Kf5Bitmap::Create( const Size& rSize, sal_uInt16 nBitCount,
                         const BitmapPalette& rPal )
 {
-    m_pImage.reset( new QImage( toQSize( rSize ), getBitFormat( nBitCount ) ) );
+    assert(
+          (nBitCount ==  1
+        || nBitCount ==  4
+        || nBitCount ==  8
+        || nBitCount == 16
+        || nBitCount == 24
+        || nBitCount == 32)
+        && "Unsupported BitCount!");
+
+    if ( nBitCount == 1 )
+        assert( 2 == rPal.GetEntryCount() );
+    if ( nBitCount == 4 )
+        assert( 16 == rPal.GetEntryCount() );
+    if ( nBitCount == 8 )
+        assert( 256 == rPal.GetEntryCount() );
+
+    if ( nBitCount == 4 )
+    {
+        m_pImage.reset( nullptr );
+        m_aSize = rSize;
+        m_nScanline = rSize.Width() / 2 + (rSize.Width() % 2) ? 0 : 1;
+        m_pBuffer.reset( new sal_uInt8[ m_nScanline * rSize.Height() ] );
+    }
+    else
+    {
+        m_pImage.reset( new QImage( toQSize( rSize ), getBitFormat( nBitCount ) ) );
+        m_pBuffer.reset( nullptr );
+    }
     m_aPalette = rPal;
-    if( unsigned count = rPal.GetEntryCount() )
+
+    auto count = rPal.GetEntryCount();
+    if( nBitCount != 4 && count )
     {
         QVector<QRgb> aColorTable( count );
         for ( unsigned i = 0; i < count; ++i )
@@ -56,8 +85,24 @@ bool Kf5Bitmap::Create( const Size& rSize, sal_uInt16 nBitCount,
 
 bool Kf5Bitmap::Create( const SalBitmap& rSalBmp )
 {
-    m_pImage.reset( new QImage(
-        *static_cast< const Kf5Bitmap*>( &rSalBmp )->m_pImage.get() ) );
+    const Kf5Bitmap *pBitmap = static_cast< const Kf5Bitmap*>( &rSalBmp );
+    sal_uInt16 nBitCount;
+    if ( pBitmap->m_pImage.get() )
+    {
+        m_pImage.reset( new QImage( *pBitmap->m_pImage.get() ) );
+        m_pBuffer.reset( nullptr );
+        nBitCount = getFormatBits( m_pImage->format() );
+    }
+    else
+    {
+        m_aSize = pBitmap->m_aSize;
+        m_nScanline = pBitmap->m_nScanline;
+        m_pBuffer.reset( new sal_uInt8[ m_nScanline * m_aSize.Height() ] );
+        memcpy( m_pBuffer.get(), pBitmap->m_pBuffer.get(), m_nScanline );
+        m_pImage.reset( nullptr );
+        nBitCount = 4;
+    }
+    m_aPalette = pBitmap->m_aPalette;
     return true;
 }
 
@@ -68,13 +113,26 @@ bool Kf5Bitmap::Create( const SalBitmap& rSalBmp,
     Kf5Graphics *pGraphics = static_cast< Kf5Graphics* >( pSalGraphics );
     QImage *pImage = static_cast< QImage* >( pGraphics->m_pDevice );
     m_pImage.reset( new QImage( pBitmap->m_pImage->convertToFormat( pImage->format() ) ) );
+    m_pBuffer.reset( nullptr );
     return true;
 }
 
 bool Kf5Bitmap::Create( const SalBitmap& rSalBmp,
                         sal_uInt16 nNewBitCount )
 {
+    assert(
+          (nNewBitCount ==  1
+        || nNewBitCount ==  4
+        || nNewBitCount ==  8
+        || nNewBitCount == 16
+        || nNewBitCount == 24
+        || nNewBitCount == 32)
+        && "Unsupported BitCount!");
+
     const Kf5Bitmap *pBitmap = static_cast< const Kf5Bitmap *>( &rSalBmp );
+    if ( pBitmap->m_pBuffer.get() )
+        return false;
+
     m_pImage.reset( new QImage( pBitmap->m_pImage->convertToFormat( getBitFormat( nNewBitCount ) ) ) );
     return true;
 }
@@ -88,89 +146,100 @@ bool Kf5Bitmap::Create( const css::uno::Reference< css::rendering::XBitmapCanvas
 void Kf5Bitmap::Destroy()
 {
     m_pImage.reset( nullptr );
+    m_pBuffer.reset( nullptr );
 }
 
 Size Kf5Bitmap::GetSize() const
 {
-    return toSize( m_pImage->size() );
+    if ( m_pBuffer.get() )
+        return m_aSize;
+    else
+        return toSize( m_pImage->size() );
 }
 
 sal_uInt16 Kf5Bitmap::GetBitCount() const
 {
-    return getFormatBits( m_pImage->format() );
+    if ( m_pBuffer.get() )
+        return 4;
+    else
+        return getFormatBits( m_pImage->format() );
 }
 
 BitmapBuffer* Kf5Bitmap::AcquireBuffer( BitmapAccessMode nMode )
 {
-    if ( !m_pImage.get() )
+    static const BitmapPalette aEmptyPalette;
+
+    if ( !(m_pImage.get() || m_pBuffer.get()) )
         return nullptr;
 
     BitmapBuffer* pBuffer = new BitmapBuffer;
-    pBuffer->mnWidth = m_pImage->width();
-    pBuffer->mnHeight = m_pImage->height();
-    pBuffer->maPalette = m_aPalette;
     pBuffer->mnScanlineSize = m_pImage->bytesPerLine();
-    pBuffer->mpBits = m_pImage->bits();
-    pBuffer->mnBitCount = getFormatBits( m_pImage->format() );
+
+    if ( m_pBuffer.get() )
+    {
+        pBuffer->mnWidth = m_aSize.Width();
+        pBuffer->mnHeight = m_aSize.Height();
+        pBuffer->mnBitCount = 4;
+        pBuffer->mpBits = m_pBuffer.get();
+        pBuffer->mnScanlineSize = m_nScanline;
+    }
+    else
+    {
+        pBuffer->mnWidth = m_pImage->width();
+        pBuffer->mnHeight = m_pImage->height();
+        pBuffer->mnBitCount = getFormatBits( m_pImage->format() );
+        pBuffer->mpBits = m_pImage->bits();
+        pBuffer->mnScanlineSize = m_pImage->bytesPerLine();
+    }
 
     switch( pBuffer->mnBitCount )
     {
         case 1:
             pBuffer->mnFormat = ScanlineFormat::N1BitMsbPal;
+            pBuffer->maPalette = m_aPalette;
             break;
         case 4:
             pBuffer->mnFormat = ScanlineFormat::N4BitMsnPal;
             break;
         case 8:
             pBuffer->mnFormat = ScanlineFormat::N8BitPal;
+            pBuffer->maPalette = m_aPalette;
             break;
-#if 0
         case 16:
         {
-            pBuffer->mnFormat = ScanlineFormat::N16BitTcMsbMask;
-            ColorMaskElement aRedMask(k16BitRedColorMask);
+#ifdef OSL_BIGENDIAN
+            pBuffer->mnFormat= ScanlineFormat::N16BitTcMsbMask;
+#else
+            pBuffer->mnFormat= ScanlineFormat::N16BitTcLsbMask;
+#endif
+            ColorMaskElement aRedMask(0xf800); // 5
             aRedMask.CalcMaskShift();
-            ColorMaskElement aGreenMask(k16BitGreenColorMask);
+            ColorMaskElement aGreenMask(0x07e0); // 6
             aGreenMask.CalcMaskShift();
-            ColorMaskElement aBlueMask(k16BitBlueColorMask);
+            ColorMaskElement aBlueMask(0x001f); // 5
             aBlueMask.CalcMaskShift();
             pBuffer->maColorMask = ColorMask(aRedMask, aGreenMask, aBlueMask);
+            pBuffer->maPalette = aEmptyPalette;
             break;
         }
-#endif
         case 24:
-            pBuffer->mnFormat = ScanlineFormat::N24BitTcBgr;
+            pBuffer->mnFormat = ScanlineFormat::N24BitTcRgb;
+            pBuffer->maPalette = aEmptyPalette;
             break;
         case 32:
         {
             pBuffer->mnFormat = ScanlineFormat::N32BitTcArgb;
-#if 0
-            ColorMaskElement aRedMask(k32BitRedColorMask);
-            aRedMask.CalcMaskShift();
-            ColorMaskElement aGreenMask(k32BitGreenColorMask);
-            aGreenMask.CalcMaskShift();
-            ColorMaskElement aBlueMask(k32BitBlueColorMask);
-            aBlueMask.CalcMaskShift();
-            pBuffer->maColorMask  = ColorMask(aRedMask, aGreenMask, aBlueMask);
-#endif
+            pBuffer->maPalette = aEmptyPalette;
             break;
         }
     }
 
-#if 0
-    // some BitmapBuffer users depend on a complete palette
-    if( (pBuffer->mnBitCount <= 8) && !m_aPalette )
-        pBuffer->maPalette = GetDefaultPalette( pBuffer->mnBitCount, true );
-#endif
     return pBuffer;
 }
 
 void Kf5Bitmap::ReleaseBuffer( BitmapBuffer* pBuffer, BitmapAccessMode nMode )
 {
-    // invalidate graphic context if we have different data
-    if( nMode == BitmapAccessMode::Write )
-        m_aPalette = pBuffer->maPalette;
-
+    m_aPalette = pBuffer->maPalette;
     delete pBuffer;
 }
 
diff --git a/vcl/unx/kf5/Kf5Bitmap.hxx b/vcl/unx/kf5/Kf5Bitmap.hxx
index 07ac7f021c4f..2ea4accc8e9c 100644
--- a/vcl/unx/kf5/Kf5Bitmap.hxx
+++ b/vcl/unx/kf5/Kf5Bitmap.hxx
@@ -27,9 +27,13 @@ class QImage;
 
 class VCL_DLLPUBLIC Kf5Bitmap : public SalBitmap
 {
-    std::unique_ptr< QImage > m_pImage;
-    BitmapPalette             m_aPalette;
-    bool                      m_bImageInUse;
+    std::unique_ptr< QImage >     m_pImage;
+    BitmapPalette                 m_aPalette;
+
+    // for 4bit support
+    std::unique_ptr< sal_uInt8 >  m_pBuffer;
+    Size                          m_aSize;
+    sal_uInt32                    m_nScanline;
 
 public:
     Kf5Bitmap();
diff --git a/vcl/unx/kf5/Kf5Data.hxx b/vcl/unx/kf5/Kf5Data.hxx
index 863fb45c2ce1..16f1e24ba710 100644
--- a/vcl/unx/kf5/Kf5Data.hxx
+++ b/vcl/unx/kf5/Kf5Data.hxx
@@ -25,10 +25,10 @@ class Kf5Data : public GenericUnixSalData
 {
 public:
     explicit Kf5Data( SalInstance *pInstance );
-    virtual ~Kf5Data();
+    virtual ~Kf5Data() override;
 
-    virtual void ErrorTrapPush();
-    virtual bool ErrorTrapPop( bool bIgnoreError = true );
+    virtual void ErrorTrapPush() override;
+    virtual bool ErrorTrapPop( bool bIgnoreError = true ) override;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kf5/Kf5Frame.cxx b/vcl/unx/kf5/Kf5Frame.cxx
index e008d2613fb1..82514345dd84 100644
--- a/vcl/unx/kf5/Kf5Frame.cxx
+++ b/vcl/unx/kf5/Kf5Frame.cxx
@@ -70,7 +70,12 @@ Kf5Frame::Kf5Frame( Kf5Frame* pParent, SalFrameStyleFlags nStyle )
     m_pQWidget.reset( new Kf5Widget( *this, pParent ? pParent->GetQWidget() : nullptr, aWinFlags ) );
 
     if (pParent && !(pParent->m_nStyle & SalFrameStyleFlags::PLUG))
-        m_pQWidget->windowHandle()->setTransientParent( pParent->GetQWidget()->window()->windowHandle() );
+    {
+        QWindow *pParentWindow = pParent->GetQWidget()->window()->windowHandle();
+        QWindow *pChildWindow = m_pQWidget->window()->windowHandle();
+        if ( pParentWindow != pChildWindow )
+            pChildWindow->setTransientParent( pParentWindow );
+    }
 }
 
 Kf5Frame::~Kf5Frame()
@@ -338,6 +343,7 @@ void Kf5Frame::EndExtTextInput( EndExtTextInputFlags nFlags )
 
 OUString Kf5Frame::GetKeyName( sal_uInt16 nKeyCode )
 {
+    return OUString();
 }
 
 bool Kf5Frame::MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, vcl::KeyCode& rKeyCode )
@@ -347,6 +353,7 @@ bool Kf5Frame::MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType
 
 LanguageType Kf5Frame::GetInputLanguage()
 {
+    return LANGUAGE_DONTKNOW;
 }
 
 void Kf5Frame::UpdateSettings( AllSettings& rSettings )
diff --git a/vcl/unx/kf5/Kf5Graphics_GDI.cxx b/vcl/unx/kf5/Kf5Graphics_GDI.cxx
index 7a6d62341acc..69ac769e1c7d 100644
--- a/vcl/unx/kf5/Kf5Graphics_GDI.cxx
+++ b/vcl/unx/kf5/Kf5Graphics_GDI.cxx
@@ -192,21 +192,22 @@ void Kf5Graphics::drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSalBi
         *pImage, QRect( rPosAry.mnSrcX, rPosAry.mnSrcY,
                         rPosAry.mnSrcWidth, rPosAry.mnSrcHeight) );
 
-    SAL_DEBUG( "Kf5Graphics::drawBitmap" );
+    if ( m_pFrame )
+        m_pFrame->GetQWidget()->update();
 }
 
 void Kf5Graphics::drawBitmap( const SalTwoRect& rPosAry,
                               const SalBitmap& rSalBitmap,
                               const SalBitmap& rTransparentBitmap )
 {
-assert( !"Impl" );
+// assert( !"Impl" );
 }
 
 void Kf5Graphics::drawMask( const SalTwoRect& rPosAry,
                                       const SalBitmap& rSalBitmap,
                                       SalColor nMaskColor )
 {
-assert( !"Impl" );
+// assert( !"Impl" );
 }
 
 SalBitmap* Kf5Graphics::getBitmap( long nX, long nY, long nWidth, long nHeight )
diff --git a/vcl/unx/kf5/Kf5Instance.cxx b/vcl/unx/kf5/Kf5Instance.cxx
index 3b1a41be69f5..da872c6b83bf 100644
--- a/vcl/unx/kf5/Kf5Instance.cxx
+++ b/vcl/unx/kf5/Kf5Instance.cxx
@@ -57,10 +57,9 @@ Kf5Instance::Kf5Instance( SalYieldMutex* pMutex )
 
 Kf5Instance::~Kf5Instance()
 {
-    for( int i = 0; i < m_nFakeCmdLineArgs; i++ )
-    {
-        free( m_pFreeCmdLineArgs[i] );
-    }
+    m_pQApplication.reset( nullptr );
+    for( int i = 0; i < *m_pFakeArgc; i++ )
+        free( m_pFakeArgvFreeable[i] );
 }
 
 SalFrame* Kf5Instance::CreateChildFrame( SystemParentData* /*pParent*/, SalFrameStyleFlags nStyle )
@@ -204,11 +203,66 @@ extern "C" {
         OString aVersion( qVersion() );
         SAL_INFO( "vcl.kf5", "qt version string is " << aVersion );
 
-        QApplication *pApplication;
-        char **pFreeCmdLineArgs = nullptr;
-        char **pAppCmdLineArgs;
-#if 1
-    KAboutData *kAboutData = new KAboutData( I18N_NOOP("LibreOffice"),
+        QApplication *pQApplication;
+        char **pFakeArgvFreeable = nullptr;
+
+        int nFakeArgc = 2;
+        const sal_uInt32 nParams = osl_getCommandArgCount();
+        OString aDisplay;
+        OUString aParam, aBin;
+
+        for ( sal_uInt32 nIdx = 0; nIdx < nParams; ++nIdx )
+        {
+            osl_getCommandArg( nIdx, &aParam.pData );
+            if ( aParam != "-display" )
+                continue;
+            if ( !pFakeArgvFreeable )
+            {
+                pFakeArgvFreeable = new char*[ nFakeArgc + 2 ];
+                pFakeArgvFreeable[ nFakeArgc++ ] = strdup( "-display" );
+            }
+            else
+                free( pFakeArgvFreeable[ nFakeArgc ] );
+
+            ++nIdx;
+            osl_getCommandArg( nIdx, &aParam.pData );
+            aDisplay = OUStringToOString( aParam, osl_getThreadTextEncoding() );
+            pFakeArgvFreeable[ nFakeArgc ] = strdup( aDisplay.getStr() );
+        }
+        if ( !pFakeArgvFreeable )
+            pFakeArgvFreeable = new char*[ nFakeArgc ];
+        else
+            nFakeArgc++;
+
+        osl_getExecutableFile( &aParam.pData );
+        osl_getSystemPathFromFileURL( aParam.pData, &aBin.pData );
+        OString aExec = OUStringToOString( aBin, osl_getThreadTextEncoding() );
+        pFakeArgvFreeable[ 0 ] = strdup( aExec.getStr() );
+        pFakeArgvFreeable[ 1 ] = strdup( "--nocrashhandler" );
+
+        char **pFakeArgv = new char*[ nFakeArgc ];
+        for( int i = 0; i < nFakeArgc; i++ )
+            pFakeArgv[ i ] = pFakeArgvFreeable[ i ];
+
+        char* session_manager = nullptr;
+        if( getenv( "SESSION_MANAGER" ) != nullptr )
+        {
+            session_manager = strdup( getenv( "SESSION_MANAGER" ));
+            unsetenv( "SESSION_MANAGER" );
+        }
+
+        int * pFakeArgc = new int;
+        *pFakeArgc = nFakeArgc;
+        pQApplication = new QApplication( *pFakeArgc, pFakeArgv );
+
+        if( session_manager != nullptr )
+        {
+            // coverity[tainted_string] - trusted source for setenv
+            setenv( "SESSION_MANAGER", session_manager, 1 );
+            free( session_manager );
+        }
+
+        KAboutData *kAboutData = new KAboutData( I18N_NOOP("LibreOffice"),
             i18n( "LibreOffice" ),
             "6.0.0",
             i18n( "LibreOffice with KF5 Native Widget Support." ),
@@ -218,71 +272,23 @@ extern "C" {
             "http://libreoffice.org",
             QLatin1String("libreoffice at lists.freedesktop.org") );
 
-    kAboutData->addAuthor( i18n( "Jan-Marek Glogowski" ),
+        kAboutData->addAuthor( i18n( "Jan-Marek Glogowski" ),
             i18n( "Original author and maintainer of the KF5 NWF." ),
             "glogow at fbihome.de" );
 
-    KAboutData::setApplicationData( *kAboutData );
-#endif
-    int nFakeCmdLineArgs = 2;
-    const unsigned nParams = osl_getCommandArgCount();
-    OString aDisplay;
-    OUString aParam, aBin;
-
-    for ( unsigned nIdx = 0; nIdx < nParams; ++nIdx )
-    {
-        osl_getCommandArg( nIdx, &aParam.pData );
-        if ( !pFreeCmdLineArgs && aParam == "-display" && nIdx + 1 < nParams )
-        {
-            osl_getCommandArg( nIdx + 1, &aParam.pData );
-            aDisplay = OUStringToOString( aParam, osl_getThreadTextEncoding() );
-
-            pFreeCmdLineArgs = new char*[ nFakeCmdLineArgs + 2 ];
-            pFreeCmdLineArgs[ nFakeCmdLineArgs + 0 ] = strdup( "-display" );
-            pFreeCmdLineArgs[ nFakeCmdLineArgs + 1 ] = strdup( aDisplay.getStr() );
-            nFakeCmdLineArgs += 2;
-        }
-    }
-    if ( !pFreeCmdLineArgs )
-        pFreeCmdLineArgs = new char*[ nFakeCmdLineArgs ];
-
-    osl_getExecutableFile( &aParam.pData );
-    osl_getSystemPathFromFileURL( aParam.pData, &aBin.pData );
-    OString aExec = OUStringToOString( aBin, osl_getThreadTextEncoding() );
-    pFreeCmdLineArgs[0] = strdup( aExec.getStr() );
-    pFreeCmdLineArgs[1] = strdup( "--nocrashhandler" );
-
-    pAppCmdLineArgs = new char*[ nFakeCmdLineArgs ];
-    for( int i = 0; i < nFakeCmdLineArgs; i++ )
-        pAppCmdLineArgs[i] = pFreeCmdLineArgs[i];
-
-    char* session_manager = nullptr;
-    if( getenv( "SESSION_MANAGER" ) != nullptr )
-    {
-        session_manager = strdup( getenv( "SESSION_MANAGER" ));
-        unsetenv( "SESSION_MANAGER" );
-    }
-
-    pApplication = new QApplication( nFakeCmdLineArgs, pAppCmdLineArgs );
-
-    if( session_manager != nullptr )
-    {
-        // coverity[tainted_string] - trusted source for setenv
-        setenv( "SESSION_MANAGER", session_manager, 1 );
-        free( session_manager );
-    }
+        KAboutData::setApplicationData( *kAboutData );
 
-    QApplication::setQuitOnLastWindowClosed(false);
+        QApplication::setQuitOnLastWindowClosed(false);
 
         Kf5Instance* pInstance = new Kf5Instance( new SalYieldMutex() );
 
         // initialize SalData
         new Kf5Data( pInstance );
 
-        pInstance->m_pApplication.reset( pApplication );
-        pInstance->m_pFreeCmdLineArgs.reset( pFreeCmdLineArgs );
-        pInstance->m_pAppCmdLineArgs.reset( pAppCmdLineArgs );
-        pInstance->m_nFakeCmdLineArgs = nFakeCmdLineArgs;
+        pInstance->m_pQApplication.reset( pQApplication );
+        pInstance->m_pFakeArgvFreeable.reset( pFakeArgvFreeable );
+        pInstance->m_pFakeArgv.reset( pFakeArgv );
+        pInstance->m_pFakeArgc.reset( pFakeArgc );
 
         return pInstance;
     }
diff --git a/vcl/unx/kf5/Kf5Instance.hxx b/vcl/unx/kf5/Kf5Instance.hxx
index 1aa0d2d30b44..98cfa31c1579 100644
--- a/vcl/unx/kf5/Kf5Instance.hxx
+++ b/vcl/unx/kf5/Kf5Instance.hxx
@@ -41,10 +41,10 @@ class Kf5Instance
     int m_postUserEventId;
 
 public:
-    std::unique_ptr<QApplication> m_pApplication;
-    std::unique_ptr<char*[]> m_pFreeCmdLineArgs;
-    std::unique_ptr<char*[]> m_pAppCmdLineArgs;
-    int m_nFakeCmdLineArgs;
+    std::unique_ptr< QApplication > m_pQApplication;
+    std::unique_ptr< char*[] >      m_pFakeArgvFreeable;
+    std::unique_ptr< char*[] >      m_pFakeArgv;
+    std::unique_ptr< int >          m_pFakeArgc;
 
 private Q_SLOTS:
     bool ImplYield( bool bWait, bool bHandleAllCurrentEvents );
diff --git a/vcl/unx/kf5/Kf5Tools.hxx b/vcl/unx/kf5/Kf5Tools.hxx
index 8d10cd84360e..40c34d9d4303 100644
--- a/vcl/unx/kf5/Kf5Tools.hxx
+++ b/vcl/unx/kf5/Kf5Tools.hxx
@@ -61,7 +61,7 @@ inline QImage::Format getBitFormat( sal_uInt16 nBitCount )
     {
     case 1  : return QImage::Format_Mono;
     case 8  : return QImage::Format_Indexed8;
-    case 16 : return QImage::Format_RGB555;
+    case 16 : return QImage::Format_RGB16;
     case 24 : return QImage::Format_RGB888;
     case 32 : return QImage::Format_ARGB32;
     default :
@@ -77,10 +77,11 @@ inline sal_uInt16 getFormatBits( QImage::Format eFormat )
     {
         case QImage::Format_Mono : return 1;
         case QImage::Format_Indexed8 : return 8;
-        case QImage::Format_RGB555 : return 16;
+        case QImage::Format_RGB16 : return 16;
         case QImage::Format_RGB888 : return 24;
         case QImage::Format_ARGB32 : return 32;
-        default:
+        default :
+            std::abort();
             return 0;
     }
 }
diff --git a/vcl/unx/kf5/Kf5Widget.cxx b/vcl/unx/kf5/Kf5Widget.cxx
index 0394c9fc2653..59f2d963a581 100644
--- a/vcl/unx/kf5/Kf5Widget.cxx
+++ b/vcl/unx/kf5/Kf5Widget.cxx
@@ -33,6 +33,7 @@ Kf5Widget::Kf5Widget( Kf5Frame &rFrame, QWidget *parent, Qt::WindowFlags f )
     , m_pFrame( &rFrame )
     , m_pObject( nullptr )
 {
+    create();
 }
 
 Kf5Widget::Kf5Widget( Kf5Object &rObject, QWidget *parent, Qt::WindowFlags f )
diff --git a/vcl/unx/kf5/tst_exclude_posted_events.hxx b/vcl/unx/kf5/tst_exclude_posted_events.hxx
new file mode 100644
index 000000000000..c07ca895a9dc
--- /dev/null
+++ b/vcl/unx/kf5/tst_exclude_posted_events.hxx
@@ -0,0 +1,67 @@
+/* -*- 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 .
+ *
+ * This code is based on the SocketEventsTester from the Qt4 test suite.
+ */
+
+#pragma once
+
+#include <QtCore/QCoreApplication>
+#include <QtCore/QEventLoop>
+
+const QEvent::Type eventType = QEvent::User;
+
+class TestExcludePostedEvents
+    : public QObject
+{
+    Q_OBJECT
+    public:
+        TestExcludePostedEvents();
+        virtual bool event( QEvent* e ) override;
+        bool processed;
+};
+
+TestExcludePostedEvents::TestExcludePostedEvents()
+    : processed( false )
+{
+}
+
+bool TestExcludePostedEvents::event( QEvent* e )
+{
+    if( e->type() == eventType )
+        processed = true;
+    return QObject::event( e );
+}
+
+#define QVERIFY(a) \
+    if (!a) return 1;
+
+static int tst_excludePostedEvents()
+{
+    TestExcludePostedEvents test;
+    QCoreApplication::postEvent( &test, new QEvent( eventType ));
+    QEventLoop loop;
+    loop.processEvents(QEventLoop::ExcludeUserInputEvents
+        | QEventLoop::ExcludeSocketNotifiers
+//        | QEventLoop::WaitForMoreEvents
+        | QEventLoop::X11ExcludeTimers);
+    QVERIFY( !test.processed );
+    loop.processEvents();
+    QVERIFY( test.processed );
+    return 0;
+}
diff --git a/vcl/unx/kf5/tst_exclude_socket_notifiers.hxx b/vcl/unx/kf5/tst_exclude_socket_notifiers.hxx
new file mode 100644
index 000000000000..d0acafede239
--- /dev/null
+++ b/vcl/unx/kf5/tst_exclude_socket_notifiers.hxx
@@ -0,0 +1,80 @@
+/* -*- 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 .
+ *
+ * This code is based on the SocketEventsTester from the Qt4 test suite.
+ */
+
+#pragma once
+
+#include <QtCore/QCoreApplication>
+#include <QtCore/QEventLoop>
+#include <QtCore/QSocketNotifier>
+#include <unistd.h>
+
+class TestExcludeSocketNotifiers
+    : public QObject
+{
+    Q_OBJECT
+    public:
+        TestExcludeSocketNotifiers( const int* pipes );
+        virtual ~TestExcludeSocketNotifiers() override;
+        bool received;
+    public slots:
+        void slotReceived();
+    private:
+        const int* pipes;
+};
+
+TestExcludeSocketNotifiers::TestExcludeSocketNotifiers( const int* thePipes )
+    : received( false )
+    , pipes( thePipes )
+{
+}
+
+TestExcludeSocketNotifiers::~TestExcludeSocketNotifiers()
+{
+    close( pipes[ 0 ] );
+    close( pipes[ 1 ] );
+}
+
+void TestExcludeSocketNotifiers::slotReceived()
+{
+    received = true;
+}
+
+#define QVERIFY(a) \
+    if (!a) return 1;
+
+static int tst_processEventsExcludeSocket()
+{
+    int pipes[ 2 ];
+    if( pipe( pipes ) < 0 )
+        return 1;
+    TestExcludeSocketNotifiers test( pipes );
+    QSocketNotifier notifier( pipes[ 0 ], QSocketNotifier::Read );
+    QObject::connect( &notifier, SIGNAL( activated( int )), &test, SLOT( slotReceived()));
+    char dummy = 'a';
+    if( 1 != write( pipes[ 1 ], &dummy, 1 ) )
+        return 1;
+    QEventLoop loop;
+    loop.processEvents( QEventLoop::ExcludeSocketNotifiers );
+    QVERIFY( !test.received );
+    loop.processEvents();
+    QVERIFY( test.received );
+    return 0;
+}


More information about the Libreoffice-commits mailing list