| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> |
| | | |
| | | This software is provided 'as-is', without any express or implied |
| | | warranty. In no event will the authors be held liable for any damages |
| | |
| | | data->dialog_height = IntMax( data->dialog_height, ybuttons + 2 * button_height ); |
| | | |
| | | /* Location for first button. */ |
| | | x = ( data->dialog_width - width_of_buttons ) / 2; |
| | | if ( messageboxdata->flags & SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT ) { |
| | | x = data->dialog_width - ( data->dialog_width - width_of_buttons ) / 2 - ( button_width + button_spacing ); |
| | | } else { |
| | | x = ( data->dialog_width - width_of_buttons ) / 2; |
| | | } |
| | | y = ybuttons + ( data->dialog_height - ybuttons - button_height ) / 2; |
| | | |
| | | for ( i = 0; i < data->numbuttons; i++ ) { |
| | |
| | | data->buttonpos[ i ].y = y + ( button_height - button_text_height - 1 ) / 2 + button_text_height; |
| | | |
| | | /* Scoot over for next button. */ |
| | | x += button_width + button_spacing; |
| | | if ( messageboxdata->flags & SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT ) { |
| | | x -= button_width + button_spacing; |
| | | } else { |
| | | x += button_width + button_spacing; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | if ( windowdata ) { |
| | | Atom _NET_WM_STATE = X11_XInternAtom(display, "_NET_WM_STATE", False); |
| | | Atom stateatoms[16]; |
| | | size_t statecount = 0; |
| | | /* Set some message-boxy window states when attached to a parent window... */ |
| | | /* we skip the taskbar since this will pop to the front when the parent window is clicked in the taskbar, etc */ |
| | | stateatoms[statecount++] = X11_XInternAtom(display, "_NET_WM_STATE_SKIP_TASKBAR", False); |
| | | stateatoms[statecount++] = X11_XInternAtom(display, "_NET_WM_STATE_SKIP_PAGER", False); |
| | | stateatoms[statecount++] = X11_XInternAtom(display, "_NET_WM_STATE_FOCUSED", False); |
| | | stateatoms[statecount++] = X11_XInternAtom(display, "_NET_WM_STATE_MODAL", False); |
| | | SDL_assert(statecount <= SDL_arraysize(stateatoms)); |
| | | X11_XChangeProperty(display, data->window, _NET_WM_STATE, XA_ATOM, 32, |
| | | PropModeReplace, (unsigned char *)stateatoms, statecount); |
| | | |
| | | /* http://tronche.com/gui/x/icccm/sec-4.html#WM_TRANSIENT_FOR */ |
| | | X11_XSetTransientForHint( display, data->window, windowdata->xwindow ); |
| | | } |