force grab on useractions menu

Workaround, this *seems* a Qt problem.
The grab fails while the button is down - Qt then also seems
to release the keyboard.

Not sending it to the deco didn't help either - nevertheless it seems
(from the Qt code) as if the button is currently grabbed
(the code is a dumb forward to xcb_grab_pointer)

As a workaround, the patch simply ensures a grab on releasing a button when
the popup is visible.

BUG: 351112
FIXED-IN: 5.5
This commit is contained in:
Thomas Lübking 2015-09-22 14:44:25 +02:00
parent 226c9a0367
commit 801e60b290
3 changed files with 17 additions and 5 deletions

View file

@ -1287,6 +1287,9 @@ bool Client::buttonReleaseEvent(xcb_window_t w, int button, int state, int x, in
}
if (w != frameId() && w != inputId() && w != moveResizeGrabWindow())
return true;
if (w == frameId() && workspace()->userActionsMenu() && workspace()->userActionsMenu()->isShown()) {
const_cast<UserActionsMenu*>(workspace()->userActionsMenu())->grabInput();
}
x = this->x(); // translate from grab window to local coords
y = this->y();

View file

@ -164,6 +164,12 @@ void UserActionsMenu::show(const QRect &pos, const QWeakPointer<AbstractClient>
}
}
void UserActionsMenu::grabInput()
{
m_menu->windowHandle()->setMouseGrabEnabled(true);
m_menu->windowHandle()->setKeyboardGrabEnabled(true);
}
void UserActionsMenu::helperDialog(const QString& message, const QWeakPointer<AbstractClient> &c)
{
QStringList args;
@ -424,19 +430,16 @@ void UserActionsMenu::menuAboutToShow()
delete m_scriptsMenu;
m_scriptsMenu = NULL;
// ask scripts whether they want to add entries for the given Client
m_scriptsMenu = new QMenu(m_menu);
m_scriptsMenu->setPalette(m_client.data()->palette());
QList<QAction*> scriptActions = Scripting::self()->actionsForUserActionMenu(m_client.data(), m_scriptsMenu);
if (!scriptActions.isEmpty()) {
m_scriptsMenu = new QMenu(m_menu);
m_scriptsMenu->setPalette(m_client.data()->palette());
m_scriptsMenu->addActions(scriptActions);
QAction *action = m_scriptsMenu->menuAction();
// set it as the first item after desktop
m_menu->insertAction(m_closeOperation, action);
action->setText(i18n("&Extensions"));
} else {
delete m_scriptsMenu;
m_scriptsMenu = NULL;
}
showHideActivityMenu();

View file

@ -69,6 +69,12 @@ public:
* @returns Whether the menu is currently visible
**/
bool isShown() const;
/**
* grabs keyboard and mouse, workaround(?) for bug #351112
**/
void grabInput();
/**
* @returns Whether the menu has a Client set to operate on.
**/