diff --git a/clients/default/kdedefault.cpp b/clients/default/kdedefault.cpp index de910a576f..d3d95142b9 100644 --- a/clients/default/kdedefault.cpp +++ b/clients/default/kdedefault.cpp @@ -597,7 +597,8 @@ void KDEDefaultButton::mouseReleaseEvent( QMouseEvent* e ) KDEDefaultClient::KDEDefaultClient( Workspace *ws, WId w, QWidget *parent, const char *name ) : Client( ws, w, parent, name, WResizeNoErase | WStaticContents | - WRepaintNoErase ) + WRepaintNoErase ), + m_closing(false) { // No flicker thanks setBackgroundMode( QWidget::NoBackground ); @@ -665,6 +666,8 @@ void KDEDefaultClient::addClientButtons( const QString& s, bool isLeft ) largeButtons, isLeft, false, NULL, i18n("Menu")); connect( button[BtnMenu], SIGNAL(pressed()), this, SLOT(menuButtonPressed()) ); + connect( button[BtnMenu], SIGNAL(released()), + this, SLOT(menuButtonReleased())); hb->addWidget( button[BtnMenu] ); } break; @@ -1081,7 +1084,7 @@ void KDEDefaultClient::menuButtonPressed() if (dbl) { - closeWindow(); + m_closing = true; return; } @@ -1091,6 +1094,12 @@ void KDEDefaultClient::menuButtonPressed() button[BtnMenu]->setDown(false); } +void KDEDefaultClient::menuButtonReleased() +{ + if (m_closing) + closeWindow(); +} + }; // Extended KWin plugin interface diff --git a/clients/default/kdedefault.h b/clients/default/kdedefault.h index 6ebf9cbb6f..7173f624ea 100644 --- a/clients/default/kdedefault.h +++ b/clients/default/kdedefault.h @@ -39,7 +39,7 @@ class KDEDefaultHandler: public QObject void readConfig(); void createPixmaps(); void freePixmaps(); - void drawButtonBackground(KPixmap *pix, + void drawButtonBackground(KPixmap *pix, const QColorGroup &g, bool sunken); }; @@ -47,11 +47,11 @@ class KDEDefaultHandler: public QObject class KDEDefaultButton : public KWinButton { public: - KDEDefaultButton(Client *parent=0, const char *name=0, + KDEDefaultButton(Client *parent=0, const char *name=0, bool largeButton=true, bool isLeftButton=true, bool isStickyButton=false, const unsigned char *bitmap=NULL, const QString& tip=NULL); - ~KDEDefaultButton(); + ~KDEDefaultButton(); int last_button; void turnOn( bool isOn ); @@ -80,7 +80,7 @@ class KDEDefaultClient : public Client Q_OBJECT public: - KDEDefaultClient( Workspace *ws, WId w, QWidget *parent=0, + KDEDefaultClient( Workspace *ws, WId w, QWidget *parent=0, const char *name=0 ); ~KDEDefaultClient() {;} @@ -99,13 +99,14 @@ class KDEDefaultClient : public Client protected slots: void slotMaximize(); void menuButtonPressed(); + void menuButtonReleased(); private: void doShape(); void calcHiddenButtons(); void addClientButtons( const QString& s, bool isLeft=true ); - enum Buttons{ BtnHelp=0, BtnMax, BtnIconify, BtnClose, + enum Buttons{ BtnHelp=0, BtnMax, BtnIconify, BtnClose, BtnMenu, BtnSticky, BtnCount }; KDEDefaultButton* button[ KDEDefaultClient::BtnCount ]; int lastButtonWidth; @@ -113,6 +114,7 @@ class KDEDefaultClient : public Client bool largeButtons; QBoxLayout* hb; QSpacerItem* titlebar; + bool m_closing; }; };