Engine/lib/sdl/src/video/x11/SDL_x11messagebox.c
/* Initialize SDL_MessageBoxData structure and Display, etc. */
Initialize SDL_MessageBoxData structure and Display, etc.
Initialize SDL_MessageBoxData structure and Display etc .
static int
X11_MessageBoxInit( SDL_MessageBoxDataX11 *data, const SDL_MessageBoxData * messageboxdata, int * pbuttonid )
{
    int i;
    int numbuttons = messageboxdata->numbuttons;
    const SDL_MessageBoxButtonData *buttondata = messageboxdata->buttons;
    const SDL_MessageBoxColor *colorhints;
    if ( numbuttons > MAX_BUTTONS ) {
        return SDL_SetError("Too many buttons (%d max allowed)", MAX_BUTTONS);
    }
    data->dialog_width = MIN_DIALOG_WIDTH;
    data->dialog_height = MIN_DIALOG_HEIGHT;
    data->messageboxdata = messageboxdata;
    data->buttondata = buttondata;
    data->numbuttons = numbuttons;
    data->pbuttonid = pbuttonid;
    data->display = X11_XOpenDisplay( NULL );
    if ( !data->display ) {
        return SDL_SetError("Couldn't open X11 display");
    }
    if (SDL_X11_HAVE_UTF8) {
        char **missing = NULL;
        int num_missing = 0;
        data->font_set = X11_XCreateFontSet(data->display, g_MessageBoxFont,
                                        &missing, &num_missing, NULL);
        if ( missing != NULL ) {
            X11_XFreeStringList(missing);
        }
        if ( data->font_set == NULL ) {
            return SDL_SetError("Couldn't load font %s", g_MessageBoxFont);
        }
    } else {
        data->font_struct = X11_XLoadQueryFont( data->display, g_MessageBoxFontLatin1 );
        if ( data->font_struct == NULL ) {
            return SDL_SetError("Couldn't load font %s", g_MessageBoxFontLatin1);
        }
    }
    if ( messageboxdata->colorScheme ) {
        colorhints = messageboxdata->colorScheme->colors;
    } else {
        colorhints = g_default_colors;
    }
    for ( i = 0; i < SDL_MESSAGEBOX_COLOR_MAX; i++ ) {
        data->color[ i ] = SDL_MAKE_RGB( colorhints[ i ].r, colorhints[ i ].g, colorhints[ i ].b );
    }
    return 0;
}
static int X11_MessageBoxInit ( SDL_MessageBoxDataX11 * data , const SDL_MessageBoxData * messageboxdata , int * pbuttonid ) { int i ; int numbuttons = messageboxdata -> numbuttons ; const SDL_MessageBoxButtonData * buttondata = messageboxdata -> buttons ; const SDL_MessageBoxColor * colorhints ; if ( numbuttons > MAX_BUTTONS ) { return SDL_SetError ( " " , MAX_BUTTONS ) ; } data -> dialog_width = MIN_DIALOG_WIDTH ; data -> dialog_height = MIN_DIALOG_HEIGHT ; data -> messageboxdata = messageboxdata ; data -> buttondata = buttondata ; data -> numbuttons = numbuttons ; data -> pbuttonid = pbuttonid ; data -> display = X11_XOpenDisplay ( NULL ) ; if ( ! data -> display ) { return SDL_SetError ( " " ) ; } if ( SDL_X11_HAVE_UTF8 ) { char * * missing = NULL ; int num_missing = 0 ; data -> font_set = X11_XCreateFontSet ( data -> display , g_MessageBoxFont , & missing , & num_missing , NULL ) ; if ( missing != NULL ) { X11_XFreeStringList ( missing ) ; } if ( data -> font_set == NULL ) { return SDL_SetError ( " " , g_MessageBoxFont ) ; } } else { data -> font_struct = X11_XLoadQueryFont ( data -> display , g_MessageBoxFontLatin1 ) ; if ( data -> font_struct == NULL ) { return SDL_SetError ( " " , g_MessageBoxFontLatin1 ) ; } } if ( messageboxdata -> colorScheme ) { colorhints = messageboxdata -> colorScheme -> colors ; } else { colorhints = g_default_colors ; } for ( i = 0 ; i < SDL_MESSAGEBOX_COLOR_MAX ; i ++ ) { data -> color [ i ] = SDL_MAKE_RGB ( colorhints [ i ] . r , colorhints [ i ] . g , colorhints [ i ] . b ) ; } return 0 ; }
Initialize SDL_MessageBoxData structure and Display, etc.
Initialize SDL_MessageBoxData structure and Display etc .
/* Convert our SDL_MessageBoxColor r,g,b values to packed RGB format. */