2007-11-27 19:40:25 +00:00
|
|
|
/********************************************************************
|
2007-04-29 17:35:43 +00:00
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
|
|
|
|
Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
|
2013-03-12 12:17:53 +00:00
|
|
|
Copyright (C) 2009 Martin Gräßlin <mgraesslin@kde.org>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2007-11-27 19:40:25 +00:00
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
//#define QT_CLEAN_NAMESPACE
|
2009-09-13 11:36:45 +00:00
|
|
|
// own
|
2007-04-29 17:35:43 +00:00
|
|
|
#include "tabbox.h"
|
2009-09-13 11:36:45 +00:00
|
|
|
// tabbox
|
|
|
|
#include "tabbox/clientmodel.h"
|
|
|
|
#include "tabbox/desktopmodel.h"
|
|
|
|
#include "tabbox/tabboxconfig.h"
|
2012-11-17 10:50:59 +00:00
|
|
|
#include "tabbox/desktopchain.h"
|
2015-07-31 11:03:35 +00:00
|
|
|
#include "tabbox/tabbox_logging.h"
|
2009-09-13 11:36:45 +00:00
|
|
|
// kwin
|
2013-04-04 14:14:12 +00:00
|
|
|
#ifdef KWIN_BUILD_ACTIVITIES
|
|
|
|
#include "activities.h"
|
|
|
|
#endif
|
2007-04-29 17:35:43 +00:00
|
|
|
#include "client.h"
|
2009-09-13 11:36:45 +00:00
|
|
|
#include "effects.h"
|
2013-07-10 09:45:51 +00:00
|
|
|
#include "input.h"
|
2016-09-14 11:19:43 +00:00
|
|
|
#include "keyboard_input.h"
|
2012-11-20 16:26:50 +00:00
|
|
|
#include "focuschain.h"
|
2013-03-08 19:17:55 +00:00
|
|
|
#include "screenedge.h"
|
2013-04-03 10:19:27 +00:00
|
|
|
#include "screens.h"
|
2013-04-24 08:46:34 +00:00
|
|
|
#include "unmanaged.h"
|
2012-11-16 07:23:47 +00:00
|
|
|
#include "virtualdesktops.h"
|
2009-09-13 11:36:45 +00:00
|
|
|
#include "workspace.h"
|
2013-08-06 08:26:45 +00:00
|
|
|
#include "xcbutils.h"
|
2009-09-13 11:36:45 +00:00
|
|
|
// Qt
|
2007-04-30 00:52:51 +00:00
|
|
|
#include <QAction>
|
2014-12-02 12:50:26 +00:00
|
|
|
#include <QKeyEvent>
|
2009-09-13 11:36:45 +00:00
|
|
|
// KDE
|
|
|
|
#include <KConfig>
|
|
|
|
#include <KConfigGroup>
|
2014-03-17 15:24:10 +00:00
|
|
|
#include <KGlobalAccel>
|
2013-03-07 11:55:39 +00:00
|
|
|
#include <KLocalizedString>
|
2007-04-29 17:35:43 +00:00
|
|
|
#include <kkeyserver.h>
|
2009-09-13 11:36:45 +00:00
|
|
|
// X11
|
|
|
|
#include <X11/keysym.h>
|
|
|
|
#include <X11/keysymdef.h>
|
2015-02-06 14:17:56 +00:00
|
|
|
// xcb
|
|
|
|
#include <xcb/xcb_keysyms.h>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
// specify externals before namespace
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2009-09-13 11:36:45 +00:00
|
|
|
namespace TabBox
|
|
|
|
{
|
|
|
|
|
2011-06-25 16:05:07 +00:00
|
|
|
TabBoxHandlerImpl::TabBoxHandlerImpl(TabBox* tabBox)
|
2014-05-27 08:10:07 +00:00
|
|
|
: TabBoxHandler(tabBox)
|
2011-06-25 16:05:07 +00:00
|
|
|
, m_tabBox(tabBox)
|
2012-11-17 10:50:59 +00:00
|
|
|
, m_desktopFocusChain(new DesktopChainManager(this))
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2012-11-17 10:50:59 +00:00
|
|
|
// connects for DesktopFocusChainManager
|
|
|
|
VirtualDesktopManager *vds = VirtualDesktopManager::self();
|
|
|
|
connect(vds, SIGNAL(countChanged(uint,uint)), m_desktopFocusChain, SLOT(resize(uint,uint)));
|
|
|
|
connect(vds, SIGNAL(currentChanged(uint,uint)), m_desktopFocusChain, SLOT(addDesktop(uint,uint)));
|
2013-04-04 14:14:12 +00:00
|
|
|
#ifdef KWIN_BUILD_ACTIVITIES
|
2015-07-07 09:48:42 +00:00
|
|
|
if (Activities::self()) {
|
|
|
|
connect(Activities::self(), SIGNAL(currentChanged(QString)), m_desktopFocusChain, SLOT(useChain(QString)));
|
|
|
|
}
|
2013-04-04 14:14:12 +00:00
|
|
|
#endif
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2009-09-13 11:36:45 +00:00
|
|
|
TabBoxHandlerImpl::~TabBoxHandlerImpl()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2009-09-13 11:36:45 +00:00
|
|
|
int TabBoxHandlerImpl::activeScreen() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2013-04-03 10:19:27 +00:00
|
|
|
return screens()->current();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2009-09-13 11:36:45 +00:00
|
|
|
int TabBoxHandlerImpl::currentDesktop() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2012-11-16 07:23:47 +00:00
|
|
|
return VirtualDesktopManager::self()->current();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
QString TabBoxHandlerImpl::desktopName(TabBoxClient* client) const
|
|
|
|
{
|
|
|
|
if (TabBoxClientImpl* c = static_cast< TabBoxClientImpl* >(client)) {
|
|
|
|
if (!c->client()->isOnAllDesktops())
|
2012-11-16 07:23:47 +00:00
|
|
|
return VirtualDesktopManager::self()->name(c->client()->desktop());
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
2012-11-16 07:23:47 +00:00
|
|
|
return VirtualDesktopManager::self()->name(VirtualDesktopManager::self()->current());
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
QString TabBoxHandlerImpl::desktopName(int desktop) const
|
|
|
|
{
|
2012-11-16 07:23:47 +00:00
|
|
|
return VirtualDesktopManager::self()->name(desktop);
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2012-05-20 13:52:24 +00:00
|
|
|
QWeakPointer<TabBoxClient> TabBoxHandlerImpl::nextClientFocusChain(TabBoxClient* client) const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
if (TabBoxClientImpl* c = static_cast< TabBoxClientImpl* >(client)) {
|
2015-03-05 09:24:54 +00:00
|
|
|
auto next = FocusChain::self()->nextMostRecentlyUsed(c->client());
|
2011-01-30 14:34:42 +00:00
|
|
|
if (next)
|
2009-09-13 13:46:58 +00:00
|
|
|
return next->tabBoxClient();
|
2009-09-13 11:36:45 +00:00
|
|
|
}
|
2012-05-20 13:52:24 +00:00
|
|
|
return QWeakPointer<TabBoxClient>();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2012-08-19 17:32:56 +00:00
|
|
|
QWeakPointer< TabBoxClient > TabBoxHandlerImpl::firstClientFocusChain() const
|
|
|
|
{
|
2015-03-05 09:24:54 +00:00
|
|
|
if (auto c = FocusChain::self()->firstMostRecentlyUsed()) {
|
2012-08-19 17:32:56 +00:00
|
|
|
return QWeakPointer<TabBoxClient>(c->tabBoxClient());
|
|
|
|
} else {
|
|
|
|
return QWeakPointer<TabBoxClient>();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-05 18:55:07 +00:00
|
|
|
bool TabBoxHandlerImpl::isInFocusChain(TabBoxClient *client) const
|
|
|
|
{
|
|
|
|
if (TabBoxClientImpl *c = static_cast<TabBoxClientImpl*>(client)) {
|
2012-11-20 16:26:50 +00:00
|
|
|
return FocusChain::self()->contains(c->client());
|
2012-09-05 18:55:07 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
int TabBoxHandlerImpl::nextDesktopFocusChain(int desktop) const
|
|
|
|
{
|
2012-11-17 10:50:59 +00:00
|
|
|
return m_desktopFocusChain->next(desktop);
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2009-09-13 11:36:45 +00:00
|
|
|
int TabBoxHandlerImpl::numberOfDesktops() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2012-11-16 07:23:47 +00:00
|
|
|
return VirtualDesktopManager::self()->count();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2012-05-20 13:52:24 +00:00
|
|
|
QWeakPointer<TabBoxClient> TabBoxHandlerImpl::activeClient() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
if (Workspace::self()->activeClient())
|
2009-09-13 11:36:45 +00:00
|
|
|
return Workspace::self()->activeClient()->tabBoxClient();
|
2007-04-29 17:35:43 +00:00
|
|
|
else
|
2012-05-20 13:52:24 +00:00
|
|
|
return QWeakPointer<TabBoxClient>();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2012-03-04 18:24:13 +00:00
|
|
|
bool TabBoxHandlerImpl::checkDesktop(TabBoxClient* client, int desktop) const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2015-03-05 12:59:18 +00:00
|
|
|
auto current = (static_cast< TabBoxClientImpl* >(client))->client();
|
2012-03-04 18:24:13 +00:00
|
|
|
|
|
|
|
switch (config().clientDesktopMode()) {
|
|
|
|
case TabBoxConfig::AllDesktopsClients:
|
|
|
|
return true;
|
|
|
|
case TabBoxConfig::ExcludeCurrentDesktopClients:
|
|
|
|
return !current->isOnDesktop(desktop);
|
|
|
|
default: // TabBoxConfig::OnlyCurrentDesktopClients
|
|
|
|
return current->isOnDesktop(desktop);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TabBoxHandlerImpl::checkActivity(TabBoxClient* client) const
|
|
|
|
{
|
2015-03-05 12:59:18 +00:00
|
|
|
auto current = (static_cast< TabBoxClientImpl* >(client))->client();
|
2012-03-04 18:24:13 +00:00
|
|
|
|
|
|
|
switch (config().clientActivitiesMode()) {
|
|
|
|
case TabBoxConfig::AllActivitiesClients:
|
|
|
|
return true;
|
|
|
|
case TabBoxConfig::ExcludeCurrentActivityClients:
|
|
|
|
return !current->isOnCurrentActivity();
|
|
|
|
default: // TabBoxConfig::OnlyCurrentActivityClients
|
|
|
|
return current->isOnCurrentActivity();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TabBoxHandlerImpl::checkApplications(TabBoxClient* client) const
|
|
|
|
{
|
2015-03-05 12:59:18 +00:00
|
|
|
auto current = (static_cast< TabBoxClientImpl* >(client))->client();
|
2012-03-04 18:24:13 +00:00
|
|
|
TabBoxClientImpl* c;
|
2012-05-20 13:52:24 +00:00
|
|
|
QListIterator< QWeakPointer<TabBoxClient> > i(clientList());
|
2012-03-04 18:24:13 +00:00
|
|
|
|
|
|
|
switch (config().clientApplicationsMode()) {
|
|
|
|
case TabBoxConfig::OneWindowPerApplication:
|
|
|
|
// check if the list already contains an entry of this application
|
|
|
|
while (i.hasNext()) {
|
2012-05-20 13:52:24 +00:00
|
|
|
QSharedPointer<TabBoxClient> client = i.next().toStrongRef();
|
|
|
|
if (!client) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if ((c = dynamic_cast< TabBoxClientImpl* >(client.data()))) {
|
2012-03-04 18:24:13 +00:00
|
|
|
if (c->client()->resourceClass() == current->resourceClass()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
2012-05-20 13:52:24 +00:00
|
|
|
case TabBoxConfig::AllWindowsCurrentApplication: {
|
|
|
|
QSharedPointer<TabBoxClient> pointer = tabBox->activeClient().toStrongRef();
|
|
|
|
if (!pointer) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if ((c = dynamic_cast< TabBoxClientImpl* >(pointer.data()))) {
|
2012-03-04 18:24:13 +00:00
|
|
|
if (c->client()->resourceClass() == current->resourceClass()) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
2012-05-20 13:52:24 +00:00
|
|
|
}
|
2012-03-04 18:24:13 +00:00
|
|
|
default: // TabBoxConfig::AllWindowsAllApplications
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TabBoxHandlerImpl::checkMinimized(TabBoxClient* client) const
|
|
|
|
{
|
|
|
|
switch (config().clientMinimizedMode()) {
|
|
|
|
case TabBoxConfig::ExcludeMinimizedClients:
|
|
|
|
return !client->isMinimized();
|
|
|
|
case TabBoxConfig::OnlyMinimizedClients:
|
|
|
|
return client->isMinimized();
|
|
|
|
default: // TabBoxConfig::IgnoreMinimizedStatus
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TabBoxHandlerImpl::checkMultiScreen(TabBoxClient* client) const
|
|
|
|
{
|
2015-03-05 12:59:18 +00:00
|
|
|
auto current = (static_cast< TabBoxClientImpl* >(client))->client();
|
2012-03-04 18:24:13 +00:00
|
|
|
|
|
|
|
switch (config().clientMultiScreenMode()) {
|
|
|
|
case TabBoxConfig::IgnoreMultiScreen:
|
|
|
|
return true;
|
|
|
|
case TabBoxConfig::ExcludeCurrentScreenClients:
|
2013-04-03 10:19:27 +00:00
|
|
|
return current->screen() != screens()->current();
|
2012-03-04 18:24:13 +00:00
|
|
|
default: // TabBoxConfig::OnlyCurrentScreenClients
|
2013-04-03 10:19:27 +00:00
|
|
|
return current->screen() == screens()->current();
|
2012-03-04 18:24:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-20 13:52:24 +00:00
|
|
|
QWeakPointer<TabBoxClient> TabBoxHandlerImpl::clientToAddToList(TabBoxClient* client, int desktop) const
|
2012-03-04 18:24:13 +00:00
|
|
|
{
|
2012-08-23 06:39:07 +00:00
|
|
|
if (!client) {
|
|
|
|
return QWeakPointer<TabBoxClient>();
|
|
|
|
}
|
2015-03-05 12:59:18 +00:00
|
|
|
AbstractClient* ret = nullptr;
|
|
|
|
AbstractClient* current = (static_cast< TabBoxClientImpl* >(client))->client();
|
2012-03-04 18:24:13 +00:00
|
|
|
|
|
|
|
bool addClient = checkDesktop(client, desktop)
|
|
|
|
&& checkActivity(client)
|
|
|
|
&& checkApplications(client)
|
|
|
|
&& checkMinimized(client)
|
|
|
|
&& checkMultiScreen(client);
|
2010-05-03 20:04:44 +00:00
|
|
|
addClient = addClient && current->wantsTabFocus() && !current->skipSwitcher();
|
2011-01-30 14:34:42 +00:00
|
|
|
if (addClient) {
|
|
|
|
// don't add windows that have modal dialogs
|
2015-03-05 12:59:18 +00:00
|
|
|
AbstractClient* modal = current->findModal();
|
2014-02-24 15:42:43 +00:00
|
|
|
if (modal == nullptr || modal == current)
|
2009-09-13 11:36:45 +00:00
|
|
|
ret = current;
|
2011-01-30 14:34:42 +00:00
|
|
|
else if (!clientList().contains(modal->tabBoxClient()))
|
2009-09-13 11:36:45 +00:00
|
|
|
ret = modal;
|
2011-01-30 14:34:42 +00:00
|
|
|
else {
|
2009-09-13 11:36:45 +00:00
|
|
|
// nothing
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (ret)
|
2009-09-13 11:36:45 +00:00
|
|
|
return ret->tabBoxClient();
|
|
|
|
else
|
2012-05-20 13:52:24 +00:00
|
|
|
return QWeakPointer<TabBoxClient>();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2009-09-13 11:36:45 +00:00
|
|
|
TabBoxClientList TabBoxHandlerImpl::stackingOrder() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2012-04-08 08:07:35 +00:00
|
|
|
ToplevelList stacking = Workspace::self()->stackingOrder();
|
2009-09-13 11:36:45 +00:00
|
|
|
TabBoxClientList ret;
|
2012-04-08 08:07:35 +00:00
|
|
|
foreach (Toplevel *toplevel, stacking) {
|
|
|
|
if (Client *client = qobject_cast<Client*>(toplevel)) {
|
|
|
|
ret.append(client->tabBoxClient());
|
|
|
|
}
|
2010-10-17 20:30:33 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2013-04-12 18:15:31 +00:00
|
|
|
bool TabBoxHandlerImpl::isKWinCompositing() const {
|
|
|
|
return Workspace::self()->compositing();
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void TabBoxHandlerImpl::raiseClient(TabBoxClient* c) const
|
|
|
|
{
|
|
|
|
Workspace::self()->raiseClient(static_cast<TabBoxClientImpl*>(c)->client());
|
|
|
|
}
|
2010-10-17 20:30:33 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void TabBoxHandlerImpl::restack(TabBoxClient *c, TabBoxClient *under)
|
2010-10-17 20:30:33 +00:00
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
Workspace::self()->restack(static_cast<TabBoxClientImpl*>(c)->client(),
|
2015-02-06 22:00:34 +00:00
|
|
|
static_cast<TabBoxClientImpl*>(under)->client(), true);
|
2010-10-17 20:30:33 +00:00
|
|
|
}
|
|
|
|
|
2016-03-04 08:44:24 +00:00
|
|
|
void TabBoxHandlerImpl::elevateClient(TabBoxClient *c, QWindow *tabbox, bool b) const
|
2012-04-10 23:19:15 +00:00
|
|
|
{
|
2015-03-05 12:59:18 +00:00
|
|
|
auto cl = static_cast<TabBoxClientImpl*>(c)->client();
|
2013-04-24 08:46:34 +00:00
|
|
|
cl->elevate(b);
|
2016-03-04 08:44:24 +00:00
|
|
|
if (Toplevel *w = Workspace::self()->findInternal(tabbox))
|
2013-04-24 08:46:34 +00:00
|
|
|
w->elevate(b);
|
2012-04-10 23:19:15 +00:00
|
|
|
}
|
|
|
|
|
2015-02-06 22:10:59 +00:00
|
|
|
void TabBoxHandlerImpl::shadeClient(TabBoxClient *c, bool b) const
|
|
|
|
{
|
2015-03-05 12:59:18 +00:00
|
|
|
Client *cl = dynamic_cast<Client*>(static_cast<TabBoxClientImpl*>(c)->client());
|
|
|
|
if (!cl) {
|
|
|
|
// shading is X11 specific
|
|
|
|
return;
|
|
|
|
}
|
2015-02-06 22:10:59 +00:00
|
|
|
cl->cancelShadeHoverTimer(); // stop core shading action
|
|
|
|
if (!b && cl->shadeMode() == ShadeNormal)
|
|
|
|
cl->setShade(ShadeHover);
|
|
|
|
else if (b && cl->shadeMode() == ShadeHover)
|
|
|
|
cl->setShade(ShadeNormal);
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2012-05-20 13:52:24 +00:00
|
|
|
QWeakPointer<TabBoxClient> TabBoxHandlerImpl::desktopClient() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2012-04-08 08:07:35 +00:00
|
|
|
foreach (Toplevel *toplevel, Workspace::self()->stackingOrder()) {
|
|
|
|
Client *client = qobject_cast<Client*>(toplevel);
|
2013-04-03 10:19:27 +00:00
|
|
|
if (client && client->isDesktop() && client->isOnCurrentDesktop() && client->screen() == screens()->current()) {
|
2010-03-19 10:15:56 +00:00
|
|
|
return client->tabBoxClient();
|
|
|
|
}
|
|
|
|
}
|
2012-05-20 13:52:24 +00:00
|
|
|
return QWeakPointer<TabBoxClient>();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2010-03-19 10:15:56 +00:00
|
|
|
|
2011-11-27 16:03:35 +00:00
|
|
|
void TabBoxHandlerImpl::activateAndClose()
|
|
|
|
{
|
2011-12-02 09:31:52 +00:00
|
|
|
m_tabBox->accept();
|
2011-11-27 16:03:35 +00:00
|
|
|
}
|
|
|
|
|
2016-08-30 13:50:31 +00:00
|
|
|
void TabBoxHandlerImpl::highlightWindows(TabBoxClient *window, QWindow *controller)
|
|
|
|
{
|
|
|
|
if (!effects) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
QVector<EffectWindow*> windows;
|
|
|
|
if (window) {
|
|
|
|
windows << static_cast<TabBoxClientImpl*>(window)->client()->effectWindow();
|
|
|
|
}
|
|
|
|
if (auto t = Workspace::self()->findToplevel(controller)) {
|
|
|
|
windows << t->effectWindow();
|
|
|
|
}
|
|
|
|
static_cast<EffectsHandlerImpl*>(effects)->highlightWindows(windows);
|
|
|
|
}
|
|
|
|
|
2009-09-13 11:36:45 +00:00
|
|
|
/*********************************************************
|
|
|
|
* TabBoxClientImpl
|
|
|
|
*********************************************************/
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2015-03-05 12:59:18 +00:00
|
|
|
TabBoxClientImpl::TabBoxClientImpl(AbstractClient *client)
|
2009-09-13 11:36:45 +00:00
|
|
|
: TabBoxClient()
|
2012-05-10 20:33:10 +00:00
|
|
|
, m_client(client)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2009-09-13 11:36:45 +00:00
|
|
|
TabBoxClientImpl::~TabBoxClientImpl()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2009-09-13 11:36:45 +00:00
|
|
|
QString TabBoxClientImpl::caption() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
if (m_client->isDesktop())
|
|
|
|
return i18nc("Special entry in alt+tab list for minimizing all windows",
|
|
|
|
"Show Desktop");
|
2009-09-13 11:36:45 +00:00
|
|
|
return m_client->caption();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-12-06 13:41:23 +00:00
|
|
|
QIcon TabBoxClientImpl::icon() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2012-03-30 06:12:23 +00:00
|
|
|
if (m_client->isDesktop()) {
|
2013-12-06 13:41:23 +00:00
|
|
|
return QIcon::fromTheme(QStringLiteral("user-desktop"));
|
2012-03-30 06:12:23 +00:00
|
|
|
}
|
2013-12-06 13:41:23 +00:00
|
|
|
return m_client->icon();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2009-09-13 11:36:45 +00:00
|
|
|
WId TabBoxClientImpl::window() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2016-05-02 15:47:39 +00:00
|
|
|
return m_client->windowId();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2009-09-13 11:36:45 +00:00
|
|
|
bool TabBoxClientImpl::isMinimized() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2009-09-13 11:36:45 +00:00
|
|
|
return m_client->isMinimized();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2009-09-13 11:36:45 +00:00
|
|
|
int TabBoxClientImpl::x() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2009-09-13 11:36:45 +00:00
|
|
|
return m_client->x();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2009-09-13 11:36:45 +00:00
|
|
|
int TabBoxClientImpl::y() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2009-09-13 11:36:45 +00:00
|
|
|
return m_client->y();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2009-09-13 11:36:45 +00:00
|
|
|
int TabBoxClientImpl::width() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2009-09-13 11:36:45 +00:00
|
|
|
return m_client->width();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2009-09-13 11:36:45 +00:00
|
|
|
int TabBoxClientImpl::height() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2009-09-13 11:36:45 +00:00
|
|
|
return m_client->height();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-11-27 13:15:49 +00:00
|
|
|
bool TabBoxClientImpl::isCloseable() const
|
|
|
|
{
|
|
|
|
return m_client->isCloseable();
|
|
|
|
}
|
|
|
|
|
2011-11-27 14:00:09 +00:00
|
|
|
void TabBoxClientImpl::close()
|
|
|
|
{
|
|
|
|
m_client->closeWindow();
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-12-01 12:15:11 +00:00
|
|
|
bool TabBoxClientImpl::isFirstInTabBox() const
|
|
|
|
{
|
|
|
|
return m_client->isFirstInTabBox();
|
|
|
|
}
|
|
|
|
|
2009-09-13 11:36:45 +00:00
|
|
|
/*********************************************************
|
|
|
|
* TabBox
|
|
|
|
*********************************************************/
|
2014-02-24 15:42:43 +00:00
|
|
|
TabBox *TabBox::s_self = nullptr;
|
2013-04-04 07:41:18 +00:00
|
|
|
|
|
|
|
TabBox *TabBox::create(QObject *parent)
|
|
|
|
{
|
|
|
|
Q_ASSERT(!s_self);
|
|
|
|
s_self = new TabBox(parent);
|
|
|
|
return s_self;
|
|
|
|
}
|
|
|
|
|
2011-06-30 11:02:30 +00:00
|
|
|
TabBox::TabBox(QObject *parent)
|
|
|
|
: QObject(parent)
|
2011-06-25 16:05:07 +00:00
|
|
|
, m_displayRefcount(0)
|
|
|
|
, m_desktopGrab(false)
|
|
|
|
, m_tabGrab(false)
|
2011-08-21 08:44:09 +00:00
|
|
|
, m_noModifierGrab(false)
|
2011-07-08 19:52:56 +00:00
|
|
|
, m_forcedGlobalMouseGrab(false)
|
2011-07-09 08:32:26 +00:00
|
|
|
, m_ready(false)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2009-09-13 12:15:04 +00:00
|
|
|
m_isShown = false;
|
2009-09-13 11:36:45 +00:00
|
|
|
m_defaultConfig = TabBoxConfig();
|
2011-01-30 14:34:42 +00:00
|
|
|
m_defaultConfig.setTabBoxMode(TabBoxConfig::ClientTabBox);
|
2012-03-04 18:24:13 +00:00
|
|
|
m_defaultConfig.setClientDesktopMode(TabBoxConfig::OnlyCurrentDesktopClients);
|
|
|
|
m_defaultConfig.setClientActivitiesMode(TabBoxConfig::OnlyCurrentActivityClients);
|
|
|
|
m_defaultConfig.setClientApplicationsMode(TabBoxConfig::AllWindowsAllApplications);
|
|
|
|
m_defaultConfig.setClientMinimizedMode(TabBoxConfig::IgnoreMinimizedStatus);
|
|
|
|
m_defaultConfig.setShowDesktopMode(TabBoxConfig::DoNotShowDesktopClient);
|
2012-03-30 20:16:24 +00:00
|
|
|
m_defaultConfig.setClientMultiScreenMode(TabBoxConfig::IgnoreMultiScreen);
|
2011-01-30 14:34:42 +00:00
|
|
|
m_defaultConfig.setClientSwitchingMode(TabBoxConfig::FocusChainSwitching);
|
2009-09-13 11:36:45 +00:00
|
|
|
|
|
|
|
m_alternativeConfig = TabBoxConfig();
|
2011-01-30 14:34:42 +00:00
|
|
|
m_alternativeConfig.setTabBoxMode(TabBoxConfig::ClientTabBox);
|
2012-03-04 18:24:13 +00:00
|
|
|
m_alternativeConfig.setClientDesktopMode(TabBoxConfig::AllDesktopsClients);
|
|
|
|
m_alternativeConfig.setClientActivitiesMode(TabBoxConfig::OnlyCurrentActivityClients);
|
|
|
|
m_alternativeConfig.setClientApplicationsMode(TabBoxConfig::AllWindowsAllApplications);
|
|
|
|
m_alternativeConfig.setClientMinimizedMode(TabBoxConfig::IgnoreMinimizedStatus);
|
|
|
|
m_alternativeConfig.setShowDesktopMode(TabBoxConfig::DoNotShowDesktopClient);
|
2012-03-30 20:16:24 +00:00
|
|
|
m_alternativeConfig.setClientMultiScreenMode(TabBoxConfig::IgnoreMultiScreen);
|
2011-01-30 14:34:42 +00:00
|
|
|
m_alternativeConfig.setClientSwitchingMode(TabBoxConfig::FocusChainSwitching);
|
2009-09-13 11:36:45 +00:00
|
|
|
|
2012-04-25 20:57:48 +00:00
|
|
|
m_defaultCurrentApplicationConfig = m_defaultConfig;
|
|
|
|
m_defaultCurrentApplicationConfig.setClientApplicationsMode(TabBoxConfig::AllWindowsCurrentApplication);
|
|
|
|
|
|
|
|
m_alternativeCurrentApplicationConfig = m_alternativeConfig;
|
|
|
|
m_alternativeCurrentApplicationConfig.setClientApplicationsMode(TabBoxConfig::AllWindowsCurrentApplication);
|
|
|
|
|
2009-09-13 11:36:45 +00:00
|
|
|
m_desktopConfig = TabBoxConfig();
|
2011-01-30 14:34:42 +00:00
|
|
|
m_desktopConfig.setTabBoxMode(TabBoxConfig::DesktopTabBox);
|
|
|
|
m_desktopConfig.setShowTabBox(true);
|
2012-03-04 18:24:13 +00:00
|
|
|
m_desktopConfig.setShowDesktopMode(TabBoxConfig::DoNotShowDesktopClient);
|
2011-01-30 14:34:42 +00:00
|
|
|
m_desktopConfig.setDesktopSwitchingMode(TabBoxConfig::MostRecentlyUsedDesktopSwitching);
|
2009-09-13 11:36:45 +00:00
|
|
|
|
|
|
|
m_desktopListConfig = TabBoxConfig();
|
2011-01-30 14:34:42 +00:00
|
|
|
m_desktopListConfig.setTabBoxMode(TabBoxConfig::DesktopTabBox);
|
|
|
|
m_desktopListConfig.setShowTabBox(true);
|
2012-03-04 18:24:13 +00:00
|
|
|
m_desktopListConfig.setShowDesktopMode(TabBoxConfig::DoNotShowDesktopClient);
|
2011-01-30 14:34:42 +00:00
|
|
|
m_desktopListConfig.setDesktopSwitchingMode(TabBoxConfig::StaticDesktopSwitching);
|
2011-06-25 16:05:07 +00:00
|
|
|
m_tabBox = new TabBoxHandlerImpl(this);
|
2012-01-14 10:49:08 +00:00
|
|
|
QTimer::singleShot(0, this, SLOT(handlerReady()));
|
2009-09-13 11:36:45 +00:00
|
|
|
|
|
|
|
m_tabBoxMode = TabBoxDesktopMode; // init variables
|
2011-06-25 16:05:07 +00:00
|
|
|
connect(&m_delayedShowTimer, SIGNAL(timeout()), this, SLOT(show()));
|
2011-07-13 10:10:52 +00:00
|
|
|
connect(Workspace::self(), SIGNAL(configChanged()), this, SLOT(reconfigure()));
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2009-03-03 11:45:39 +00:00
|
|
|
|
2009-09-13 11:36:45 +00:00
|
|
|
TabBox::~TabBox()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2014-02-24 15:42:43 +00:00
|
|
|
s_self = nullptr;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2009-03-03 11:45:39 +00:00
|
|
|
|
2011-07-09 08:32:26 +00:00
|
|
|
void TabBox::handlerReady()
|
|
|
|
{
|
|
|
|
m_tabBox->setConfig(m_defaultConfig);
|
|
|
|
reconfigure();
|
|
|
|
m_ready = true;
|
|
|
|
}
|
|
|
|
|
2013-09-06 12:57:33 +00:00
|
|
|
template <typename Slot>
|
2013-12-10 08:34:11 +00:00
|
|
|
void TabBox::key(const char *actionName, Slot slot, const QKeySequence &shortcut)
|
2013-09-06 12:57:33 +00:00
|
|
|
{
|
2013-12-10 08:34:11 +00:00
|
|
|
QAction *a = new QAction(this);
|
2016-09-13 11:02:20 +00:00
|
|
|
a->setProperty("componentName", QStringLiteral(KWIN_NAME));
|
2013-12-10 08:34:11 +00:00
|
|
|
a->setObjectName(QString::fromUtf8(actionName));
|
2013-09-06 12:57:33 +00:00
|
|
|
a->setText(i18n(actionName));
|
|
|
|
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << shortcut);
|
2015-02-19 09:38:49 +00:00
|
|
|
input()->registerShortcut(shortcut, a, TabBox::self(), slot);
|
2013-09-06 12:57:33 +00:00
|
|
|
auto cuts = KGlobalAccel::self()->shortcut(a);
|
|
|
|
globalShortcutChanged(a, cuts.isEmpty() ? QKeySequence() : cuts.first());
|
|
|
|
}
|
|
|
|
|
2014-09-27 18:30:49 +00:00
|
|
|
static const char s_windows[] = I18N_NOOP("Walk Through Windows");
|
|
|
|
static const char s_windowsRev[] = I18N_NOOP("Walk Through Windows (Reverse)");
|
|
|
|
static const char s_windowsAlt[] = I18N_NOOP("Walk Through Windows Alternative");
|
|
|
|
static const char s_windowsAltRev[] = I18N_NOOP("Walk Through Windows Alternative (Reverse)");
|
|
|
|
static const char s_app[] = I18N_NOOP("Walk Through Windows of Current Application");
|
|
|
|
static const char s_appRev[] = I18N_NOOP("Walk Through Windows of Current Application (Reverse)");
|
|
|
|
static const char s_appAlt[] = I18N_NOOP("Walk Through Windows of Current Application Alternative");
|
|
|
|
static const char s_appAltRev[] = I18N_NOOP("Walk Through Windows of Current Application Alternative (Reverse)");
|
|
|
|
static const char s_desktops[] = I18N_NOOP("Walk Through Desktops");
|
|
|
|
static const char s_desktopsRev[] = I18N_NOOP("Walk Through Desktops (Reverse)");
|
|
|
|
static const char s_desktopList[] = I18N_NOOP("Walk Through Desktop List");
|
|
|
|
static const char s_desktopListRev[] = I18N_NOOP("Walk Through Desktop List (Reverse)");
|
2013-09-06 12:57:33 +00:00
|
|
|
|
2013-12-10 08:34:11 +00:00
|
|
|
void TabBox::initShortcuts()
|
|
|
|
{
|
|
|
|
key(s_windows, &TabBox::slotWalkThroughWindows, Qt::ALT + Qt::Key_Tab);
|
|
|
|
key(s_windowsRev, &TabBox::slotWalkBackThroughWindows, Qt::ALT + Qt::SHIFT + Qt::Key_Backtab);
|
|
|
|
key(s_app, &TabBox::slotWalkThroughCurrentAppWindows, Qt::ALT + Qt::Key_QuoteLeft);
|
|
|
|
key(s_appRev, &TabBox::slotWalkBackThroughCurrentAppWindows, Qt::ALT + Qt::Key_AsciiTilde);
|
|
|
|
key(s_windowsAlt, &TabBox::slotWalkThroughWindowsAlternative);
|
|
|
|
key(s_windowsAltRev, &TabBox::slotWalkBackThroughWindowsAlternative);
|
|
|
|
key(s_appAlt, &TabBox::slotWalkThroughCurrentAppWindowsAlternative);
|
|
|
|
key(s_appAltRev, &TabBox::slotWalkBackThroughCurrentAppWindowsAlternative);
|
|
|
|
key(s_desktops, &TabBox::slotWalkThroughDesktops);
|
|
|
|
key(s_desktopsRev, &TabBox::slotWalkBackThroughDesktops);
|
|
|
|
key(s_desktopList, &TabBox::slotWalkThroughDesktopList);
|
|
|
|
key(s_desktopListRev, &TabBox::slotWalkBackThroughDesktopList);
|
2013-09-06 12:57:33 +00:00
|
|
|
|
|
|
|
connect(KGlobalAccel::self(), &KGlobalAccel::globalShortcutChanged, this, &TabBox::globalShortcutChanged);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TabBox::globalShortcutChanged(QAction *action, const QKeySequence &seq)
|
|
|
|
{
|
|
|
|
if (qstrcmp(qPrintable(action->objectName()), s_windows) == 0) {
|
|
|
|
m_cutWalkThroughWindows = seq;
|
|
|
|
} else if (qstrcmp(qPrintable(action->objectName()), s_windowsRev) == 0) {
|
|
|
|
m_cutWalkThroughWindowsReverse = seq;
|
|
|
|
} else if (qstrcmp(qPrintable(action->objectName()), s_app) == 0) {
|
|
|
|
m_cutWalkThroughCurrentAppWindows = seq;
|
|
|
|
} else if (qstrcmp(qPrintable(action->objectName()), s_appRev) == 0) {
|
|
|
|
m_cutWalkThroughCurrentAppWindowsReverse = seq;
|
|
|
|
} else if (qstrcmp(qPrintable(action->objectName()), s_windowsAlt) == 0) {
|
|
|
|
m_cutWalkThroughWindowsAlternative = seq;
|
|
|
|
} else if (qstrcmp(qPrintable(action->objectName()), s_windowsAltRev) == 0) {
|
|
|
|
m_cutWalkThroughWindowsAlternativeReverse = seq;
|
|
|
|
} else if (qstrcmp(qPrintable(action->objectName()), s_appAlt) == 0) {
|
|
|
|
m_cutWalkThroughCurrentAppWindowsAlternative = seq;
|
|
|
|
} else if (qstrcmp(qPrintable(action->objectName()), s_appAltRev) == 0) {
|
|
|
|
m_cutWalkThroughCurrentAppWindowsAlternativeReverse = seq;
|
|
|
|
} else if (qstrcmp(qPrintable(action->objectName()), s_desktops) == 0) {
|
|
|
|
m_cutWalkThroughDesktops = seq;
|
|
|
|
} else if (qstrcmp(qPrintable(action->objectName()), s_desktopsRev) == 0) {
|
|
|
|
m_cutWalkThroughDesktopsReverse = seq;
|
|
|
|
} else if (qstrcmp(qPrintable(action->objectName()), s_desktopList) == 0) {
|
|
|
|
m_cutWalkThroughDesktopList = seq;
|
|
|
|
} else if (qstrcmp(qPrintable(action->objectName()), s_desktopListRev) == 0) {
|
|
|
|
m_cutWalkThroughDesktopListReverse = seq;
|
|
|
|
}
|
2011-06-25 16:05:07 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2009-09-13 11:36:45 +00:00
|
|
|
/*!
|
|
|
|
Sets the current mode to \a mode, either TabBoxDesktopListMode or TabBoxWindowsMode
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2009-09-13 11:36:45 +00:00
|
|
|
\sa mode()
|
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
void TabBox::setMode(TabBoxMode mode)
|
|
|
|
{
|
2009-09-13 11:36:45 +00:00
|
|
|
m_tabBoxMode = mode;
|
2011-01-30 14:34:42 +00:00
|
|
|
switch(mode) {
|
|
|
|
case TabBoxWindowsMode:
|
|
|
|
m_tabBox->setConfig(m_defaultConfig);
|
|
|
|
break;
|
|
|
|
case TabBoxWindowsAlternativeMode:
|
|
|
|
m_tabBox->setConfig(m_alternativeConfig);
|
|
|
|
break;
|
2012-04-25 20:57:48 +00:00
|
|
|
case TabBoxCurrentAppWindowsMode:
|
|
|
|
m_tabBox->setConfig(m_defaultCurrentApplicationConfig);
|
|
|
|
break;
|
|
|
|
case TabBoxCurrentAppWindowsAlternativeMode:
|
|
|
|
m_tabBox->setConfig(m_alternativeCurrentApplicationConfig);
|
|
|
|
break;
|
2011-01-30 14:34:42 +00:00
|
|
|
case TabBoxDesktopMode:
|
|
|
|
m_tabBox->setConfig(m_desktopConfig);
|
|
|
|
break;
|
|
|
|
case TabBoxDesktopListMode:
|
|
|
|
m_tabBox->setConfig(m_desktopListConfig);
|
|
|
|
break;
|
2009-09-13 11:36:45 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2009-06-19 21:22:45 +00:00
|
|
|
|
2009-09-13 11:36:45 +00:00
|
|
|
/*!
|
|
|
|
Resets the tab box to display the active client in TabBoxWindowsMode, or the
|
|
|
|
current desktop in TabBoxDesktopListMode
|
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
void TabBox::reset(bool partial_reset)
|
|
|
|
{
|
|
|
|
switch(m_tabBox->config().tabBoxMode()) {
|
|
|
|
case TabBoxConfig::ClientTabBox:
|
|
|
|
m_tabBox->createModel(partial_reset);
|
|
|
|
if (!partial_reset) {
|
2011-06-25 16:05:07 +00:00
|
|
|
if (Workspace::self()->activeClient())
|
|
|
|
setCurrentClient(Workspace::self()->activeClient());
|
2011-01-30 14:34:42 +00:00
|
|
|
// it's possible that the active client is not part of the model
|
|
|
|
// in that case the index is invalid
|
2011-10-31 13:34:37 +00:00
|
|
|
if (!m_tabBox->currentIndex().isValid())
|
2011-01-30 14:34:42 +00:00
|
|
|
setCurrentIndex(m_tabBox->first());
|
|
|
|
} else {
|
2011-10-31 13:34:37 +00:00
|
|
|
if (!m_tabBox->currentIndex().isValid() || !m_tabBox->client(m_tabBox->currentIndex()))
|
2011-01-30 14:34:42 +00:00
|
|
|
setCurrentIndex(m_tabBox->first());
|
2009-03-03 11:45:39 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
break;
|
|
|
|
case TabBoxConfig::DesktopTabBox:
|
|
|
|
m_tabBox->createModel();
|
2009-03-03 11:45:39 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
if (!partial_reset)
|
2012-11-16 07:23:47 +00:00
|
|
|
setCurrentDesktop(VirtualDesktopManager::self()->current());
|
2011-01-30 14:34:42 +00:00
|
|
|
break;
|
2009-03-03 11:45:39 +00:00
|
|
|
}
|
|
|
|
|
2011-03-06 11:15:16 +00:00
|
|
|
emit tabBoxUpdated();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
/*!
|
|
|
|
Shows the next or previous item, depending on \a next
|
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
void TabBox::nextPrev(bool next)
|
|
|
|
{
|
|
|
|
setCurrentIndex(m_tabBox->nextPrev(next), false);
|
2011-03-06 11:15:16 +00:00
|
|
|
emit tabBoxUpdated();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
Returns the currently displayed client ( only works in TabBoxWindowsMode ).
|
|
|
|
Returns 0 if no client is displayed.
|
|
|
|
*/
|
2015-03-05 12:59:18 +00:00
|
|
|
AbstractClient* TabBox::currentClient()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2011-10-31 13:34:37 +00:00
|
|
|
if (TabBoxClientImpl* client = static_cast< TabBoxClientImpl* >(m_tabBox->client(m_tabBox->currentIndex()))) {
|
2011-06-25 16:05:07 +00:00
|
|
|
if (!Workspace::self()->hasClient(client->client()))
|
2014-02-24 15:42:43 +00:00
|
|
|
return nullptr;
|
2009-09-13 11:36:45 +00:00
|
|
|
return client->client();
|
2011-01-30 14:34:42 +00:00
|
|
|
} else
|
2014-02-24 15:42:43 +00:00
|
|
|
return nullptr;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
Returns the list of clients potentially displayed ( only works in
|
|
|
|
TabBoxWindowsMode ).
|
|
|
|
Returns an empty list if no clients are available.
|
|
|
|
*/
|
2015-03-05 12:59:18 +00:00
|
|
|
QList<AbstractClient*> TabBox::currentClientList()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2009-09-13 11:36:45 +00:00
|
|
|
TabBoxClientList list = m_tabBox->clientList();
|
2015-03-05 12:59:18 +00:00
|
|
|
QList<AbstractClient*> ret;
|
2012-12-29 06:51:05 +00:00
|
|
|
foreach (const QWeakPointer<TabBoxClient> &clientPointer, list) {
|
2012-05-20 13:52:24 +00:00
|
|
|
QSharedPointer<TabBoxClient> client = clientPointer.toStrongRef();
|
|
|
|
if (!client)
|
|
|
|
continue;
|
|
|
|
if (const TabBoxClientImpl* c = static_cast< const TabBoxClientImpl* >(client.data()))
|
2011-01-30 14:34:42 +00:00
|
|
|
ret.append(c->client());
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
return ret;
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
Returns the currently displayed virtual desktop ( only works in
|
|
|
|
TabBoxDesktopListMode )
|
|
|
|
Returns -1 if no desktop is displayed.
|
|
|
|
*/
|
|
|
|
int TabBox::currentDesktop()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2011-10-31 13:34:37 +00:00
|
|
|
return m_tabBox->desktop(m_tabBox->currentIndex());
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
Returns the list of desktops potentially displayed ( only works in
|
|
|
|
TabBoxDesktopListMode )
|
2009-09-13 11:36:45 +00:00
|
|
|
Returns an empty list if no are available.
|
2007-04-29 17:35:43 +00:00
|
|
|
*/
|
|
|
|
QList< int > TabBox::currentDesktopList()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2009-09-13 11:36:45 +00:00
|
|
|
return m_tabBox->desktopList();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
Change the currently selected client, and notify the effects.
|
|
|
|
|
|
|
|
\sa setCurrentDesktop()
|
|
|
|
*/
|
2015-03-05 12:59:18 +00:00
|
|
|
void TabBox::setCurrentClient(AbstractClient *newClient)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
setCurrentIndex(m_tabBox->index(newClient->tabBoxClient()));
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
Change the currently selected desktop, and notify the effects.
|
|
|
|
|
|
|
|
\sa setCurrentClient()
|
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
void TabBox::setCurrentDesktop(int newDesktop)
|
|
|
|
{
|
|
|
|
setCurrentIndex(m_tabBox->desktopIndex(newDesktop));
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-09-10 10:39:10 +00:00
|
|
|
void TabBox::setCurrentIndex(QModelIndex index, bool notifyEffects)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
if (!index.isValid())
|
2009-09-13 11:36:45 +00:00
|
|
|
return;
|
2011-01-30 14:34:42 +00:00
|
|
|
m_tabBox->setCurrentIndex(index);
|
2011-03-06 11:15:16 +00:00
|
|
|
if (notifyEffects) {
|
|
|
|
emit tabBoxUpdated();
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
Notify effects that the tab box is being shown, and only display the
|
|
|
|
default tab box QFrame if no effect has referenced the tab box.
|
|
|
|
*/
|
|
|
|
void TabBox::show()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2011-03-06 11:15:16 +00:00
|
|
|
emit tabBoxAdded(m_tabBoxMode);
|
2011-01-30 14:34:42 +00:00
|
|
|
if (isDisplayed()) {
|
2009-09-13 11:36:45 +00:00
|
|
|
m_isShown = false;
|
2009-03-21 19:16:44 +00:00
|
|
|
return;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2015-02-18 01:09:00 +00:00
|
|
|
workspace()->setShowingDesktop(false);
|
2011-06-25 16:05:07 +00:00
|
|
|
reference();
|
2009-09-13 11:36:45 +00:00
|
|
|
m_isShown = true;
|
|
|
|
m_tabBox->show();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
Notify effects that the tab box is being hidden.
|
|
|
|
*/
|
2010-10-17 20:30:33 +00:00
|
|
|
void TabBox::hide(bool abort)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2011-06-25 16:05:07 +00:00
|
|
|
m_delayedShowTimer.stop();
|
2011-01-30 14:34:42 +00:00
|
|
|
if (m_isShown) {
|
2009-09-13 11:36:45 +00:00
|
|
|
m_isShown = false;
|
2011-06-25 16:05:07 +00:00
|
|
|
unreference();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2011-03-06 11:15:16 +00:00
|
|
|
emit tabBoxClosed();
|
2011-01-30 14:34:42 +00:00
|
|
|
if (isDisplayed())
|
2015-07-31 11:03:35 +00:00
|
|
|
qCDebug(KWIN_TABBOX) << "Tab box was not properly closed by an effect";
|
2011-01-30 14:34:42 +00:00
|
|
|
m_tabBox->hide(abort);
|
2013-08-06 08:26:45 +00:00
|
|
|
Xcb::sync();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
void TabBox::reconfigure()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2016-01-29 10:24:18 +00:00
|
|
|
KSharedConfigPtr c = kwinApp()->config();
|
2011-01-30 14:34:42 +00:00
|
|
|
KConfigGroup config = c->group("TabBox");
|
2009-09-13 11:36:45 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
loadConfig(c->group("TabBox"), m_defaultConfig);
|
|
|
|
loadConfig(c->group("TabBoxAlternative"), m_alternativeConfig);
|
2009-09-13 11:36:45 +00:00
|
|
|
|
2012-04-25 20:57:48 +00:00
|
|
|
m_defaultCurrentApplicationConfig = m_defaultConfig;
|
|
|
|
m_defaultCurrentApplicationConfig.setClientApplicationsMode(TabBoxConfig::AllWindowsCurrentApplication);
|
|
|
|
m_alternativeCurrentApplicationConfig = m_alternativeConfig;
|
|
|
|
m_alternativeCurrentApplicationConfig.setClientApplicationsMode(TabBoxConfig::AllWindowsCurrentApplication);
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
m_tabBox->setConfig(m_defaultConfig);
|
2009-09-13 11:36:45 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
m_delayShow = config.readEntry<bool>("ShowDelay", true);
|
|
|
|
m_delayShowTime = config.readEntry<int>("DelayTime", 90);
|
2013-03-08 19:17:55 +00:00
|
|
|
|
2014-10-29 08:52:06 +00:00
|
|
|
const QString defaultDesktopLayout = QStringLiteral("org.kde.breeze.desktop");
|
|
|
|
m_desktopConfig.setLayoutName(config.readEntry("DesktopLayout", defaultDesktopLayout));
|
|
|
|
m_desktopListConfig.setLayoutName(config.readEntry("DesktopListLayout", defaultDesktopLayout));
|
2013-04-15 11:03:13 +00:00
|
|
|
|
2013-03-08 19:17:55 +00:00
|
|
|
QList<ElectricBorder> *borders = &m_borderActivate;
|
2013-07-23 05:02:52 +00:00
|
|
|
QString borderConfig = QStringLiteral("BorderActivate");
|
2013-03-08 19:17:55 +00:00
|
|
|
for (int i = 0; i < 2; ++i) {
|
|
|
|
foreach (ElectricBorder border, *borders) {
|
|
|
|
ScreenEdges::self()->unreserve(border, this);
|
|
|
|
}
|
|
|
|
borders->clear();
|
|
|
|
QStringList list = config.readEntry(borderConfig, QStringList());
|
|
|
|
foreach (const QString &s, list) {
|
|
|
|
bool ok;
|
|
|
|
const int i = s.toInt(&ok);
|
|
|
|
if (!ok)
|
|
|
|
continue;
|
|
|
|
borders->append(ElectricBorder(i));
|
|
|
|
ScreenEdges::self()->reserve(ElectricBorder(i), this, "toggle");
|
|
|
|
}
|
|
|
|
borders = &m_borderAlternativeActivate;
|
2013-07-23 05:02:52 +00:00
|
|
|
borderConfig = QStringLiteral("BorderAlternativeActivate");
|
2013-03-08 19:17:55 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2009-09-13 11:36:45 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void TabBox::loadConfig(const KConfigGroup& config, TabBoxConfig& tabBoxConfig)
|
|
|
|
{
|
2012-03-04 18:24:13 +00:00
|
|
|
tabBoxConfig.setClientDesktopMode(TabBoxConfig::ClientDesktopMode(
|
|
|
|
config.readEntry<int>("DesktopMode", TabBoxConfig::defaultDesktopMode())));
|
|
|
|
tabBoxConfig.setClientActivitiesMode(TabBoxConfig::ClientActivitiesMode(
|
|
|
|
config.readEntry<int>("ActivitiesMode", TabBoxConfig::defaultActivitiesMode())));
|
|
|
|
tabBoxConfig.setClientApplicationsMode(TabBoxConfig::ClientApplicationsMode(
|
|
|
|
config.readEntry<int>("ApplicationsMode", TabBoxConfig::defaultApplicationsMode())));
|
2012-01-26 23:25:32 +00:00
|
|
|
tabBoxConfig.setClientMinimizedMode(TabBoxConfig::ClientMinimizedMode(
|
|
|
|
config.readEntry<int>("MinimizedMode", TabBoxConfig::defaultMinimizedMode())));
|
2012-03-04 18:24:13 +00:00
|
|
|
tabBoxConfig.setShowDesktopMode(TabBoxConfig::ShowDesktopMode(
|
|
|
|
config.readEntry<int>("ShowDesktopMode", TabBoxConfig::defaultShowDesktopMode())));
|
|
|
|
tabBoxConfig.setClientMultiScreenMode(TabBoxConfig::ClientMultiScreenMode(
|
|
|
|
config.readEntry<int>("MultiScreenMode", TabBoxConfig::defaultMultiScreenMode())));
|
|
|
|
tabBoxConfig.setClientSwitchingMode(TabBoxConfig::ClientSwitchingMode(
|
|
|
|
config.readEntry<int>("SwitchingMode", TabBoxConfig::defaultSwitchingMode())));
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
tabBoxConfig.setShowTabBox(config.readEntry<bool>("ShowTabBox",
|
|
|
|
TabBoxConfig::defaultShowTabBox()));
|
|
|
|
tabBoxConfig.setHighlightWindows(config.readEntry<bool>("HighlightWindows",
|
|
|
|
TabBoxConfig::defaultHighlightWindow()));
|
|
|
|
|
|
|
|
tabBoxConfig.setLayoutName(config.readEntry<QString>("LayoutName", TabBoxConfig::defaultLayoutName()));
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
Rikkus: please document! (Matthias)
|
|
|
|
|
|
|
|
Ok, here's the docs :)
|
|
|
|
|
|
|
|
You call delayedShow() instead of show() directly.
|
|
|
|
|
|
|
|
If the 'ShowDelay' setting is false, show() is simply called.
|
|
|
|
|
|
|
|
Otherwise, we start a timer for the delay given in the settings and only
|
|
|
|
do a show() when it times out.
|
|
|
|
|
|
|
|
This means that you can alt-tab between windows and you don't see the
|
|
|
|
tab box immediately. Not only does this make alt-tabbing faster, it gives
|
|
|
|
less 'flicker' to the eyes. You don't need to see the tab box if you're
|
|
|
|
just quickly switching between 2 or 3 windows. It seems to work quite
|
|
|
|
nicely.
|
|
|
|
*/
|
|
|
|
void TabBox::delayedShow()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2011-06-25 16:05:07 +00:00
|
|
|
if (isDisplayed() || m_delayedShowTimer.isActive())
|
2009-09-13 11:36:45 +00:00
|
|
|
// already called show - no need to call it twice
|
|
|
|
return;
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
if (!m_delayShowTime) {
|
2007-04-29 17:35:43 +00:00
|
|
|
show();
|
|
|
|
return;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-06-25 16:05:07 +00:00
|
|
|
m_delayedShowTimer.setSingleShot(true);
|
|
|
|
m_delayedShowTimer.start(m_delayShowTime);
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-07-26 06:46:31 +00:00
|
|
|
bool TabBox::handleMouseEvent(xcb_button_press_event_t *e)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2014-06-01 15:20:01 +00:00
|
|
|
xcb_allow_events(connection(), XCB_ALLOW_ASYNC_POINTER, XCB_CURRENT_TIME);
|
2011-01-30 14:34:42 +00:00
|
|
|
if (!m_isShown && isDisplayed()) {
|
|
|
|
// tabbox has been replaced, check effects
|
|
|
|
if (effects && static_cast<EffectsHandlerImpl*>(effects)->checkInputWindowEvent(e))
|
2011-10-31 13:34:37 +00:00
|
|
|
return true;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2013-09-09 02:51:54 +00:00
|
|
|
if ((e->response_type & ~0x80) == XCB_BUTTON_PRESS) {
|
2011-10-31 13:34:37 +00:00
|
|
|
// press outside Tabbox?
|
2013-07-26 06:46:31 +00:00
|
|
|
QPoint pos(e->root_x, e->root_y);
|
2011-10-31 13:34:37 +00:00
|
|
|
|
|
|
|
if ((!m_isShown && isDisplayed())
|
|
|
|
|| (!m_tabBox->containsPos(pos) &&
|
2013-07-26 06:46:31 +00:00
|
|
|
(e->detail == XCB_BUTTON_INDEX_1 || e->detail == XCB_BUTTON_INDEX_2 || e->detail == XCB_BUTTON_INDEX_3))) {
|
2011-10-31 13:34:37 +00:00
|
|
|
close(); // click outside closes tab
|
|
|
|
return true;
|
|
|
|
}
|
2013-07-26 06:46:31 +00:00
|
|
|
if (e->detail == XCB_BUTTON_INDEX_5 || e->detail == XCB_BUTTON_INDEX_4) {
|
2012-01-14 13:48:06 +00:00
|
|
|
// mouse wheel event
|
2013-07-26 06:46:31 +00:00
|
|
|
const QModelIndex index = m_tabBox->nextPrev(e->detail == XCB_BUTTON_INDEX_5);
|
2012-01-14 13:48:06 +00:00
|
|
|
if (index.isValid()) {
|
|
|
|
setCurrentIndex(index);
|
2009-03-03 11:45:39 +00:00
|
|
|
}
|
2012-01-14 13:48:06 +00:00
|
|
|
return true;
|
2009-03-03 11:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
2012-01-14 13:48:06 +00:00
|
|
|
return false;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
|
|
|
|
2013-07-26 06:46:31 +00:00
|
|
|
bool TabBox::handleMouseEvent(xcb_motion_notify_event_t *e)
|
|
|
|
{
|
2014-06-01 15:20:01 +00:00
|
|
|
xcb_allow_events(connection(), XCB_ALLOW_ASYNC_POINTER, XCB_CURRENT_TIME);
|
2013-07-26 06:46:31 +00:00
|
|
|
if (!m_isShown && isDisplayed()) {
|
|
|
|
// tabbox has been replaced, check effects
|
|
|
|
if (effects && static_cast<EffectsHandlerImpl*>(effects)->checkInputWindowEvent(e))
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-03-04 13:15:27 +00:00
|
|
|
bool TabBox::handleMouseEvent(QMouseEvent *event)
|
|
|
|
{
|
|
|
|
if (!m_isShown && isDisplayed()) {
|
|
|
|
// tabbox has been replaced, check effects
|
|
|
|
if (effects && static_cast<EffectsHandlerImpl*>(effects)->checkInputWindowEvent(event)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
switch (event->type()) {
|
|
|
|
case QEvent::MouseMove:
|
|
|
|
if (!m_tabBox->containsPos(event->globalPos())) {
|
|
|
|
// filter out all events which are not on the TabBox window.
|
|
|
|
// We don't want windows to react on the mouse events
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
case QEvent::MouseButtonPress:
|
|
|
|
if ((!m_isShown && isDisplayed()) || !m_tabBox->containsPos(event->globalPos())) {
|
|
|
|
close(); // click outside closes tab
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
// fall through
|
|
|
|
case QEvent::MouseButtonRelease:
|
|
|
|
default:
|
|
|
|
// we do not filter it out, the intenal filter takes care
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TabBox::handleWheelEvent(QWheelEvent *event)
|
|
|
|
{
|
|
|
|
if (!m_isShown && isDisplayed()) {
|
|
|
|
// tabbox has been replaced, check effects
|
|
|
|
if (effects && static_cast<EffectsHandlerImpl*>(effects)->checkInputWindowEvent(event)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (event->angleDelta().y() == 0) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
const QModelIndex index = m_tabBox->nextPrev(event->angleDelta().y() > 0);
|
|
|
|
if (index.isValid()) {
|
|
|
|
setCurrentIndex(index);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2011-06-25 16:05:07 +00:00
|
|
|
void TabBox::grabbedKeyEvent(QKeyEvent* event)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2011-03-06 11:15:16 +00:00
|
|
|
emit tabBoxKeyEvent(event);
|
2011-01-30 14:34:42 +00:00
|
|
|
if (!m_isShown && isDisplayed()) {
|
|
|
|
// tabbox has been replaced, check effects
|
2009-09-13 11:36:45 +00:00
|
|
|
return;
|
2009-03-03 11:45:39 +00:00
|
|
|
}
|
2011-08-21 08:44:09 +00:00
|
|
|
if (m_noModifierGrab) {
|
|
|
|
if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return || event->key() == Qt::Key_Space) {
|
2011-12-02 09:31:52 +00:00
|
|
|
accept();
|
2012-03-20 19:01:46 +00:00
|
|
|
return;
|
2011-08-21 08:44:09 +00:00
|
|
|
}
|
|
|
|
}
|
2012-03-20 19:01:46 +00:00
|
|
|
m_tabBox->grabbedKeyEvent(event);
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2009-03-03 11:45:39 +00:00
|
|
|
|
2015-02-06 14:17:56 +00:00
|
|
|
struct KeySymbolsDeleter
|
|
|
|
{
|
|
|
|
static inline void cleanup(xcb_key_symbols_t *symbols)
|
|
|
|
{
|
|
|
|
xcb_key_symbols_free(symbols);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
/*!
|
|
|
|
Handles alt-tab / control-tab
|
|
|
|
*/
|
2011-06-25 16:05:07 +00:00
|
|
|
static bool areKeySymXsDepressed(bool bAll, const uint keySyms[], int nKeySyms) {
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2015-07-31 11:03:35 +00:00
|
|
|
qCDebug(KWIN_TABBOX) << "areKeySymXsDepressed: " << (bAll ? "all of " : "any of ") << nKeySyms;
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2015-02-06 14:17:56 +00:00
|
|
|
Xcb::QueryKeymap keys;
|
|
|
|
|
|
|
|
QScopedPointer<xcb_key_symbols_t, KeySymbolsDeleter> symbols(xcb_key_symbols_alloc(connection()));
|
|
|
|
if (symbols.isNull() || !keys) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
const auto keymap = keys->keys;
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
for (int iKeySym = 0; iKeySym < nKeySyms; iKeySym++) {
|
2007-04-29 17:35:43 +00:00
|
|
|
uint keySymX = keySyms[ iKeySym ];
|
2015-02-06 14:17:56 +00:00
|
|
|
xcb_keycode_t *keyCodes = xcb_key_symbols_get_keycode(symbols.data(), keySymX);
|
|
|
|
if (!keyCodes) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
xcb_keycode_t keyCodeX = keyCodes[0];
|
|
|
|
free(keyCodes);
|
|
|
|
if (keyCodeX == XCB_NO_SYMBOL) {
|
|
|
|
continue;
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
int i = keyCodeX / 8;
|
|
|
|
char mask = 1 << (keyCodeX - (i * 8));
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
// Abort if bad index value,
|
|
|
|
if (i < 0 || i >= 32)
|
|
|
|
return false;
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2015-07-31 11:03:35 +00:00
|
|
|
qCDebug(KWIN_TABBOX) << iKeySym << ": keySymX=0x" << QString::number(keySymX, 16)
|
2011-01-30 14:34:42 +00:00
|
|
|
<< " i=" << i << " mask=0x" << QString::number(mask, 16)
|
2015-07-20 11:35:45 +00:00
|
|
|
<< " keymap[i]=0x" << QString::number(keymap[i], 16);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
// If ALL keys passed need to be depressed,
|
|
|
|
if (bAll) {
|
|
|
|
if ((keymap[i] & mask) == 0)
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
// If we are looking for ANY key press, and this key is depressed,
|
|
|
|
if (keymap[i] & mask)
|
|
|
|
return true;
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
// If we were looking for ANY key press, then none was found, return false,
|
|
|
|
// If we were looking for ALL key presses, then all were found, return true.
|
2007-04-29 17:35:43 +00:00
|
|
|
return bAll;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2015-08-24 09:43:39 +00:00
|
|
|
static bool areModKeysDepressedX11(const QKeySequence &seq)
|
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
uint rgKeySyms[10];
|
|
|
|
int nKeySyms = 0;
|
|
|
|
int mod = seq[seq.count()-1] & Qt::KeyboardModifierMask;
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
if (mod & Qt::SHIFT) {
|
2007-04-29 17:35:43 +00:00
|
|
|
rgKeySyms[nKeySyms++] = XK_Shift_L;
|
|
|
|
rgKeySyms[nKeySyms++] = XK_Shift_R;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
|
|
|
if (mod & Qt::CTRL) {
|
2007-04-29 17:35:43 +00:00
|
|
|
rgKeySyms[nKeySyms++] = XK_Control_L;
|
|
|
|
rgKeySyms[nKeySyms++] = XK_Control_R;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
|
|
|
if (mod & Qt::ALT) {
|
2007-04-30 11:36:55 +00:00
|
|
|
rgKeySyms[nKeySyms++] = XK_Alt_L;
|
|
|
|
rgKeySyms[nKeySyms++] = XK_Alt_R;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
|
|
|
if (mod & Qt::META) {
|
2007-04-30 11:36:55 +00:00
|
|
|
// It would take some code to determine whether the Win key
|
|
|
|
// is associated with Super or Meta, so check for both.
|
|
|
|
// See bug #140023 for details.
|
|
|
|
rgKeySyms[nKeySyms++] = XK_Super_L;
|
|
|
|
rgKeySyms[nKeySyms++] = XK_Super_R;
|
|
|
|
rgKeySyms[nKeySyms++] = XK_Meta_L;
|
|
|
|
rgKeySyms[nKeySyms++] = XK_Meta_R;
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
return areKeySymXsDepressed(false, rgKeySyms, nKeySyms);
|
|
|
|
}
|
|
|
|
|
2015-08-24 09:43:39 +00:00
|
|
|
static bool areModKeysDepressedWayland(const QKeySequence &seq)
|
|
|
|
{
|
|
|
|
const int mod = seq[seq.count()-1] & Qt::KeyboardModifierMask;
|
2016-09-14 11:19:43 +00:00
|
|
|
const Qt::KeyboardModifiers mods = input()->keyboard()->xkb()->modifiersRelevantForGlobalShortcuts();
|
2015-08-24 09:43:39 +00:00
|
|
|
if ((mod & Qt::SHIFT) && mods.testFlag(Qt::ShiftModifier)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if ((mod & Qt::CTRL) && mods.testFlag(Qt::ControlModifier)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if ((mod & Qt::ALT) && mods.testFlag(Qt::AltModifier)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if ((mod & Qt::META) && mods.testFlag(Qt::MetaModifier)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool areModKeysDepressed(const QKeySequence& seq) {
|
|
|
|
if (seq.isEmpty())
|
|
|
|
return false;
|
|
|
|
if (kwinApp()->shouldUseWaylandForCompositing()) {
|
|
|
|
return areModKeysDepressedWayland(seq);
|
|
|
|
} else {
|
|
|
|
return areModKeysDepressedX11(seq);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-06 12:57:33 +00:00
|
|
|
void TabBox::navigatingThroughWindows(bool forward, const QKeySequence &shortcut, TabBoxMode mode)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2013-02-12 23:40:11 +00:00
|
|
|
if (!m_ready || isGrabbed() || !Workspace::self()->isOnCurrentHead()) {
|
2007-04-29 17:35:43 +00:00
|
|
|
return;
|
2013-02-12 23:40:11 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
if (!options->focusPolicyIsReasonable()) {
|
2007-04-29 17:35:43 +00:00
|
|
|
//ungrabXKeyboard(); // need that because of accelerator raw mode
|
|
|
|
// CDE style raise / lower
|
2011-01-30 14:34:42 +00:00
|
|
|
CDEWalkThroughWindows(forward);
|
|
|
|
} else {
|
|
|
|
if (areModKeysDepressed(shortcut)) {
|
|
|
|
if (startKDEWalkThroughWindows(mode))
|
|
|
|
KDEWalkThroughWindows(forward);
|
|
|
|
} else
|
2007-04-29 17:35:43 +00:00
|
|
|
// if the shortcut has no modifiers, don't show the tabbox,
|
|
|
|
// don't grab, but simply go to the next window
|
2011-01-30 14:34:42 +00:00
|
|
|
KDEOneStepThroughWindows(forward, mode);
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-06-25 16:05:07 +00:00
|
|
|
void TabBox::slotWalkThroughWindows()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2011-06-25 16:05:07 +00:00
|
|
|
navigatingThroughWindows(true, m_cutWalkThroughWindows, TabBoxWindowsMode);
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2009-09-13 11:36:45 +00:00
|
|
|
|
2011-06-25 16:05:07 +00:00
|
|
|
void TabBox::slotWalkBackThroughWindows()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2011-06-25 16:05:07 +00:00
|
|
|
navigatingThroughWindows(false, m_cutWalkThroughWindowsReverse, TabBoxWindowsMode);
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2009-09-13 11:36:45 +00:00
|
|
|
|
2011-06-25 16:05:07 +00:00
|
|
|
void TabBox::slotWalkThroughWindowsAlternative()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2011-06-25 16:05:07 +00:00
|
|
|
navigatingThroughWindows(true, m_cutWalkThroughWindowsAlternative, TabBoxWindowsAlternativeMode);
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2009-09-13 11:36:45 +00:00
|
|
|
|
2011-06-25 16:05:07 +00:00
|
|
|
void TabBox::slotWalkBackThroughWindowsAlternative()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2011-06-25 16:05:07 +00:00
|
|
|
navigatingThroughWindows(false, m_cutWalkThroughWindowsAlternativeReverse, TabBoxWindowsAlternativeMode);
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2012-04-25 20:57:48 +00:00
|
|
|
void TabBox::slotWalkThroughCurrentAppWindows()
|
|
|
|
{
|
|
|
|
navigatingThroughWindows(true, m_cutWalkThroughCurrentAppWindows, TabBoxCurrentAppWindowsMode);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TabBox::slotWalkBackThroughCurrentAppWindows()
|
|
|
|
{
|
|
|
|
navigatingThroughWindows(false, m_cutWalkThroughCurrentAppWindowsReverse, TabBoxCurrentAppWindowsMode);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TabBox::slotWalkThroughCurrentAppWindowsAlternative()
|
|
|
|
{
|
|
|
|
navigatingThroughWindows(true, m_cutWalkThroughCurrentAppWindowsAlternative, TabBoxCurrentAppWindowsAlternativeMode);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TabBox::slotWalkBackThroughCurrentAppWindowsAlternative()
|
|
|
|
{
|
|
|
|
navigatingThroughWindows(false, m_cutWalkThroughCurrentAppWindowsAlternativeReverse, TabBoxCurrentAppWindowsAlternativeMode);
|
|
|
|
}
|
|
|
|
|
2011-06-25 16:05:07 +00:00
|
|
|
void TabBox::slotWalkThroughDesktops()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2013-02-12 23:40:11 +00:00
|
|
|
if (!m_ready || isGrabbed() || !Workspace::self()->isOnCurrentHead()) {
|
2011-07-09 08:32:26 +00:00
|
|
|
return;
|
|
|
|
}
|
2011-06-25 16:05:07 +00:00
|
|
|
if (areModKeysDepressed(m_cutWalkThroughDesktops)) {
|
2011-01-30 14:34:42 +00:00
|
|
|
if (startWalkThroughDesktops())
|
|
|
|
walkThroughDesktops(true);
|
|
|
|
} else {
|
|
|
|
oneStepThroughDesktops(true);
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-06-25 16:05:07 +00:00
|
|
|
void TabBox::slotWalkBackThroughDesktops()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2013-02-12 23:40:11 +00:00
|
|
|
if (!m_ready || isGrabbed() || !Workspace::self()->isOnCurrentHead()) {
|
2011-07-09 08:32:26 +00:00
|
|
|
return;
|
|
|
|
}
|
2011-06-25 16:05:07 +00:00
|
|
|
if (areModKeysDepressed(m_cutWalkThroughDesktopsReverse)) {
|
2011-01-30 14:34:42 +00:00
|
|
|
if (startWalkThroughDesktops())
|
|
|
|
walkThroughDesktops(false);
|
|
|
|
} else {
|
|
|
|
oneStepThroughDesktops(false);
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-06-25 16:05:07 +00:00
|
|
|
void TabBox::slotWalkThroughDesktopList()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2013-02-12 23:40:11 +00:00
|
|
|
if (!m_ready || isGrabbed() || !Workspace::self()->isOnCurrentHead()) {
|
2011-07-09 08:32:26 +00:00
|
|
|
return;
|
|
|
|
}
|
2011-06-25 16:05:07 +00:00
|
|
|
if (areModKeysDepressed(m_cutWalkThroughDesktopList)) {
|
2011-01-30 14:34:42 +00:00
|
|
|
if (startWalkThroughDesktopList())
|
|
|
|
walkThroughDesktops(true);
|
|
|
|
} else {
|
|
|
|
oneStepThroughDesktopList(true);
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-06-25 16:05:07 +00:00
|
|
|
void TabBox::slotWalkBackThroughDesktopList()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2013-02-12 23:40:11 +00:00
|
|
|
if (!m_ready || isGrabbed() || !Workspace::self()->isOnCurrentHead()) {
|
2011-07-09 08:32:26 +00:00
|
|
|
return;
|
|
|
|
}
|
2011-06-25 16:05:07 +00:00
|
|
|
if (areModKeysDepressed(m_cutWalkThroughDesktopListReverse)) {
|
2011-01-30 14:34:42 +00:00
|
|
|
if (startWalkThroughDesktopList())
|
|
|
|
walkThroughDesktops(false);
|
|
|
|
} else {
|
|
|
|
oneStepThroughDesktopList(false);
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2015-03-12 11:26:01 +00:00
|
|
|
void TabBox::shadeActivate(AbstractClient *c)
|
2015-02-06 22:10:59 +00:00
|
|
|
{
|
|
|
|
if ((c->shadeMode() == ShadeNormal || c->shadeMode() == ShadeHover) && options->isShadeHover())
|
|
|
|
c->setShade(ShadeActivated);
|
|
|
|
}
|
|
|
|
|
2013-03-08 19:17:55 +00:00
|
|
|
bool TabBox::toggle(ElectricBorder eb)
|
|
|
|
{
|
|
|
|
if (!options->focusPolicyIsReasonable())
|
|
|
|
return false; // not supported.
|
|
|
|
if (isDisplayed()) {
|
|
|
|
accept();
|
|
|
|
return true;
|
|
|
|
}
|
2014-08-11 10:35:14 +00:00
|
|
|
if (!establishTabBoxGrab())
|
2013-03-08 19:17:55 +00:00
|
|
|
return false;
|
|
|
|
m_noModifierGrab = m_tabGrab = true;
|
|
|
|
if (m_borderAlternativeActivate.contains(eb))
|
|
|
|
setMode(TabBoxWindowsAlternativeMode);
|
|
|
|
else
|
|
|
|
setMode(TabBoxWindowsMode);
|
|
|
|
reset();
|
|
|
|
show();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2011-06-25 16:05:07 +00:00
|
|
|
bool TabBox::startKDEWalkThroughWindows(TabBoxMode mode)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
if (!establishTabBoxGrab())
|
2007-04-29 17:35:43 +00:00
|
|
|
return false;
|
2011-06-25 16:05:07 +00:00
|
|
|
m_tabGrab = true;
|
2011-08-21 08:44:09 +00:00
|
|
|
m_noModifierGrab = false;
|
2011-06-25 16:05:07 +00:00
|
|
|
setMode(mode);
|
|
|
|
reset();
|
2007-04-29 17:35:43 +00:00
|
|
|
return true;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-06-25 16:05:07 +00:00
|
|
|
bool TabBox::startWalkThroughDesktops(TabBoxMode mode)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
if (!establishTabBoxGrab())
|
2007-04-29 17:35:43 +00:00
|
|
|
return false;
|
2011-06-25 16:05:07 +00:00
|
|
|
m_desktopGrab = true;
|
2011-08-21 08:44:09 +00:00
|
|
|
m_noModifierGrab = false;
|
2011-06-25 16:05:07 +00:00
|
|
|
setMode(mode);
|
|
|
|
reset();
|
2007-04-29 17:35:43 +00:00
|
|
|
return true;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-06-25 16:05:07 +00:00
|
|
|
bool TabBox::startWalkThroughDesktops()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
return startWalkThroughDesktops(TabBoxDesktopMode);
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-06-25 16:05:07 +00:00
|
|
|
bool TabBox::startWalkThroughDesktopList()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
return startWalkThroughDesktops(TabBoxDesktopListMode);
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-06-25 16:05:07 +00:00
|
|
|
void TabBox::KDEWalkThroughWindows(bool forward)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2011-06-25 16:05:07 +00:00
|
|
|
nextPrev(forward);
|
|
|
|
delayedShow();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-06-25 16:05:07 +00:00
|
|
|
void TabBox::walkThroughDesktops(bool forward)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2011-06-25 16:05:07 +00:00
|
|
|
nextPrev(forward);
|
|
|
|
delayedShow();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-06-25 16:05:07 +00:00
|
|
|
void TabBox::CDEWalkThroughWindows(bool forward)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2014-02-24 15:42:43 +00:00
|
|
|
Client* c = nullptr;
|
2007-04-29 17:35:43 +00:00
|
|
|
// this function find the first suitable client for unreasonable focus
|
|
|
|
// policies - the topmost one, with some exceptions (can't be keepabove/below,
|
|
|
|
// otherwise it gets stuck on them)
|
2011-06-25 16:05:07 +00:00
|
|
|
// Q_ASSERT(Workspace::self()->block_stacking_updates == 0);
|
|
|
|
for (int i = Workspace::self()->stackingOrder().size() - 1;
|
2011-01-30 14:34:42 +00:00
|
|
|
i >= 0 ;
|
|
|
|
--i) {
|
2012-04-08 08:07:35 +00:00
|
|
|
Client* it = qobject_cast<Client*>(Workspace::self()->stackingOrder().at(i));
|
|
|
|
if (it && it->isOnCurrentActivity() && it->isOnCurrentDesktop() && !it->isSpecialWindow()
|
2011-01-30 14:34:42 +00:00
|
|
|
&& it->isShown(false) && it->wantsTabFocus()
|
|
|
|
&& !it->keepAbove() && !it->keepBelow()) {
|
2007-04-29 17:35:43 +00:00
|
|
|
c = it;
|
|
|
|
break;
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
Client* nc = c;
|
|
|
|
bool options_traverse_all;
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2016-01-29 10:24:18 +00:00
|
|
|
KConfigGroup group(kwinApp()->config(), "TabBox");
|
2011-01-30 14:34:42 +00:00
|
|
|
options_traverse_all = group.readEntry("TraverseAll", false);
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2014-02-24 15:42:43 +00:00
|
|
|
Client* firstClient = nullptr;
|
2011-01-30 14:34:42 +00:00
|
|
|
do {
|
2007-04-29 17:35:43 +00:00
|
|
|
nc = forward ? nextClientStatic(nc) : previousClientStatic(nc);
|
2011-01-30 14:34:42 +00:00
|
|
|
if (!firstClient) {
|
2007-04-29 17:35:43 +00:00
|
|
|
// When we see our first client for the second time,
|
|
|
|
// it's time to stop.
|
|
|
|
firstClient = nc;
|
2011-01-30 14:34:42 +00:00
|
|
|
} else if (nc == firstClient) {
|
2007-04-29 17:35:43 +00:00
|
|
|
// No candidates found.
|
2014-02-24 15:42:43 +00:00
|
|
|
nc = nullptr;
|
2007-04-29 17:35:43 +00:00
|
|
|
break;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
|
|
|
} while (nc && nc != c &&
|
|
|
|
((!options_traverse_all && !nc->isOnDesktop(currentDesktop())) ||
|
|
|
|
nc->isMinimized() || !nc->wantsTabFocus() || nc->keepAbove() || nc->keepBelow() || !nc->isOnCurrentActivity()));
|
|
|
|
if (nc) {
|
2007-04-29 17:35:43 +00:00
|
|
|
if (c && c != nc)
|
2011-06-25 16:05:07 +00:00
|
|
|
Workspace::self()->lowerClient(c);
|
2011-01-30 14:34:42 +00:00
|
|
|
if (options->focusPolicyIsReasonable()) {
|
2011-06-25 16:05:07 +00:00
|
|
|
Workspace::self()->activateClient(nc);
|
2015-02-06 22:10:59 +00:00
|
|
|
shadeActivate(nc);
|
2011-01-30 14:34:42 +00:00
|
|
|
} else {
|
|
|
|
if (!nc->isOnDesktop(currentDesktop()))
|
|
|
|
setCurrentDesktop(nc->desktop());
|
2011-06-25 16:05:07 +00:00
|
|
|
Workspace::self()->raiseClient(nc);
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-06-25 16:05:07 +00:00
|
|
|
void TabBox::KDEOneStepThroughWindows(bool forward, TabBoxMode mode)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2011-06-25 16:05:07 +00:00
|
|
|
setMode(mode);
|
|
|
|
reset();
|
|
|
|
nextPrev(forward);
|
2015-03-12 11:28:20 +00:00
|
|
|
if (AbstractClient* c = currentClient()) {
|
2011-06-25 16:05:07 +00:00
|
|
|
Workspace::self()->activateClient(c);
|
2015-02-06 22:10:59 +00:00
|
|
|
shadeActivate(c);
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-06-25 16:05:07 +00:00
|
|
|
void TabBox::oneStepThroughDesktops(bool forward, TabBoxMode mode)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2011-06-25 16:05:07 +00:00
|
|
|
setMode(mode);
|
|
|
|
reset();
|
|
|
|
nextPrev(forward);
|
|
|
|
if (currentDesktop() != -1)
|
|
|
|
setCurrentDesktop(currentDesktop());
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-06-25 16:05:07 +00:00
|
|
|
void TabBox::oneStepThroughDesktops(bool forward)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
oneStepThroughDesktops(forward, TabBoxDesktopMode);
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-06-25 16:05:07 +00:00
|
|
|
void TabBox::oneStepThroughDesktopList(bool forward)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
oneStepThroughDesktops(forward, TabBoxDesktopListMode);
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
Handles holding alt-tab / control-tab
|
|
|
|
*/
|
2011-06-25 16:05:07 +00:00
|
|
|
void TabBox::keyPress(int keyQt)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2015-09-25 06:49:44 +00:00
|
|
|
enum Direction { Backward = -1, Steady = 0, Forward = 1 };
|
|
|
|
Direction direction(Steady);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-09-06 12:57:33 +00:00
|
|
|
auto contains = [](const QKeySequence &shortcut, int key) -> bool {
|
|
|
|
for (int i = 0; i < shortcut.count(); ++i) {
|
|
|
|
if (shortcut[i] == key) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
};
|
2015-09-25 06:49:44 +00:00
|
|
|
|
|
|
|
// tests whether a shortcut matches and handles pitfalls on ShiftKey invocation
|
|
|
|
auto directionFor = [keyQt, contains](const QKeySequence &forward, const QKeySequence &backward) -> Direction {
|
|
|
|
if (contains(forward, keyQt))
|
|
|
|
return Forward;
|
|
|
|
if (contains(backward, keyQt))
|
|
|
|
return Backward;
|
|
|
|
if (!(keyQt & Qt::ShiftModifier))
|
|
|
|
return Steady;
|
|
|
|
|
|
|
|
// Before testing the unshifted key (Ctrl+A vs. Ctrl+Shift+a etc.), see whether this is +Shift+Tab
|
|
|
|
// and check that against +Shift+Backtab (as well)
|
|
|
|
Qt::KeyboardModifiers mods = Qt::ShiftModifier|Qt::ControlModifier|Qt::AltModifier|Qt::MetaModifier|Qt::KeypadModifier|Qt::GroupSwitchModifier;
|
|
|
|
mods &= keyQt;
|
2013-09-26 07:31:23 +00:00
|
|
|
if ((keyQt & ~mods) == Qt::Key_Tab) {
|
2015-09-25 06:49:44 +00:00
|
|
|
if (contains(forward, mods | Qt::Key_Backtab))
|
|
|
|
return Forward;
|
|
|
|
if (contains(backward, mods | Qt::Key_Backtab))
|
|
|
|
return Backward;
|
2013-09-26 07:31:23 +00:00
|
|
|
}
|
2015-09-25 06:49:44 +00:00
|
|
|
|
|
|
|
// if the shortcuts do not match, try matching again after filtering the shift key from keyQt
|
|
|
|
// it is needed to handle correctly the ALT+~ shorcut for example as it is coded as ALT+SHIFT+~ in keyQt
|
|
|
|
if (contains(forward, keyQt & ~Qt::ShiftModifier))
|
|
|
|
return Forward;
|
|
|
|
if (contains(backward, keyQt & ~Qt::ShiftModifier))
|
|
|
|
return Backward;
|
|
|
|
|
|
|
|
return Steady;
|
2013-09-26 07:31:23 +00:00
|
|
|
};
|
2013-09-06 12:57:33 +00:00
|
|
|
|
2011-06-25 16:05:07 +00:00
|
|
|
if (m_tabGrab) {
|
2015-09-25 06:49:44 +00:00
|
|
|
static const int ModeCount = 4;
|
|
|
|
static const TabBoxMode modes[ModeCount] = {
|
|
|
|
TabBoxWindowsMode, TabBoxWindowsAlternativeMode,
|
|
|
|
TabBoxCurrentAppWindowsMode, TabBoxCurrentAppWindowsAlternativeMode
|
|
|
|
};
|
|
|
|
static const QKeySequence cuts[2*ModeCount] = {
|
|
|
|
// forward
|
|
|
|
m_cutWalkThroughWindows, m_cutWalkThroughWindowsAlternative,
|
|
|
|
m_cutWalkThroughCurrentAppWindows, m_cutWalkThroughCurrentAppWindowsAlternative,
|
|
|
|
// backward
|
|
|
|
m_cutWalkThroughWindowsReverse, m_cutWalkThroughWindowsAlternativeReverse,
|
|
|
|
m_cutWalkThroughCurrentAppWindowsReverse, m_cutWalkThroughCurrentAppWindowsAlternativeReverse
|
|
|
|
};
|
|
|
|
bool testedCurrent = false; // in case of collision, prefer to stay in the current mode
|
|
|
|
int i = 0, j = 0;
|
|
|
|
while (true) {
|
|
|
|
if (!testedCurrent && modes[i] != mode()) {
|
|
|
|
++j;
|
|
|
|
i = (i+1) % ModeCount;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (testedCurrent && modes[i] == mode()) {
|
2012-04-25 20:57:48 +00:00
|
|
|
break;
|
2015-09-25 06:49:44 +00:00
|
|
|
}
|
|
|
|
testedCurrent = true;
|
|
|
|
direction = directionFor(cuts[i], cuts[i+ModeCount]);
|
|
|
|
if (direction != Steady) {
|
|
|
|
if (modes[i] != mode()) {
|
|
|
|
accept(false);
|
|
|
|
setMode(modes[i]);
|
|
|
|
auto replayWithChangedTabboxMode = [this, direction]() {
|
|
|
|
reset();
|
|
|
|
nextPrev(direction == Forward);
|
|
|
|
};
|
|
|
|
QTimer::singleShot(50, this, replayWithChangedTabboxMode);
|
|
|
|
}
|
2012-04-25 20:57:48 +00:00
|
|
|
break;
|
2015-09-25 06:49:44 +00:00
|
|
|
} else if (++j > ModeCount) { // guarding counter for invalid modes
|
2015-07-31 11:03:35 +00:00
|
|
|
qCDebug(KWIN_TABBOX) << "Invalid TabBoxMode";
|
2012-04-25 20:57:48 +00:00
|
|
|
return;
|
2012-11-23 21:05:31 +00:00
|
|
|
}
|
2015-09-25 06:49:44 +00:00
|
|
|
i = (i+1) % ModeCount;
|
2012-04-25 20:57:48 +00:00
|
|
|
}
|
2015-09-25 06:49:44 +00:00
|
|
|
if (direction != Steady) {
|
|
|
|
qCDebug(KWIN_TABBOX) << "== " << cuts[i].toString() << " or " << cuts[i+ModeCount].toString();
|
|
|
|
KDEWalkThroughWindows(direction == Forward);
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
2011-06-25 16:05:07 +00:00
|
|
|
} else if (m_desktopGrab) {
|
2015-09-25 06:49:44 +00:00
|
|
|
direction = directionFor(m_cutWalkThroughDesktops, m_cutWalkThroughDesktopsReverse);
|
|
|
|
if (direction == Steady)
|
|
|
|
direction = directionFor(m_cutWalkThroughDesktopList, m_cutWalkThroughDesktopListReverse);
|
|
|
|
if (direction != Steady)
|
|
|
|
walkThroughDesktops(direction == Forward);
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-06-25 16:05:07 +00:00
|
|
|
if (m_desktopGrab || m_tabGrab) {
|
2015-09-25 06:49:44 +00:00
|
|
|
if (((keyQt & ~Qt::KeyboardModifierMask) == Qt::Key_Escape) && direction == Steady) {
|
2011-01-30 14:34:42 +00:00
|
|
|
// if Escape is part of the shortcut, don't cancel
|
2011-06-25 16:05:07 +00:00
|
|
|
close(true);
|
2015-09-25 06:49:44 +00:00
|
|
|
} else if (direction == Steady) {
|
2011-01-30 14:34:42 +00:00
|
|
|
QKeyEvent* event = new QKeyEvent(QEvent::KeyPress, keyQt & ~Qt::KeyboardModifierMask, Qt::NoModifier);
|
2011-06-25 16:05:07 +00:00
|
|
|
grabbedKeyEvent(event);
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-06-25 16:05:07 +00:00
|
|
|
void TabBox::close(bool abort)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2011-08-21 09:14:34 +00:00
|
|
|
if (isGrabbed()) {
|
|
|
|
removeTabBoxGrab();
|
2011-08-21 08:44:09 +00:00
|
|
|
}
|
2011-06-25 16:05:07 +00:00
|
|
|
hide(abort);
|
|
|
|
m_tabGrab = false;
|
|
|
|
m_desktopGrab = false;
|
2011-08-21 08:44:09 +00:00
|
|
|
m_noModifierGrab = false;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2015-09-25 06:49:44 +00:00
|
|
|
void TabBox::accept(bool closeTabBox)
|
2011-12-02 09:31:52 +00:00
|
|
|
{
|
2015-03-12 11:28:20 +00:00
|
|
|
AbstractClient *c = currentClient();
|
2015-09-25 06:49:44 +00:00
|
|
|
if (closeTabBox)
|
|
|
|
close();
|
2011-12-02 09:31:52 +00:00
|
|
|
if (c) {
|
|
|
|
Workspace::self()->activateClient(c);
|
2015-02-06 22:10:59 +00:00
|
|
|
shadeActivate(c);
|
2011-12-02 09:31:52 +00:00
|
|
|
if (c->isDesktop())
|
|
|
|
Workspace::self()->setShowingDesktop(!Workspace::self()->showingDesktop());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
/*!
|
|
|
|
Handles alt-tab / control-tab releasing
|
|
|
|
*/
|
2013-07-26 08:04:53 +00:00
|
|
|
void TabBox::keyRelease(const xcb_key_release_event_t *ev)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2011-08-21 08:44:09 +00:00
|
|
|
if (m_noModifierGrab) {
|
|
|
|
return;
|
|
|
|
}
|
2013-07-26 08:04:53 +00:00
|
|
|
unsigned int mk = ev->state &
|
2011-01-30 14:34:42 +00:00
|
|
|
(KKeyServer::modXShift() |
|
|
|
|
KKeyServer::modXCtrl() |
|
|
|
|
KKeyServer::modXAlt() |
|
|
|
|
KKeyServer::modXMeta());
|
2007-04-29 17:35:43 +00:00
|
|
|
// ev.state is state before the key release, so just checking mk being 0 isn't enough
|
|
|
|
// using XQueryPointer() also doesn't seem to work well, so the check that all
|
|
|
|
// modifiers are released: only one modifier is active and the currently released
|
|
|
|
// key is this modifier - if yes, release the grab
|
|
|
|
int mod_index = -1;
|
2013-07-26 08:04:53 +00:00
|
|
|
for (int i = XCB_MAP_INDEX_SHIFT;
|
|
|
|
i <= XCB_MAP_INDEX_5;
|
2011-01-30 14:34:42 +00:00
|
|
|
++i)
|
|
|
|
if ((mk & (1 << i)) != 0) {
|
|
|
|
if (mod_index >= 0)
|
|
|
|
return;
|
|
|
|
mod_index = i;
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
bool release = false;
|
2011-01-30 14:34:42 +00:00
|
|
|
if (mod_index == -1)
|
2007-04-29 17:35:43 +00:00
|
|
|
release = true;
|
2011-01-30 14:34:42 +00:00
|
|
|
else {
|
2015-02-06 14:17:56 +00:00
|
|
|
Xcb::ModifierMapping xmk;
|
|
|
|
if (xmk) {
|
|
|
|
xcb_keycode_t *keycodes = xmk.keycodes();
|
|
|
|
const int maxIndex = xmk.size();
|
|
|
|
for (int i = 0; i < xmk->keycodes_per_modifier; ++i) {
|
|
|
|
const int index = xmk->keycodes_per_modifier * mod_index + i;
|
|
|
|
if (index >= maxIndex) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (keycodes[index] == ev->detail) {
|
|
|
|
release = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
|
|
|
if (!release)
|
|
|
|
return;
|
2011-06-25 16:05:07 +00:00
|
|
|
if (m_tabGrab) {
|
|
|
|
bool old_control_grab = m_desktopGrab;
|
2011-12-02 09:31:52 +00:00
|
|
|
accept();
|
2011-06-25 16:05:07 +00:00
|
|
|
m_desktopGrab = old_control_grab;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2011-06-25 16:05:07 +00:00
|
|
|
if (m_desktopGrab) {
|
|
|
|
bool old_tab_grab = m_tabGrab;
|
|
|
|
int desktop = currentDesktop();
|
|
|
|
close();
|
|
|
|
m_tabGrab = old_tab_grab;
|
2011-01-30 14:34:42 +00:00
|
|
|
if (desktop != -1) {
|
|
|
|
setCurrentDesktop(desktop);
|
2012-11-16 07:23:47 +00:00
|
|
|
VirtualDesktopManager::self()->setCurrent(desktop);
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2016-09-14 11:19:43 +00:00
|
|
|
void TabBox::modifiersReleased()
|
2013-07-10 11:20:43 +00:00
|
|
|
{
|
2016-09-14 11:19:43 +00:00
|
|
|
if (m_noModifierGrab) {
|
2013-07-10 11:20:43 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (m_tabGrab) {
|
|
|
|
bool old_control_grab = m_desktopGrab;
|
|
|
|
accept();
|
|
|
|
m_desktopGrab = old_control_grab;
|
|
|
|
}
|
|
|
|
if (m_desktopGrab) {
|
|
|
|
bool old_tab_grab = m_tabGrab;
|
|
|
|
int desktop = currentDesktop();
|
|
|
|
close();
|
|
|
|
m_tabGrab = old_tab_grab;
|
|
|
|
if (desktop != -1) {
|
|
|
|
setCurrentDesktop(desktop);
|
|
|
|
VirtualDesktopManager::self()->setCurrent(desktop);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-25 16:05:07 +00:00
|
|
|
int TabBox::nextDesktopStatic(int iDesktop) const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2012-11-16 07:23:47 +00:00
|
|
|
DesktopNext functor;
|
|
|
|
return functor(iDesktop, true);
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-06-25 16:05:07 +00:00
|
|
|
int TabBox::previousDesktopStatic(int iDesktop) const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2012-11-16 07:23:47 +00:00
|
|
|
DesktopPrevious functor;
|
|
|
|
return functor(iDesktop, true);
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
/*!
|
2008-09-25 17:51:35 +00:00
|
|
|
auxiliary functions to travers all clients according to the static
|
2007-04-29 17:35:43 +00:00
|
|
|
order. Useful for the CDE-style Alt-tab feature.
|
|
|
|
*/
|
2011-06-25 16:05:07 +00:00
|
|
|
Client* TabBox::nextClientStatic(Client* c) const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2011-06-25 16:05:07 +00:00
|
|
|
if (!c || Workspace::self()->clientList().isEmpty())
|
2007-04-29 17:35:43 +00:00
|
|
|
return 0;
|
2011-06-25 16:05:07 +00:00
|
|
|
int pos = Workspace::self()->clientList().indexOf(c);
|
2011-01-30 14:34:42 +00:00
|
|
|
if (pos == -1)
|
2011-06-25 16:05:07 +00:00
|
|
|
return Workspace::self()->clientList().first();
|
2007-04-29 17:35:43 +00:00
|
|
|
++pos;
|
2011-06-25 16:05:07 +00:00
|
|
|
if (pos == Workspace::self()->clientList().count())
|
|
|
|
return Workspace::self()->clientList().first();
|
|
|
|
return Workspace::self()->clientList()[ pos ];
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2011-06-25 16:05:07 +00:00
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
/*!
|
2008-09-25 17:51:35 +00:00
|
|
|
auxiliary functions to travers all clients according to the static
|
2007-04-29 17:35:43 +00:00
|
|
|
order. Useful for the CDE-style Alt-tab feature.
|
|
|
|
*/
|
2011-06-25 16:05:07 +00:00
|
|
|
Client* TabBox::previousClientStatic(Client* c) const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2011-06-25 16:05:07 +00:00
|
|
|
if (!c || Workspace::self()->clientList().isEmpty())
|
2007-04-29 17:35:43 +00:00
|
|
|
return 0;
|
2011-06-25 16:05:07 +00:00
|
|
|
int pos = Workspace::self()->clientList().indexOf(c);
|
2011-01-30 14:34:42 +00:00
|
|
|
if (pos == -1)
|
2011-06-25 16:05:07 +00:00
|
|
|
return Workspace::self()->clientList().last();
|
2011-01-30 14:34:42 +00:00
|
|
|
if (pos == 0)
|
2011-06-25 16:05:07 +00:00
|
|
|
return Workspace::self()->clientList().last();
|
2007-04-29 17:35:43 +00:00
|
|
|
--pos;
|
2011-06-25 16:05:07 +00:00
|
|
|
return Workspace::self()->clientList()[ pos ];
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-06-25 16:05:07 +00:00
|
|
|
bool TabBox::establishTabBoxGrab()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2015-08-24 09:44:05 +00:00
|
|
|
if (kwinApp()->shouldUseWaylandForCompositing()) {
|
|
|
|
m_forcedGlobalMouseGrab = true;
|
|
|
|
return true;
|
|
|
|
}
|
2013-11-13 08:25:47 +00:00
|
|
|
updateXTime();
|
2011-01-30 14:34:42 +00:00
|
|
|
if (!grabXKeyboard())
|
2007-04-29 17:35:43 +00:00
|
|
|
return false;
|
|
|
|
// Don't try to establish a global mouse grab using XGrabPointer, as that would prevent
|
|
|
|
// using Alt+Tab while DND (#44972). However force passive grabs on all windows
|
|
|
|
// in order to catch MouseRelease events and close the tabbox (#67416).
|
|
|
|
// All clients already have passive grabs in their wrapper windows, so check only
|
|
|
|
// the active client, which may not have it.
|
2011-06-25 16:05:07 +00:00
|
|
|
assert(!m_forcedGlobalMouseGrab);
|
|
|
|
m_forcedGlobalMouseGrab = true;
|
2015-03-12 14:01:08 +00:00
|
|
|
if (Workspace::self()->activeClient() != nullptr)
|
|
|
|
Workspace::self()->activeClient()->updateMouseGrab();
|
2007-04-29 17:35:43 +00:00
|
|
|
return true;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-06-25 16:05:07 +00:00
|
|
|
void TabBox::removeTabBoxGrab()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2015-08-24 09:44:05 +00:00
|
|
|
if (kwinApp()->shouldUseWaylandForCompositing()) {
|
|
|
|
m_forcedGlobalMouseGrab = false;
|
|
|
|
return;
|
|
|
|
}
|
2013-11-13 08:25:47 +00:00
|
|
|
updateXTime();
|
2007-04-29 17:35:43 +00:00
|
|
|
ungrabXKeyboard();
|
2011-06-25 16:05:07 +00:00
|
|
|
assert(m_forcedGlobalMouseGrab);
|
|
|
|
m_forcedGlobalMouseGrab = false;
|
2015-03-12 14:01:08 +00:00
|
|
|
if (Workspace::self()->activeClient() != nullptr)
|
|
|
|
Workspace::self()->activeClient()->updateMouseGrab();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2011-06-25 16:05:07 +00:00
|
|
|
} // namespace TabBox
|
2007-04-29 17:35:43 +00:00
|
|
|
} // namespace
|
|
|
|
|