dispswitch.c revision 919
749N/Astatic char *program_name;
749N/Astatic int cur_keycode;
typedef enum _relation {
} relation_t;
typedef enum _changes {
changes_none = 0,
} changes_t;
typedef enum _name_kind {
name_none = 0,
} name_kind_t;
char *string;
int index;
} name_t;
struct _crtc {
int noutput;
struct _output {
float refresh;
static int num_crtcs;
struct _con_output {
int nsmodes;
struct _mod_key_table {
char *modname;
unsigned int mod;
static int start = 0;
static int ncon;
static int dis_ncon;
case RR_Rotate_0:
case RR_Rotate_180:
case RR_Rotate_90:
case RR_Rotate_270:
case RR_Rotate_0:
case RR_Rotate_180:
case RR_Rotate_90:
case RR_Rotate_270:
float rate;
rate = 0;
return rate;
static output_t *
add_output (void)
if (!output)
return output;
static output_t *
return output;
static output_t *
static crtc_t *
for (c = 0; c < num_crtcs; c++)
return crtc;
static crtc_t *
static XRRModeInfo *
return best;
static XRRModeInfo *
get_crtcs (void)
if (crtcs)
crtcs[c].x = 0;
crtcs[c].y = 0;
set_crtcs (void)
for (i = 0; i < ncon; i++) {
reset_crtcs_for_outputs (void)
static Status
if (verbose)
if (dryrun)
return RRSetConfigSuccess;
static Status
if (verbose)
if (dryrun)
return RRSetConfigSuccess;
static Status
Status s;
return RRSetConfigSuccess;
if (!rr_outputs)
return BadAlloc;
if (verbose) {
if (dryrun)
s = RRSetConfigSuccess;
screen_revert (void)
if (verbose)
if (dryrun)
screen_apply (void)
if (verbose)
if (dryrun)
revert (void)
screen_revert ();
char *message;
revert ();
apply (void)
Status s;
if (!old_mode)
x = crtc_info->x;
y = crtc_info->y;
if (s != RRSetConfigSuccess)
screen_apply ();
if (s != RRSetConfigSuccess)
get_outputs (void)
if (!output)
static Bool
for (i = 0; i < ncon; i++)
return False;
return False;
return False;
return False;
return False;
return True;
static crtc_t *
return crtc;
return NULL;
set_positions (void)
for (i = 0; i < ncon; i++)
output->x = 0;
output->y = 0;
case left_of:
case right_of:
case above:
case below:
case same_as:
if (!keep_going)
if (!any_set)
for (i = 0; i < ncon; i++)
for (i = 0; i < ncon; i++)
static Bool
set_screen_size (void)
for (i = 0; i < ncon; i++)
if (!mode_info) continue;
x = output->x;
y = output->y;
if (verbose)
return False;
return True;
while (outputs)
int best_score;
int my_score;
int score;
if (!outputs)
return best_score;
if (!crtc)
my_score++;
return best_score;
static Bool
pick_crtcs (void)
for (i = 0; i < ncon; i++)
if (verbose)
if (i == ncon)
return True;
if (verbose)
return False;
return True;
static Bool
probe_and_check_output_changes (void) {
if (!new_res)
if (changed) {
if (res)
if (verbose)
return True;
if (verbose)
return False;
static Bool
need_probe (void) {
return True;
return False;
static Bool
return False;
x = output->x;
y = output->y;
return False;
x = output->x;
y = output->y;
return True;
static XRRModeInfo *
for (i = 0; i < c->nsmodes; i++) {
if (mode_info) {
x = output->x;
y = output->y;
if (i < c->nsmodes)
return c->smodes[i];
static Bool
return True;
return False;
do_init (void)
for (i = 0; i < MAX_OUTPUT; i++) {
ncon = 0;
dis_ncon = 0;
init_x = 0;
init_y = 0;
get_crtcs ();
get_outputs ();
(int (*) (const void *, const void *)) mode_sort);
if (verbose)
if (crtc)
ncon ++;
dis_ncon ++;
if (verbose) {
for (j = 0; j < ncon; j++) {
for (j = 0; j < dis_ncon; j++) {
start = i;
had_error = 0;
if (!testrun) {
if (had_error) {
if (verbose)
return keycode;
static Bool
do_switch (void)
int single;
for (i = 0; i < ncon; i++)
for (i = 0; i < ncon; i++) {
if (use_init_pos) {
output->x = 0;
output->y = 0;
if (!nosideview) {
if (verbose)
if (verbose)
single = 0;
if (single) {
for (i = 0; i < ncon; i++) {
if (new_mode[i]) {
if (verbose)
if (verbose)
if (!set_screen_size ())
return False;
if (!did_init)
get_crtcs();
if (!pick_crtcs()) {
if (verbose)
return True;
set_crtcs ();
apply();
return True;
static Bool
do_toggle ()
int ret;
if (!atom) {
return False;
if (!win) {
return False;
if (!ret)
return (!ret);
unsigned int modifier = 0;
usage();
int end = 0;
if (verbose)
for (j = 0; j < MAX_MODIFIERS; j++) {
if (j == MAX_MODIFIERS) {
usage();
if (end)
free (q);
usage();
if (toggle)
if (!atom) {
if (verbose)
if (verbose)
if (!win) {
if (verbose)
if (verbose)
if (!key_given)
if (!mod_given)
if (!listen)
if (!res)
do_init();
if (testrun) {
if (verbose)
if (verbose)
if (probe_and_check_output_changes ()) {
while (output) {
for (i = 0; i < ncon; i++) {
do_init();
if (!do_not_switch)
if (!do_switch()) {
if (verbose)
(void) do_switch();