Adjust TabBox::handleMouseEvent for only declarative views

Makes mouse wheel work again.
This commit is contained in:
Martin Gräßlin 2012-01-14 14:48:06 +01:00
parent bd5ad8aa6b
commit 28dd3b1353

View file

@ -643,36 +643,16 @@ bool TabBox::handleMouseEvent(XEvent* e)
close(); // click outside closes tab
return true;
}
}
if (m_tabBoxMode == TabBoxWindowsMode || m_tabBoxMode == TabBoxWindowsAlternativeMode) {
// pass to declarative view
return false;
}
// not declarative view
if (e->type != ButtonPress) {
return true;
}
QPoint pos(e->xbutton.x_root, e->xbutton.y_root);
QModelIndex index;
if (e->xbutton.button == Button1 || e->xbutton.button == Button2 || e->xbutton.button == Button3) {
index = m_tabBox->indexAt(pos);
if (e->xbutton.button == Button2 && index.isValid()) {
if (TabBoxClientImpl* client = static_cast< TabBoxClientImpl* >(m_tabBox->client(index))) {
if (Workspace::self()->hasClient(client->client())) {
client->client()->closeWindow();
return true;
}
if (e->xbutton.button == Button5 || e->xbutton.button == Button4) {
// mouse wheel event
const QModelIndex index = m_tabBox->nextPrev(e->xbutton.button == Button5);
if (index.isValid()) {
setCurrentIndex(index);
}
return true;
}
} else {
// mouse wheel event
index = m_tabBox->nextPrev(e->xbutton.button == Button5);
}
if (index.isValid())
setCurrentIndex(index);
return true;
return false;
}
void TabBox::grabbedKeyEvent(QKeyEvent* event)