Changeset View
Changeset View
Standalone View
Standalone View
workspace.h
Show First 20 Lines • Show All 99 Lines • ▼ Show 20 Line(s) | 67 | public: | |||
---|---|---|---|---|---|
100 | * | 100 | * | ||
101 | * @param func Unary function that accepts a Client* as argument and | 101 | * @param func Unary function that accepts a Client* as argument and | ||
102 | * returns a value convertible to bool. The value returned indicates whether the | 102 | * returns a value convertible to bool. The value returned indicates whether the | ||
103 | * Client* is considered a match in the context of this function. | 103 | * Client* is considered a match in the context of this function. | ||
104 | * The function shall not modify its argument. | 104 | * The function shall not modify its argument. | ||
105 | * This can either be a function pointer or a function object. | 105 | * This can either be a function pointer or a function object. | ||
106 | * @return KWin::Client* The found Client or @c null | 106 | * @return KWin::Client* The found Client or @c null | ||
107 | * @see findClient(Predicate, xcb_window_t) | 107 | * @see findClient(Predicate, xcb_window_t) | ||
108 | */ | 108 | **/ | ||
109 | Client *findClient(std::function<bool (const Client*)> func) const; | 109 | Client *findClient(std::function<bool (const Client*)> func) const; | ||
110 | AbstractClient *findAbstractClient(std::function<bool (const AbstractClient*)> func) const; | 110 | AbstractClient *findAbstractClient(std::function<bool (const AbstractClient*)> func) const; | ||
111 | /** | 111 | /** | ||
112 | * @brief Finds the Client matching the given match @p predicate for the given window. | 112 | * @brief Finds the Client matching the given match @p predicate for the given window. | ||
113 | * | 113 | * | ||
114 | * @param predicate Which window should be compared | 114 | * @param predicate Which window should be compared | ||
115 | * @param w The window id to test against | 115 | * @param w The window id to test against | ||
116 | * @return KWin::Client* The found Client or @c null | 116 | * @return KWin::Client* The found Client or @c null | ||
117 | * @see findClient(std::function<bool (const Client*)>) | 117 | * @see findClient(std::function<bool (const Client*)>) | ||
118 | */ | 118 | **/ | ||
119 | Client *findClient(Predicate predicate, xcb_window_t w) const; | 119 | Client *findClient(Predicate predicate, xcb_window_t w) const; | ||
120 | void forEachClient(std::function<void (Client*)> func); | 120 | void forEachClient(std::function<void (Client*)> func); | ||
121 | void forEachAbstractClient(std::function<void (AbstractClient*)> func); | 121 | void forEachAbstractClient(std::function<void (AbstractClient*)> func); | ||
122 | Unmanaged *findUnmanaged(std::function<bool (const Unmanaged*)> func) const; | 122 | Unmanaged *findUnmanaged(std::function<bool (const Unmanaged*)> func) const; | ||
123 | /** | 123 | /** | ||
124 | * @brief Finds the Unmanaged with the given window id. | 124 | * @brief Finds the Unmanaged with the given window id. | ||
125 | * | 125 | * | ||
126 | * @param w The window id to search for | 126 | * @param w The window id to search for | ||
127 | * @return KWin::Unmanaged* Found Unmanaged or @c null if there is no Unmanaged with given Id. | 127 | * @return KWin::Unmanaged* Found Unmanaged or @c null if there is no Unmanaged with given Id. | ||
128 | */ | 128 | **/ | ||
129 | Unmanaged *findUnmanaged(xcb_window_t w) const; | 129 | Unmanaged *findUnmanaged(xcb_window_t w) const; | ||
130 | void forEachUnmanaged(std::function<void (Unmanaged*)> func); | 130 | void forEachUnmanaged(std::function<void (Unmanaged*)> func); | ||
131 | Toplevel *findToplevel(std::function<bool (const Toplevel*)> func) const; | 131 | Toplevel *findToplevel(std::function<bool (const Toplevel*)> func) const; | ||
132 | /** | 132 | /** | ||
133 | * Finds the Toplevel for the KWin internal window @p w. | 133 | * Finds the Toplevel for the KWin internal window @p w. | ||
134 | * On Wayland this is normally a ShellClient. For X11 an Unmanaged. | 134 | * On Wayland this is normally a ShellClient. For X11 an Unmanaged. | ||
135 | **/ | 135 | **/ | ||
136 | Toplevel *findToplevel(QWindow *w) const; | 136 | Toplevel *findToplevel(QWindow *w) const; | ||
Show All 13 Lines | |||||
150 | 150 | | |||
151 | QRegion restrictedMoveArea(int desktop, StrutAreas areas = StrutAreaAll) const; | 151 | QRegion restrictedMoveArea(int desktop, StrutAreas areas = StrutAreaAll) const; | ||
152 | 152 | | |||
153 | bool initializing() const; | 153 | bool initializing() const; | ||
154 | 154 | | |||
155 | /** | 155 | /** | ||
156 | * Returns the active client, i.e. the client that has the focus (or None | 156 | * Returns the active client, i.e. the client that has the focus (or None | ||
157 | * if no client has the focus) | 157 | * if no client has the focus) | ||
158 | */ | 158 | **/ | ||
159 | AbstractClient* activeClient() const; | 159 | AbstractClient* activeClient() const; | ||
160 | /** | 160 | /** | ||
161 | * Client that was activated, but it's not yet really activeClient(), because | 161 | * Client that was activated, but it's not yet really activeClient(), because | ||
162 | * we didn't process yet the matching FocusIn event. Used mostly in focus | 162 | * we didn't process yet the matching FocusIn event. Used mostly in focus | ||
163 | * stealing prevention code. | 163 | * stealing prevention code. | ||
164 | */ | 164 | **/ | ||
165 | AbstractClient* mostRecentlyActivatedClient() const; | 165 | AbstractClient* mostRecentlyActivatedClient() const; | ||
166 | 166 | | |||
167 | AbstractClient* clientUnderMouse(int screen) const; | 167 | AbstractClient* clientUnderMouse(int screen) const; | ||
168 | 168 | | |||
169 | void activateClient(AbstractClient*, bool force = false); | 169 | void activateClient(AbstractClient*, bool force = false); | ||
170 | void requestFocus(AbstractClient* c, bool force = false); | 170 | void requestFocus(AbstractClient* c, bool force = false); | ||
171 | enum ActivityFlag { | 171 | enum ActivityFlag { | ||
172 | ActivityFocus = 1 << 0, // focus the window | 172 | ActivityFocus = 1 << 0, // focus the window | ||
Show All 9 Lines | |||||
182 | void setShouldGetFocus(AbstractClient*); | 182 | void setShouldGetFocus(AbstractClient*); | ||
183 | bool activateNextClient(AbstractClient* c); | 183 | bool activateNextClient(AbstractClient* c); | ||
184 | bool focusChangeEnabled() { | 184 | bool focusChangeEnabled() { | ||
185 | return block_focus == 0; | 185 | return block_focus == 0; | ||
186 | } | 186 | } | ||
187 | 187 | | |||
188 | /** | 188 | /** | ||
189 | * Indicates that the client c is being moved around by the user. | 189 | * Indicates that the client c is being moved around by the user. | ||
190 | */ | 190 | **/ | ||
191 | void setClientIsMoving(AbstractClient* c); | 191 | void setClientIsMoving(AbstractClient* c); | ||
192 | 192 | | |||
193 | QPoint adjustClientPosition(AbstractClient* c, QPoint pos, bool unrestricted, double snapAdjust = 1.0); | 193 | QPoint adjustClientPosition(AbstractClient* c, QPoint pos, bool unrestricted, double snapAdjust = 1.0); | ||
194 | QRect adjustClientSize(AbstractClient* c, QRect moveResizeGeom, int mode); | 194 | QRect adjustClientSize(AbstractClient* c, QRect moveResizeGeom, int mode); | ||
195 | void raiseClient(AbstractClient* c, bool nogroup = false); | 195 | void raiseClient(AbstractClient* c, bool nogroup = false); | ||
196 | void lowerClient(AbstractClient* c, bool nogroup = false); | 196 | void lowerClient(AbstractClient* c, bool nogroup = false); | ||
197 | void raiseClientRequest(AbstractClient* c, NET::RequestSource src = NET::FromApplication, xcb_timestamp_t timestamp = 0); | 197 | void raiseClientRequest(AbstractClient* c, NET::RequestSource src = NET::FromApplication, xcb_timestamp_t timestamp = 0); | ||
198 | void lowerClientRequest(Client* c, NET::RequestSource src, xcb_timestamp_t timestamp); | 198 | void lowerClientRequest(Client* c, NET::RequestSource src, xcb_timestamp_t timestamp); | ||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Line(s) | 254 | public: | |||
259 | QRegion previousRestrictedMoveArea(int desktop, StrutAreas areas = StrutAreaAll) const; | 259 | QRegion previousRestrictedMoveArea(int desktop, StrutAreas areas = StrutAreaAll) const; | ||
260 | QVector< QRect > previousScreenSizes() const; | 260 | QVector< QRect > previousScreenSizes() const; | ||
261 | int oldDisplayWidth() const; | 261 | int oldDisplayWidth() const; | ||
262 | int oldDisplayHeight() const; | 262 | int oldDisplayHeight() const; | ||
263 | 263 | | |||
264 | /** | 264 | /** | ||
265 | * Returns the list of clients sorted in stacking order, with topmost client | 265 | * Returns the list of clients sorted in stacking order, with topmost client | ||
266 | * at the last position | 266 | * at the last position | ||
267 | */ | 267 | **/ | ||
268 | const ToplevelList& stackingOrder() const; | 268 | const ToplevelList& stackingOrder() const; | ||
269 | ToplevelList xStackingOrder() const; | 269 | ToplevelList xStackingOrder() const; | ||
270 | ClientList ensureStackingOrder(const ClientList& clients) const; | 270 | ClientList ensureStackingOrder(const ClientList& clients) const; | ||
271 | QList<AbstractClient*> ensureStackingOrder(const QList<AbstractClient*> &clients) const; | 271 | QList<AbstractClient*> ensureStackingOrder(const QList<AbstractClient*> &clients) const; | ||
272 | 272 | | |||
273 | AbstractClient* topClientOnDesktop(int desktop, int screen, bool unconstrained = false, | 273 | AbstractClient* topClientOnDesktop(int desktop, int screen, bool unconstrained = false, | ||
274 | bool only_normal = true) const; | 274 | bool only_normal = true) const; | ||
275 | AbstractClient* findDesktop(bool topmost, int desktop) const; | 275 | AbstractClient* findDesktop(bool topmost, int desktop) const; | ||
276 | void sendClientToDesktop(AbstractClient* c, int desktop, bool dont_activate); | 276 | void sendClientToDesktop(AbstractClient* c, int desktop, bool dont_activate); | ||
277 | void windowToPreviousDesktop(AbstractClient* c); | 277 | void windowToPreviousDesktop(AbstractClient* c); | ||
278 | void windowToNextDesktop(AbstractClient* c); | 278 | void windowToNextDesktop(AbstractClient* c); | ||
279 | void sendClientToScreen(AbstractClient* c, int screen); | 279 | void sendClientToScreen(AbstractClient* c, int screen); | ||
280 | 280 | | |||
281 | /** | 281 | /** | ||
282 | * Shows the menu operations menu for the client and makes it active if | 282 | * Shows the menu operations menu for the client and makes it active if | ||
283 | * it's not already. | 283 | * it's not already. | ||
284 | */ | 284 | **/ | ||
285 | void showWindowMenu(const QRect& pos, AbstractClient* cl); | 285 | void showWindowMenu(const QRect& pos, AbstractClient* cl); | ||
286 | const UserActionsMenu *userActionsMenu() const { | 286 | const UserActionsMenu *userActionsMenu() const { | ||
287 | return m_userActionsMenu; | 287 | return m_userActionsMenu; | ||
288 | } | 288 | } | ||
289 | 289 | | |||
290 | void showApplicationMenu(const QRect &pos, AbstractClient *c, int actionId); | 290 | void showApplicationMenu(const QRect &pos, AbstractClient *c, int actionId); | ||
291 | 291 | | |||
292 | void updateMinimizedOfTransients(AbstractClient*); | 292 | void updateMinimizedOfTransients(AbstractClient*); | ||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Line(s) | |||||
345 | void requestDelayFocus(AbstractClient*); | 345 | void requestDelayFocus(AbstractClient*); | ||
346 | 346 | | |||
347 | /** | 347 | /** | ||
348 | * updates the mouse position to track whether a focus follow mouse focus change was caused by | 348 | * updates the mouse position to track whether a focus follow mouse focus change was caused by | ||
349 | * an actual mouse move | 349 | * an actual mouse move | ||
350 | * is esp. called on enter/motion events of inactive windows | 350 | * is esp. called on enter/motion events of inactive windows | ||
351 | * since an active window doesn't receive mouse events, it must also be invoked if a (potentially) | 351 | * since an active window doesn't receive mouse events, it must also be invoked if a (potentially) | ||
352 | * active window might be moved/resize away from the cursor (causing a leave event) | 352 | * active window might be moved/resize away from the cursor (causing a leave event) | ||
353 | */ | 353 | **/ | ||
354 | void updateFocusMousePosition(const QPoint& pos); | 354 | void updateFocusMousePosition(const QPoint& pos); | ||
355 | QPoint focusMousePosition() const; | 355 | QPoint focusMousePosition() const; | ||
356 | 356 | | |||
357 | AbstractClient* getMovingClient() { | 357 | AbstractClient* getMovingClient() { | ||
358 | return movingClient; | 358 | return movingClient; | ||
359 | } | 359 | } | ||
360 | 360 | | |||
361 | /** | 361 | /** | ||
▲ Show 20 Lines • Show All 122 Lines • ▼ Show 20 Line(s) | 467 | Q_SIGNALS: | |||
484 | void unmanagedRemoved(KWin::Unmanaged*); | 484 | void unmanagedRemoved(KWin::Unmanaged*); | ||
485 | void deletedRemoved(KWin::Deleted*); | 485 | void deletedRemoved(KWin::Deleted*); | ||
486 | void configChanged(); | 486 | void configChanged(); | ||
487 | void reinitializeCompositing(); | 487 | void reinitializeCompositing(); | ||
488 | void showingDesktopChanged(bool showing); | 488 | void showingDesktopChanged(bool showing); | ||
489 | /** | 489 | /** | ||
490 | * This signels is emitted when ever the stacking order is change, ie. a window is risen | 490 | * This signels is emitted when ever the stacking order is change, ie. a window is risen | ||
491 | * or lowered | 491 | * or lowered | ||
492 | */ | 492 | **/ | ||
493 | void stackingOrderChanged(); | 493 | void stackingOrderChanged(); | ||
494 | 494 | | |||
495 | private: | 495 | private: | ||
496 | void init(); | 496 | void init(); | ||
497 | void initWithX11(); | 497 | void initWithX11(); | ||
498 | void initShortcuts(); | 498 | void initShortcuts(); | ||
499 | template <typename Slot> | 499 | template <typename Slot> | ||
500 | void initShortcut(const QString &actionName, const QString &description, const QKeySequence &shortcut, | 500 | void initShortcut(const QString &actionName, const QString &description, const QKeySequence &shortcut, | ||
▲ Show 20 Lines • Show All 128 Lines • ▼ Show 20 Line(s) | |||||
629 | 629 | | |||
630 | private: | 630 | private: | ||
631 | friend bool performTransiencyCheck(); | 631 | friend bool performTransiencyCheck(); | ||
632 | friend Workspace *workspace(); | 632 | friend Workspace *workspace(); | ||
633 | }; | 633 | }; | ||
634 | 634 | | |||
635 | /** | 635 | /** | ||
636 | * Helper for Workspace::blockStackingUpdates() being called in pairs (True/false) | 636 | * Helper for Workspace::blockStackingUpdates() being called in pairs (True/false) | ||
637 | */ | 637 | **/ | ||
638 | class StackingUpdatesBlocker | 638 | class StackingUpdatesBlocker | ||
639 | { | 639 | { | ||
640 | public: | 640 | public: | ||
641 | explicit StackingUpdatesBlocker(Workspace* w) | 641 | explicit StackingUpdatesBlocker(Workspace* w) | ||
642 | : ws(w) { | 642 | : ws(w) { | ||
643 | ws->blockStackingUpdates(true); | 643 | ws->blockStackingUpdates(true); | ||
644 | } | 644 | } | ||
645 | ~StackingUpdatesBlocker() { | 645 | ~StackingUpdatesBlocker() { | ||
▲ Show 20 Lines • Show All 125 Lines • Show Last 20 Lines |