vcl/Library_vclplug_gen.mk | 1 vcl/inc/unx/Xproto.h | 43 -------------- vcl/inc/unx/soicon.hxx | 33 ---------- vcl/unx/generic/app/saldata.cxx | 5 + vcl/unx/generic/app/soicon.cxx | 110 ------------------------------------ vcl/unx/generic/gdi/salbmp.cxx | 7 +- vcl/unx/generic/gdi/salgdi.cxx | 17 +++-- vcl/unx/generic/window/salframe.cxx | 98 ++++++++++++++++++++++++++++---- 8 files changed, 105 insertions(+), 209 deletions(-)
New commits: commit d91b76bcc47a28825ae7e8fc3c1c5a93af20782b Author: Tor Lillqvist <t...@iki.fi> Date: Wed Apr 10 21:00:13 2013 +0300 vcl/inc/unx/Xproto.h seems pointless Change-Id: I22405b5d3416be28e677d7a383e8101bd6f15559 diff --git a/vcl/inc/unx/Xproto.h b/vcl/inc/unx/Xproto.h deleted file mode 100644 index 11e3ac7..0000000 --- a/vcl/inc/unx/Xproto.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- 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 . - */ - -#ifndef INCLUDED_VCL_UNX_INC_XPROTO_H -#define INCLUDED_VCL_UNX_INC_XPROTO_H - -#include "sal/config.h" - -#include <tools/prex.h> - -#if defined __GNUC__ -#pragma GCC system_header -#elif defined __SUNPRO_CC -#pragma disable_warn -#endif - -#include <X11/Xproto.h> - -#if defined __SUNPRO_CC -#pragma enable_warn -#endif - -#include <tools/postx.h> - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/app/saldata.cxx b/vcl/unx/generic/app/saldata.cxx index 6202b34..5416211 100644 --- a/vcl/unx/generic/app/saldata.cxx +++ b/vcl/unx/generic/app/saldata.cxx @@ -39,10 +39,13 @@ #include <sys/time.h> #endif +#include <tools/prex.h> +#include <X11/Xproto.h> +#include <tools/postx.h> + #include <osl/process.h> #include <osl/mutex.hxx> -#include "unx/Xproto.h" #include "unx/saldisp.hxx" #include "unx/saldata.hxx" #include "unx/salframe.h" diff --git a/vcl/unx/generic/gdi/salbmp.cxx b/vcl/unx/generic/gdi/salbmp.cxx index bf9a703..43a8b3e 100644 --- a/vcl/unx/generic/gdi/salbmp.cxx +++ b/vcl/unx/generic/gdi/salbmp.cxx @@ -26,15 +26,16 @@ #include <sys/types.h> #endif +#include <tools/prex.h> +#include <X11/Xproto.h> +#include <tools/postx.h> + #include <osl/endian.h> #include <vcl/bitmap.hxx> #include <vcl/salbtype.hxx> #include <com/sun/star/beans/XFastPropertySet.hpp> -#include <tools/prex.h> -#include "unx/Xproto.h" -#include <tools/postx.h> #include <unx/salunx.h> #include <unx/saldata.hxx> #include <unx/saldisp.hxx> diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx index 2464dd4..64df691 100644 --- a/vcl/unx/generic/gdi/salgdi.cxx +++ b/vcl/unx/generic/gdi/salgdi.cxx @@ -17,6 +17,16 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <config_graphite.h> + +#include <vector> +#include <queue> +#include <set> + +#include <tools/prex.h> +#include <X11/Xproto.h> +#include <tools/postx.h> + #include "tools/debug.hxx" #include "basegfx/polygon/b2dpolygon.hxx" @@ -32,7 +42,6 @@ #include "vcl/jobdata.hxx" -#include "unx/Xproto.h" #include "unx/salunx.h" #include "unx/saldata.hxx" #include "unx/saldisp.hxx" @@ -45,12 +54,6 @@ #include "xrender_peer.hxx" #include "region.h" -#include <vector> -#include <queue> -#include <set> - -#include <config_graphite.h> - #define STATIC_POINTS 64 class SalPolyLine commit 1382dad9d244bf437cd9cd181eb708bdaaca3539 Author: Tor Lillqvist <t...@iki.fi> Date: Wed Apr 10 20:50:12 2013 +0300 Minor refactoring: Move a function to the only file where it is used Change-Id: I98f1eda871eb36cdf61e003d046395698dcdad18 diff --git a/vcl/Library_vclplug_gen.mk b/vcl/Library_vclplug_gen.mk index 5bef143..f3c6d7d 100644 --- a/vcl/Library_vclplug_gen.mk +++ b/vcl/Library_vclplug_gen.mk @@ -73,7 +73,6 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_gen,\ vcl/unx/generic/app/salinst \ vcl/unx/generic/app/saltimer \ vcl/unx/generic/app/sm \ - vcl/unx/generic/app/soicon \ vcl/unx/generic/app/wmadaptor \ vcl/unx/generic/dtrans/bmp \ vcl/unx/generic/dtrans/config \ diff --git a/vcl/inc/unx/soicon.hxx b/vcl/inc/unx/soicon.hxx deleted file mode 100644 index 1f7f31a..0000000 --- a/vcl/inc/unx/soicon.hxx +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- 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 . - */ -#ifndef _SV_SOICON_HXX -#define _SV_SOICON_HXX - -#include <unx/saltype.h> - -class SalDisplay; -class SalBitmap; -class Bitmap; - -sal_Bool SelectAppIconPixmap( SalDisplay *pDisplay, SalX11Screen nScreen, - sal_uInt16 nIcon, sal_uInt16 iconSize, - Pixmap& icon_pixmap, Pixmap& icon_mask ); -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/app/soicon.cxx b/vcl/unx/generic/app/soicon.cxx deleted file mode 100644 index e08d98f..0000000 --- a/vcl/unx/generic/app/soicon.cxx +++ /dev/null @@ -1,110 +0,0 @@ -/* -*- 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 <unx/salunx.h> -#include <unx/saldisp.hxx> -#include <unx/salbmp.h> -#include <unx/soicon.hxx> - -#include <vcl/bitmap.hxx> -#include <vcl/bitmapex.hxx> -#include <vcl/graph.hxx> - -#include <svdata.hxx> -#include <svids.hrc> -#include <salbmp.hxx> -#include <impbmp.hxx> - - -sal_Bool SelectAppIconPixmap( SalDisplay *pDisplay, SalX11Screen nXScreen, - sal_uInt16 nIcon, sal_uInt16 iconSize, - Pixmap& icon_pixmap, Pixmap& icon_mask) -{ - if( ! ImplGetResMgr() ) - return sal_False; - - sal_uInt16 nIconSizeOffset; - - if( iconSize >= 48 ) - nIconSizeOffset = SV_ICON_SIZE48_START; - else if( iconSize >= 32 ) - nIconSizeOffset = SV_ICON_SIZE32_START; - else if( iconSize >= 16 ) - nIconSizeOffset = SV_ICON_SIZE16_START; - else - return sal_False; - - BitmapEx aIcon( ResId(nIconSizeOffset + nIcon, *ImplGetResMgr())); - if( sal_True == aIcon.IsEmpty() ) - return sal_False; - - SalTwoRect aRect; - aRect.mnSrcX = 0; aRect.mnSrcY = 0; - aRect.mnSrcWidth = iconSize; aRect.mnSrcHeight = iconSize; - aRect.mnDestX = 0; aRect.mnDestY = 0; - aRect.mnDestWidth = iconSize; aRect.mnDestHeight = iconSize; - - X11SalBitmap *pBitmap = static_cast < X11SalBitmap * > - (aIcon.ImplGetBitmapImpBitmap()->ImplGetSalBitmap()); - - icon_pixmap = XCreatePixmap( pDisplay->GetDisplay(), - pDisplay->GetRootWindow( nXScreen ), - iconSize, iconSize, - DefaultDepth( pDisplay->GetDisplay(), - nXScreen.getXScreen() ) - ); - - pBitmap->ImplDraw( icon_pixmap, - nXScreen, - DefaultDepth( pDisplay->GetDisplay(), - nXScreen.getXScreen() ), - aRect, - DefaultGC( pDisplay->GetDisplay(), - nXScreen.getXScreen() ) ); - - icon_mask = None; - - if( TRANSPARENT_BITMAP == aIcon.GetTransparentType() ) - { - icon_mask = XCreatePixmap( pDisplay->GetDisplay(), - pDisplay->GetRootWindow( pDisplay->GetDefaultXScreen() ), - iconSize, iconSize, 1); - - XGCValues aValues; - aValues.foreground = 0xffffffff; - aValues.background = 0; - aValues.function = GXcopy; - GC aMonoGC = XCreateGC( pDisplay->GetDisplay(), icon_mask, - GCFunction|GCForeground|GCBackground, &aValues ); - - Bitmap aMask = aIcon.GetMask(); - aMask.Invert(); - - X11SalBitmap *pMask = static_cast < X11SalBitmap * > - (aMask.ImplGetImpBitmap()->ImplGetSalBitmap()); - - pMask->ImplDraw(icon_mask, nXScreen, 1, aRect, aMonoGC); - XFreeGC( pDisplay->GetDisplay(), aMonoGC ); - } - - return sal_True; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index ec482e7..294a392 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -50,7 +50,6 @@ #include "unx/saldisp.hxx" #include "unx/salgdi.h" #include "unx/salframe.h" -#include "unx/soicon.hxx" #include "unx/sm.hxx" #include "unx/wmadaptor.hxx" #include "generic/genprn.h" @@ -66,6 +65,9 @@ #include <sal/macros.h> #include <com/sun/star/uno/Exception.hpp> +#include "svids.hrc" +#include "impbmp.hxx" + #include <algorithm> #ifndef Button6 @@ -191,6 +193,80 @@ void X11SalFrame::askForXEmbedFocus( sal_Int32 i_nTimeCode ) GetGenericData()->ErrorTrapPop(); } +static sal_Bool lcl_SelectAppIconPixmap( SalDisplay *pDisplay, SalX11Screen nXScreen, + sal_uInt16 nIcon, sal_uInt16 iconSize, + Pixmap& icon_pixmap, Pixmap& icon_mask) +{ + if( ! ImplGetResMgr() ) + return sal_False; + + sal_uInt16 nIconSizeOffset; + + if( iconSize >= 48 ) + nIconSizeOffset = SV_ICON_SIZE48_START; + else if( iconSize >= 32 ) + nIconSizeOffset = SV_ICON_SIZE32_START; + else if( iconSize >= 16 ) + nIconSizeOffset = SV_ICON_SIZE16_START; + else + return sal_False; + + BitmapEx aIcon( ResId(nIconSizeOffset + nIcon, *ImplGetResMgr())); + if( sal_True == aIcon.IsEmpty() ) + return sal_False; + + SalTwoRect aRect; + aRect.mnSrcX = 0; aRect.mnSrcY = 0; + aRect.mnSrcWidth = iconSize; aRect.mnSrcHeight = iconSize; + aRect.mnDestX = 0; aRect.mnDestY = 0; + aRect.mnDestWidth = iconSize; aRect.mnDestHeight = iconSize; + + X11SalBitmap *pBitmap = static_cast < X11SalBitmap * > + (aIcon.ImplGetBitmapImpBitmap()->ImplGetSalBitmap()); + + icon_pixmap = XCreatePixmap( pDisplay->GetDisplay(), + pDisplay->GetRootWindow( nXScreen ), + iconSize, iconSize, + DefaultDepth( pDisplay->GetDisplay(), + nXScreen.getXScreen() ) + ); + + pBitmap->ImplDraw( icon_pixmap, + nXScreen, + DefaultDepth( pDisplay->GetDisplay(), + nXScreen.getXScreen() ), + aRect, + DefaultGC( pDisplay->GetDisplay(), + nXScreen.getXScreen() ) ); + + icon_mask = None; + + if( TRANSPARENT_BITMAP == aIcon.GetTransparentType() ) + { + icon_mask = XCreatePixmap( pDisplay->GetDisplay(), + pDisplay->GetRootWindow( pDisplay->GetDefaultXScreen() ), + iconSize, iconSize, 1); + + XGCValues aValues; + aValues.foreground = 0xffffffff; + aValues.background = 0; + aValues.function = GXcopy; + GC aMonoGC = XCreateGC( pDisplay->GetDisplay(), icon_mask, + GCFunction|GCForeground|GCBackground, &aValues ); + + Bitmap aMask = aIcon.GetMask(); + aMask.Invert(); + + X11SalBitmap *pMask = static_cast < X11SalBitmap * > + (aMask.ImplGetImpBitmap()->ImplGetSalBitmap()); + + pMask->ImplDraw(icon_mask, nXScreen, 1, aRect, aMonoGC); + XFreeGC( pDisplay->GetDisplay(), aMonoGC ); + } + + return sal_True; +} + void X11SalFrame::Init( sal_uLong nSalFrameStyle, SalX11Screen nXScreen, SystemParentData* pParentData, bool bUseGeometry ) { if( nXScreen.getXScreen() >= GetDisplay()->GetXScreenCount() ) @@ -401,10 +477,10 @@ void X11SalFrame::Init( sal_uLong nSalFrameStyle, SalX11Screen nXScreen, SystemP bool bOk=false; try { - bOk=SelectAppIconPixmap( pDisplay_, m_nXScreen, - mnIconID != 1 ? mnIconID : - (mpParent ? mpParent->mnIconID : 1), 32, - Hints.icon_pixmap, Hints.icon_mask ); + bOk = lcl_SelectAppIconPixmap( pDisplay_, m_nXScreen, + mnIconID != 1 ? mnIconID : + (mpParent ? mpParent->mnIconID : 1), 32, + Hints.icon_pixmap, Hints.icon_mask ); } catch( com::sun::star::uno::Exception& ) { @@ -931,15 +1007,15 @@ void X11SalFrame::SetIcon( sal_uInt16 nIcon ) } pHints = &Hints; - sal_Bool bOk = SelectAppIconPixmap( GetDisplay(), m_nXScreen, - nIcon, iconSize, - pHints->icon_pixmap, pHints->icon_mask ); + sal_Bool bOk = lcl_SelectAppIconPixmap( GetDisplay(), m_nXScreen, + nIcon, iconSize, + pHints->icon_pixmap, pHints->icon_mask ); if ( !bOk ) { // load default icon (0) - bOk = SelectAppIconPixmap( GetDisplay(), m_nXScreen, - 0, iconSize, - pHints->icon_pixmap, pHints->icon_mask ); + bOk = lcl_SelectAppIconPixmap( GetDisplay(), m_nXScreen, + 0, iconSize, + pHints->icon_pixmap, pHints->icon_mask ); } if( bOk ) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits