[Cin] Interesting confusion on X screens vs displays

Andrew Randrianasulu randrianasulu at gmail.com
Sun Jan 8 05:40:45 CET 2023


I tried to test multi-monitor support by firing another, nested X server

Xephyr :1 -screen 1024x768

then Cin displays her windows on either DISPLAY :0 or :1 depend on
preferences but I can\t set compositor to just one ...xserver.

I looked into code :)

in cwindowgui.C

CWindowGUI::CWindowGUI(MWindow *mwindow, CWindow *cwindow)
 : BC_Window(_(PROGRAM_NAME ": Compositor"),
    mwindow->session->cwindow_x,
    mwindow->session->cwindow_y,
    mwindow->session->cwindow_w,
    mwindow->session->cwindow_h,
    xS(100), yS(100), 1, 1, 1,
    BC_WindowBase::get_resources()->bg_color,
    mwindow->get_cwindow_display())

in mwindow.C

char *MWindow::get_cwindow_display()
{
    char *x11_host = screens < 2 || session->window_config == 0 ?
        session->a_x11_host : session->b_x11_host;
    return *x11_host ? x11_host : 0;
}

and screens set in

void MWindow::init_preferences()
{
    preferences = new Preferences;
    preferences->load_defaults(defaults);
    File::setenv_path("LV2_PATH",preferences->lv2_path, 1);
    session = new MainSession(this);
    session->load_defaults(defaults);
    // set x11_host, screens, window_config
    screens = session->set_default_x11_host();

so into mainsession.C

// set default x11 host, window_config, return screens
int MainSession::set_default_x11_host(int win_config)
{
    if( win_config < 0 ) win_config = window_config;
    const char *x11_host = win_config!=1 ? a_x11_host : b_x11_host;
    BC_DisplayInfo display_info(x11_host,0);
    int screen = display_info.get_screen();
    if( screen < 0 && strcmp(a_x11_host, b_x11_host) ) {
        win_config = win_config==1 ? 0 : 1;
        x11_host = win_config!=1 ? a_x11_host : b_x11_host;
        display_info.init_window(x11_host,0);
        screen = display_info.get_screen();
    }
    if( screen < 0 ) {
        x11_host = "";
        display_info.init_window(x11_host,1);
    }
    int screens = 1;
    if( display_info.get_screen_count() > 1 )
        screens = strcmp(a_x11_host, b_x11_host) != 0 ? 2 : 1;
    window_config = win_config;
    BC_Window::set_default_x11_host(x11_host);
    return screens;
}

and display_info lives in

guicast/bcdisplayinfo.C and h

in our case in h file

int get_screen() { return scrnum; }

and scrnum set to
 scrnum = DefaultScreen(display);

in void BC_DisplayInfo::init_window(const char *display_name, int show_error)

so, it seems having two 'x11 hosts" as separate X servers to send
Compositor to actually not supported... ? we query number of screens
on specific display/host ...

so :0.0 and :0.1 works, while :1.0 and :0.0 not ?

also, 3 or more displays will not work?


More information about the Cin mailing list