vcl/inc/unx/salgdi.h                |    1 
 vcl/inc/unx/svsys.h                 |    1 
 vcl/unx/generic/gdi/salgdi.cxx      |    2 
 vcl/unx/generic/gdi/salvd.cxx       |    1 
 vcl/unx/generic/window/salframe.cxx |  136 +-----------------------------------
 5 files changed, 7 insertions(+), 134 deletions(-)

New commits:
commit a11cabb47249257d8b6510fe91063ade03d0c636
Author:     Caolán McNamara <[email protected]>
AuthorDate: Wed Jan 11 12:22:17 2023 +0000
Commit:     Caolán McNamara <[email protected]>
CommitDate: Thu Jan 12 13:45:55 2023 +0000

    rely on support for NET_WM_ICON
    
    I can't find anything where that doesn't work, so can drop
    IconPixmapHint/IconMaskHint.
    
    Change-Id: Ifa9f6a548a92006450335037836fbb7dd3039ecd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145339
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/vcl/unx/generic/window/salframe.cxx 
b/vcl/unx/generic/window/salframe.cxx
index 325cb8853fe6..4721c9c96c12 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -286,92 +286,6 @@ static void CreateNetWmAppIcon( sal_uInt16 nIcon, 
NetWmIconData& netwm_icon )
     netwm_icon.resize( pos );
 }
 
-static bool lcl_SelectAppIconPixmap( SalDisplay const *pDisplay, SalX11Screen 
nXScreen,
-                                         sal_uInt16 nIcon, sal_uInt16 iconSize,
-                                         Pixmap& icon_pixmap, Pixmap& 
icon_mask, NetWmIconData& netwm_icon)
-{
-    CreateNetWmAppIcon( nIcon, netwm_icon );
-
-    OUString sIcon;
-
-    if( iconSize >= 48 )
-        sIcon = SV_ICON_SIZE48[nIcon];
-    else if( iconSize >= 32 )
-        sIcon = SV_ICON_SIZE32[nIcon];
-    else if( iconSize >= 16 )
-         sIcon = SV_ICON_SIZE16[nIcon];
-    else
-        return false;
-
-    BitmapEx aIcon = vcl::bitmap::loadFromName(sIcon, 
ImageLoadFlags::IgnoreScalingFactor);
-
-    if( aIcon.IsEmpty() )
-        return false;
-
-    SvpSalBitmap* pBitmap = dynamic_cast<SvpSalBitmap*>
-        (aIcon.ImplGetBitmapSalBitmap().get());
-    if (!pBitmap) // FIXME: TODO SKIA
-        return false;
-
-    // Note: can't find a working environment where this seems to matter 
anymore,
-    icon_pixmap = XCreatePixmap( pDisplay->GetDisplay(),
-                                 pDisplay->GetRootWindow( nXScreen ),
-                                 iconSize, iconSize,
-                                 DefaultDepth( pDisplay->GetDisplay(),
-                                               nXScreen.getXScreen() )
-                                 );
-
-    {
-        cairo_surface_t* pSurface = 
cairo_xlib_surface_create(pDisplay->GetDisplay(), icon_pixmap,
-                                                   
pDisplay->GetColormap(nXScreen).GetVisual().visual,
-                                                   iconSize, iconSize);
-
-        cairo_t* cr = cairo_create(pSurface);
-
-        BitmapHelper aBitmapHelper(*pBitmap);
-        cairo_surface_t* source = aBitmapHelper.getSurface(iconSize, iconSize);
-
-        cairo_rectangle(cr, 0, 0, iconSize, iconSize);
-        cairo_set_source_surface(cr, source, 0, 0);
-        cairo_paint(cr);
-
-        cairo_destroy(cr);
-        cairo_surface_destroy(pSurface);
-    }
-
-    icon_mask = None;
-
-    if( aIcon.IsAlpha() )
-    {
-        icon_mask = XCreatePixmap( pDisplay->GetDisplay(),
-                                   pDisplay->GetRootWindow(nXScreen),
-                                   iconSize, iconSize, 1);
-
-        Bitmap aMask = aIcon.GetAlphaMask();
-
-        SvpSalBitmap* pMask = static_cast<SvpSalBitmap*>
-            (aMask.ImplGetSalBitmap().get());
-
-        cairo_surface_t* pSurface = 
cairo_xlib_surface_create_for_bitmap(pDisplay->GetDisplay(), icon_mask,
-                                                   
ScreenOfDisplay(pDisplay->GetDisplay(), nXScreen.getXScreen()),
-                                                   iconSize, iconSize);
-
-        cairo_t* cr = cairo_create(pSurface);
-
-        MaskHelper aMaskHelper(*pMask);
-        cairo_surface_t* source = aMaskHelper.getSurface(iconSize, iconSize);
-
-        cairo_rectangle(cr, 0, 0, iconSize, iconSize);
-        cairo_set_source_surface(cr, source, 0, 0);
-        cairo_paint(cr);
-
-        cairo_destroy(cr);
-        cairo_surface_destroy(pSurface);
-    }
-
-    return true;
-}
-
 void X11SalFrame::Init( SalFrameStyleFlags nSalFrameStyle, SalX11Screen 
nXScreen, SystemParentData const * pParentData, bool bUseGeometry )
 {
     if( nXScreen.getXScreen() >= GetDisplay()->GetXScreenCount() )
@@ -581,24 +495,15 @@ void X11SalFrame::Init( SalFrameStyleFlags 
nSalFrameStyle, SalX11Screen nXScreen
         // default icon
         if( !(nStyle_ & SalFrameStyleFlags::INTRO) && !(nStyle_ & 
SalFrameStyleFlags::NOICON))
         {
-            bool bOk=false;
             try
             {
-                bOk = lcl_SelectAppIconPixmap( pDisplay_, m_nXScreen,
-                                               mnIconID != SV_ICON_ID_OFFICE ? 
mnIconID :
-                                               (mpParent ? mpParent->mnIconID 
: SV_ICON_ID_OFFICE), 32,
-                                               Hints.icon_pixmap, 
Hints.icon_mask, netwm_icon );
+                CreateNetWmAppIcon( mnIconID != SV_ICON_ID_OFFICE ? mnIconID :
+                                    (mpParent ? mpParent->mnIconID : 
SV_ICON_ID_OFFICE), netwm_icon );
             }
             catch( css::uno::Exception& )
             {
                 // can happen - no ucb during early startup
             }
-            if( bOk )
-            {
-                Hints.flags     |= IconPixmapHint;
-                if( Hints.icon_mask )
-                    Hints.flags |= IconMaskHint;
-            }
         }
 
         // find the top level frame of the transience hierarchy
@@ -1078,40 +983,13 @@ void X11SalFrame::SetIcon( sal_uInt16 nIcon )
             iconSize = 48;
     }
 
-    XWMHints Hints;
-    Hints.flags = 0;
-    XWMHints *pHints = XGetWMHints( GetXDisplay(), GetShellWindow() );
-    if( pHints )
-    {
-        memcpy(&Hints, pHints, sizeof( XWMHints ));
-        XFree( pHints );
-    }
-    pHints = &Hints;
-
     NetWmIconData netwm_icon;
-    bool bOk = lcl_SelectAppIconPixmap( GetDisplay(), m_nXScreen,
-                                            nIcon, iconSize,
-                                            pHints->icon_pixmap, 
pHints->icon_mask, netwm_icon );
-    if ( !bOk )
-    {
-        // load default icon (0)
-        bOk = lcl_SelectAppIconPixmap( GetDisplay(), m_nXScreen,
-                                       0, iconSize,
-                                       pHints->icon_pixmap, pHints->icon_mask, 
netwm_icon );
-    }
-    if( bOk )
-    {
-        pHints->flags    |= IconPixmapHint;
-        if( pHints->icon_mask )
-            pHints->flags |= IconMaskHint;
-
-        XSetWMHints( GetXDisplay(), GetShellWindow(), pHints );
-        if( !netwm_icon.empty() && GetDisplay()->getWMAdaptor()->getAtom( 
WMAdaptor::NET_WM_ICON ))
-            XChangeProperty( GetXDisplay(), mhWindow,
-                GetDisplay()->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_ICON 
),
-                XA_CARDINAL, 32, PropModeReplace, reinterpret_cast<unsigned 
char*>(netwm_icon.data()), netwm_icon.size());
-    }
+    CreateNetWmAppIcon( nIcon, netwm_icon );
 
+    if( !netwm_icon.empty() && GetDisplay()->getWMAdaptor()->getAtom( 
WMAdaptor::NET_WM_ICON ))
+        XChangeProperty( GetXDisplay(), mhWindow,
+            GetDisplay()->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_ICON ),
+            XA_CARDINAL, 32, PropModeReplace, reinterpret_cast<unsigned 
char*>(netwm_icon.data()), netwm_icon.size());
 }
 
 void X11SalFrame::SetMaxClientSize( tools::Long nWidth, tools::Long nHeight )
commit 099413f4f113fd697afcb0b96cb0dd95ab5d32c6
Author:     Caolán McNamara <[email protected]>
AuthorDate: Wed Jan 11 11:40:09 2023 +0000
Commit:     Caolán McNamara <[email protected]>
CommitDate: Thu Jan 12 13:45:45 2023 +0000

    drop some unneeded includes
    
    Change-Id: Ibde845b19bc5993251fb2118b3daeafb63871aef
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145338
    Tested-by: Caolán McNamara <[email protected]>
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h
index db6f59f1b867..f87c0ebc253f 100644
--- a/vcl/inc/unx/salgdi.h
+++ b/vcl/inc/unx/salgdi.h
@@ -23,7 +23,6 @@
 
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
-#include <X11/extensions/Xrender.h>
 
 #include <vcl/salgtype.hxx>
 #include <vcl/vclenum.hxx>
diff --git a/vcl/inc/unx/svsys.h b/vcl/inc/unx/svsys.h
index 174a1ed74b27..c65e7cc9e8c9 100644
--- a/vcl/inc/unx/svsys.h
+++ b/vcl/inc/unx/svsys.h
@@ -21,7 +21,6 @@
 
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
-#include <X11/extensions/Xrender.h>
 #include <X11/XKBlib.h>
 
 #endif // INCLUDED_VCL_INC_UNX_SVSYS_H
diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx
index 7908d04e2164..bd8a8eb73c3a 100644
--- a/vcl/unx/generic/gdi/salgdi.cxx
+++ b/vcl/unx/generic/gdi/salgdi.cxx
@@ -26,8 +26,6 @@
 
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
-#include <X11/extensions/Xrender.h>
-
 
 #include <basegfx/polygon/b2dpolygon.hxx>
 #include <basegfx/polygon/b2dpolypolygon.hxx>
diff --git a/vcl/unx/generic/gdi/salvd.cxx b/vcl/unx/generic/gdi/salvd.cxx
index ee23e9112d96..bd76d3774a1c 100644
--- a/vcl/unx/generic/gdi/salvd.cxx
+++ b/vcl/unx/generic/gdi/salvd.cxx
@@ -20,7 +20,6 @@
 #include <vcl/sysdata.hxx>
 
 #include <X11/Xlib.h>
-#include <X11/extensions/Xrender.h>
 
 #include <unx/saldisp.hxx>
 #include <unx/salinst.h>

Reply via email to