OSDN Git Service

generic: drop unused oxygen style background pixmap feature
authorIvailo Monev <xakepa10@gmail.com>
Mon, 31 Jul 2023 08:53:14 +0000 (08:53 +0000)
committerIvailo Monev <xakepa10@gmail.com>
Mon, 31 Jul 2023 08:54:54 +0000 (08:54 +0000)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
kstyles/oxygen/oxygen.kcfg
kstyles/oxygen/oxygenstyle.cpp
kstyles/oxygen/oxygenstylehelper.cpp
kwin/clients/oxygen/oxygenclient.cpp
kwin/clients/oxygen/oxygenfactory.cpp
libs/oxygen/oxygenhelper.cpp
libs/oxygen/oxygenhelper.h

index 116bcbc..326233c 100644 (file)
        <default>true</default>
     </entry>
 
-    <!-- background pixmap -->
-    <entry name="BackgroundPixmap" type = "String" >
-       <default></default>
-    </entry>
-
   </group>
 
   <!-- widget style -->
index e306ac8..58274f3 100644 (file)
@@ -142,7 +142,6 @@ namespace Oxygen
         if( event->type() == QEvent::Show && _helper.hasDecoration( widget ) )
         {
             _helper.setHasBackgroundGradient( widget->winId(), true );
-            _helper.setHasBackgroundPixmap( widget->winId(), _helper.hasBackgroundPixmap() );
         }
 
         return false;
@@ -7337,9 +7336,6 @@ namespace Oxygen
         // background gradient
         helper().setUseBackgroundGradient( StyleConfigData::useBackgroundGradient() );
 
-        // background pixmap
-        helper().setBackgroundPixmap( StyleConfigData::backgroundPixmap() );
-
         // reset config
         StyleConfigData::self()->readConfig();
 
index 506df68..847ccc0 100644 (file)
@@ -130,10 +130,6 @@ namespace Oxygen
 
             p->fillRect( widget->rect(), color );
         }
-
-        // background pixmap
-        Helper::renderBackgroundPixmap( p, clipRect, widget, widget->window(), y_shift, gradientHeight );
-
     }
 
     //____________________________________________________________________
index 12f13bb..4222f36 100644 (file)
@@ -591,24 +591,6 @@ namespace Oxygen
 
         }
 
-        // background pixmap
-        if( isPreview() || helper().hasBackgroundPixmap( windowId() ) )
-        {
-            int offset = layoutMetric( LM_OuterPaddingTop );
-
-            // radial gradient positionning
-            const int height = hideTitleBar() ? 0:layoutMetric(LM_TitleHeight);
-            if( isMaximized() ) offset -= 3;
-
-            // background pixmap
-            const QPoint backgroundPixmapOffset( layoutMetric( LM_OuterPaddingLeft ) + layoutMetric( LM_BorderLeft ), 0 );
-            helper().setBackgroundPixmapOffset( backgroundPixmapOffset );
-
-            const QWidget* window( isPreview() ? this->widget() : widget->window() );
-            helper().renderBackgroundPixmap(painter, rect, widget, window, offset, height );
-
-        }
-
     }
 
     //_________________________________________________________
index c2120e5..46c63af 100644 (file)
@@ -102,12 +102,6 @@ namespace Oxygen
         // read shadowCache configuration
         _shadowCache.readConfig();
 
-        // background pixmap
-        {
-            KConfigGroup group( config->group("Common") );
-            helper().setBackgroundPixmap( group.readEntry( "BackgroundPixmap", "" ) );
-        }
-
     }
 
     //_________________________________________________________________
index 52b2523..bd1613e 100644 (file)
@@ -68,7 +68,6 @@ namespace Oxygen
 
         // create background atoms
         _backgroundGradientAtom = XInternAtom( QX11Info::display(), "_KDE_OXYGEN_BACKGROUND_GRADIENT", False);
-        _backgroundPixmapAtom = XInternAtom( QX11Info::display(), "_KDE_OXYGEN_BACKGROUND_PIXMAP", False);
 
         #endif
 
@@ -186,59 +185,6 @@ namespace Oxygen
         { p->restore(); }
     }
 
-
-    //____________________________________________________________________
-    void Helper::renderBackgroundPixmap( QPainter* p, const QRect& clipRect, const QWidget* widget, const QWidget* window, int yShift, int gradientHeight )
-    {
-
-        // background pixmap
-        if( _backgroundPixmap.isNull() ) return;
-
-        // get coordinates relative to the client area
-        // this is stupid. One could use mapTo if this was taking const QWidget* and not
-        // QWidget* as argument.
-        const QWidget* w( widget );
-        int x( 0 );
-        int y( -yShift );
-
-        while ( w != window && !w->isWindow() && w != w->parentWidget() )
-        {
-            x += w->geometry().x();
-            y += w->geometry().y();
-            w = w->parentWidget();
-        }
-
-        if ( clipRect.isValid() )
-        {
-            p->save();
-            p->setClipRegion( clipRect,Qt::IntersectClip );
-        }
-
-        // calculate upper part height
-        // special tricks are needed
-        // to handle both window contents and window decoration
-        int height( window->frameGeometry().height() );
-        int width( window->frameGeometry().width() );
-
-        // account for vertical shift
-        if( yShift > 0 ) height -= 2*yShift;
-
-        // calculate source rect
-        QPoint offset( 40, 48 - 20 );
-        QRect source( 0, 0, width + offset.x(), height + offset.y() );
-
-        offset -= _backgroundPixmapOffset;
-        source.translate( offset.x(), offset.y() );
-        source.translate( 0, 20 - gradientHeight );
-
-        // draw
-        p->drawPixmap( QPoint( -x, -y ), _backgroundPixmap, source );
-
-        if ( clipRect.isValid() )
-        { p->restore(); }
-
-    }
-
     //_____________________________________________________________
     void Helper::renderDot( QPainter* p, const QPoint& point, const QColor& baseColor )
     {
@@ -920,31 +866,6 @@ namespace Oxygen
         #endif
     }
 
-    //____________________________________________________________________
-    void Helper::setHasBackgroundPixmap( WId id, bool value ) const
-    {
-
-        #ifdef Q_WS_X11
-        setHasHint( id, _backgroundPixmapAtom, value );
-        #else
-        Q_UNUSED( id );
-        Q_UNUSED( value );
-        #endif
-        return;
-    }
-
-    //____________________________________________________________________
-    bool Helper::hasBackgroundPixmap( WId id ) const
-    {
-
-        #ifdef Q_WS_X11
-        return hasHint( id, _backgroundPixmapAtom );
-        #else
-        Q_UNUSED( id );
-        return false;
-        #endif
-    }
-
     //______________________________________________________________________________________
     void Helper::drawSlab( QPainter& p, const QColor& color, qreal shade )
     {
index 20871ae..3e6df57 100644 (file)
@@ -197,21 +197,6 @@ namespace Oxygen
         //! render window background using a given color as a reference
         virtual void renderWindowBackground( QPainter* p, const QRect& clipRect, const QWidget* widget, const QWidget* window, const QColor& color, int y_shift=-23, int gradientHeight = 20 );
 
-        //! background pixmap
-        bool hasBackgroundPixmap( void ) const
-        { return !_backgroundPixmap.isNull(); }
-
-        //! background pixmap
-        void setBackgroundPixmap( const QPixmap& pixmap )
-        { _backgroundPixmap = pixmap; }
-
-        //! offset
-        void setBackgroundPixmapOffset( const QPoint& offset )
-        { _backgroundPixmapOffset = offset; }
-
-        //! render window background using a given color as a reference
-        virtual void renderBackgroundPixmap( QPainter* p, const QRect& clipRect, const QWidget* widget, const QWidget* window, int y_shift=-23, int gradientHeight = 20 );
-
         //@}
 
         //! dots
@@ -327,12 +312,6 @@ namespace Oxygen
         //! true if background gradient hint is set
         virtual bool hasBackgroundGradient( WId ) const;
 
-        //! set background pixmap hint to widget
-        virtual void setHasBackgroundPixmap( WId, bool ) const;
-
-        //! true if background pixmap hint is set
-        virtual bool hasBackgroundPixmap( WId ) const;
-
         //@}
 
         protected:
@@ -414,12 +393,6 @@ namespace Oxygen
         ColorMap _highThreshold;
         ColorMap _lowThreshold;
 
-        //! background pixmap
-        QPixmap _backgroundPixmap;
-
-        //! background pixmap offsets
-        QPoint _backgroundPixmapOffset;
-
         #ifdef Q_WS_X11
 
         //! set value for given hint
@@ -431,9 +404,6 @@ namespace Oxygen
         //! background gradient hint atom
         Atom _backgroundGradientAtom;
 
-        //! background gradient hint atom
-        Atom _backgroundPixmapAtom;
-
         #endif
     };