#include <time.h>
#include <xcb/randr.h>
#include "all.h"
Go to the source code of this file.
Defines | |
#define | WIN(variable, condition) |
Typedefs | |
typedef xcb_randr_get_crtc_info_reply_t | crtc_info |
typedef xcb_randr_mode_info_t | mode_info |
typedef xcb_randr_get_screen_resources_current_reply_t | resources_reply |
Functions | |
static Output * | get_output_by_id (xcb_randr_output_t id) |
Output * | get_output_by_name (const char *name) |
Returns the output with the given name if it is active (!) or NULL. | |
Output * | get_first_output () |
Returns the first output which is active. | |
Output * | get_output_containing (int x, int y) |
Returns the active (!) output which contains the coordinates x, y or NULL if there is no output which contains these coordinates. | |
Output * | get_output_most (direction_t direction, Output *current) |
Gets the output which is the last one in the given direction, for example the output on the most bottom when direction == D_DOWN, the output most right when direction == D_RIGHT and so on. | |
void | disable_randr (xcb_connection_t *conn) |
Disables RandR support by creating exactly one output with the size of the X11 screen. | |
void | output_init_con (Output *output) |
Initializes a CT_OUTPUT Con (searches existing ones from inplace restart before) to use for the given Output. | |
void | init_ws_for_output (Output *output, Con *content) |
Initializes at least one workspace for this output, trying the following steps until there is at least one workspace:. | |
static void | output_change_mode (xcb_connection_t *conn, Output *output) |
static void | handle_output (xcb_connection_t *conn, xcb_randr_output_t id, xcb_randr_get_output_info_reply_t *output, xcb_timestamp_t cts, resources_reply *res) |
void | randr_query_outputs () |
Initializes the specified output, assigning the specified workspace to it. | |
void | randr_init (int *event_base) |
We have just established a connection to the X server and need the initial XRandR information to setup workspaces for each screen. | |
Variables | |
xcb_randr_get_output_primary_reply_t * | primary |
struct outputs_head | outputs = TAILQ_HEAD_INITIALIZER(outputs) |
static bool | randr_disabled = false |
#define WIN | ( | variable, | |||
condition | ) |
if (variable condition) { \ candidate = output; \ position = variable; \ } \ break;
Referenced by get_output_most().
typedef xcb_randr_get_screen_resources_current_reply_t resources_reply |
void disable_randr | ( | xcb_connection_t * | conn | ) |
Disables RandR support by creating exactly one output with the size of the X11 screen.
Definition at line 151 of file randr.c.
References xoutput::active, xoutput::con, DLOG, Rect::height, init_ws_for_output(), xoutput::name, output_get_content(), output_init_con(), outputs, randr_disabled, xoutput::rect, root_screen, scalloc(), TAILQ_INSERT_TAIL, Rect::width, Rect::x, and Rect::y.
Referenced by randr_init(), randr_query_outputs(), and xinerama_init().
Output* get_first_output | ( | ) |
Returns the first output which is active.
Definition at line 68 of file randr.c.
References xoutput::active, outputs, and TAILQ_FOREACH.
Referenced by randr_query_outputs().
static Output* get_output_by_id | ( | xcb_randr_output_t | id | ) | [static] |
Definition at line 41 of file randr.c.
References xoutput::id, outputs, and TAILQ_FOREACH.
Referenced by handle_output().
Output* get_output_by_name | ( | const char * | name | ) |
Returns the output with the given name if it is active (!) or NULL.
Definition at line 54 of file randr.c.
References xoutput::active, xoutput::name, outputs, and TAILQ_FOREACH.
Referenced by init_ws_for_output().
Output* get_output_containing | ( | int | x, | |
int | y | |||
) |
Returns the active (!) output which contains the coordinates x, y or NULL if there is no output which contains these coordinates.
Definition at line 83 of file randr.c.
References xoutput::active, DLOG, Rect::height, outputs, xoutput::rect, TAILQ_FOREACH, Rect::width, Rect::x, and Rect::y.
Referenced by check_crossing_screen_boundary(), floating_enable(), floating_maybe_reassign_ws(), and manage_window().
Output* get_output_most | ( | direction_t | direction, | |
Output * | current | |||
) |
Gets the output which is the last one in the given direction, for example the output on the most bottom when direction == D_DOWN, the output most right when direction == D_RIGHT and so on.
This function always returns a output.
Definition at line 106 of file randr.c.
References xoutput::active, D_DOWN, D_LEFT, D_RIGHT, D_UP, outputs, xoutput::rect, TAILQ_FOREACH, WIN, Rect::x, and Rect::y.
static void handle_output | ( | xcb_connection_t * | conn, | |
xcb_randr_output_t | id, | |||
xcb_randr_get_output_info_reply_t * | output, | |||
xcb_timestamp_t | cts, | |||
resources_reply * | res | |||
) | [static] |
Definition at line 476 of file randr.c.
References DLOG, FREE, get_output_by_id(), outputs, primary, scalloc(), TAILQ_INSERT_HEAD, TAILQ_INSERT_TAIL, and update_if_necessary().
Referenced by randr_query_outputs().
Initializes at least one workspace for this output, trying the following steps until there is at least one workspace:.
• Move existing workspaces, which are assigned to be on the given output, to the output. • Create the first assigned workspace for this output. • Create the first unused workspace.
Definition at line 280 of file randr.c.
References xoutput::con, con_attach(), con_detach(), con_focus(), con_get_output(), con_new(), config, croot, Config::default_orientation, DLOG, focused, FREE, Con::fullscreen_mode, get_output_by_name(), GREP_FIRST, Rect::height, HORIZ, init_ws_for_output(), LOG, Con::name, Workspace_Assignment::name, xoutput::name, NO_ORIENTATION, Con::num, Con::orientation, Workspace_Assignment::output, output_get_content(), xoutput::rect, TAILQ_EMPTY, TAILQ_FIRST, TAILQ_FOREACH, TAILQ_NEXT, Con::type, VERT, Rect::width, workspace_is_visible(), workspace_show(), ws_assignments, and x_set_name().
Referenced by disable_randr(), init_ws_for_output(), query_screens(), and randr_query_outputs().
static void output_change_mode | ( | xcb_connection_t * | conn, | |
Output * | output | |||
) | [static] |
Definition at line 436 of file randr.c.
References xoutput::con, con_num_children(), config, Config::default_orientation, DLOG, Rect::height, HORIZ, Con::name, NO_ORIENTATION, Con::num, Con::orientation, output_get_content(), xoutput::rect, Con::rect, TAILQ_FIRST, TAILQ_FOREACH, VERT, and Rect::width.
Referenced by randr_query_outputs().
void output_init_con | ( | Output * | output | ) |
Initializes a CT_OUTPUT Con (searches existing ones from inplace restart before) to use for the given Output.
Definition at line 175 of file randr.c.
References xoutput::con, con_attach(), con_fix_percent(), con_new(), croot, DLOG, Match::dock, FREE, Match::insert_where, Con::layout, match_init(), Con::name, xoutput::name, Con::orientation, xoutput::rect, Con::rect, scalloc(), sstrdup(), TAILQ_FOREACH, TAILQ_INSERT_TAIL, Con::type, VERT, and x_set_name().
Referenced by disable_randr(), query_screens(), and randr_query_outputs().
void randr_init | ( | int * | event_base | ) |
We have just established a connection to the X server and need the initial XRandR information to setup workspaces for each screen.
Definition at line 767 of file randr.c.
References conn, disable_randr(), randr_query_outputs(), and root.
Referenced by main().
void randr_query_outputs | ( | ) |
Initializes the specified output, assigning the specified workspace to it.
(Re-)queries the outputs via RandR and stores them in the list of outputs.
Definition at line 550 of file randr.c.
References xoutput::active, xoutput::changed, xoutput::con, con_attach(), con_descend_focused(), con_detach(), con_focus(), con_for_window(), con_next_focused(), conn, croot, die, disable_randr(), DLOG, DONT_KILL_WINDOW, ELOG, ewmh_update_workarea(), FREE, get_first_output(), handle_output(), Rect::height, init_ws_for_output(), min(), Con::name, xoutput::name, Workspace_Assignment::output, output_change_mode(), output_get_content(), output_init_con(), outputs, xoutput::primary, primary, randr_disabled, xoutput::rect, root, TAILQ_EMPTY, TAILQ_END, TAILQ_FIRST, TAILQ_FOREACH, TAILQ_NEXT, xoutput::to_be_disabled, tree_close(), tree_render(), Con::type, update_if_necessary(), Rect::width, Con::window, Rect::x, and Rect::y.
Referenced by handle_screen_change(), and randr_init().
Definition at line 31 of file randr.c.
Referenced by disable_randr(), get_first_output(), get_output_by_id(), get_output_by_name(), get_output_containing(), get_output_most(), get_screen_at(), handle_output(), handle_signal(), IPC_HANDLER(), query_screens(), randr_query_outputs(), and xinerama_init().
xcb_randr_get_output_primary_reply_t* primary |
Definition at line 28 of file randr.c.
Referenced by handle_output(), and randr_query_outputs().
bool randr_disabled = false [static] |
Definition at line 33 of file randr.c.
Referenced by disable_randr(), and randr_query_outputs().