#include <stdio.h>#include <stdlib.h>#include <string.h>#include <stdbool.h>#include <assert.h>#include <time.h>#include <unistd.h>#include <xcb/xcb.h>#include <xcb/randr.h>#include "queue.h"#include "i3.h"#include "data.h"#include "table.h"#include "util.h"#include "layout.h"#include "xcb.h"#include "config.h"#include "workspace.h"#include "log.h"#include "ewmh.h"#include "ipc.h"#include "client.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 | initialize_output (xcb_connection_t *conn, Output *output, Workspace *workspace) |
| Initializes the specified output, assigning the specified workspace to it. | |
| void | disable_randr (xcb_connection_t *conn) |
| Disables RandR support by creating exactly one output with the size of the X11 screen. | |
| 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) |
| static void | init_workspaces () |
| void | randr_query_outputs (xcb_connection_t *conn) |
| (Re-)queries the outputs via RandR and stores them in the list of outputs. | |
| void | initialize_randr (xcb_connection_t *conn, 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 | |
| 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 216 of file randr.c.
References xoutput::active, DLOG, Rect::height, xoutput::name, outputs, randr_disabled, xoutput::rect, scalloc(), TAILQ_INSERT_TAIL, Rect::width, Rect::x, and Rect::y.
Referenced by initialize_randr(), initialize_xinerama(), and randr_query_outputs().

| Output* get_first_output | ( | ) |
Returns the first output which is active.
Definition at line 84 of file randr.c.
References xoutput::active, outputs, and TAILQ_FOREACH.
Referenced by main(), and randr_query_outputs().
| static Output* get_output_by_id | ( | xcb_randr_output_t | id | ) | [static] |
Definition at line 57 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 70 of file randr.c.
References xoutput::active, xoutput::name, outputs, and TAILQ_FOREACH.
Referenced by get_first_workspace_for_output(), initialize_output(), and workspace_initialize().
| 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 99 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(), focus_thing(), main(), reparent_window(), reposition_client(), and resize_graphical_handler().
| 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 122 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.
Referenced by focus_thing(), and resize_graphical_handler().
| 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 303 of file randr.c.
References DLOG, FREE, get_output_by_id(), outputs, scalloc(), TAILQ_INSERT_TAIL, and update_if_necessary().
Referenced by randr_query_outputs().

| static void init_workspaces | ( | ) | [static] |
Definition at line 367 of file randr.c.
References xoutput::active, xoutput::current_workspace, get_first_workspace_for_output(), global_conn, initialize_output(), outputs, render_layout(), and TAILQ_FOREACH.
Referenced by initialize_randr(), and randr_query_outputs().

Initializes the specified output, assigning the specified workspace to it.
Definition at line 166 of file randr.c.
References xoutput::bar, xoutput::bargc, config, create_window(), xoutput::current_workspace, Config::disable_workspace_bar, DLOG, Config::font, get_output_by_name(), Font::height, Rect::height, ipc_send_event(), load_font(), Workspace::num, Workspace::output, Workspace::preferred_output, xoutput::rect, Workspace::rect, SLIST_INIT, TAILQ_FOREACH, Rect::width, workspace_assign_to(), workspace_map_clients(), workspaces, Rect::x, XCB_CURSOR_LEFT_PTR, and Rect::y.
Referenced by init_workspaces(), initialize_xinerama(), and randr_query_outputs().

| void initialize_randr | ( | xcb_connection_t * | conn, | |
| 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 522 of file randr.c.
References disable_randr(), init_workspaces(), randr_query_outputs(), and root.
Referenced by main().

| static void output_change_mode | ( | xcb_connection_t * | conn, | |
| Output * | output | |||
| ) | [static] |
Definition at line 246 of file randr.c.
References xoutput::bar, Client::child, client_is_floating(), config, DLOG, Config::font, Client::force_reconfigure, Client::frame, Workspace::fullscreen_client, Font::height, Rect::height, load_font(), Workspace::output, Workspace::rect, Client::rect, xoutput::rect, SLIST_FOREACH, TAILQ_FOREACH, Rect::width, workspaces, Rect::x, xcb_set_window_rect(), and Rect::y.
Referenced by randr_query_outputs().

| void randr_query_outputs | ( | xcb_connection_t * | conn | ) |
(Re-)queries the outputs via RandR and stores them in the list of outputs.
Definition at line 387 of file randr.c.
References xoutput::active, xoutput::changed, xoutput::current_workspace, die, disable_randr(), DLOG, ELOG, ewmh_update_workarea(), get_first_output(), handle_output(), height, Rect::height, init_workspaces(), initialize_output(), min(), xoutput::name, Workspace::output, output_change_mode(), outputs, randr_disabled, xoutput::rect, root, SLIST_EMPTY, SLIST_FIRST, SLIST_INSERT_HEAD, SLIST_REMOVE_HEAD, TAILQ_EMPTY, TAILQ_END, TAILQ_FOREACH, TAILQ_NEXT, xoutput::to_be_disabled, update_if_necessary(), width, Rect::width, workspace_assign_to(), workspaces, Rect::x, and Rect::y.
Referenced by handle_screen_change(), and initialize_randr().

Definition at line 47 of file randr.c.
Referenced by button_press_bar(), client_enter_fullscreen(), disable_randr(), get_first_output(), get_output_by_id(), get_output_by_name(), get_output_containing(), get_output_most(), get_screen_at(), handle_expose_event(), handle_output(), handle_signal(), init_workspaces(), initialize_xinerama(), IPC_HANDLER(), query_screens(), randr_query_outputs(), and render_layout().
bool randr_disabled = false [static] |
Definition at line 49 of file randr.c.
Referenced by disable_randr(), and randr_query_outputs().
1.7.1