[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kwin
Subject:    [PATCH] Menu translucency in the "Translucency" plug-in
From:       romnes () stud ! ntnu ! no
Date:       2008-03-11 21:36:23
Message-ID: 20080311223623.m0gj2h0dssgow88c () webmail ! ntnu ! no
[Download RAW message or body]

This message is in MIME format.


Hi,

This patch adds support for translucent menus via the "Translucency"  
plug-in for kwin. It partially fixes Bug #158988 and was also attached  
in that report, but I was asked to also send it here since I am  
applying for a SVN account -- so here it is. I will also try to take a  
look at the rest of that bug report (rules.cpp).

The patch works fine for me, i was however a bit unsure what exactly  
the difference between isMenu(), isDropdownMenu() and isPopupMenu()  
is. As a result I added a check for all three, and it seems to work  
fine.

Kind regards,
Magnus Romnes
romnes@stud.ntnu.no

["kwin_menu_transparency.patch" (text/x-patch)]

Index: effects/maketransparent_config.cpp
===================================================================
--- effects/maketransparent_config.cpp	(revision 784209)
+++ effects/maketransparent_config.cpp	(working copy)
@@ -74,8 +74,15 @@
     connect(mDialogs, SIGNAL(valueChanged(int)), this, SLOT(changed()));
     layout->addWidget(mDialogs, 4, 1);
 
-    layout->addItem(new QSpacerItem(10, 10, QSizePolicy::Minimum, QSizePolicy::Expanding), 4, 0, 1, 2);
+    layout->addWidget(new QLabel(i18n("Menus:"), this), 5, 0);
+    mMenus = new QSpinBox(this);
+    mMenus->setRange(10, 100);
+    mMenus->setSuffix("%");
+    connect(mMenus, SIGNAL(valueChanged(int)), this, SLOT(changed()));
+    layout->addWidget(mMenus, 5, 1);
 
+    layout->addItem(new QSpacerItem(10, 10, QSizePolicy::Minimum, QSizePolicy::Expanding), 5, 0, 1, 2);
+
     load();
     }
 
@@ -89,6 +96,7 @@
     mMoveResize->setValue( (int)( conf.readEntry( "MoveResize", 0.8 ) * 100 ) );
     mDialogs->setValue( (int)( conf.readEntry( "Dialogs", 1.0 ) * 100 ) );
     mInactive->setValue( (int)( conf.readEntry( "Inactive", 1.0 ) * 100 ) );
+    mMenus->setValue( (int)( conf.readEntry( "Menus", 1.0) * 100 ) );
 
     emit changed(false);
     }
@@ -103,6 +111,7 @@
     conf.writeEntry( "MoveResize", mMoveResize->value() / 100.0 );
     conf.writeEntry( "Dialogs", mDialogs->value() / 100.0 );
     conf.writeEntry( "Inactive", mInactive->value() / 100.0 );
+    conf.writeEntry( "Menus", mMenus->value() / 100.0 );
     conf.sync();
 
     emit changed(false);
@@ -116,6 +125,7 @@
     mMoveResize->setValue( 80 );
     mDialogs->setValue( 100 );
     mInactive->setValue( 100 );
+    mMenus->setValue( 100 );
     emit changed(true);
     }
 
Index: effects/maketransparent.h
===================================================================
--- effects/maketransparent.h	(revision 784209)
+++ effects/maketransparent.h	(working copy)
@@ -42,6 +42,7 @@
         double moveresize;
         double dialogs;
         double inactive;
+        double menus;
         EffectWindow* active;
     };
 
Index: effects/maketransparent.cpp
===================================================================
--- effects/maketransparent.cpp	(revision 784209)
+++ effects/maketransparent.cpp	(working copy)
@@ -34,6 +34,7 @@
     moveresize = conf.readEntry( "MoveResize", 0.8 );
     dialogs = conf.readEntry( "Dialogs", 1.0 );
     inactive = conf.readEntry( "Inactive", 1.0 );
+    menus = conf.readEntry( "Menus", 1.0 );
     active = effects->activeWindow();
     }
 
@@ -50,6 +51,10 @@
         {
         data.setTranslucent();
         }
+    if( menus != 1.0 && (w->isMenu() || w->isDropdownMenu() || w->isPopupMenu()))
+        {
+        data.setTranslucent();
+        }
     effects->prePaintWindow( w, data, time );
     }
 
@@ -67,6 +72,8 @@
             data.opacity *= dialogs;
         if( moveresize != 1.0 && ( w->isUserMove() || w->isUserResize()))
             data.opacity *= moveresize;
+        if( menus != 1.0 && (w->isMenu() || w->isDropdownMenu() || w->isPopupMenu()))
+            data.opacity *= menus;
         }
     effects->paintWindow( w, mask, region, data );
     }
Index: effects/maketransparent_config.h
===================================================================
--- effects/maketransparent_config.h	(revision 784209)
+++ effects/maketransparent_config.h	(working copy)
@@ -45,6 +45,7 @@
         QSpinBox* mMoveResize;
         QSpinBox* mDialogs;
         QSpinBox* mInactive;
+        QSpinBox* mMenus;
     };
 
 } // namespace


_______________________________________________
Kwin mailing list
Kwin@kde.org
https://mail.kde.org/mailman/listinfo/kwin


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic