Make titlebar buttons only react on left-click, if they have one function
only. (Bug #58220) svn path=/trunk/kdeartwork/kwin-styles/plastik/; revision=263816
This commit is contained in:
parent
3726cc23fd
commit
7008c02051
3 changed files with 8 additions and 6 deletions
|
@ -54,10 +54,11 @@ static const uint TIMERINTERVAL = 50; // msec
|
|||
static const uint ANIMATIONSTEPS = 4;
|
||||
|
||||
PlastikButton::PlastikButton(PlastikClient *parent, const char *name,
|
||||
const QString& tip, ButtonType type, int size)
|
||||
const QString& tip, ButtonType type, int size, int btns)
|
||||
: QButton(parent->widget(), name),
|
||||
m_client(parent),
|
||||
m_lastMouse(0),
|
||||
m_realizeButtons(btns),
|
||||
m_size(size),
|
||||
m_type(type),
|
||||
m_aDecoLight(QImage() ), m_iDecoLight(QImage() ),
|
||||
|
@ -214,7 +215,7 @@ void PlastikButton::mousePressEvent(QMouseEvent* e)
|
|||
m_lastMouse = e->button();
|
||||
// pass on event after changing button to LeftButton
|
||||
QMouseEvent me(e->type(), e->pos(), e->globalPos(),
|
||||
LeftButton, e->state());
|
||||
(e->button()&m_realizeButtons)?LeftButton:NoButton, e->state());
|
||||
|
||||
QButton::mousePressEvent(&me);
|
||||
}
|
||||
|
@ -224,7 +225,7 @@ void PlastikButton::mouseReleaseEvent(QMouseEvent* e)
|
|||
m_lastMouse = e->button();
|
||||
// pass on event after changing button to LeftButton
|
||||
QMouseEvent me(e->type(), e->pos(), e->globalPos(),
|
||||
LeftButton, e->state());
|
||||
(e->button()&m_realizeButtons)?LeftButton:NoButton, e->state());
|
||||
|
||||
QButton::mouseReleaseEvent(&me);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ class PlastikButton : public QButton
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PlastikButton(PlastikClient *parent=0, const char *name=0, const QString &tip=NULL, ButtonType type = HelpButton, int size = 18);
|
||||
PlastikButton(PlastikClient *parent, const char *name, const QString &tip, ButtonType type, int size, int btns = LeftButton);
|
||||
~PlastikButton();
|
||||
|
||||
void setOnAllDesktops(bool oad) { isOnAllDesktops = oad; repaint(false); }
|
||||
|
@ -63,6 +63,7 @@ private:
|
|||
private:
|
||||
PlastikClient *m_client;
|
||||
int m_lastMouse;
|
||||
int m_realizeButtons;
|
||||
|
||||
int m_size;
|
||||
|
||||
|
|
|
@ -552,7 +552,7 @@ void PlastikClient::addButtons(QBoxLayout *layout, const QString& s, int buttonS
|
|||
switch (s[n]) {
|
||||
case 'M': // Menu button
|
||||
if (!m_button[MenuButton]){
|
||||
m_button[MenuButton] = new PlastikButton(this, "menu", i18n("Menu"), MenuButton, buttonSize);
|
||||
m_button[MenuButton] = new PlastikButton(this, "menu", i18n("Menu"), MenuButton, buttonSize, LeftButton|RightButton);
|
||||
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);
|
||||
|
@ -581,7 +581,7 @@ void PlastikClient::addButtons(QBoxLayout *layout, const QString& s, int buttonS
|
|||
break;
|
||||
case 'A': // Maximize button
|
||||
if ((!m_button[MaxButton]) && isMaximizable()){
|
||||
m_button[MaxButton] = new PlastikButton(this, "maximize", i18n("Maximize"), MaxButton, buttonSize);
|
||||
m_button[MaxButton] = new PlastikButton(this, "maximize", i18n("Maximize"), MaxButton, buttonSize, LeftButton|MidButton|RightButton);
|
||||
connect(m_button[MaxButton], SIGNAL(clicked()), SLOT(slotMaximize()));
|
||||
layout->addWidget(m_button[MaxButton], 0, Qt::AlignHCenter | Qt::AlignTop);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue