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>
|
2009-02-14 15:40:52 +00:00
|
|
|
Copyright (C) 2009 Lucas Murray <lmurray@undefinedfire.com>
|
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
|
|
|
|
|
|
|
#ifndef KWIN_WORKSPACE_H
|
|
|
|
#define KWIN_WORKSPACE_H
|
|
|
|
|
2013-04-25 13:47:40 +00:00
|
|
|
// kwin
|
|
|
|
#include "sm.h"
|
2014-12-02 09:39:38 +00:00
|
|
|
#include "options.h"
|
2013-04-25 13:47:40 +00:00
|
|
|
#include "utils.h"
|
|
|
|
// Qt
|
2007-04-29 17:35:43 +00:00
|
|
|
#include <QTimer>
|
|
|
|
#include <QVector>
|
2013-08-05 07:42:10 +00:00
|
|
|
// std
|
|
|
|
#include <functional>
|
2017-06-21 19:10:12 +00:00
|
|
|
#include <memory>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2008-12-18 13:50:57 +00:00
|
|
|
// TODO: Cleanup the order of things in this .h file
|
|
|
|
|
2010-09-24 12:03:22 +00:00
|
|
|
class QStringList;
|
2007-04-29 17:35:43 +00:00
|
|
|
class KConfig;
|
2013-08-06 08:27:49 +00:00
|
|
|
class KConfigGroup;
|
2007-04-29 17:35:43 +00:00
|
|
|
class KStartupInfo;
|
|
|
|
class KStartupInfoId;
|
|
|
|
class KStartupInfoData;
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2013-04-30 11:06:46 +00:00
|
|
|
namespace Xcb
|
|
|
|
{
|
2017-06-21 19:10:12 +00:00
|
|
|
class Tree;
|
2013-04-30 11:06:46 +00:00
|
|
|
class Window;
|
|
|
|
}
|
|
|
|
|
2015-03-05 11:10:30 +00:00
|
|
|
class AbstractClient;
|
2009-09-13 11:36:45 +00:00
|
|
|
class Client;
|
2013-04-08 12:30:55 +00:00
|
|
|
class KillWindow;
|
2013-04-25 15:21:54 +00:00
|
|
|
class ShortcutDialog;
|
2012-08-19 10:00:53 +00:00
|
|
|
class UserActionsMenu;
|
2011-08-21 19:50:23 +00:00
|
|
|
class Compositor;
|
2014-09-02 16:46:07 +00:00
|
|
|
class X11EventFilter;
|
2014-03-20 08:19:53 +00:00
|
|
|
enum class Predicate;
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2015-02-20 08:33:36 +00:00
|
|
|
class KWIN_EXPORT Workspace : public QObject
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
Q_OBJECT
|
2011-01-30 14:34:42 +00:00
|
|
|
public:
|
2015-05-01 14:55:15 +00:00
|
|
|
explicit Workspace(const QString &sessionKey = QString());
|
2011-01-30 14:34:42 +00:00
|
|
|
virtual ~Workspace();
|
|
|
|
|
|
|
|
static Workspace* self() {
|
|
|
|
return _self;
|
|
|
|
}
|
|
|
|
|
2013-07-26 05:52:56 +00:00
|
|
|
bool workspaceEvent(xcb_generic_event_t*);
|
2011-01-30 14:34:42 +00:00
|
|
|
bool workspaceEvent(QEvent*);
|
|
|
|
|
|
|
|
bool hasClient(const Client*);
|
2015-03-05 11:41:15 +00:00
|
|
|
bool hasClient(const AbstractClient*);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2014-03-20 08:19:53 +00:00
|
|
|
/**
|
|
|
|
* @brief Finds the first Client matching the condition expressed by passed in @p func.
|
|
|
|
*
|
|
|
|
* Internally findClient uses the std::find_if algorithm and that determines how the function
|
|
|
|
* needs to be implemented. An example usage for finding a Client with a matching windowId
|
|
|
|
* @code
|
|
|
|
* xcb_window_t w; // our test window
|
|
|
|
* Client *client = findClient([w](const Client *c) -> bool {
|
|
|
|
* return c->window() == w;
|
|
|
|
* });
|
|
|
|
* @endcode
|
|
|
|
*
|
|
|
|
* For the standard cases of matching the window id with one of the Client's windows use
|
|
|
|
* the simplified overload method findClient(Predicate, xcb_window_t). Above example
|
|
|
|
* can be simplified to:
|
|
|
|
* @code
|
|
|
|
* xcb_window_t w; // our test window
|
|
|
|
* Client *client = findClient(Predicate::WindowMatch, w);
|
|
|
|
* @endcode
|
|
|
|
*
|
|
|
|
* @param func Unary function that accepts a Client* as argument and
|
|
|
|
* returns a value convertible to bool. The value returned indicates whether the
|
|
|
|
* Client* is considered a match in the context of this function.
|
|
|
|
* The function shall not modify its argument.
|
|
|
|
* This can either be a function pointer or a function object.
|
|
|
|
* @return KWin::Client* The found Client or @c null
|
|
|
|
* @see findClient(Predicate, xcb_window_t)
|
|
|
|
*/
|
|
|
|
Client *findClient(std::function<bool (const Client*)> func) const;
|
2015-12-04 08:53:18 +00:00
|
|
|
AbstractClient *findAbstractClient(std::function<bool (const AbstractClient*)> func) const;
|
2014-03-20 08:19:53 +00:00
|
|
|
/**
|
|
|
|
* @brief Finds the Client matching the given match @p predicate for the given window.
|
|
|
|
*
|
|
|
|
* @param predicate Which window should be compared
|
|
|
|
* @param w The window id to test against
|
|
|
|
* @return KWin::Client* The found Client or @c null
|
|
|
|
* @see findClient(std::function<bool (const Client*)>)
|
|
|
|
*/
|
|
|
|
Client *findClient(Predicate predicate, xcb_window_t w) const;
|
2013-08-05 07:42:10 +00:00
|
|
|
void forEachClient(std::function<void (Client*)> func);
|
2015-12-17 14:49:32 +00:00
|
|
|
void forEachAbstractClient(std::function<void (AbstractClient*)> func);
|
2014-03-20 06:52:18 +00:00
|
|
|
Unmanaged *findUnmanaged(std::function<bool (const Unmanaged*)> func) const;
|
|
|
|
/**
|
|
|
|
* @brief Finds the Unmanaged with the given window id.
|
|
|
|
*
|
|
|
|
* @param w The window id to search for
|
|
|
|
* @return KWin::Unmanaged* Found Unmanaged or @c null if there is no Unmanaged with given Id.
|
|
|
|
*/
|
|
|
|
Unmanaged *findUnmanaged(xcb_window_t w) const;
|
2013-08-05 07:42:10 +00:00
|
|
|
void forEachUnmanaged(std::function<void (Unmanaged*)> func);
|
2015-02-09 15:07:30 +00:00
|
|
|
Toplevel *findToplevel(std::function<bool (const Toplevel*)> func) const;
|
2016-08-30 13:47:59 +00:00
|
|
|
/**
|
|
|
|
* Finds the Toplevel for the KWin internal window @p w.
|
|
|
|
* On Wayland this is normally a ShellClient. For X11 an Unmanaged.
|
|
|
|
**/
|
|
|
|
Toplevel *findToplevel(QWindow *w) const;
|
2016-03-04 08:42:33 +00:00
|
|
|
/**
|
|
|
|
* @brief Finds a Toplevel for the internal window @p w.
|
|
|
|
*
|
|
|
|
* Internal window means a window created by KWin itself. On X11 this is an Unmanaged
|
|
|
|
* and mapped by the window id, on Wayland a ShellClient mapped on the internal window id.
|
|
|
|
*
|
|
|
|
* @returns Toplevel
|
|
|
|
**/
|
|
|
|
Toplevel *findInternal(QWindow *w) const;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
QRect clientArea(clientAreaOption, const QPoint& p, int desktop) const;
|
2015-03-06 07:58:59 +00:00
|
|
|
QRect clientArea(clientAreaOption, const AbstractClient* c) const;
|
2011-01-30 14:34:42 +00:00
|
|
|
QRect clientArea(clientAreaOption, int screen, int desktop) const;
|
|
|
|
|
|
|
|
QRegion restrictedMoveArea(int desktop, StrutAreas areas = StrutAreaAll) const;
|
|
|
|
|
|
|
|
bool initializing() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the active client, i.e. the client that has the focus (or None
|
|
|
|
* if no client has the focus)
|
|
|
|
*/
|
2015-03-06 12:37:56 +00:00
|
|
|
AbstractClient* activeClient() const;
|
2011-01-30 14:34:42 +00:00
|
|
|
/**
|
|
|
|
* Client that was activated, but it's not yet really activeClient(), because
|
|
|
|
* we didn't process yet the matching FocusIn event. Used mostly in focus
|
|
|
|
* stealing prevention code.
|
|
|
|
*/
|
2015-03-12 10:56:55 +00:00
|
|
|
AbstractClient* mostRecentlyActivatedClient() const;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2016-02-18 09:28:00 +00:00
|
|
|
AbstractClient* clientUnderMouse(int screen) const;
|
2012-02-13 22:50:49 +00:00
|
|
|
|
2015-03-06 13:45:58 +00:00
|
|
|
void activateClient(AbstractClient*, bool force = false);
|
|
|
|
void requestFocus(AbstractClient* c, bool force = false);
|
2014-03-20 12:39:00 +00:00
|
|
|
enum ActivityFlag {
|
|
|
|
ActivityFocus = 1 << 0, // focus the window
|
|
|
|
ActivityFocusForce = 1 << 1 | ActivityFocus, // focus even if Dock etc.
|
|
|
|
ActivityRaise = 1 << 2 // raise the window
|
|
|
|
};
|
|
|
|
Q_DECLARE_FLAGS(ActivityFlags, ActivityFlag)
|
2015-03-06 14:04:59 +00:00
|
|
|
void takeActivity(AbstractClient* c, ActivityFlags flags);
|
2015-03-12 10:35:31 +00:00
|
|
|
bool allowClientActivation(const AbstractClient* c, xcb_timestamp_t time = -1U, bool focus_in = false,
|
2011-01-30 14:34:42 +00:00
|
|
|
bool ignore_desktop = false);
|
|
|
|
void restoreFocus();
|
2015-07-09 11:16:19 +00:00
|
|
|
void gotFocusIn(const AbstractClient*);
|
|
|
|
void setShouldGetFocus(AbstractClient*);
|
2015-04-30 11:47:44 +00:00
|
|
|
bool activateNextClient(AbstractClient* c);
|
2011-01-30 14:34:42 +00:00
|
|
|
bool focusChangeEnabled() {
|
|
|
|
return block_focus == 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates that the client c is being moved around by the user.
|
|
|
|
*/
|
2015-03-06 11:38:07 +00:00
|
|
|
void setClientIsMoving(AbstractClient* c);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2015-09-18 11:46:42 +00:00
|
|
|
QPoint adjustClientPosition(AbstractClient* c, QPoint pos, bool unrestricted, double snapAdjust = 1.0);
|
2015-09-18 12:05:19 +00:00
|
|
|
QRect adjustClientSize(AbstractClient* c, QRect moveResizeGeom, int mode);
|
2015-03-05 12:35:54 +00:00
|
|
|
void raiseClient(AbstractClient* c, bool nogroup = false);
|
|
|
|
void lowerClient(AbstractClient* c, bool nogroup = false);
|
2015-09-16 14:36:26 +00:00
|
|
|
void raiseClientRequest(AbstractClient* c, NET::RequestSource src = NET::FromApplication, xcb_timestamp_t timestamp = 0);
|
2013-04-30 14:01:25 +00:00
|
|
|
void lowerClientRequest(Client* c, NET::RequestSource src, xcb_timestamp_t timestamp);
|
2015-09-16 14:36:26 +00:00
|
|
|
void lowerClientRequest(AbstractClient* c);
|
2015-03-06 14:32:35 +00:00
|
|
|
void restackClientUnderActive(AbstractClient*);
|
2015-03-05 11:10:30 +00:00
|
|
|
void restack(AbstractClient *c, AbstractClient *under, bool force = false);
|
2015-03-13 08:26:09 +00:00
|
|
|
void updateClientLayer(AbstractClient* c);
|
2015-03-05 12:35:54 +00:00
|
|
|
void raiseOrLowerClient(AbstractClient*);
|
2011-01-30 14:34:42 +00:00
|
|
|
void resetUpdateToolWindowsTimer();
|
|
|
|
void restoreSessionStackingOrder(Client* c);
|
|
|
|
void updateStackingOrder(bool propagate_new_clients = false);
|
|
|
|
void forceRestacking();
|
|
|
|
|
2015-04-30 11:47:44 +00:00
|
|
|
void clientHidden(AbstractClient*);
|
2015-03-13 10:13:29 +00:00
|
|
|
void clientAttentionChanged(AbstractClient* c, bool set);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2011-02-27 08:25:45 +00:00
|
|
|
/**
|
|
|
|
* @return List of clients currently managed by Workspace
|
|
|
|
**/
|
|
|
|
const ClientList &clientList() const {
|
|
|
|
return clients;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @return List of unmanaged "clients" currently registered in Workspace
|
|
|
|
**/
|
|
|
|
const UnmanagedList &unmanagedList() const {
|
|
|
|
return unmanaged;
|
|
|
|
}
|
2011-08-21 19:50:23 +00:00
|
|
|
/**
|
|
|
|
* @return List of desktop "clients" currently managed by Workspace
|
|
|
|
**/
|
|
|
|
const ClientList &desktopList() const {
|
|
|
|
return desktops;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @return List of deleted "clients" currently managed by Workspace
|
|
|
|
**/
|
|
|
|
const DeletedList &deletedList() const {
|
|
|
|
return deleted;
|
|
|
|
}
|
2015-09-18 11:44:54 +00:00
|
|
|
/**
|
|
|
|
* @returns List of all clients (either X11 or Wayland) currently managed by Workspace
|
|
|
|
**/
|
|
|
|
const QList<AbstractClient*> allClientList() const {
|
|
|
|
return m_allClients;
|
|
|
|
}
|
2011-02-27 08:25:45 +00:00
|
|
|
|
2013-02-08 19:59:35 +00:00
|
|
|
void stackScreenEdgesUnderOverrideRedirect();
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
public:
|
2015-03-06 08:31:14 +00:00
|
|
|
QPoint cascadeOffset(const AbstractClient *c) const;
|
2012-08-25 16:20:34 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
private:
|
2011-08-21 19:50:23 +00:00
|
|
|
Compositor *m_compositor;
|
2011-04-28 09:16:27 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
//-------------------------------------------------
|
|
|
|
// Unsorted
|
|
|
|
|
|
|
|
public:
|
2013-02-12 23:40:11 +00:00
|
|
|
bool isOnCurrentHead();
|
2011-09-30 11:22:39 +00:00
|
|
|
// True when performing Workspace::updateClientArea().
|
|
|
|
// The calls below are valid only in that case.
|
|
|
|
bool inUpdateClientArea() const;
|
|
|
|
QRegion previousRestrictedMoveArea(int desktop, StrutAreas areas = StrutAreaAll) const;
|
|
|
|
QVector< QRect > previousScreenSizes() const;
|
2011-09-30 12:50:18 +00:00
|
|
|
int oldDisplayWidth() const;
|
|
|
|
int oldDisplayHeight() const;
|
2011-09-30 11:22:39 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
/**
|
|
|
|
* Returns the list of clients sorted in stacking order, with topmost client
|
|
|
|
* at the last position
|
|
|
|
*/
|
2012-04-08 08:07:35 +00:00
|
|
|
const ToplevelList& stackingOrder() const;
|
2011-01-30 14:34:42 +00:00
|
|
|
ToplevelList xStackingOrder() const;
|
|
|
|
ClientList ensureStackingOrder(const ClientList& clients) const;
|
2015-09-14 07:20:05 +00:00
|
|
|
QList<AbstractClient*> ensureStackingOrder(const QList<AbstractClient*> &clients) const;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2015-09-14 11:37:11 +00:00
|
|
|
AbstractClient* topClientOnDesktop(int desktop, int screen, bool unconstrained = false,
|
2011-01-30 14:34:42 +00:00
|
|
|
bool only_normal = true) const;
|
2015-09-14 11:31:41 +00:00
|
|
|
AbstractClient* findDesktop(bool topmost, int desktop) const;
|
2015-03-06 16:31:47 +00:00
|
|
|
void sendClientToDesktop(AbstractClient* c, int desktop, bool dont_activate);
|
2015-03-06 14:17:13 +00:00
|
|
|
void windowToPreviousDesktop(AbstractClient* c);
|
|
|
|
void windowToNextDesktop(AbstractClient* c);
|
2015-03-06 07:36:29 +00:00
|
|
|
void sendClientToScreen(AbstractClient* c, int screen);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Shows the menu operations menu for the client and makes it active if
|
|
|
|
* it's not already.
|
|
|
|
*/
|
2015-03-06 14:33:13 +00:00
|
|
|
void showWindowMenu(const QRect& pos, AbstractClient* cl);
|
2012-08-19 10:00:53 +00:00
|
|
|
const UserActionsMenu *userActionsMenu() const {
|
|
|
|
return m_userActionsMenu;
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2017-01-11 09:21:03 +00:00
|
|
|
void showApplicationMenu(const QRect &pos, AbstractClient *c, int actionId);
|
|
|
|
|
2015-09-14 08:55:27 +00:00
|
|
|
void updateMinimizedOfTransients(AbstractClient*);
|
2015-09-14 09:37:19 +00:00
|
|
|
void updateOnAllDesktopsOfTransients(AbstractClient*);
|
2013-04-30 13:41:59 +00:00
|
|
|
void checkTransients(xcb_window_t w);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
void storeSession(KConfig* config, SMSavePhase phase);
|
|
|
|
void storeClient(KConfigGroup &cg, int num, Client *c);
|
|
|
|
void storeSubSession(const QString &name, QSet<QByteArray> sessionIds);
|
2013-04-04 14:14:12 +00:00
|
|
|
void loadSubSessionInfo(const QString &name);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
SessionInfo* takeSessionInfo(Client*);
|
|
|
|
|
|
|
|
// D-Bus interface
|
2012-03-04 14:13:22 +00:00
|
|
|
QString supportInformation() const;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
void setCurrentScreen(int new_screen);
|
|
|
|
|
|
|
|
void setShowingDesktop(bool showing);
|
|
|
|
bool showingDesktop() const;
|
|
|
|
|
2013-04-30 13:41:59 +00:00
|
|
|
void sendPingToWindow(xcb_window_t w, xcb_timestamp_t timestamp); // Called from Client::pingWindow()
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2013-04-26 07:47:45 +00:00
|
|
|
void removeClient(Client*); // Only called from Client::destroyClient() or Client::releaseWindow()
|
2015-03-12 11:08:54 +00:00
|
|
|
void setActiveClient(AbstractClient*);
|
2013-04-30 13:41:59 +00:00
|
|
|
Group* findGroup(xcb_window_t leader) const;
|
2013-04-26 07:47:45 +00:00
|
|
|
void addGroup(Group* group);
|
|
|
|
void removeGroup(Group* group);
|
2011-01-30 14:34:42 +00:00
|
|
|
Group* findClientLeaderGroup(const Client* c) const;
|
|
|
|
|
2013-04-26 07:47:45 +00:00
|
|
|
void removeUnmanaged(Unmanaged*); // Only called from Unmanaged::release()
|
|
|
|
void removeDeleted(Deleted*);
|
|
|
|
void addDeleted(Deleted*, Toplevel*);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2013-04-30 13:41:59 +00:00
|
|
|
bool checkStartupNotification(xcb_window_t w, KStartupInfoId& id, KStartupInfoData& data);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
void focusToNull(); // SELI TODO: Public?
|
|
|
|
|
2017-07-21 18:22:56 +00:00
|
|
|
void clientShortcutUpdated(AbstractClient* c);
|
|
|
|
bool shortcutAvailable(const QKeySequence &cut, AbstractClient* ignore = NULL) const;
|
2011-01-30 14:34:42 +00:00
|
|
|
bool globalShortcutsDisabled() const;
|
|
|
|
void disableGlobalShortcutsForClient(bool disable);
|
|
|
|
|
|
|
|
void sessionSaveStarted();
|
|
|
|
void sessionSaveDone();
|
|
|
|
void setWasUserInteraction();
|
|
|
|
bool wasUserInteraction() const;
|
|
|
|
bool sessionSaving() const;
|
|
|
|
|
2015-03-12 09:55:14 +00:00
|
|
|
int packPositionLeft(const AbstractClient* cl, int oldx, bool left_edge) const;
|
|
|
|
int packPositionRight(const AbstractClient* cl, int oldx, bool right_edge) const;
|
|
|
|
int packPositionUp(const AbstractClient* cl, int oldy, bool top_edge) const;
|
|
|
|
int packPositionDown(const AbstractClient* cl, int oldy, bool bottom_edge) const;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
void cancelDelayFocus();
|
2016-02-18 10:18:50 +00:00
|
|
|
void requestDelayFocus(AbstractClient*);
|
2015-01-28 23:14:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* updates the mouse position to track whether a focus follow mouse focus change was caused by
|
|
|
|
* an actual mouse move
|
|
|
|
* is esp. called on enter/motion events of inactive windows
|
|
|
|
* since an active window doesn't receive mouse events, it must also be invoked if a (potentially)
|
|
|
|
* active window might be moved/resize away from the cursor (causing a leave event)
|
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
void updateFocusMousePosition(const QPoint& pos);
|
|
|
|
QPoint focusMousePosition() const;
|
|
|
|
|
2015-03-06 11:38:07 +00:00
|
|
|
AbstractClient* getMovingClient() {
|
2011-06-23 10:09:17 +00:00
|
|
|
return movingClient;
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2013-01-10 09:10:35 +00:00
|
|
|
/**
|
|
|
|
* @returns Whether we have a Compositor and it is active (Scene created)
|
|
|
|
**/
|
|
|
|
bool compositing() const;
|
|
|
|
|
2014-09-02 16:46:07 +00:00
|
|
|
void registerEventFilter(X11EventFilter *filter);
|
|
|
|
void unregisterEventFilter(X11EventFilter *filter);
|
|
|
|
|
2017-06-21 19:10:12 +00:00
|
|
|
void markXStackingOrderAsDirty();
|
|
|
|
|
2017-07-18 19:12:37 +00:00
|
|
|
void quickTileWindow(QuickTileMode mode);
|
|
|
|
|
2017-07-20 04:58:35 +00:00
|
|
|
enum Direction {
|
|
|
|
DirectionNorth,
|
|
|
|
DirectionEast,
|
|
|
|
DirectionSouth,
|
|
|
|
DirectionWest
|
|
|
|
};
|
|
|
|
void switchWindow(Direction direction);
|
|
|
|
|
2017-07-22 10:49:57 +00:00
|
|
|
ShortcutDialog *shortcutDialog() const {
|
|
|
|
return client_keys_dialog;
|
|
|
|
}
|
|
|
|
|
2013-07-22 14:07:39 +00:00
|
|
|
public Q_SLOTS:
|
2015-03-06 09:05:40 +00:00
|
|
|
void performWindowOperation(KWin::AbstractClient* c, Options::WindowOperation op);
|
2011-01-30 14:34:42 +00:00
|
|
|
// Keybindings
|
|
|
|
//void slotSwitchToWindow( int );
|
2017-07-21 14:10:14 +00:00
|
|
|
void slotWindowToDesktop(uint i);
|
2011-02-16 18:23:54 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
//void slotWindowToListPosition( int );
|
2011-02-16 18:23:54 +00:00
|
|
|
void slotSwitchToScreen();
|
|
|
|
void slotWindowToScreen();
|
2011-01-30 14:34:42 +00:00
|
|
|
void slotSwitchToNextScreen();
|
|
|
|
void slotWindowToNextScreen();
|
2013-05-19 12:23:49 +00:00
|
|
|
void slotSwitchToPrevScreen();
|
|
|
|
void slotWindowToPrevScreen();
|
2011-01-30 14:34:42 +00:00
|
|
|
void slotToggleShowDesktop();
|
|
|
|
|
|
|
|
void slotWindowMaximize();
|
|
|
|
void slotWindowMaximizeVertical();
|
|
|
|
void slotWindowMaximizeHorizontal();
|
|
|
|
void slotWindowMinimize();
|
|
|
|
void slotWindowShade();
|
|
|
|
void slotWindowRaise();
|
|
|
|
void slotWindowLower();
|
|
|
|
void slotWindowRaiseOrLower();
|
|
|
|
void slotActivateAttentionWindow();
|
|
|
|
void slotWindowPackLeft();
|
|
|
|
void slotWindowPackRight();
|
|
|
|
void slotWindowPackUp();
|
|
|
|
void slotWindowPackDown();
|
|
|
|
void slotWindowGrowHorizontal();
|
|
|
|
void slotWindowGrowVertical();
|
|
|
|
void slotWindowShrinkHorizontal();
|
|
|
|
void slotWindowShrinkVertical();
|
|
|
|
|
2011-08-19 19:53:30 +00:00
|
|
|
void slotIncreaseWindowOpacity();
|
|
|
|
void slotLowerWindowOpacity();
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void slotWindowOperations();
|
|
|
|
void slotWindowClose();
|
|
|
|
void slotWindowMove();
|
|
|
|
void slotWindowResize();
|
|
|
|
void slotWindowAbove();
|
|
|
|
void slotWindowBelow();
|
|
|
|
void slotWindowOnAllDesktops();
|
|
|
|
void slotWindowFullScreen();
|
|
|
|
void slotWindowNoBorder();
|
|
|
|
|
|
|
|
void slotWindowToNextDesktop();
|
|
|
|
void slotWindowToPreviousDesktop();
|
|
|
|
void slotWindowToDesktopRight();
|
|
|
|
void slotWindowToDesktopLeft();
|
|
|
|
void slotWindowToDesktopUp();
|
|
|
|
void slotWindowToDesktopDown();
|
|
|
|
|
|
|
|
void reconfigure();
|
|
|
|
void slotReconfigure();
|
|
|
|
|
|
|
|
void slotKillWindow();
|
|
|
|
|
|
|
|
void slotSetupWindowShortcut();
|
|
|
|
void setupWindowShortcutDone(bool);
|
|
|
|
|
|
|
|
void updateClientArea();
|
|
|
|
|
2012-01-12 06:42:55 +00:00
|
|
|
void slotActivateNextTab(); // Slot to move left the active Client.
|
|
|
|
void slotActivatePrevTab(); // Slot to move right the active Client.
|
|
|
|
void slotUntab(); // Slot to remove the active client from its group.
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2013-07-22 14:07:39 +00:00
|
|
|
private Q_SLOTS:
|
2011-01-30 14:34:42 +00:00
|
|
|
void desktopResized();
|
2014-06-15 12:07:44 +00:00
|
|
|
void selectWmInputEventMask();
|
2011-01-30 14:34:42 +00:00
|
|
|
void slotUpdateToolWindows();
|
|
|
|
void delayFocus();
|
|
|
|
void slotReloadConfig();
|
|
|
|
void updateCurrentActivity(const QString &new_activity);
|
2012-11-16 07:23:47 +00:00
|
|
|
// virtual desktop handling
|
|
|
|
void slotDesktopCountChanged(uint previousCount, uint newCount);
|
|
|
|
void slotCurrentDesktopChanged(uint oldDesktop, uint newDesktop);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2015-05-01 14:55:15 +00:00
|
|
|
// session management
|
|
|
|
void saveState(QSessionManager &sm);
|
|
|
|
void commitData(QSessionManager &sm);
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
Q_SIGNALS:
|
2012-04-13 09:27:50 +00:00
|
|
|
/**
|
|
|
|
* Emitted after the Workspace has setup the complete initialization process.
|
|
|
|
* This can be used to connect to for performing post-workspace initialization.
|
|
|
|
**/
|
|
|
|
void workspaceInitialized();
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2010-09-21 14:31:40 +00:00
|
|
|
//Signals required for the scripting interface
|
2015-03-13 10:48:08 +00:00
|
|
|
void desktopPresenceChanged(KWin::AbstractClient*, int);
|
2015-03-06 11:38:07 +00:00
|
|
|
void currentDesktopChanged(int, KWin::AbstractClient*);
|
2011-01-30 14:34:42 +00:00
|
|
|
void clientAdded(KWin::Client*);
|
2015-04-30 08:51:58 +00:00
|
|
|
void clientRemoved(KWin::AbstractClient*);
|
2015-03-06 12:58:24 +00:00
|
|
|
void clientActivated(KWin::AbstractClient*);
|
2015-03-13 10:13:29 +00:00
|
|
|
void clientDemandsAttentionChanged(KWin::AbstractClient*, bool);
|
2017-10-04 19:02:16 +00:00
|
|
|
void clientMinimizedChanged(KWin::AbstractClient*);
|
2011-01-30 14:34:42 +00:00
|
|
|
void groupAdded(KWin::Group*);
|
2011-02-25 21:06:02 +00:00
|
|
|
void unmanagedAdded(KWin::Unmanaged*);
|
2013-07-01 06:37:59 +00:00
|
|
|
void unmanagedRemoved(KWin::Unmanaged*);
|
2011-02-27 09:47:42 +00:00
|
|
|
void deletedRemoved(KWin::Deleted*);
|
2011-07-13 09:36:49 +00:00
|
|
|
void configChanged();
|
2011-08-21 19:50:23 +00:00
|
|
|
void reinitializeCompositing();
|
2015-03-28 23:08:32 +00:00
|
|
|
void showingDesktopChanged(bool showing);
|
2013-01-01 00:47:16 +00:00
|
|
|
/**
|
|
|
|
* This signels is emitted when ever the stacking order is change, ie. a window is risen
|
|
|
|
* or lowered
|
|
|
|
*/
|
|
|
|
void stackingOrderChanged();
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void init();
|
2017-09-20 18:02:02 +00:00
|
|
|
void initWithX11();
|
2011-01-30 14:34:42 +00:00
|
|
|
void initShortcuts();
|
2013-09-09 07:41:37 +00:00
|
|
|
template <typename Slot>
|
|
|
|
void initShortcut(const QString &actionName, const QString &description, const QKeySequence &shortcut,
|
|
|
|
Slot slot, const QVariant &data = QVariant());
|
2017-09-24 08:10:52 +00:00
|
|
|
template <typename T, typename Slot>
|
|
|
|
void initShortcut(const QString &actionName, const QString &description, const QKeySequence &shortcut, T *receiver, Slot slot, const QVariant &data = QVariant());
|
2015-03-06 08:03:08 +00:00
|
|
|
void setupWindowShortcut(AbstractClient* c);
|
Cycle between windows of the same desktop on switch
Summary:
When switching virtual desktops using shortcuts, the behavior is to
switch to a virtual desktop in the opposite direction if the current
one is on the edges of the layout. For example, in a one row layout with
4 virtual desktops, "Switch One Desktop to the Left" while in virtual
desktop # 1 will send the user to virtual desktop # 4. Likewise, in a 3
rows layout with 9 virtual desktops, "Switch One Desktop Down" while in
virtual desktop # 8 will lead the user to desktop # 2.
This patch uses the same behavior whilst changing windows using
"Switch to Window Above|Below|to the Right|to the Left".
For example, in a 3 display set-up (my set-up), the user would go from an
application in the rightmost position to an application in the leftmost
position using just one key combination: "Switch to Window to the Right".
Currently, the shortcuts are no-op in these cases (ie, trying "Switch to
Window to the Left" from the leftmost window has no outcome, which is
mostly accurate with the shortcut semantics but totally useless in behavior).
Reviewers: #vdg, #kwin, graesslin
Reviewed By: #kwin, graesslin
Subscribers: luebking, subdiff, colomar, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D3602
2016-12-22 20:12:46 +00:00
|
|
|
bool switchWindow(AbstractClient *c, Direction direction, QPoint curPos, int desktop);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
void propagateClients(bool propagate_new_clients); // Called only from updateStackingOrder
|
2012-04-07 15:29:22 +00:00
|
|
|
ToplevelList constrainedStackingOrder();
|
2015-09-14 12:49:18 +00:00
|
|
|
void raiseClientWithinApplication(AbstractClient* c);
|
2015-09-14 12:47:45 +00:00
|
|
|
void lowerClientWithinApplication(AbstractClient* c);
|
2015-03-12 10:46:08 +00:00
|
|
|
bool allowFullClientRaising(const AbstractClient* c, xcb_timestamp_t timestamp);
|
2015-09-11 11:49:06 +00:00
|
|
|
bool keepTransientAbove(const AbstractClient* mainwindow, const AbstractClient* transient);
|
Keep Deleted transients above old parents
Summary:
If a modal window is closed, usually, it will go behind its parent. The
reason for this is that Workspace::constrainedStackingOrder() puts only
AbstractClient transients above parents, not Deleted transients.
So, if fade/glide/scale effect animates the disappearing of a transient,
unfortunately, one can't see that animation.
BUG: 397448
FIXED-IN: 5.15.0
Test Plan:
=== Closing of a transient and parent window
Before:
https://www.youtube.com/watch?v=XiLq7EAVCp0
After:
https://www.youtube.com/watch?v=cH_Ki-sqY8M
=== Scale effect
Before:
https://www.youtube.com/watch?v=Eb2a3U7R10I
After:
https://www.youtube.com/watch?v=4AKu3fdrnYQ
=== Sheet effect
Before:
https://www.youtube.com/watch?v=xPPSnR5FUU0
After:
https://www.youtube.com/watch?v=o_hxTNT-5Hg
=== Popup menus on Wayland
Before:
https://www.youtube.com/watch?v=5DnrY8p3F5A
After:
https://www.youtube.com/watch?v=7XEo8n_CrCc
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: abetts, davidedmundson, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D14868
2018-10-15 13:04:05 +00:00
|
|
|
bool keepDeletedTransientAbove(const Toplevel *mainWindow, const Deleted *transient) const;
|
2011-01-30 14:34:42 +00:00
|
|
|
void blockStackingUpdates(bool block);
|
|
|
|
void updateToolWindows(bool also_hide);
|
2012-03-26 15:30:34 +00:00
|
|
|
void fixPositionAfterCrash(xcb_window_t w, const xcb_get_geometry_reply_t *geom);
|
2011-09-30 11:22:39 +00:00
|
|
|
void saveOldScreenSizes();
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
/// This is the right way to create a new client
|
2013-04-30 13:41:59 +00:00
|
|
|
Client* createClient(xcb_window_t w, bool is_mapped);
|
2016-07-01 14:03:13 +00:00
|
|
|
void setupClientConnections(AbstractClient *client);
|
2013-04-26 07:47:45 +00:00
|
|
|
void addClient(Client* c);
|
2013-04-30 13:41:59 +00:00
|
|
|
Unmanaged* createUnmanaged(xcb_window_t w);
|
2013-04-26 07:47:45 +00:00
|
|
|
void addUnmanaged(Unmanaged* c);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------
|
|
|
|
|
|
|
|
void closeActivePopup();
|
|
|
|
void updateClientArea(bool force);
|
2012-11-16 07:23:47 +00:00
|
|
|
void resetClientAreas(uint desktopCount);
|
2017-10-01 07:51:09 +00:00
|
|
|
void updateClientVisibilityOnDesktopChange(uint newDesktop);
|
2012-11-16 07:23:47 +00:00
|
|
|
void activateClientOnNewDesktop(uint desktop);
|
2015-03-12 11:08:54 +00:00
|
|
|
AbstractClient *findClientToActivateOnDesktop(uint desktop);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
QWidget* active_popup;
|
2015-03-06 08:03:08 +00:00
|
|
|
AbstractClient* active_popup_client;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2015-05-01 14:55:15 +00:00
|
|
|
int m_initialDesktop;
|
|
|
|
void loadSessionInfo(const QString &key);
|
2011-01-30 14:34:42 +00:00
|
|
|
void addSessionInfo(KConfigGroup &cg);
|
|
|
|
|
|
|
|
QList<SessionInfo*> session;
|
|
|
|
static const char* windowTypeToTxt(NET::WindowType type);
|
|
|
|
static NET::WindowType txtToWindowType(const char* txt);
|
|
|
|
static bool sessionInfoWindowTypeMatch(Client* c, SessionInfo* info);
|
|
|
|
|
2017-06-21 19:10:12 +00:00
|
|
|
void updateXStackingOrder();
|
2017-06-21 04:56:53 +00:00
|
|
|
|
2015-03-12 11:08:54 +00:00
|
|
|
AbstractClient* active_client;
|
2015-03-12 10:39:22 +00:00
|
|
|
AbstractClient* last_active_client;
|
2015-03-05 12:35:54 +00:00
|
|
|
AbstractClient* most_recently_raised; // Used ONLY by raiseOrLowerClient()
|
2015-03-06 11:38:07 +00:00
|
|
|
AbstractClient* movingClient;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
// Delay(ed) window focus timer and client
|
|
|
|
QTimer* delayFocusTimer;
|
2016-02-18 10:18:50 +00:00
|
|
|
AbstractClient* delayfocus_client;
|
2011-01-30 14:34:42 +00:00
|
|
|
QPoint focusMousePos;
|
|
|
|
|
|
|
|
ClientList clients;
|
2015-09-18 11:44:54 +00:00
|
|
|
QList<AbstractClient*> m_allClients;
|
2011-01-30 14:34:42 +00:00
|
|
|
ClientList desktops;
|
|
|
|
UnmanagedList unmanaged;
|
|
|
|
DeletedList deleted;
|
|
|
|
|
2012-04-08 08:07:35 +00:00
|
|
|
ToplevelList unconstrained_stacking_order; // Topmost last
|
|
|
|
ToplevelList stacking_order; // Topmost last
|
2011-01-30 14:34:42 +00:00
|
|
|
bool force_restacking;
|
2017-06-21 19:10:12 +00:00
|
|
|
ToplevelList x_stacking; // From XQueryTree()
|
|
|
|
std::unique_ptr<Xcb::Tree> m_xStackingQueryTree;
|
2017-09-17 07:26:24 +00:00
|
|
|
bool m_xStackingDirty = false;
|
2015-03-12 10:59:41 +00:00
|
|
|
QList<AbstractClient*> should_get_focus; // Last is most recent
|
2015-03-13 10:13:29 +00:00
|
|
|
QList<AbstractClient*> attention_chain;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
bool showing_desktop;
|
|
|
|
|
|
|
|
GroupList groups;
|
|
|
|
|
|
|
|
bool was_user_interaction;
|
2017-08-17 17:10:45 +00:00
|
|
|
QScopedPointer<X11EventFilter> m_wasUserInteractionFilter;
|
2011-01-30 14:34:42 +00:00
|
|
|
bool session_saving;
|
|
|
|
int session_active_client;
|
|
|
|
int session_desktop;
|
|
|
|
|
|
|
|
int block_focus;
|
|
|
|
|
2012-08-19 10:00:53 +00:00
|
|
|
/**
|
|
|
|
* Holds the menu containing the user actions which is shown
|
|
|
|
* on e.g. right click the window decoration.
|
|
|
|
**/
|
|
|
|
UserActionsMenu *m_userActionsMenu;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
void modalActionsSwitch(bool enabled);
|
|
|
|
|
|
|
|
ShortcutDialog* client_keys_dialog;
|
2015-03-06 08:03:08 +00:00
|
|
|
AbstractClient* client_keys_client;
|
2011-01-30 14:34:42 +00:00
|
|
|
bool global_shortcuts_disabled_for_client;
|
|
|
|
|
|
|
|
// Timer to collect requests for 'reconfigure'
|
|
|
|
QTimer reconfigureTimer;
|
|
|
|
|
|
|
|
QTimer updateToolWindowsTimer;
|
|
|
|
|
|
|
|
static Workspace* _self;
|
|
|
|
|
|
|
|
bool workspaceInit;
|
|
|
|
|
|
|
|
KStartupInfo* startup;
|
|
|
|
|
|
|
|
QVector<QRect> workarea; // Array of workareas for virtual desktops
|
|
|
|
// Array of restricted areas that window cannot be moved into
|
|
|
|
QVector<StrutRects> restrictedmovearea;
|
|
|
|
// Array of the previous restricted areas that window cannot be moved into
|
|
|
|
QVector<StrutRects> oldrestrictedmovearea;
|
|
|
|
QVector< QVector<QRect> > screenarea; // Array of workareas per xinerama screen for all virtual desktops
|
2011-09-30 11:22:39 +00:00
|
|
|
QVector< QRect > oldscreensizes; // array of previous sizes of xinerama screens
|
2011-09-30 12:50:18 +00:00
|
|
|
QSize olddisplaysize; // previous sizes od displayWidth()/displayHeight()
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
int set_active_client_recursion;
|
|
|
|
int block_stacking_updates; // When > 0, stacking updates are temporarily disabled
|
|
|
|
bool blocked_propagating_new_clients; // Propagate also new clients after enabling stacking updates?
|
2013-04-30 11:06:46 +00:00
|
|
|
QScopedPointer<Xcb::Window> m_nullFocus;
|
2011-01-30 14:34:42 +00:00
|
|
|
friend class StackingUpdatesBlocker;
|
|
|
|
|
2012-12-27 13:26:46 +00:00
|
|
|
QScopedPointer<KillWindow> m_windowKiller;
|
|
|
|
|
2014-09-02 16:46:07 +00:00
|
|
|
QList<X11EventFilter *> m_eventFilters;
|
|
|
|
QList<X11EventFilter *> m_genericEventFilters;
|
2017-08-17 19:12:28 +00:00
|
|
|
QScopedPointer<X11EventFilter> m_movingClientFilter;
|
2014-09-02 16:46:07 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
private:
|
|
|
|
friend bool performTransiencyCheck();
|
2013-05-08 11:39:06 +00:00
|
|
|
friend Workspace *workspace();
|
2011-01-30 14:34:42 +00:00
|
|
|
};
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2008-12-18 13:50:57 +00:00
|
|
|
/**
|
|
|
|
* Helper for Workspace::blockStackingUpdates() being called in pairs (True/false)
|
|
|
|
*/
|
2007-04-29 17:35:43 +00:00
|
|
|
class StackingUpdatesBlocker
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
public:
|
2012-12-29 06:34:38 +00:00
|
|
|
explicit StackingUpdatesBlocker(Workspace* w)
|
2011-01-30 14:34:42 +00:00
|
|
|
: ws(w) {
|
|
|
|
ws->blockStackingUpdates(true);
|
|
|
|
}
|
|
|
|
~StackingUpdatesBlocker() {
|
|
|
|
ws->blockStackingUpdates(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
Workspace* ws;
|
|
|
|
};
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-04-30 12:55:06 +00:00
|
|
|
class ColorMapper : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
ColorMapper(QObject *parent);
|
|
|
|
virtual ~ColorMapper();
|
|
|
|
public Q_SLOTS:
|
|
|
|
void update();
|
|
|
|
private:
|
|
|
|
xcb_colormap_t m_default;
|
|
|
|
xcb_colormap_t m_installed;
|
|
|
|
};
|
|
|
|
|
2009-02-14 15:40:52 +00:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// Unsorted
|
|
|
|
|
|
|
|
inline bool Workspace::initializing() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2009-02-14 15:40:52 +00:00
|
|
|
return workspaceInit;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2009-02-14 09:46:12 +00:00
|
|
|
|
2015-03-12 11:11:42 +00:00
|
|
|
inline AbstractClient *Workspace::activeClient() const
|
|
|
|
{
|
|
|
|
return active_client;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline AbstractClient *Workspace::mostRecentlyActivatedClient() const
|
|
|
|
{
|
|
|
|
return should_get_focus.count() > 0 ? should_get_focus.last() : active_client;
|
|
|
|
}
|
|
|
|
|
2013-04-26 07:47:45 +00:00
|
|
|
inline void Workspace::addGroup(Group* group)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2010-09-21 14:31:40 +00:00
|
|
|
emit groupAdded(group);
|
2011-01-30 14:34:42 +00:00
|
|
|
groups.append(group);
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-04-26 07:47:45 +00:00
|
|
|
inline void Workspace::removeGroup(Group* group)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
groups.removeAll(group);
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2012-04-08 08:07:35 +00:00
|
|
|
inline const ToplevelList& Workspace::stackingOrder() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2008-12-18 13:50:57 +00:00
|
|
|
// TODO: Q_ASSERT( block_stacking_updates == 0 );
|
2007-04-29 17:35:43 +00:00
|
|
|
return stacking_order;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2008-12-18 13:50:57 +00:00
|
|
|
inline bool Workspace::wasUserInteraction() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return was_user_interaction;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline void Workspace::sessionSaveStarted()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
session_saving = true;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline bool Workspace::sessionSaving() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return session_saving;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline bool Workspace::showingDesktop() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return showing_desktop;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline bool Workspace::globalShortcutsDisabled() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2013-05-08 15:28:55 +00:00
|
|
|
return global_shortcuts_disabled_for_client;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2008-12-18 13:50:57 +00:00
|
|
|
inline void Workspace::forceRestacking()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-07-04 09:51:10 +00:00
|
|
|
force_restacking = true;
|
2011-01-30 14:34:42 +00:00
|
|
|
StackingUpdatesBlocker blocker(this); // Do restacking if not blocked
|
|
|
|
}
|
2007-07-04 09:51:10 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
inline void Workspace::updateFocusMousePosition(const QPoint& pos)
|
|
|
|
{
|
2007-08-24 09:46:56 +00:00
|
|
|
focusMousePos = pos;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-08-24 09:46:56 +00:00
|
|
|
|
2008-12-18 13:50:57 +00:00
|
|
|
inline QPoint Workspace::focusMousePosition() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-08-24 09:46:56 +00:00
|
|
|
return focusMousePos;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-08-24 09:46:56 +00:00
|
|
|
|
2013-08-05 07:42:10 +00:00
|
|
|
inline
|
|
|
|
void Workspace::forEachClient(std::function< void (Client*) > func)
|
|
|
|
{
|
|
|
|
std::for_each(clients.constBegin(), clients.constEnd(), func);
|
|
|
|
std::for_each(desktops.constBegin(), desktops.constEnd(), func);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline
|
|
|
|
void Workspace::forEachUnmanaged(std::function< void (Unmanaged*) > func)
|
|
|
|
{
|
|
|
|
std::for_each(unmanaged.constBegin(), unmanaged.constEnd(), func);
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
inline bool Workspace::hasClient(const Client* c)
|
|
|
|
{
|
2014-03-20 08:19:53 +00:00
|
|
|
return findClient([c](const Client *test) {
|
|
|
|
return test == c;
|
|
|
|
});
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-05-08 11:39:06 +00:00
|
|
|
inline Workspace *workspace()
|
|
|
|
{
|
|
|
|
return Workspace::_self;
|
|
|
|
}
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
} // namespace
|
2014-03-20 12:39:00 +00:00
|
|
|
Q_DECLARE_OPERATORS_FOR_FLAGS(KWin::Workspace::ActivityFlags)
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
#endif
|