Repository: libsdl-org/SDL
File: src/video/x11/SDL_x11messagebox.c (C)

Code before:
    w += (SDL_TOOLKIT_X11_ELEMENT_PADDING_2 * controls->window->iscale) * 2;
    if (controls->message->rect.h > controls->icon->rect.h) {
        h = controls->message->rect.h;
    } else {
        h = controls->icon->rect.h;
    }
    h += max_button_h + (SDL_TOOLKIT_X11_ELEMENT_PADDING_2 * controls->window->iscale) * 3;
    t = (w - total_text_and_icon_w) / 2;
    controls->icon->rect.x += t;
    controls->message->rect.x += t;
    controls->icon->rect.y += (SDL_TOOLKIT_X11_ELEMENT_PADDING_2 * controls->window->iscale);
    controls->message->rect.y += (SDL_TOOLKIT_X11_ELEMENT_PADDING_2 * controls->window->iscale);
    t = (w - total_button_w) / 2;
    for (i = 0; i < controls->messageboxdata->numbuttons; i++) {
        controls->buttons[i]->rect.x += t;
        controls->buttons[i]->rect.y += (SDL_TOOLKIT_X11_ELEMENT_PADDING_2 * controls->window->iscale);
    }
    if (!controls->messageboxdata->message) {
        controls->icon->rect.x = (w - controls->icon->rect.w)/2;
    }

    *wp = w;
    *hp = h;
}

static void X11_PositionMessageBoxFlipped(SDL_MessageBoxControlsX11 *controls, int *wp, int *hp) {
    int max_button_w;
    int max_button_h;
    int total_button_w;
    int total_text_and_icon_w;
    int w;
    int h;
    int i;
    int t;

    /* Init vars */
    max_button_w = 50;
    max_button_h = 0;
    w = h = 2;
    i = t = total_button_w = total_text_and_icon_w = 0;
    max_button_w *= controls->window->iscale;

    /* Positioning and sizing */
    for (i = 0; i < controls->messageboxdata->numbuttons; i++) {
        max_button_w = SDL_max(max_button_w, controls->buttons[i]->rect.w);
        max_button_h = SDL_max(max_button_h, controls->buttons[i]->rect.h);
        controls->buttons[i]->rect.x = 0;
    }

    if (controls->icon) {
        controls->icon->rect.y = 0;

Review comment (suggestion):
```suggestion
static void X11_PositionMessageBoxFlipped(SDL_MessageBoxControlsX11 *controls, int *wp, int *hp)
{
```

Code after:
    w += (SDL_TOOLKIT_X11_ELEMENT_PADDING_2 * controls->window->iscale) * 2;
    if (controls->message->rect.h > controls->icon->rect.h) {
        h = controls->message->rect.h;
    } else {
        h = controls->icon->rect.h;
    }
    h += max_button_h + (SDL_TOOLKIT_X11_ELEMENT_PADDING_2 * controls->window->iscale) * 3;
    t = (w - total_text_and_icon_w) / 2;
    controls->icon->rect.x += t;
    controls->message->rect.x += t;
    controls->icon->rect.y += (SDL_TOOLKIT_X11_ELEMENT_PADDING_2 * controls->window->iscale);
    controls->message->rect.y += (SDL_TOOLKIT_X11_ELEMENT_PADDING_2 * controls->window->iscale);
    t = (w - total_button_w) / 2;
    for (i = 0; i < controls->messageboxdata->numbuttons; i++) {
        controls->buttons[i]->rect.x += t;
        controls->buttons[i]->rect.y += (SDL_TOOLKIT_X11_ELEMENT_PADDING_2 * controls->window->iscale);
    }
    if (!controls->messageboxdata->message) {
        controls->icon->rect.x = (w - controls->icon->rect.w)/2;
    }

    *wp = w;
    *hp = h;
}

static void X11_PositionMessageBoxFlipped(SDL_MessageBoxControlsX11 *controls, int *wp, int *hp)
{
    int max_button_w;
    int max_button_h;
    int total_button_w;
    int total_text_and_icon_w;
    int w;
    int h;
    int i;
    int t;

    /* Init vars */
    max_button_w = 50;
    max_button_h = 0;
    w = h = 2;
    i = t = total_button_w = total_text_and_icon_w = 0;
    max_button_w *= controls->window->iscale;

    /* Positioning and sizing */
    for (i = 0; i < controls->messageboxdata->numbuttons; i++) {
        max_button_w = SDL_max(max_button_w, controls->buttons[i]->rect.w);
        max_button_h = SDL_max(max_button_h, controls->buttons[i]->rect.h);
        controls->buttons[i]->rect.x = 0;
    }

    if (controls->icon) {