diff --git a/clients/plastik/config/config.cpp b/clients/plastik/config/config.cpp
index aca778178a..c5c947ad95 100644
--- a/clients/plastik/config/config.cpp
+++ b/clients/plastik/config/config.cpp
@@ -53,6 +53,8 @@ PlastikConfig::PlastikConfig(KConfig* config, QWidget* parent)
this, SIGNAL(changed()));
connect(m_dialog->animateButtons, SIGNAL(toggled(bool)),
this, SIGNAL(changed()));
+ connect(m_dialog->menuClose, SIGNAL(toggled(bool)),
+ this, SIGNAL(changed()));
connect(m_dialog->titleShadow, SIGNAL(toggled(bool)),
this, SIGNAL(changed()));
connect(m_dialog->titlebarHeight, SIGNAL(valueChanged(int)),
@@ -76,6 +78,8 @@ void PlastikConfig::load(KConfig*)
if (button) button->setChecked(true);
bool animateButtons = m_config->readBoolEntry("AnimateButtons", true);
m_dialog->animateButtons->setChecked(animateButtons);
+ bool menuClose = m_config->readBoolEntry("CloseOnMenuDoubleClick", true);
+ m_dialog->menuClose->setChecked(menuClose);
bool titleShadow = m_config->readBoolEntry("TitleShadow", true);
m_dialog->titleShadow->setChecked(titleShadow);
int titlebarHeight = m_config->readNumEntry("TitleHeightMin", 19);
@@ -112,6 +116,7 @@ void PlastikConfig::save(KConfig*)
QRadioButton *button = (QRadioButton*)m_dialog->titleAlign->selected();
if (button) m_config->writeEntry("TitleAlignment", QString(button->name()));
m_config->writeEntry("AnimateButtons", m_dialog->animateButtons->isChecked() );
+ m_config->writeEntry("CloseOnMenuDoubleClick", m_dialog->menuClose->isChecked() );
m_config->writeEntry("TitleShadow", m_dialog->titleShadow->isChecked() );
switch(m_dialog->titlebarHeight->value())
{
@@ -143,6 +148,7 @@ void PlastikConfig::defaults()
(QRadioButton*)m_dialog->titleAlign->child("AlignHCenter");
if (button) button->setChecked(true);
m_dialog->animateButtons->setChecked(true);
+ m_dialog->menuClose->setChecked(false);
m_dialog->titleShadow->setChecked(true);
m_dialog->titlebarHeight->setValue(2);
}
diff --git a/clients/plastik/config/configdialog.ui b/clients/plastik/config/configdialog.ui
index db81b2787d..229d8b4b02 100644
--- a/clients/plastik/config/configdialog.ui
+++ b/clients/plastik/config/configdialog.ui
@@ -9,178 +9,179 @@
0
0
541
- 188
+ 214
Config Dialog
-
+
unnamed
-
+
- layout1
+ titleAlign
-
+
+ Title &Alignment
+
+
unnamed
-
+
- titleAlign
-
-
- Title &Alignment
-
-
-
- unnamed
-
-
-
- AlignLeft
-
-
- Left
-
-
-
-
- AlignHCenter
-
-
- Center
-
-
-
-
- AlignRight
-
-
- Right
-
-
-
-
-
-
- spacer5_2
-
-
- Horizontal
-
-
- Expanding
-
-
-
- 270
- 20
-
-
-
-
-
- animateButtons
+ AlignLeft
- Animate buttons
-
-
- Check this option if you want the buttons fade in/out when the mouse enters or leaves the button.
+ Left
-
+
- titlebarHeight
-
-
- 1
-
-
- 6
-
-
- 1
-
-
- Horizontal
-
-
- NoMarks
-
-
- By adjusting this slider, you can modify the height of the title bar.
-Note: This setting gets overwritten if the caption font is bigger than the title bar.
-
-
-
-
- textLabel2
+ AlignHCenter
- Small
+ Center
-
+
- titleShadow
+ AlignRight
- Use shadowed &text
-
-
- Alt+T
-
-
- Check this option if you want the titlebar text to have a 3D look with a shadow behind it.
+ Right
-
-
- textLabel1_2
-
-
- Tit&le bar height:
-
-
- titlebarHeight
-
-
- By adjusting this slider, you can modify the height of the title bar.
-Note: This setting gets overwritten if the caption font is bigger than the title bar.
-
-
-
-
- spacer7
-
-
- Horizontal
-
-
- Expanding
-
-
-
- 140
- 20
-
-
-
-
-
- textLabel4
-
-
- Large
-
-
-
+
-
+
+
+ spacer5_2
+
+
+ Horizontal
+
+
+ Expanding
+
+
+
+ 270
+ 20
+
+
+
+
+
+ titlebarHeight
+
+
+ 1
+
+
+ 6
+
+
+ 1
+
+
+ Horizontal
+
+
+ NoMarks
+
+
+ By adjusting this slider, you can modify the height of the title bar.
+Note: This setting gets overwritten if the caption font is bigger than the title bar.
+
+
+
+
+ textLabel2
+
+
+ Small
+
+
+
+
+ textLabel1_2
+
+
+ Tit&le bar height:
+
+
+ titlebarHeight
+
+
+ By adjusting this slider, you can modify the height of the title bar.
+Note: This setting gets overwritten if the caption font is bigger than the title bar.
+
+
+
+
+ spacer7
+
+
+ Horizontal
+
+
+ Expanding
+
+
+
+ 161
+ 20
+
+
+
+
+
+ textLabel4
+
+
+ Large
+
+
+
+
+ titleShadow
+
+
+ Use shadowed &text
+
+
+ Alt+T
+
+
+ Check this option if you want the titlebar text to have a 3D look with a shadow behind it.
+
+
+
+
+ animateButtons
+
+
+ Animate buttons
+
+
+ Check this option if you want the buttons fade in/out when the mouse enters or leaves the button.
+
+
+
+
+ menuClose
+
+
+ Close windows by double clicking the menu button
+
+
+ Check this option if you want windows to be closed when you double click the menu button, similar to Microsoft Windows.
+
+
+
AlignLeft
diff --git a/clients/plastik/plastik.cpp b/clients/plastik/plastik.cpp
index b6bd608024..a778c0c1d7 100644
--- a/clients/plastik/plastik.cpp
+++ b/clients/plastik/plastik.cpp
@@ -36,6 +36,8 @@ bool PlastikHandler::m_initialized = false;
bool PlastikHandler::m_animateButtons = true;
bool PlastikHandler::m_titleShadow = true;
bool PlastikHandler::m_shrinkBorders = true;
+bool PlastikHandler::m_menuClose = false;
+bool PlastikHandler::m_reverse = false;
int PlastikHandler::m_borderSize = 4;
int PlastikHandler::m_titleHeight = 19;
int PlastikHandler::m_titleHeightTool= 12;
@@ -84,6 +86,9 @@ bool PlastikHandler::reset(unsigned long changed)
m_borderSize = 4;
}
+ // check if we are in reverse layout mode
+ m_reverse = QApplication::reverseLayout();
+
// read in the configuration
readConfig();
@@ -136,6 +141,7 @@ void PlastikHandler::readConfig()
else if (value == "AlignRight") m_titleAlign = Qt::AlignRight;
m_animateButtons = config.readBoolEntry("AnimateButtons", true);
+ m_menuClose = config.readBoolEntry("CloseOnMenuDoubleClick", true);
}
QColor PlastikHandler::getColor(KWinPlastik::ColorType type, const bool active)
diff --git a/clients/plastik/plastik.h b/clients/plastik/plastik.h
index 02ac83d7f9..3b28a193b8 100644
--- a/clients/plastik/plastik.h
+++ b/clients/plastik/plastik.h
@@ -73,7 +73,9 @@ public:
static int borderSize() { return m_borderSize; }
static bool useHighContrastHoveredButtons() { return m_useHighContrastHoveredButtons; }
static bool animateButtons() { return m_animateButtons; }
+ static bool menuClose() { return m_menuClose; }
static Qt::AlignmentFlags titleAlign() { return m_titleAlign; }
+ static bool reverseLayout() { return m_reverse; }
static QColor getColor(KWinPlastik::ColorType type, const bool active = true);
private:
void readConfig();
@@ -82,6 +84,8 @@ private:
static bool m_shrinkBorders;
static bool m_useHighContrastHoveredButtons;
static bool m_animateButtons;
+ static bool m_menuClose;
+ static bool m_reverse;
static int m_borderSize;
static int m_titleHeight;
static int m_titleHeightTool;
diff --git a/clients/plastik/plastikclient.cpp b/clients/plastik/plastikclient.cpp
index 23fc392ebd..fc5d745371 100644
--- a/clients/plastik/plastikclient.cpp
+++ b/clients/plastik/plastikclient.cpp
@@ -60,6 +60,7 @@ PlastikClient::PlastikClient(KDecorationBridge* bridge, KDecorationFactory* fact
aTitleBarTile(0), iTitleBarTile(0), aTitleBarTopTile(0), iTitleBarTopTile(0),
pixmaps_created(false),
captionBufferDirty(true),
+ closing(false),
s_titleHeight(0),
s_titleFont(QFont() )
{ }
@@ -516,7 +517,7 @@ void PlastikClient::_resetLayout()
// sizeof(...) is calculated at compile time
memset(m_button, 0, sizeof(PlastikButton *) * NumButtons);
- titleLayout_->addItem(leftTitleSpacer_);
+ titleLayout_->addItem(PlastikHandler::reverseLayout()?rightTitleSpacer_:leftTitleSpacer_);
addButtons(titleLayout_,
options()->customButtonPositions() ? options()->titleButtonsLeft() : QString(default_left),
s_titleHeight-1);
@@ -524,16 +525,16 @@ void PlastikClient::_resetLayout()
addButtons(titleLayout_,
options()->customButtonPositions() ? options()->titleButtonsRight() : QString(default_right),
s_titleHeight-1);
- titleLayout_->addItem(rightTitleSpacer_);
+ titleLayout_->addItem(PlastikHandler::reverseLayout()?leftTitleSpacer_:rightTitleSpacer_);
// deco
mainLayout_->addItem(decoSpacer_);
//Mid
QHBoxLayout * midLayout = new QHBoxLayout(mainLayout_, 0, 0);
- midLayout->addItem(leftSpacer_);
+ midLayout->addItem(PlastikHandler::reverseLayout()?rightSpacer_:leftSpacer_);
midLayout->addWidget(new QLabel( i18n( "Plastik" ), widget()) );
- midLayout->addItem(rightSpacer_);
+ midLayout->addItem(PlastikHandler::reverseLayout()?leftSpacer_:rightSpacer_);
//Bottom
mainLayout_->addItem(bottomSpacer_);
@@ -550,6 +551,7 @@ void PlastikClient::addButtons(QBoxLayout *layout, const QString& s, int buttonS
if (!m_button[MenuButton]){
m_button[MenuButton] = new PlastikButton(this, "menu", i18n("Menu"), MenuButton, buttonSize);
connect(m_button[MenuButton], SIGNAL(pressed()), SLOT(menuButtonPressed()));
+ connect(m_button[MenuButton], SIGNAL(released()), this, SLOT(menuButtonReleased()));
layout->addWidget(m_button[MenuButton], 0, Qt::AlignHCenter | Qt::AlignTop);
}
break;
@@ -756,9 +758,26 @@ void PlastikClient::slotMaximize()
void PlastikClient::menuButtonPressed()
{
- QPoint pos = m_button[MenuButton]->mapToGlobal(m_button[MenuButton]->rect().bottomLeft() );
- showWindowMenu( pos );
- m_button[MenuButton]->setDown(false);
+ static QTime* t = NULL;
+ static PlastikClient* lastClient = NULL;
+ if (t == NULL)
+ t = new QTime;
+ bool dbl = (lastClient==this && t->elapsed() <= QApplication::doubleClickInterval());
+ lastClient = this;
+ t->start();
+ if (!dbl || !PlastikHandler::menuClose()) {
+ QPoint pos = m_button[MenuButton]->mapToGlobal(m_button[MenuButton]->rect().bottomLeft() );
+ showWindowMenu( pos );
+ m_button[MenuButton]->setDown(false);
+ }
+ else
+ closing = true;
+}
+
+void PlastikClient::menuButtonReleased()
+{
+ if(closing)
+ closeWindow();
}
void PlastikClient::create_pixmaps()
diff --git a/clients/plastik/plastikclient.h b/clients/plastik/plastikclient.h
index 6ef41e71ac..88ea63131a 100644
--- a/clients/plastik/plastikclient.h
+++ b/clients/plastik/plastikclient.h
@@ -75,6 +75,7 @@ protected:
private slots:
void slotMaximize();
void menuButtonPressed();
+ void menuButtonReleased();
bool isTool();
private:
void _resetLayout();
@@ -100,6 +101,8 @@ private:
bool captionBufferDirty;
+ bool closing;
+
// settings...
int s_titleHeight;
QFont s_titleFont;