Encapsulate the details of an X root window. More...
#include <root_window.hh>
Public Member Functions | |
root_window (Display *d, int s) | |
Create a wrapper object for a root window. More... | |
root_window (Display *d, int s, const XineramaScreenInfo &i) | |
Create a wrapper object for a root window with Xinerama active. More... | |
void | set_properties (const std::map< std::string, std::string > &prop) |
Set window properties. More... | |
void | reparent (const window &p) |
Reparent this window to another. More... | |
window | parent () |
Get this root window's parent window. More... | |
int | screen () |
Get screen number of this root window. More... | |
void | show () |
Show the window, i.e., map it. More... | |
void | hide () |
Hide this window, i.e., unmap it. More... | |
bool | is_mapped () |
Check if root window is currently mapped or not. More... | |
void | move_resize (int x, int y, int w, int h) |
Move and resize the window. More... | |
void | configure (int x, int y, int w, int h, int b, const window *s, int t, unsigned int v) |
Configure the window. More... | |
void | set_border_attr (unsigned long c, unsigned int s) |
Set window's border color and size. More... | |
std::vector< int > | geometry () |
Retrieve window's size, position, and border width. More... | |
void | focus () |
Set input focus on this root window and raise it. More... | |
void | kill () |
Kill this window. More... | |
void | nuke () |
Kill this window using brute force. More... | |
Public Member Functions inherited from minxlib::window | |
window (Display *d, Window w) | |
Create a wrapper object for an existing Xlib window. More... | |
bool | operator== (const window &w) const |
Window equality operator. More... | |
bool | operator!= (const window &w) const |
Window inequality operator. More... | |
bool | operator== (Window w) const |
Window equality operator. More... | |
bool | operator!= (Window w) const |
Window inequality operator. More... | |
operator Window () const | |
Convert to an Xlib Window. More... | |
std::map< std::string, std::string > | properties () |
Retrieve window properties from X server. More... | |
std::vector< window > | children () |
Get this window's children. More... | |
void | select_events (long mask) |
Set the X event mask for this window. More... | |
void | grab_key (const std::string &s) |
Setup a passive keyboard grab. More... | |
virtual | ~window () |
Destructor. More... | |
Static Public Member Functions | |
static void | pythonize () |
Export the window class to minxlib Python module. More... | |
Static Public Member Functions inherited from minxlib::window | |
static void | pythonize () |
Export the window class to minxlib Python module. More... | |
Additional Inherited Members | |
Public Types inherited from minxlib::window | |
enum | event_mask |
An enumeration for the different event masks. More... | |
enum | configure_mask |
An enumeration for the different configure values. More... | |
Encapsulate the details of an X root window.
This class provides an API for the Python parts of Minx to be able to deal with X root windows. It wraps around the relevant parts of Xlib and exposes its functionality to Python via Boost.Python.
Although we could just represent a root window as just another minxlib::window, we have a dedicated subclass for root windows to be able to deal with Xinerama. When Xinerama is active, a multi-head setup will have just one root window. However, to make Minx's layout functionality work properly across multiple physical monitors, minxlib always presents as many root windows as there are physical monitors. With Xinerama, these root windows will have the same window ID, but will have different geometries.
minxlib::root_window::root_window | ( | Display * | d, |
int | s | ||
) |
Create a wrapper object for a root window.
d | The display object to which the window is "linked." |
s | The zero-based screen index whose root window we want. |
This constructor is meant to be used when Xinerama is not active. In multi-head setups without Xinerama, the X server will be configured with independent displays.
minxlib::root_window::root_window | ( | Display * | d, |
int | s, | ||
const XineramaScreenInfo & | i | ||
) |
Create a wrapper object for a root window with Xinerama active.
d | The display object to which the window is "linked." |
s | The zero-based screen index whose root window we want. |
i | The Xinerama screen info structure for the specified screen. |
This constructor is meant to be used when Xinerama is active. It is the caller's responsibility to obtain the XineramaScreenInfo structures by calling XineramaQueryScreens() and then freeing them once all the necessary root window objects have been created.
|
virtual |
Configure the window.
x | Window's x coordinate relative to parent's origin. |
y | Window's y coordinate relative to parent's origin. |
w | Window's width (not counting its border). |
h | Window's height (not counting its border). |
b | Window's border width. |
s | Window's sibling for stacking operations. |
t | Window's stacking mode. |
v | Value mask to determine what to configure. |
This is an override of minxlib::window::configure(). minxlib does not allow root windows to be configured. Thus, this implementation simply logs a warning to the Minx log and does nothing else.
Reimplemented from minxlib::window.
|
virtual |
Set input focus on this root window and raise it.
This is an override of minxlib::window::focus(). minxlib does not allow root windows to be focused. Thus, this implementation simply logs a warning to the Minx log and does nothing else.
Reimplemented from minxlib::window.
|
virtual |
Retrieve window's size, position, and border width.
Root windows have a fixed geometry. When a root window object is constructed, we determine its geometry and store that in a data member. This function simply returns the above-mentioned data member, which is an STL vector of integers containing the following five values:
Reimplemented from minxlib::window.
|
virtual |
Hide this window, i.e., unmap it.
This is an override of minxlib::window::hide(). Since root windows are always visible and cannot be unmapped, this function simply logs a warning to the Minx log.
Reimplemented from minxlib::window.
|
virtual |
Check if root window is currently mapped or not.
Reimplemented from minxlib::window.
|
virtual |
Kill this window.
This is an override of minxlib::window::kill(). minxlib does not allow root windows to be killed. Thus, this implementation simply logs a warning to the Minx log and does nothing else.
Reimplemented from minxlib::window.
|
virtual |
Move and resize the window.
x | Window's x coordinate relative to parent's origin. |
y | Window's y coordinate relative to parent's origin. |
w | Window's width (not counting its border). |
h | Window's height (not counting its border). |
This is an override of minxlib::window::move_resize(). minxlib does not allow root windows to be moved and/or resized. Thus, this implementation simply logs a warning to the Minx log and does nothing else.
Reimplemented from minxlib::window.
|
virtual |
Kill this window using brute force.
This is an override of minxlib::window::nuke(). minxlib does not allow root windows to be killed. Thus, this implementation simply logs a warning to the Minx log and does nothing else.
Reimplemented from minxlib::window.
|
virtual |
Get this root window's parent window.
This is an override of minxlib::window::parent(). minxlib does not allow querying root windows for their parents. Thus, this implementation simply logs a warning to the Minx log and returns a window object with ID zero.
Reimplemented from minxlib::window.
|
static |
Export the window class to minxlib Python module.
This function exposes the root window class's interface so that it can be used by the Python parts of Minx. It is meant to be called by the Boost.Python initialization code in python.cc.
|
virtual |
Reparent this window to another.
p | New parent window. |
This is an override of minxlib::window::reparent(). minxlib does not allow root windows to be reparented. Thus, this implementation simply logs a warning to the Minx log and does nothing else.
Reimplemented from minxlib::window.
|
virtual |
Get screen number of this root window.
This function simply returns the screen index used when this root window object was created.
Reimplemented from minxlib::window.
|
virtual |
Set window's border color and size.
c | Three-byte RGB spec. |
s | Border size (in pixels). |
This is an override of minxlib::window::set_border_attr(). minxlib does not allow root window borders to be changed. Thus, this implementation simply logs a warning to the Minx log and does nothing else.
Reimplemented from minxlib::window.
|
virtual |
Set window properties.
prop | An STL map of strings to strings. |
This is an override of minxlib::window::set_properties(). minxlib does not allow root window properties to be set. Thus, this implementation simply logs a warning to the Minx log and does nothing else.
Reimplemented from minxlib::window.
|
virtual |
Show the window, i.e., map it.
This is an override of minxlib::window::show(). Since root windows are always visible, this function simply logs a warning to the Minx log.
Reimplemented from minxlib::window.