KWin
|
Singleton class to handle the various focus chains. More...
#include <focuschain.h>
Public Types | |
enum | Change { MakeFirst , MakeLast , Update , MakeFirstMinimized = MakeFirst } |
Public Slots | |
void | remove (KWin::Window *window) |
Removes window from all focus chains. | |
void | setSeparateScreenFocus (bool enabled) |
void | setActiveWindow (KWin::Window *window) |
void | setCurrentDesktop (VirtualDesktop *desktop) |
void | addDesktop (VirtualDesktop *desktop) |
void | removeDesktop (VirtualDesktop *desktop) |
Public Member Functions | |
FocusChain ()=default | |
void | update (Window *window, Change change) |
Updates the position of the window according to the requested change in the focus chain. | |
void | moveAfterWindow (Window *window, Window *reference) |
Moves window behind the reference Window in all focus chains. | |
Window * | getForActivation (VirtualDesktop *desktop) const |
Finds the best Window to become the new active Window in the focus chain for the given virtual desktop . | |
Window * | getForActivation (VirtualDesktop *desktop, Output *output) const |
Finds the best Window to become the new active Window in the focus chain for the given virtual desktop on the given screen . | |
bool | contains (Window *window) const |
Checks whether the most recently used focus chain contains the given window . | |
bool | contains (Window *window, VirtualDesktop *desktop) const |
Checks whether the focus chain for the given desktop contains the given window . | |
Window * | nextMostRecentlyUsed (Window *reference) const |
Queries the most recently used focus chain for the next Window after the given reference Window. | |
Window * | nextForDesktop (Window *reference, VirtualDesktop *desktop) const |
Queries the focus chain for desktop for the next Window in relation to the given reference Window. | |
Window * | firstMostRecentlyUsed () const |
Returns the first Window in the most recently used focus chain. First Window in this case means really the first Window in the chain and not the most recently used Window. | |
bool | isUsableFocusCandidate (Window *window, Window *prev) const |
Singleton class to handle the various focus chains.
A focus chain is a list of Windows containing information on which Window should be activated.
Internally this FocusChain holds multiple independent chains. There is one chain of most recently used Windows which is primarily used by TabBox to build up the list of Windows for navigation. The chains are organized as a normal QList of Windows with the most recently used Window being the last item of the list, that is a LIFO like structure.
In addition there is one chain for each virtual desktop which is used to determine which Window should get activated when the user switches to another virtual desktop.
Furthermore this class contains various helper methods for the two different kind of chains.
Definition at line 38 of file focuschain.h.
Enumerator | |
---|---|
MakeFirst | |
MakeLast | |
Update | |
MakeFirstMinimized |
Definition at line 42 of file focuschain.h.
|
explicitdefault |
|
slot |
Definition at line 26 of file focuschain.cpp.
|
inline |
Checks whether the most recently used focus chain contains the given window
.
Does not consider the per-desktop focus chains.
window | The Window to look for. |
true
if the most recently used focus chain contains window
, false
otherwise. Definition at line 209 of file focuschain.h.
bool KWin::FocusChain::contains | ( | Window * | window, |
VirtualDesktop * | desktop ) const |
Checks whether the focus chain for the given desktop
contains the given window
.
Does not consider the most recently used focus chain.
window | The Window to look for. |
desktop | The virtual desktop whose focus chain should be used |
true
if the focus chain for desktop
contains window
, false
otherwise. Definition at line 229 of file focuschain.cpp.
Window * KWin::FocusChain::firstMostRecentlyUsed | ( | ) | const |
Window * KWin::FocusChain::getForActivation | ( | VirtualDesktop * | desktop | ) | const |
Finds the best Window to become the new active Window in the focus chain for the given virtual desktop
.
In case that separate screen focus is used only Windows on the current screen are considered. If no Window for activation is found null
is returned.
desktop | The virtual desktop to look for a Window for activation |
Definition at line 39 of file focuschain.cpp.
Window * KWin::FocusChain::getForActivation | ( | VirtualDesktop * | desktop, |
Output * | output ) const |
Finds the best Window to become the new active Window in the focus chain for the given virtual desktop
on the given screen
.
This method makes only sense to use if separate screen focus is used. If separate screen focus is disabled the screen
is ignored. If no Window for activation is found null
is returned.
desktop | The virtual desktop to look for a Window for activation |
output | The screen to constrain the search on with separate screen focus |
Definition at line 44 of file focuschain.cpp.
Definition at line 194 of file focuschain.cpp.
Moves window
behind the reference
Window in all focus chains.
window | The Window to move in the chains |
reference | The Window behind which the window should be moved |
Definition at line 132 of file focuschain.cpp.
Window * KWin::FocusChain::nextForDesktop | ( | Window * | reference, |
VirtualDesktop * | desktop ) const |
Queries the focus chain for desktop
for the next Window in relation to the given reference
Window.
The method finds the first usable Window which is not the reference
Window. If no Window can be found null
is returned
reference | The reference Window which should not be returned |
desktop | The virtual desktop whose focus chain should be used |
Definition at line 199 of file focuschain.cpp.
Queries the most recently used focus chain for the next Window after the given reference
Window.
The navigation wraps around the borders of the chain. That is if the reference
Window is the last item of the focus chain, the first Window will be returned.
If the reference
Window cannot be found in the focus chain, the first element of the focus chain is returned.
reference | The start point in the focus chain to search |
Definition at line 178 of file focuschain.cpp.
|
slot |
Removes window
from all focus chains.
window | The Window to remove from all focus chains. |
Definition at line 16 of file focuschain.cpp.
|
slot |
Definition at line 31 of file focuschain.cpp.
|
inlineslot |
Definition at line 219 of file focuschain.h.
|
inlineslot |
Definition at line 224 of file focuschain.h.
|
inlineslot |
Definition at line 214 of file focuschain.h.
void KWin::FocusChain::update | ( | Window * | window, |
FocusChain::Change | change ) |
Updates the position of the window
according to the requested change
in the focus chain.
This method affects both the most recently used focus chain and the per virtual desktop focus chain.
In case the window does no longer want to get focus, it is removed from all chains. In case the window is on all virtual desktops it is ensured that it is present in each of the virtual desktops focus chain. In case it's on exactly one virtual desktop it is ensured that it is only in the focus chain for that virtual desktop.
Depending on change
the Window is inserted at different positions in the focus chain. In case of MakeFirst
it is moved to the first position of the chain, in case of MakeLast
it is moved to the last position of the chain. In all other cases it depends on whether the window
is the currently active Window. If it is the active Window it becomes the first Window in the chain, otherwise it is inserted at the second position that is directly after the currently active Window.
Definition at line 62 of file focuschain.cpp.