diff --git a/kwin/bridge.h b/kwin/bridge.h index 069ae57c8a..017f622bbf 100644 --- a/kwin/bridge.h +++ b/kwin/bridge.h @@ -1,83 +1,83 @@ /******************************************************************** KWin - the KDE window manager This file is part of the KDE project. Copyright (C) 2003 Lubos Lunak This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . *********************************************************************/ #ifndef KWIN_BRIDGE_H #define KWIN_BRIDGE_H -#include +#include namespace KWin { class Client; class Bridge : public KDecorationBridge { public: Bridge( Client* cl ); virtual bool isActive() const; virtual bool isCloseable() const; virtual bool isMaximizable() const; virtual MaximizeMode maximizeMode() const; virtual bool isMinimizable() const; virtual bool providesContextHelp() const; virtual int desktop() const; virtual bool isModal() const; virtual bool isShadeable() const; virtual bool isShade() const; virtual bool isSetShade() const; virtual bool keepAbove() const; virtual bool keepBelow() const; virtual bool isMovable() const; virtual bool isResizable() const; virtual NET::WindowType windowType( unsigned long supported_types ) const; virtual QIcon icon() const; virtual QString caption() const; virtual void processMousePressEvent( QMouseEvent* ); virtual void showWindowMenu( const QPoint & ); virtual void showWindowMenu( const QRect & ); virtual void performWindowOperation( WindowOperation ); virtual void setMask( const QRegion&, int ); virtual bool isPreview() const; virtual QRect geometry() const; virtual QRect iconGeometry() const; virtual QRegion unobscuredRegion( const QRegion& r ) const; virtual WId windowId() const; virtual void closeWindow(); virtual void maximize( MaximizeMode mode ); virtual void minimize(); virtual void showContextHelp(); virtual void setDesktop( int desktop ); virtual void titlebarDblClickOperation(); virtual void titlebarMouseWheelOperation( int delta ); virtual void setShade( bool set ); virtual void setKeepAbove( bool ); virtual void setKeepBelow( bool ); virtual int currentDesktop() const; virtual QWidget* initialParentWidget() const; virtual Qt::WFlags initialWFlags() const; virtual void grabXServer( bool grab ); private: Client* c; }; } // namespace #endif diff --git a/kwin/kcmkwin/kwindecoration/preview.h b/kwin/kcmkwin/kwindecoration/preview.h index 32a7bb310e..3cd089a0c0 100644 --- a/kwin/kcmkwin/kwindecoration/preview.h +++ b/kwin/kcmkwin/kwindecoration/preview.h @@ -1,152 +1,153 @@ /* * * Copyright (c) 2003 Lubos Lunak * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KWINDECORATION_PREVIEW_H #define KWINDECORATION_PREVIEW_H #include //Added by qt3to4: #include #include #include #include +#include #include class QLabel; class KDecorationPreviewBridge; class KDecorationPreviewOptions; class KDecorationPreview : public QWidget { Q_OBJECT public: // Note: Windows can't be added or removed without making changes to // the code, since parts of it assume there's just an active // and an inactive window. enum Windows { Inactive = 0, Active, NumWindows }; KDecorationPreview( QWidget* parent = NULL ); virtual ~KDecorationPreview(); bool recreateDecoration( KDecorationPlugins* plugin ); void enablePreview(); void disablePreview(); void setPreviewMask( const QRegion&, int, bool ); QRegion unobscuredRegion( bool, const QRegion& ) const; QRect windowGeometry( bool ) const; void setTempBorderSize(KDecorationPlugins* plugin, KDecorationDefines::BorderSize size); void setTempButtons(KDecorationPlugins* plugin, bool customEnabled, const QString &left, const QString &right); protected: virtual void resizeEvent( QResizeEvent* ); private: void positionPreviews(); KDecorationPreviewOptions* options; KDecorationPreviewBridge* bridge[NumWindows]; KDecoration* deco[NumWindows]; QLabel* no_preview; QRegion mask; }; class KDecorationPreviewBridge : public KDecorationBridge { public: KDecorationPreviewBridge( KDecorationPreview* preview, bool active ); virtual bool isActive() const; virtual bool isCloseable() const; virtual bool isMaximizable() const; virtual MaximizeMode maximizeMode() const; virtual bool isMinimizable() const; virtual bool providesContextHelp() const; virtual int desktop() const; virtual bool isModal() const; virtual bool isShadeable() const; virtual bool isShade() const; virtual bool isSetShade() const; virtual bool keepAbove() const; virtual bool keepBelow() const; virtual bool isMovable() const; virtual bool isResizable() const; virtual NET::WindowType windowType( unsigned long supported_types ) const; virtual QIcon icon() const; virtual QString caption() const; virtual void processMousePressEvent( QMouseEvent* ); virtual void showWindowMenu( const QRect &); virtual void showWindowMenu( const QPoint & ); virtual void performWindowOperation( WindowOperation ); virtual void setMask( const QRegion&, int ); virtual bool isPreview() const; virtual QRect geometry() const; virtual QRect iconGeometry() const; virtual QRegion unobscuredRegion( const QRegion& r ) const; virtual WId windowId() const; virtual void closeWindow(); virtual void maximize( MaximizeMode mode ); virtual void minimize(); virtual void showContextHelp(); virtual void setDesktop( int desktop ); virtual void titlebarDblClickOperation(); virtual void titlebarMouseWheelOperation( int delta ); virtual void setShade( bool set ); virtual void setKeepAbove( bool ); virtual void setKeepBelow( bool ); virtual int currentDesktop() const; virtual QWidget* initialParentWidget() const; virtual Qt::WFlags initialWFlags() const; virtual void grabXServer( bool grab ); private: KDecorationPreview* preview; bool active; }; class KDecorationPreviewOptions : public KDecorationOptions { public: KDecorationPreviewOptions(); virtual ~KDecorationPreviewOptions(); virtual unsigned long updateSettings(); void setCustomBorderSize(BorderSize size); void setCustomTitleButtonsEnabled(bool enabled); void setCustomTitleButtons(const QString &left, const QString &right); private: BorderSize customBorderSize; bool customButtonsChanged; bool customButtons; QString customTitleButtonsLeft; QString customTitleButtonsRight; }; class KDecorationPreviewPlugins : public KDecorationPlugins { public: KDecorationPreviewPlugins(const KSharedConfigPtr &cfg); virtual bool provides( Requirement ); }; inline KDecorationPreviewPlugins::KDecorationPreviewPlugins(const KSharedConfigPtr &cfg) : KDecorationPlugins( cfg ) { } #endif diff --git a/kwin/lib/kdecoration.cpp b/kwin/lib/kdecoration.cpp index 3dcc8e1542..a12eafdb11 100644 --- a/kwin/lib/kdecoration.cpp +++ b/kwin/lib/kdecoration.cpp @@ -1,475 +1,475 @@ /***************************************************************** This file is part of the KDE project. Copyright (C) 2003 Lubos Lunak Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************/ #include "kdecoration.h" #include #include #include #include #if defined Q_WS_X11 && ! defined K_WS_QTONLY #include #include #include #endif #include "kdecoration_p.h" #include "kdecorationfactory.h" - +#include "kdecorationbridge.h" /* Extending KDecoration: ====================== If KDecoration will ever need to be extended in a way that'd break binary compatibility (i.e. adding new virtual methods most probably), new class KDecoration2 should be inherited from KDecoration and those methods added there. Code that would depend on the new functionality could then dynamic_cast<> to KDecoration2 to check whether it is available and use it. KCommonDecoration would have to be extended the same way, adding KCommonDecoration2 inheriting KCommonDecoration and adding the new API matching KDecoration2. */ KDecorationOptions* KDecoration::options_; KDecoration::KDecoration( KDecorationBridge* bridge, KDecorationFactory* factory ) : bridge_( bridge ), w_( NULL ), factory_( factory ) { factory->addDecoration( this ); } KDecoration::~KDecoration() { factory()->removeDecoration( this ); delete w_; } const KDecorationOptions* KDecoration::options() { return options_; } void KDecoration::createMainWidget( Qt::WFlags flags ) { // FRAME check flags? QWidget *w = new QWidget( initialParentWidget(), initialWFlags() | flags ); w->setObjectName("decoration widget"); w->setAttribute( Qt::WA_PaintOnScreen ); setMainWidget(w); } void KDecoration::setMainWidget( QWidget* w ) { assert( w_ == NULL ); w_ = w; w->setMouseTracking( true ); widget()->resize( geometry().size()); } QWidget* KDecoration::initialParentWidget() const { return bridge_->initialParentWidget(); } Qt::WFlags KDecoration::initialWFlags() const { return bridge_->initialWFlags(); } bool KDecoration::isActive() const { return bridge_->isActive(); } bool KDecoration::isCloseable() const { return bridge_->isCloseable(); } bool KDecoration::isMaximizable() const { return bridge_->isMaximizable(); } KDecoration::MaximizeMode KDecoration::maximizeMode() const { return bridge_->maximizeMode(); } bool KDecoration::isMinimizable() const { return bridge_->isMinimizable(); } bool KDecoration::providesContextHelp() const { return bridge_->providesContextHelp(); } int KDecoration::desktop() const { return bridge_->desktop(); } bool KDecoration::isModal() const { return bridge_->isModal(); } bool KDecoration::isShadeable() const { return bridge_->isShadeable(); } bool KDecoration::isShade() const { return bridge_->isShade(); } bool KDecoration::isSetShade() const { return bridge_->isSetShade(); } bool KDecoration::keepAbove() const { return bridge_->keepAbove(); } bool KDecoration::keepBelow() const { return bridge_->keepBelow(); } bool KDecoration::isMovable() const { return bridge_->isMovable(); } bool KDecoration::isResizable() const { return bridge_->isResizable(); } NET::WindowType KDecoration::windowType( unsigned long supported_types ) const { // this one is also duplicated in KDecorationFactory return bridge_->windowType( supported_types ); } QIcon KDecoration::icon() const { return bridge_->icon(); } QString KDecoration::caption() const { return bridge_->caption(); } void KDecoration::processMousePressEvent( QMouseEvent* e ) { return bridge_->processMousePressEvent( e ); } void KDecoration::showWindowMenu( const QRect &pos ) { bridge_->showWindowMenu( pos ); } void KDecoration::showWindowMenu( QPoint pos ) { bridge_->showWindowMenu( pos ); } void KDecoration::performWindowOperation( WindowOperation op ) { bridge_->performWindowOperation( op ); } void KDecoration::setMask( const QRegion& reg, int mode ) { bridge_->setMask( reg, mode ); } void KDecoration::clearMask() { bridge_->setMask( QRegion(), 0 ); } bool KDecoration::isPreview() const { return bridge_->isPreview(); } QRect KDecoration::geometry() const { return bridge_->geometry(); } QRect KDecoration::iconGeometry() const { return bridge_->iconGeometry(); } QRegion KDecoration::unobscuredRegion( const QRegion& r ) const { return bridge_->unobscuredRegion( r ); } WId KDecoration::windowId() const { return bridge_->windowId(); } void KDecoration::closeWindow() { bridge_->closeWindow(); } void KDecoration::maximize( Qt::MouseButtons button ) { performWindowOperation( options()->operationMaxButtonClick( button )); } void KDecoration::maximize( MaximizeMode mode ) { bridge_->maximize( mode ); } void KDecoration::minimize() { bridge_->minimize(); } void KDecoration::showContextHelp() { bridge_->showContextHelp(); } void KDecoration::setDesktop( int desktop ) { bridge_->setDesktop( desktop ); } void KDecoration::toggleOnAllDesktops() { if( isOnAllDesktops()) setDesktop( bridge_->currentDesktop()); else setDesktop( NET::OnAllDesktops ); } void KDecoration::titlebarDblClickOperation() { bridge_->titlebarDblClickOperation(); } void KDecoration::titlebarMouseWheelOperation( int delta ) { bridge_->titlebarMouseWheelOperation( delta ); } void KDecoration::setShade( bool set ) { bridge_->setShade( set ); } void KDecoration::setKeepAbove( bool set ) { bridge_->setKeepAbove( set ); } void KDecoration::setKeepBelow( bool set ) { bridge_->setKeepBelow( set ); } void KDecoration::emitKeepAboveChanged( bool above ) { keepAboveChanged( above ); } void KDecoration::emitKeepBelowChanged( bool below ) { keepBelowChanged( below ); } bool KDecoration::drawbound( const QRect&, bool ) { return false; } bool KDecoration::windowDocked( Position ) { return false; } void KDecoration::reset( unsigned long ) { } void KDecoration::grabXServer() { bridge_->grabXServer( true ); } void KDecoration::ungrabXServer() { bridge_->grabXServer( false ); } KDecoration::Position KDecoration::mousePosition( const QPoint& p ) const { const int range = 16; int bleft, bright, btop, bbottom; borders( bleft, bright, btop, bbottom ); btop = qMin( btop, 4 ); // otherwise whole titlebar would have resize cursor Position m = PositionCenter; if ( ( p.x() > bleft && p.x() < widget()->width() - bright ) && ( p.y() > btop && p.y() < widget()->height() - bbottom ) ) return PositionCenter; if ( p.y() <= qMax( range, btop ) && p.x() <= qMax( range, bleft )) m = PositionTopLeft; else if ( p.y() >= widget()->height()- qMax( range, bbottom ) && p.x() >= widget()->width()- qMax( range, bright )) m = PositionBottomRight; else if ( p.y() >= widget()->height()- qMax( range, bbottom ) && p.x() <= qMax( range, bleft )) m = PositionBottomLeft; else if ( p.y() <= qMax( range, btop ) && p.x() >= widget()->width()- qMax( range, bright )) m = PositionTopRight; else if ( p.y() <= btop ) m = PositionTop; else if ( p.y() >= widget()->height()-bbottom ) m = PositionBottom; else if ( p.x() <= bleft ) m = PositionLeft; else if ( p.x() >= widget()->width()-bright ) m = PositionRight; else m = PositionCenter; return m; } KDecorationOptions::KDecorationOptions() { assert( KDecoration::options_ == NULL ); KDecoration::options_ = this; } KDecorationOptions::~KDecorationOptions() { assert( KDecoration::options_ == this ); KDecoration::options_ = NULL; } QColor KDecorationOptions::color(ColorType type, bool active) const { return(d->colors[type + (active ? 0 : NUM_COLORS)]); } QFont KDecorationOptions::font(bool active, bool small) const { if ( small ) return(active ? d->activeFontSmall : d->inactiveFontSmall); else return(active ? d->activeFont : d->inactiveFont); } QPalette KDecorationOptions::palette(ColorType type, bool active) const { int idx = type + (active ? 0 : NUM_COLORS); if(d->pal[idx]) return(*d->pal[idx]); #ifdef __GNUC__ #warning KDE4 : why construct the palette this way? #endif // TODO: Is this worth 'porting' to Qt4? // d->pal[idx] = new QPalette(Qt::black, d->colors[idx], d->colors[idx].light(150), // d->colors[idx].dark(), d->colors[idx].dark(120), // Qt::black, QApplication::palette().active(). // base()); d->pal[idx] = new QPalette(d->colors[idx]); return(*d->pal[idx]); } bool KDecorationOptions::customButtonPositions() const { return d->custom_button_positions; } QString KDecorationOptions::titleButtonsLeft() const { return d->title_buttons_left; } QString KDecorationOptions::defaultTitleButtonsLeft() { return "MS"; } QString KDecorationOptions::titleButtonsRight() const { return d->title_buttons_right; } QString KDecorationOptions::defaultTitleButtonsRight() { return "HIA__X"; } bool KDecorationOptions::showTooltips() const { return d->show_tooltips; } KDecorationOptions::BorderSize KDecorationOptions::preferredBorderSize( KDecorationFactory* factory ) const { assert( factory != NULL ); if( d->cached_border_size == BordersCount ) // invalid d->cached_border_size = d->findPreferredBorderSize( d->border_size, factory->borderSizes()); return d->cached_border_size; } bool KDecorationOptions::moveResizeMaximizedWindows() const { return d->move_resize_maximized_windows; } KDecorationDefines::WindowOperation KDecorationOptions::operationMaxButtonClick( Qt::MouseButtons button ) const { return button == Qt::RightButton? d->OpMaxButtonRightClick : button == Qt::MidButton? d->OpMaxButtonMiddleClick : d->OpMaxButtonLeftClick; } #include "kdecoration.moc" diff --git a/kwin/lib/kdecoration_p.h b/kwin/lib/kdecoration_p.h index eb1a9b5c0a..030f3a5622 100644 --- a/kwin/lib/kdecoration_p.h +++ b/kwin/lib/kdecoration_p.h @@ -1,111 +1,60 @@ /***************************************************************** This file is part of the KDE project. Copyright (C) 2003 Lubos Lunak Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************/ #ifndef KDECORATION_P_H #define KDECORATION_P_H // // This header file is internal. I mean it. // #include "kdecoration.h" #include class KConfig; class KWIN_EXPORT KDecorationOptionsPrivate : public KDecorationDefines { public: KDecorationOptionsPrivate(); virtual ~KDecorationOptionsPrivate(); void defaultKWinSettings(); // shared implementation unsigned long updateKWinSettings( KConfig* ); // shared implementation BorderSize findPreferredBorderSize( BorderSize size, QList< BorderSize > ) const; // shared implementation QColor colors[NUM_COLORS*2]; QPalette *pal[NUM_COLORS*2]; QFont activeFont, inactiveFont, activeFontSmall, inactiveFontSmall; QString title_buttons_left; QString title_buttons_right; bool custom_button_positions; bool show_tooltips; BorderSize border_size, cached_border_size; bool move_resize_maximized_windows; WindowOperation OpMaxButtonRightClick; WindowOperation OpMaxButtonMiddleClick; WindowOperation OpMaxButtonLeftClick; }; -class KDecorationBridge : public KDecorationDefines - { - public: - virtual ~KDecorationBridge(){} - virtual bool isActive() const = 0; - virtual bool isCloseable() const = 0; - virtual bool isMaximizable() const = 0; - virtual MaximizeMode maximizeMode() const = 0; - virtual bool isMinimizable() const = 0; - virtual bool providesContextHelp() const = 0; - virtual int desktop() const = 0; - virtual bool isModal() const = 0; - virtual bool isShadeable() const = 0; - virtual bool isShade() const = 0; - virtual bool isSetShade() const = 0; - virtual bool keepAbove() const = 0; - virtual bool keepBelow() const = 0; - virtual bool isMovable() const = 0; - virtual bool isResizable() const = 0; - virtual NET::WindowType windowType( unsigned long supported_types ) const = 0; - virtual QIcon icon() const = 0; - virtual QString caption() const = 0; - virtual void processMousePressEvent( QMouseEvent* ) = 0; - virtual void showWindowMenu( const QRect &) = 0; - virtual void showWindowMenu( const QPoint & ) = 0; - virtual void performWindowOperation( WindowOperation ) = 0; - virtual void setMask( const QRegion&, int ) = 0; - virtual bool isPreview() const = 0; - virtual QRect geometry() const = 0; - virtual QRect iconGeometry() const = 0; - virtual QRegion unobscuredRegion( const QRegion& r ) const = 0; - virtual WId windowId() const = 0; - virtual void closeWindow() = 0; - virtual void maximize( MaximizeMode mode ) = 0; - virtual void minimize() = 0; - virtual void showContextHelp() = 0; - virtual void setDesktop( int desktop ) = 0; - virtual void titlebarDblClickOperation() = 0; - virtual void titlebarMouseWheelOperation( int delta ) = 0; - virtual void setShade( bool set ) = 0; - virtual void setKeepAbove( bool ) = 0; - virtual void setKeepBelow( bool ) = 0; - // not part of public API - virtual int currentDesktop() const = 0; - virtual QWidget* initialParentWidget() const = 0; - virtual Qt::WFlags initialWFlags() const = 0; - virtual void grabXServer( bool grab ) = 0; - }; - -/** @} */ - #endif diff --git a/kwin/lib/kdecoration_p.h b/kwin/lib/kdecorationbridge.h similarity index 76% copy from kwin/lib/kdecoration_p.h copy to kwin/lib/kdecorationbridge.h index eb1a9b5c0a..5c28e52f70 100644 --- a/kwin/lib/kdecoration_p.h +++ b/kwin/lib/kdecorationbridge.h @@ -1,111 +1,94 @@ /***************************************************************** This file is part of the KDE project. Copyright (C) 2003 Lubos Lunak Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************/ -#ifndef KDECORATION_P_H -#define KDECORATION_P_H - -// -// This header file is internal. I mean it. -// +#ifndef KDECORATIONBRIDGE_H +#define KDECORATIONBRIDGE_H #include "kdecoration.h" #include -class KConfig; - -class KWIN_EXPORT KDecorationOptionsPrivate : public KDecorationDefines - { - public: - KDecorationOptionsPrivate(); - virtual ~KDecorationOptionsPrivate(); - void defaultKWinSettings(); // shared implementation - unsigned long updateKWinSettings( KConfig* ); // shared implementation - BorderSize findPreferredBorderSize( BorderSize size, QList< BorderSize > ) const; // shared implementation - - QColor colors[NUM_COLORS*2]; - QPalette *pal[NUM_COLORS*2]; - QFont activeFont, inactiveFont, activeFontSmall, inactiveFontSmall; - QString title_buttons_left; - QString title_buttons_right; - bool custom_button_positions; - bool show_tooltips; - BorderSize border_size, cached_border_size; - bool move_resize_maximized_windows; - WindowOperation OpMaxButtonRightClick; - WindowOperation OpMaxButtonMiddleClick; - WindowOperation OpMaxButtonLeftClick; - }; +/** @addtogroup kdecoration */ +/** @{ */ +/** + * @short Bridge class for communicating between decorations and KWin core. + * + * This class allows communication between decorations and KWin core while allowing + * to keep binary compatibility. Decorations do not need to use it directly at all. + */ +// This class is supposed to keep binary compatibility, just like KDecoration. +// Extending should be done the same way, i.e. inheriting KDecorationBridge2 from it +// and adding new functionality there. class KDecorationBridge : public KDecorationDefines { public: virtual ~KDecorationBridge(){} virtual bool isActive() const = 0; virtual bool isCloseable() const = 0; virtual bool isMaximizable() const = 0; virtual MaximizeMode maximizeMode() const = 0; virtual bool isMinimizable() const = 0; virtual bool providesContextHelp() const = 0; virtual int desktop() const = 0; virtual bool isModal() const = 0; virtual bool isShadeable() const = 0; virtual bool isShade() const = 0; virtual bool isSetShade() const = 0; virtual bool keepAbove() const = 0; virtual bool keepBelow() const = 0; virtual bool isMovable() const = 0; virtual bool isResizable() const = 0; virtual NET::WindowType windowType( unsigned long supported_types ) const = 0; virtual QIcon icon() const = 0; virtual QString caption() const = 0; virtual void processMousePressEvent( QMouseEvent* ) = 0; virtual void showWindowMenu( const QRect &) = 0; virtual void showWindowMenu( const QPoint & ) = 0; virtual void performWindowOperation( WindowOperation ) = 0; virtual void setMask( const QRegion&, int ) = 0; virtual bool isPreview() const = 0; virtual QRect geometry() const = 0; virtual QRect iconGeometry() const = 0; virtual QRegion unobscuredRegion( const QRegion& r ) const = 0; virtual WId windowId() const = 0; virtual void closeWindow() = 0; virtual void maximize( MaximizeMode mode ) = 0; virtual void minimize() = 0; virtual void showContextHelp() = 0; virtual void setDesktop( int desktop ) = 0; virtual void titlebarDblClickOperation() = 0; virtual void titlebarMouseWheelOperation( int delta ) = 0; virtual void setShade( bool set ) = 0; virtual void setKeepAbove( bool ) = 0; virtual void setKeepBelow( bool ) = 0; // not part of public API virtual int currentDesktop() const = 0; virtual QWidget* initialParentWidget() const = 0; virtual Qt::WFlags initialWFlags() const = 0; virtual void grabXServer( bool grab ) = 0; }; /** @} */ #endif diff --git a/kwin/lib/kdecorationfactory.cpp b/kwin/lib/kdecorationfactory.cpp index b03dd56737..ac7562531c 100644 --- a/kwin/lib/kdecorationfactory.cpp +++ b/kwin/lib/kdecorationfactory.cpp @@ -1,80 +1,80 @@ /***************************************************************** This file is part of the KDE project. Copyright (C) 2003 Lubos Lunak Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************/ #include "kdecorationfactory.h" #include -#include "kdecoration_p.h" +#include "kdecorationbridge.h" KDecorationFactory::KDecorationFactory() { } KDecorationFactory::~KDecorationFactory() { assert( _decorations.count() == 0 ); } bool KDecorationFactory::reset( unsigned long ) { return true; } void KDecorationFactory::checkRequirements( KDecorationProvides* ) { } QList< KDecorationDefines::BorderSize > KDecorationFactory::borderSizes() const { return QList< BorderSize >() << BorderNormal; } bool KDecorationFactory::exists( const KDecoration* deco ) const { return _decorations.contains( const_cast< KDecoration* >( deco )); } void KDecorationFactory::addDecoration( KDecoration* deco ) { _decorations.append( deco ); } void KDecorationFactory::removeDecoration( KDecoration* deco ) { _decorations.removeAll( deco ); } void KDecorationFactory::resetDecorations( unsigned long changed ) { for( QList< KDecoration* >::ConstIterator it = _decorations.begin(); it != _decorations.end(); ++it ) (*it)->reset( changed ); } NET::WindowType KDecorationFactory::windowType( unsigned long supported_types, KDecorationBridge* bridge ) const { return bridge->windowType( supported_types ); }