~ubuntu-branches/ubuntu/wily/kwin/wily-proposed

« back to all changes in this revision

Viewing changes to focuschain.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2015-08-10 23:16:37 UTC
  • mfrom: (1.1.10)
  • Revision ID: package-import@ubuntu.com-20150810231637-5zb2tstjkez93hml
Tags: 4:5.3.95-0ubuntu1
new upstream beta release

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
namespace KWin
29
29
{
30
30
// forward declarations
31
 
class Client;
 
31
class AbstractClient;
32
32
 
33
33
/**
34
34
 * @brief Singleton class to handle the various focus chains.
79
79
     * @param change Where to move the Client
80
80
     * @return void
81
81
     **/
82
 
    void update(Client *client, Change change);
 
82
    void update(AbstractClient *client, Change change);
83
83
    /**
84
84
     * @brief Moves @p client behind the @p reference Client in all focus chains.
85
85
     *
87
87
     * @param reference The Client behind which the @p client should be moved
88
88
     * @return void
89
89
     **/
90
 
    void moveAfterClient(Client *client, Client *reference);
 
90
    void moveAfterClient(AbstractClient *client, AbstractClient *reference);
91
91
    /**
92
92
     * @brief Finds the best Client to become the new active Client in the focus chain for the given
93
93
     * virtual @p desktop.
98
98
     * @param desktop The virtual desktop to look for a Client for activation
99
99
     * @return :Client* The Client which could be activated or @c null if there is none.
100
100
     **/
101
 
    Client *getForActivation(uint desktop) const;
 
101
    AbstractClient *getForActivation(uint desktop) const;
102
102
    /**
103
103
     * @brief Finds the best Client to become the new active Client in the focus chain for the given
104
104
     * virtual @p desktop on the given @p screen.
111
111
     * @param screen The screen to constrain the search on with separate screen focus
112
112
     * @return :Client* The Client which could be activated or @c null if there is none.
113
113
     **/
114
 
    Client *getForActivation(uint desktop, int screen) const;
 
114
    AbstractClient *getForActivation(uint desktop, int screen) const;
115
115
 
116
116
    /**
117
117
     * @brief Checks whether the most recently used focus chain contains the given @p client.
120
120
     * @param client The Client to look for.
121
121
     * @return bool @c true if the most recently used focus chain contains @p client, @c false otherwise.
122
122
     **/
123
 
    bool contains(Client *client) const;
 
123
    bool contains(AbstractClient *client) const;
124
124
    /**
125
125
     * @brief Checks whether the focus chain for the given @p desktop contains the given @p client.
126
126
     *
130
130
     * @param desktop The virtual desktop whose focus chain should be used
131
131
     * @return bool @c true if the focus chain for @p desktop contains @p client, @c false otherwise.
132
132
     **/
133
 
    bool contains(Client *client, uint desktop) const;
 
133
    bool contains(AbstractClient *client, uint desktop) const;
134
134
    /**
135
135
     * @brief Queries the most recently used focus chain for the next Client after the given
136
136
     * @p reference Client.
144
144
     * @param reference The start point in the focus chain to search
145
145
     * @return :Client* The relatively next Client in the most recently used chain.
146
146
     **/
147
 
    Client *nextMostRecentlyUsed(Client *reference) const;
 
147
    AbstractClient *nextMostRecentlyUsed(AbstractClient *reference) const;
148
148
    /**
149
149
     * @brief Queries the focus chain for @p desktop for the next Client in relation to the given
150
150
     * @p reference Client.
156
156
     * @param desktop The virtual desktop whose focus chain should be used
157
157
     * @return :Client* The next usable Client or @c null if none can be found.
158
158
     **/
159
 
    Client *nextForDesktop(Client *reference, uint desktop) const;
 
159
    AbstractClient *nextForDesktop(AbstractClient *reference, uint desktop) const;
160
160
    /**
161
161
     * @brief Returns the first Client in the most recently used focus chain. First Client in this
162
162
     * case means really the first Client in the chain and not the most recently used Client.
163
163
     *
164
164
     * @return :Client* The first Client in the most recently used chain.
165
165
     **/
166
 
    Client *firstMostRecentlyUsed() const;
 
166
    AbstractClient *firstMostRecentlyUsed() const;
167
167
 
168
168
public Q_SLOTS:
169
169
    /**
182
182
     * @param client The Client to remove from all focus chains.
183
183
     * @return void
184
184
     **/
185
 
    void remove(KWin::Client *client);
 
185
    void remove(KWin::AbstractClient *client);
186
186
    void setSeparateScreenFocus(bool enabled);
187
 
    void setActiveClient(KWin::Client *client);
 
187
    void setActiveClient(KWin::AbstractClient *client);
188
188
    void setCurrentDesktop(uint previous, uint newDesktop);
189
 
    bool isUsableFocusCandidate(Client *c, Client *prev) const;
 
189
    bool isUsableFocusCandidate(AbstractClient *c, AbstractClient *prev) const;
190
190
 
191
191
private:
192
192
    /**
199
199
     * @param chain The focus chain to operate on
200
200
     * @return void
201
201
     **/
202
 
    void makeFirstInChain(Client *client, QList<Client*> &chain);
 
202
    void makeFirstInChain(AbstractClient *client, QList<AbstractClient*> &chain);
203
203
    /**
204
204
     * @brief Makes @p client the last Client in the given focus @p chain.
205
205
     *
210
210
     * @param chain The focus chain to operate on
211
211
     * @return void
212
212
     **/
213
 
    void makeLastInChain(Client *client, QList<Client*> &chain);
214
 
    void moveAfterClientInChain(Client *client, Client *reference, QList<Client*> &chain);
215
 
    void updateClientInChain(Client *client, Change change, QList<Client*> &chain);
216
 
    void insertClientIntoChain(Client *client, QList<Client*> &chain);
217
 
    typedef QHash<uint, QList<Client*> > DesktopChains;
218
 
    QList<Client*> m_mostRecentlyUsed;
 
213
    void makeLastInChain(AbstractClient *client, QList<AbstractClient*> &chain);
 
214
    void moveAfterClientInChain(AbstractClient *client, AbstractClient *reference, QList<AbstractClient*> &chain);
 
215
    void updateClientInChain(AbstractClient *client, Change change, QList<AbstractClient*> &chain);
 
216
    void insertClientIntoChain(AbstractClient *client, QList<AbstractClient*> &chain);
 
217
    typedef QHash<uint, QList<AbstractClient*> > DesktopChains;
 
218
    QList<AbstractClient*> m_mostRecentlyUsed;
219
219
    DesktopChains m_desktopFocusChains;
220
220
    bool m_separateScreenFocus;
221
 
    Client *m_activeClient;
 
221
    AbstractClient *m_activeClient;
222
222
    uint m_currentDesktop;
223
223
 
224
224
    KWIN_SINGLETON_VARIABLE(FocusChain, s_manager)
225
225
};
226
226
 
227
227
inline
228
 
bool FocusChain::contains(Client *client) const
 
228
bool FocusChain::contains(AbstractClient *client) const
229
229
{
230
230
    return m_mostRecentlyUsed.contains(client);
231
231
}
237
237
}
238
238
 
239
239
inline
240
 
void FocusChain::setActiveClient(Client *client)
 
240
void FocusChain::setActiveClient(AbstractClient *client)
241
241
{
242
242
    m_activeClient = client;
243
243
}