i3
Enumerations | Functions | Variables
randr.h File Reference
#include <config.h>
#include "data.h"
#include <xcb/randr.h>
Include dependency graph for randr.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  output_close_far_t { CLOSEST_OUTPUT = 0, FARTHEST_OUTPUT = 1 }
 

Functions

 TAILQ_HEAD (outputs_head, xoutput)
 
void randr_init (int *event_base, const bool disable_randr15)
 We have just established a connection to the X server and need the initial XRandR information to setup workspaces for each screen. More...
 
void output_init_con (Output *output)
 Initializes a CT_OUTPUT Con (searches existing ones from inplace restart before) to use for the given Output. More...
 
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: More...
 
void randr_query_outputs (void)
 Initializes the specified output, assigning the specified workspace to it. More...
 
void randr_disable_output (Output *output)
 Disables the output and moves its content. More...
 
Outputget_first_output (void)
 Returns the first output which is active. More...
 
Outputget_output_by_name (const char *name, const bool require_active)
 Returns the output with the given name or NULL. More...
 
Outputget_output_containing (unsigned int x, unsigned int y)
 Returns the active (!) output which contains the coordinates x, y or NULL if there is no output which contains these coordinates. More...
 
Outputget_output_with_dimensions (Rect rect)
 Returns the active output which spans exactly the area specified by rect or NULL if there is no output like this. More...
 
bool contained_by_output (Rect rect)
 
Outputget_output_next (direction_t direction, Output *current, output_close_far_t close_far)
 Gets the output which is the next one in the given direction. More...
 
Outputget_output_next_wrap (direction_t direction, Output *current)
 Like get_output_next with close_far == CLOSEST_OUTPUT, but wraps. More...
 
Outputcreate_root_output (xcb_connection_t *conn)
 

Variables

struct outputs_head outputs
 

Enumeration Type Documentation

◆ output_close_far_t

Enumerator
CLOSEST_OUTPUT 
FARTHEST_OUTPUT 

Definition at line 22 of file randr.h.

Function Documentation

◆ contained_by_output()

bool contained_by_output ( Rect  rect)

Definition at line 146 of file randr.c.

References xoutput::active, DLOG, Rect::height, outputs, xoutput::rect, TAILQ_FOREACH, Rect::width, Rect::x, and Rect::y.

Referenced by floating_reposition().

◆ create_root_output()

Output* create_root_output ( xcb_connection_t *  conn)

◆ get_first_output()

Output* get_first_output ( void  )

Returns the first output which is active.

Definition at line 72 of file randr.c.

References xoutput::active, die, outputs, and TAILQ_FOREACH.

Referenced by main(), and randr_disable_output().

◆ get_output_by_name()

Output* get_output_by_name ( const char *  name,
const bool  require_active 
)

Returns the output with the given name or NULL.

If require_active is true, only active outputs are considered.

Definition at line 47 of file randr.c.

References xoutput::active, output_name::name, output_name::names, xoutput::names_head, outputs, xoutput::primary, SLIST_FOREACH, and TAILQ_FOREACH.

Referenced by canonicalize_output_name(), get_output_for_con(), get_output_from_string(), init_ws_for_output(), and randr_query_outputs_15().

◆ get_output_containing()

Output* get_output_containing ( unsigned int  x,
unsigned 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 102 of file randr.c.

References xoutput::active, DLOG, Rect::height, outputs, xoutput::rect, TAILQ_FOREACH, Rect::width, Rect::x, and Rect::y.

Referenced by _tree_next(), check_crossing_screen_boundary(), floating_enable(), floating_maybe_reassign_ws(), floating_move_to_pointer(), handle_configure_request(), main(), manage_window(), and x_push_changes().

◆ get_output_next()

Output* get_output_next ( direction_t  direction,
Output current,
output_close_far_t  close_far 
)

Gets the output which is the next one in the given direction.

If close_far == CLOSEST_OUTPUT, then the output next to the current one will selected. If close_far == FARTHEST_OUTPUT, the output which is the last one in the given direction will be selected.

NULL will be returned when no active outputs are present in the direction specified (note that ‘current’ counts as such an output).

Definition at line 204 of file randr.c.

References xoutput::active, CLOSEST_OUTPUT, D_DOWN, D_LEFT, D_RIGHT, D_UP, DLOG, Rect::height, output_primary_name(), outputs, xoutput::rect, TAILQ_FOREACH, Rect::width, Rect::x, and Rect::y.

Referenced by _tree_next(), get_output_next_wrap(), and move_to_output_directed().

Here is the call graph for this function:

◆ get_output_next_wrap()

Output* get_output_next_wrap ( direction_t  direction,
Output current 
)

Like get_output_next with close_far == CLOSEST_OUTPUT, but wraps.

For example if get_output_next(D_DOWN, x, FARTHEST_OUTPUT) = NULL, then get_output_next_wrap(D_DOWN, x) will return the topmost output.

This function always returns a output: if no active outputs can be found, current itself is returned.

Definition at line 172 of file randr.c.

References CLOSEST_OUTPUT, D_DOWN, D_LEFT, D_RIGHT, D_UP, DLOG, FARTHEST_OUTPUT, get_output_next(), and output_primary_name().

Referenced by get_output_from_string().

Here is the call graph for this function:

◆ get_output_with_dimensions()

Output* get_output_with_dimensions ( Rect  rect)

Returns the active output which spans exactly the area specified by rect or NULL if there is no output like this.

Definition at line 122 of file randr.c.

References xoutput::active, DLOG, Rect::height, outputs, xoutput::rect, TAILQ_FOREACH, Rect::width, Rect::x, and Rect::y.

Referenced by manage_window().

◆ init_ws_for_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:

• 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 399 of file randr.c.

References CF_OUTPUT, xoutput::con, con_attach(), con_detach(), con_focus(), con_get_output(), create_workspace_on_output(), croot, DLOG, floating_fix_coordinates(), Con::floating_head, focused, Con::fullscreen_mode, get_output_by_name(), GREP_FIRST, init_ws_for_output(), LOG, Workspace_Assignment::name, Con::name, Con::nodes_head, Workspace_Assignment::output, output_get_content(), output_primary_name(), Con::rect, render_con(), TAILQ_EMPTY, TAILQ_FIRST, TAILQ_FOREACH, TAILQ_NEXT, workspace_is_visible(), workspace_show(), workspace_show_by_name(), and ws_assignments.

Referenced by fake_outputs_init(), fallback_to_root_output(), init_ws_for_output(), query_screens(), randr_query_outputs(), and use_root_output().

Here is the call graph for this function:

◆ output_init_con()

void output_init_con ( Output output)

◆ randr_disable_output()

void randr_disable_output ( Output output)

◆ randr_init()

void randr_init ( int *  event_base,
const bool  disable_randr15 
)

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 1037 of file randr.c.

References conn, create_root_output(), DLOG, ELOG, fallback_to_root_output(), has_randr_1_5, outputs, randr_query_outputs(), root, and TAILQ_INSERT_TAIL.

Referenced by main().

Here is the call graph for this function:

◆ randr_query_outputs()

void randr_query_outputs ( void  )

◆ TAILQ_HEAD()

TAILQ_HEAD ( outputs_head  ,
xoutput   
)

Variable Documentation

◆ outputs

struct outputs_head outputs