Public Member Functions | List of all members
minx.core.focus_list.focus_list Class Reference

A doubly-linked circular list for keeping track of windows that can be focused. More...

Public Member Functions

def __init__
 Create an empty list.
 
def add
 Insert an item at the beginning of the list. More...
 
def remove
 Remove specified item from list. More...
 
def head
 Return list's first element or None if list is empty.
 
def forward
 Move head to next element. More...
 
def backward
 Move head to previous element. More...
 

Detailed Description

A doubly-linked circular list for keeping track of windows that can be focused.

This class implements a doubly-linked circular list that is meant to be used by the window manager for keeping track of the list of top-level windows that can be focused. The head of this list will always be taken to be the currently focused window.

Member Function Documentation

def minx.core.focus_list.focus_list.add (   self,
  item 
)

Insert an item at the beginning of the list.

Parameters
itemThe item to be added.

This method inserts item (which can be of any type) at the beginning of the list, taking care to maintain circularity.

Note
We add new items to the beginning of the list because this is usually how we want input focus to behave: when a new window is created, it should acquire the input focus.
def minx.core.focus_list.focus_list.backward (   self)

Move head to previous element.

This method is meant to allow moving the input focus from the current top-level window to the previous one in the window manager's list of windows that can be focused.

If the focus list is empty, this function does nothing.

def minx.core.focus_list.focus_list.forward (   self)

Move head to next element.

This method is meant to allow moving the input focus from the current top-level window to the next one in the window manager's list of windows that can be focused.

If the focus list is empty, this function does nothing.

def minx.core.focus_list.focus_list.remove (   self,
  item 
)

Remove specified item from list.

Parameters
itemList item to be removed.

This method searches the list for item and, if it is present, removes it, taking care to maintain circularity. If item is the first element in the list, the second element will become the list's new head after the removal.

Note
To be able to find item, we need its type to support the equality operator. Also, if item occurs more than once, the first instance will be removed.