Defines | Typedefs | Functions | Variables

src/randr.c File Reference

#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"
Include dependency graph for randr.c:

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 Outputget_output_by_id (xcb_randr_output_t id)
Outputget_output_by_name (const char *name)
 Returns the output with the given name if it is active (!) or NULL.
Outputget_first_output ()
 Returns the first output which is active.
Outputget_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.
Outputget_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 Documentation

#define WIN (   variable,
  condition 
)
Value:
if (variable condition) { \
                                candidate = output; \
                                position = variable; \
                        } \
                        break;

Referenced by get_output_most().


Typedef Documentation

typedef xcb_randr_get_crtc_info_reply_t crtc_info

Definition at line 42 of file randr.c.

typedef xcb_randr_mode_info_t mode_info

Definition at line 43 of file randr.c.

typedef xcb_randr_get_screen_resources_current_reply_t resources_reply

Definition at line 44 of file randr.c.


Function Documentation

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

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 randr_query_outputs().

Here is the call graph for this function:

void initialize_output ( xcb_connection_t *  conn,
Output output,
Workspace workspace 
)
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(), randr_query_outputs(), and root.

Referenced by main().

Here is the call graph for this function:

static void output_change_mode ( xcb_connection_t *  conn,
Output output 
) [static]
void randr_query_outputs ( xcb_connection_t *  conn  ) 

Variable Documentation

struct outputs_head outputs = TAILQ_HEAD_INITIALIZER(outputs)
bool randr_disabled = false [static]

Definition at line 49 of file randr.c.

Referenced by disable_randr(), and randr_query_outputs().