1 /***************************************************************************** 2 * Copyright 2010 Craig Drummond <craig.p.drummond@gmail.com> * 3 * Copyright 2013 - 2015 Yichao Yu <yyc1992@gmail.com> * 4 * * 5 * This program is free software; you can redistribute it and/or modify * 6 * it under the terms of the GNU Lesser General Public License as * 7 * published by the Free Software Foundation; either version 2.1 of the * 8 * License, or (at your option) version 3, or any later version accepted * 9 * by the membership of KDE e.V. (or its successor approved by the * 10 * membership of KDE e.V.), which shall act as a proxy defined in * 11 * Section 6 of version 3 of the license. * 12 * * 13 * This program is distributed in the hope that it will be useful, * 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 16 * Lesser General Public License for more details. * 17 * * 18 * You should have received a copy of the GNU Lesser General Public * 19 * License along with this library. If not, * 20 * see <http://www.gnu.org/licenses/>. * 21 *****************************************************************************/ 22 23 #ifndef shadowhelper_h 24 #define shadowhelper_h 25 26 ////////////////////////////////////////////////////////////////////////////// 27 // shadowhelper.h 28 // handle shadow pixmaps passed to window manager via X property 29 // ------------------- 30 // 31 // Copyright (c) 2010 Hugo Pereira Da Costa <hugo@oxygen-icons.org> 32 // 33 // Permission is hereby granted, free of charge, to any person obtaining a copy 34 // of this software and associated documentation files (the "Software"), to 35 // deal in the Software without restriction, including without limitation the 36 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 37 // sell copies of the Software, and to permit persons to whom the Software is 38 // furnished to do so, subject to the following conditions: 39 // 40 // The above copyright notice and this permission notice shall be included in 41 // all copies or substantial portions of the Software. 42 // 43 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 44 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 45 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 46 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 47 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 48 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 49 // IN THE SOFTWARE. 50 ////////////////////////////////////////////////////////////////////////////// 51 52 #include <QObject> 53 54 namespace QtCurve { 55 //! handle shadow pixmaps passed to window manager via X property 56 class ShadowHelper: public QObject { 57 Q_OBJECT 58 public: 59 //!@name property names 60 static const char *const netWMForceShadowPropertyName; 61 static const char *const netWMSkipShadowPropertyName; 62 //! constructor ShadowHelper(QObject * parent)63 ShadowHelper(QObject *parent): QObject(parent) 64 { 65 } 66 67 //! register widget 68 bool registerWidget(QWidget*, bool force=false); 69 70 //! unregister widget 71 void unregisterWidget(QWidget*); 72 73 //! event filter 74 bool eventFilter(QObject*, QEvent*) override; 75 76 protected: 77 //! accept widget 78 bool acceptWidget(QWidget*) const; 79 80 //! install shadow X11 property on given widget 81 bool installX11Shadows(QWidget*); 82 83 //! uninstall shadow X11 property on given widget 84 void uninstallX11Shadows(QWidget*) const; 85 }; 86 } 87 88 #endif 89