Add initial menu transparency support

There is a (mostly aesthetic) problem related to widgets not respecting the palette's background pixmap, due to lack of support in themes (and probably the styles API?).

Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
feat/minor-improvements
Mavridis Philippe 1 year ago
parent 30cc7c2464
commit 6d92006da3
No known key found for this signature in database
GPG Key ID: 93F66F98F906147D

File diff suppressed because it is too large Load Diff

@ -8,8 +8,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>538</width>
<height>428</height>
<width>879</width>
<height>708</height>
</rect>
</property>
<property name="caption">
@ -27,7 +27,10 @@
</property>
<widget class="TQFrame">
<property name="name">
<cstring>frame9</cstring>
<cstring>menuFrame</cstring>
</property>
<property name="backgroundOrigin">
<enum>WidgetOrigin</enum>
</property>
<property name="frameShape">
<enum>PopupPanel</enum>
@ -49,6 +52,9 @@
<height>32767</height>
</size>
</property>
<property name="backgroundOrigin">
<enum>AncestorOrigin</enum>
</property>
<property name="frameShape">
<enum>StyledPanel</enum>
</property>
@ -88,6 +94,9 @@
<property name="name">
<cstring>searchLabel</cstring>
</property>
<property name="backgroundOrigin">
<enum>AncestorOrigin</enum>
</property>
<property name="text">
<string>Se&amp;arch:</string>
</property>
@ -162,6 +171,9 @@
<property name="name">
<cstring>showLabel</cstring>
</property>
<property name="backgroundOrigin">
<enum>AncestorOrigin</enum>
</property>
<property name="text">
<string>&amp;Show:</string>
</property>
@ -205,6 +217,9 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="backgroundOrigin">
<enum>AncestorOrigin</enum>
</property>
<property name="frameShape">
<enum>StyledPanel</enum>
</property>
@ -220,7 +235,10 @@
</property>
<widget class="TQLabel">
<property name="name">
<cstring>textLabel1</cstring>
<cstring>allAppsLabel</cstring>
</property>
<property name="backgroundOrigin">
<enum>AncestorOrigin</enum>
</property>
<property name="font">
<font>
@ -246,6 +264,9 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="backgroundOrigin">
<enum>AncestorOrigin</enum>
</property>
<property name="text">
<string>...</string>
</property>
@ -350,9 +371,10 @@
<tabstop>lockButton</tabstop>
<tabstop>logoutButton</tabstop>
</tabstops>
<layoutdefaults spacing="6" margin="11"/>
<includes>
<include location="global" impldecl="in implementation">kpushbutton.h</include>
<include location="global" impldecl="in implementation">tdelistviewsearchline.h</include>
<include location="global" impldecl="in implementation">tastylistview.h</include>
</includes>
<layoutdefaults spacing="6" margin="11"/>
</UI>

@ -1,4 +1,3 @@
/***************************************************************************
* Copyright (C) 2006-2007 by Marco Martin *
* notmart@gmail.com *
@ -30,14 +29,16 @@
#include <tqfile.h>
#include <tqcursor.h>
#include <tdepopupmenu.h>
#include <tqobjectlist.h>
#include <kdebug.h>
#include <tqlabel.h>
#include <time.h>
#include "menuhandler.h"
#include "buttons.h"
MenuHandler::MenuHandler( TQWidget *parent, Prefs *prefs, char *name, WFlags fl)
:TQFrame(parent, name, fl ), searchMode(false)
:TQFrame(parent, name, fl ), searchMode(false), rootPix(nullptr)
{
prefSkel = prefs;
@ -82,6 +83,7 @@ MenuHandler::MenuHandler( TQWidget *parent, Prefs *prefs, char *name, WFlags fl)
readConfig();
setupColumns();
updateWindowType();
setBackground();
//Searchline...
iconLoader = TDEGlobal::iconLoader();
@ -139,6 +141,7 @@ MenuHandler::MenuHandler( TQWidget *parent, Prefs *prefs, char *name, WFlags fl)
sessionsMenu = new TQPopupMenu();
menu->switchButton->setPopup(sessionsMenu);
menu->allAppsFrame->setPaletteBackgroundColor(colorGroup().background());
initializeRecentlyUsed( );
@ -490,6 +493,7 @@ void MenuHandler::updateConfig()
{
readConfig();
updateWindowType();
setBackground();
menu->dynamicList->setActionIconSize( _actionIconSize );
menu->rootList->setActionIconSize( _actionIconSize );
@ -501,7 +505,7 @@ void MenuHandler::updateConfig()
menuModeChanged( _menuMode );
KServiceGroup::Ptr service = KServiceGroup::root();
menu->rootList->clear();
populateList( service, menu->rootList, NULL, false );
populateList( service, menu->rootList, NULL, false );
}
@ -518,10 +522,8 @@ void MenuHandler::mousePressEvent( TQMouseEvent *e)
}
}
void MenuHandler::closeEvent ( TQCloseEvent *e)
void MenuHandler::closeEvent(TQCloseEvent *e)
{
e=e;
if( _isNormalWindow )
{
prefSkel->setNormalWindowWidth(width());
@ -1697,5 +1699,29 @@ void MenuHandler::switchWindowMode()
menu->detachButton->setIconSet(TQPixmap(uic_findImage(_isNormalWindow ? "attach.png" : "detach.png")));
}
void MenuHandler::setBackground()
{
if (rootPix) {
rootPix->stop();
delete rootPix;
rootPix = nullptr;
}
if (prefSkel->transparent()) {
rootPix = new KRootPixmap(this);
rootPix->setCustomPainting(true);
rootPix->setBlurEffect(0.0, prefSkel->blurBackground() ? 4.0 : 0.0);
connect(rootPix, TQT_SIGNAL(backgroundUpdated(const TQPixmap&)),
TQT_SLOT(updateBackground(const TQPixmap&)));
rootPix->start();
}
}
void MenuHandler::updateBackground(const TQPixmap &pix)
{
menu->setPaletteBackgroundPixmap(pix);
}
#include "menuhandler.moc"
//EOF

@ -41,6 +41,7 @@
#include <kdirlister.h>
#include <tqlayout.h>
#include <tdefileitem.h>
#include <krootpixmap.h>
#include "dmctl.h"
#include "menu.h"
@ -109,6 +110,7 @@ private:
int firstListing;
TQStringList oldInstalledList, newInstalledList;
TQValueList<int> newInstalledTimeStamps;
KRootPixmap *rootPix;
TQPixmap bookMarkPix;
TQVBoxLayout * MenuHandlerLayout;
@ -152,6 +154,7 @@ private:
void setupDynList( MenuMode mode );
//FIXME: this thing is UBER HEAVY
bool searchNewItems(KServiceGroup::Ptr group);
void setBackground();
public slots:
void slotUpdateApplications();
@ -178,6 +181,7 @@ private slots:
void menuModeChanged( int index );
void switchWindowMode();
void updateWindowType();
void updateBackground(const TQPixmap &pix);
};
#endif

@ -56,12 +56,7 @@ TastyMenu::TastyMenu(const TQString& configFile, Type type, int actions, TQWidge
_showBigToolTip = kickerConf->readBoolEntry("EnableIconZoom", true);
button = new TastyButton(this);
auto windowType = (prefSkel->isNormalWindow() ? TQt::WType_Dialog
: (prefSkel->startFullScreen() ? TQt::WType_TopLevel
: TQt::WType_Popup));
menuHandler = new MenuHandler(this, prefSkel, "MenuHandler", windowType | TQt::WNoAutoErase);
menuHandler = new MenuHandler(this, prefSkel, "MenuHandler", 0);
connect (button, SIGNAL (pressed()), this, SLOT (clickSlot ()));
connect (menuHandler, SIGNAL(hidden()), this, SLOT(setButtonUp()));

@ -101,6 +101,16 @@
<label>If the applications categories should be collapsed by default</label>
<default>false</default>
</entry>
<entry name="Transparent" type="Bool">
<label>Transparent background</label>
<default>false</default>
</entry>
<entry name="BlurBackground" type="Bool">
<label>Blur background</label>
<default>false</default>
</entry>
</group>
<group name="Behaviour">

Loading…
Cancel
Save