Bool XRRQueryExtension (Display *_d_p_y, int *_e_v_e_n_t___b_a_s_e___r_e_t_u_r_n, int *_e_r_r_o_r___b_a_s_e___r_e_t_u_r_n);
Status XRRQueryVersion (Display *_d_p_y, int *_m_a_j_o_r___v_e_r_s_i_o_n___r_e_t_u_r_n, int *_m_i_n_o_r___v_e_r_s_i_o_n___r_e_t_u_r_n);
XRRScreenConfiguration *XRRGetScreenInfo (Display *dpy, Drawable _d_r_a_w);
void XRRFreeScreenConfigInfo ( _X_R_R_S_c_r_e_e_n_C_o_n_f_i_g_u_r_a_t_i_o_n _*_c_o_n_f_i_g);
Status XRRSetScreenConfig (Display *_d_p_y, XRRScreenConfiguration *_c_o_n_f_i_g, Drawable _d_r_a_w, int _s_i_z_e___i_n_d_e_x, Rotation _r_o_t_a_t_i_o_n, Time _t_i_m_e_s_t_a_m_p);
Status XRRSetScreenConfigAndRate (Display *_d_p_y, XRRScreenConfiguration *_c_o_n_f_i_g, Drawable _d_r_a_w, int _s_i_z_e___i_n_d_e_x, Rotation _r_o_t_a_t_i_o_n, short _r_a_t_e, Time _t_i_m_e_s_t_a_m_p);
Rotation XRRConfigRotations( XRRScreenConfiguration *_c_o_n_f_i_g, Rotation *_c_u_r_r_e_n_t___r_o_t_a_t_i_o_n);
Time XRRConfigTimes ( XRRScreenConfiguration *_c_o_n_f_i_g, Time *_c_o_n_f_i_g___t_i_m_e_s_t_a_m_p);
XRRScreenSize *XRRConfigSizes( XRRScreenConfiguration *_c_o_n_f_i_g, int *_n_s_i_z_e_s);
short *XRRConfigRates ( XRRScreenConfiguration *_c_o_n_f_i_g, int _s_i_z_e___i_n_d_e_x, int *_n_r_a_t_e_s);
SizeID XRRConfigCurrentConfiguration ( XRRScreenConfiguration *_c_o_n_f_i_g, Rotation *_r_o_t_a_t_i_o_n);
short XRRConfigCurrentRate ( XRRScreenConfiguration *_c_o_n_f_i_g);
int XRRRootToScreen( Display *_d_p_y, Window _r_o_o_t);
void XRRSelectInput(Display *_d_p_y, Window _w_i_n_d_o_w, int _m_a_s_k);
/* * intended to take RRScreenChangeNotify, or * ConfigureNotify (_o_n _t_h_e _r_o_o_t _w_i_n_d_o_w) * returns 1 if it is an event type it understands, 0 if not */ int XRRUpdateConfiguration(XEvent *_e_v_e_n_t^);
/* * the following are always safe to call, even if RandR is * not implemented on a screen */ Rotation XRRRotations( Display *_d_p_y, int _s_c_r_e_e_n, Rotation *_c_u_r_r_e_n_t___r_o_t_a_t_i_o_n);
XRRScreenSize *XRRSizes(Display *_d_p_y, int _s_c_r_e_e_n, int *_n_s_i_z_e_s);
short *XRRRates (Display *_d_p_y, int _s_c_r_e_e_n, int _s_i_z_e___i_n_d_e_x, int *_n_r_a_t_e_s);
Time XRRTimes (Display *_d_p_y, int _s_c_r_e_e_n, Time *_c_o_n_f_i_g___t_i_m_e_s_t_a_m_p);
Rotations/Reflections
Can be any of:
#define RR_Rotate_0 1 #define RR_Rotate_90 2 #define RR_Rotate_180 4 #define RR_Rotate_270 8
/* new in 1.0 protocol, to allow reflection of screen */ /* reflection is applied after rotation */
#define RR_Reflect_X 16 #define RR_Reflect_Y 32
typedef struct { int width, height; int mwidth, mheight; } XRRScreenSize;
typedef struct {
int type; /* event base */
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Window window; /* window which selected for this event */
Window root; /* Root window for changed screen */
Time timestamp; /* when the screen change occurred */
Time config_timestamp; /* when the last configuration change */
SizeID size_index;
SubpixelOrder subpixel_order;
Rotation rotation;
int width;
int height;
int mwidth;
int mheight;
} XRRScreenChangeNotifyEvent;
XRRScreenSize
structure contains a possible root size in pixels and in millimeters.
XRRScreenChangeNotifyEvent
Is sent to a client that has requested notification whenever the screen
configuration is changed.
XRRScreenConfiguration This is an opaque data type containing the configuration information for a screen.
Timestamps
Time stamps are included and must be used to ensure the client is playing with a full deck: the screen may change properties on the fly and this ensures its knowledge of the configuration is up to date. This is to help issues when screens may become hot-pluggable in the future.
The Xrandr library does some minimal caching to avoid roundtrips to provide clients frequently used information. See "The X Resize and Rotate Extension" for a detailed description; also note that depth switching, as described in the document is not implemented, and may (or may not) ever be implemented, as display memory is growing rapidly, and toolkits are already beginning to support migration, mitigating the need for depth switching. If it is implemented in the future, we expect to do so via an upward compatible extension to the current library/protocol; functionality described here should continue to work.
Rotation and reflection and how they interact can be confusing. In Randr, the coordinate system is rotated in a counter-clockwise direction relative to the normal orientation. Reflection is along the window system coordinate system, not the physical screen X and Y axis, so that rotation and reflection do not interact. The other way to consider reflection is to is specified in the "normal" orientation, before rotation, if you find the other way confusing.
The XRRScreenChangeNotify event is sent to clients that ask to be informed whenever the root window configuration changes. Configuration changes may include resolution, physical size, subpixel order (see XRender(3)), and rotation. Note that changes to any or all of these could occur due to external events (user control in the X server, a different monitor/flat panel display being hot-plugged) and is not only the result of a protocol/library request to the X server.
Additionally, to eliminate a potential race condition, this event may be generated immediately upon selecting for notification if the screen has changed since the client of Xrandr connected to the X server, to enable reliable screen resolution changing when a user may log in and change the configuration while one or many clients are starting up.
Xlib notification
Clients must call back into Xlib using XRRUpdateConfiguration when screen configuration change notify events are generated (or root window configuration changes occur, to update Xlib's view of the resolution, size, rotation, reflection or subpixel order. Generally, toolkits will perform this operation on behalf of applications; we did not want to change display structure data behind the back of toolkits, as in multithreaded clients, various race conditions might occur. Toolkits should provide clients some mechanism for notification of screen change, of course.
XRRRotations returns both the possible set of rotations/reflections supported (as a bitmask) as the value of the function, along with the current rotation/reflection of the screen.
XRRSizes returns the size and a pointer to the current sizes supported by the specified screen. The first size specified is the default size of the server. If RandR is not supported, it returns 0 for the number of sizes.
XRRRates returns a pointer to a the rates supported by the specified size. If RandR is not supported, it returns 0 for the number of rates.
XRRTimes returns the time last reported by the server along with the timestamp the last configuration changed. If the configuration has changed since the client last updated its view of the server time, requests to change the configuration will fail until the client has an up to date timestamp.
XRRRootToScreen returns the screen number given a root window (for example, from an XXRRRRSSccrreeeennCChhaannggeeNNoottiiffyyEEvveenntt_.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