howm
howm
|
A monitor stores workspaces. The user can have multiple monitors. More...
#include <stdlib.h>
#include <xcb/randr.h>
#include "monitor.h"
#include "helper.h"
#include "howm.h"
#include "workspace.h"
#include "xcb_help.h"
Functions | |
monitor_t * | create_monitor (xcb_rectangle_t rect) |
Allocate memory for a monitor and update global state. More... | |
void | remove_monitor (monitor_t *m) |
Remove a monitor and all of its workspaces. More... | |
void | focus_monitor (monitor_t *m) |
Set a monitor as the focused monitor. More... | |
uint32_t | monitor_to_index (const monitor_t *m) |
Find and return a monitor's index in the monitor list. More... | |
monitor_t * | index_to_monitor (uint32_t index) |
Convert a monitor's index in a monitor list to an index. More... | |
static void | scan_x11_monitor (void) |
Create a single monitor for use with default X11. More... | |
static bool | scan_xrandr_monitors (void) |
Detect and initialise monitors for each Xrandr output. More... | |
static monitor_t * | randr_output_to_monitor (xcb_randr_output_t output) |
Convert an xcb output to a monitor. More... | |
monitor_t * | point_to_monitor (xcb_point_t point) |
Convert a point to a monitor that it is within. More... | |
void | scan_monitors (void) |
Initialise a monitor for each supported screen. More... | |
A monitor stores workspaces. The user can have multiple monitors.
monitor_t* create_monitor | ( | xcb_rectangle_t | rect | ) |
Allocate memory for a monitor and update global state.
rect | A rectangle representing the size of the monitor. |
void focus_monitor | ( | monitor_t * | m | ) |
Set a monitor as the focused monitor.
m | The monitor to be focused. |
monitor_t* index_to_monitor | ( | uint32_t | index | ) |
Convert a monitor's index in a monitor list to an index.
index | The index to search for. |
uint32_t monitor_to_index | ( | const monitor_t * | m | ) |
Find and return a monitor's index in the monitor list.
m | The monitor to search for. |
monitor_t* point_to_monitor | ( | xcb_point_t | point | ) |
Convert a point to a monitor that it is within.
point | The point to be converted to a monitor. |
|
static |
Convert an xcb output to a monitor.
output | The xcb output to be searched for. |
void remove_monitor | ( | monitor_t * | m | ) |
Remove a monitor and all of its workspaces.
m | The monitor to be removed. |
void scan_monitors | ( | void | ) |
Initialise a monitor for each supported screen.
|
static |
Create a single monitor for use with default X11.
|
static |
Detect and initialise monitors for each Xrandr output.
We loop through outputs and then go "backwards" to find their CRTCs. This means we can skip CRTCs with no outputs.
XXX: I was sleep deprived when I wrote this, so I can imagine there being lots of memory leaks etc...