Commit graph

23 commits

Author SHA1 Message Date
Sam Lantinga
e2b4d5eb8c Fixed bug 2137 - SDL Message Boxes don't cope with fixed width fonts (in windows at least)
Pegasus Epsilon

With the system dialog font set to Arial or Tahoma or another variable-width font, everything works just as expected. When using a fixed-width font, like Courier or DejaVu Sans Mono, the text gets cut off. Example screenshots attached.
2017-08-14 23:45:06 -07:00
Sam Lantinga
b3ecc4942c Fixed compiler warnings on Visual Studio 2013 2017-08-12 00:04:46 -07:00
Sam Lantinga
b5dbd2a97c Fixed bug 3334 - SDL_ShowMessageBox uses wrong index and accesses un-allocated memory
romain.lacroix

For the windows implementation of SDL_ShowMessageBox() : ./src/video/windows/SDL_windowsmessagebox.c:345 WIN_ShowMessageBox()

The implementation in 2.0.4 uses "button index" for parameter "id" of function AddDialogButton().

It then expects the value provided in param wParam of function MessageBoxDialogProc() to be a valid index of a button.

It uses this value to index in the array of buttons when DialogBoxIndirect() returns (line 474 : *buttonid = buttons[which].buttonid;)

However, when dismissing this box with Escape, the return value of DialogBoxIndirect will be SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT (=2) which is not always a valid index of array buttons.

When the array buttons has a length less or equal than 2, the memory access is invalid; I can see that the value written to *buttonId is uninitialized memory (random value).

The fix I propose : use value "buttonid" (field of button) for parameter "id" of AddDialogButton(), then copy return value of DialogBoxIndirect() in *buttonid. This way, we will not use an out-of-bounds index in array buttons.
2017-08-11 19:42:39 -07:00
Ryan C. Gordon
ac5d0eb674 code style: wrap a single-statement if in braces. 2017-05-27 00:33:26 -04:00
Ryan C. Gordon
d0d830b80a windows: msgboxes should specify a parent HWND if possible (thanks, Ismael!).
This lets them be properly modal.

Fixes Bugzilla #3650.
2017-05-27 00:30:06 -04:00
Sam Lantinga
1b24bfad38 Updated copyright for 2017 2017-01-01 18:33:28 -08:00
Sam Lantinga
d3e667887a Fixed bug 2832 - Inverted arrow-key navigation in MessageBox
Jan Hellwig

On Windows, you are able to navigate between the buttons on a MessageBox that was created using SDL_ShowMessageBox using the arrow keys. However, if you press the left arrow key, the selection jumps to the button on the right of the currently selected one (and vice versa).

This can be fixed by reversing the order in which the buttons are added to the dialog.

The attached patch files fixes this problem. However the first press of an arrow key leads to the selection of the leftmost or rightmost button on the MessageBox, not to the selection of the button left/right of the one that is selected by default.
2016-10-07 16:19:50 -07:00
Sam Lantinga
7ee8dda270 Updated copyright to 2016 2016-01-02 10:10:34 -08:00
Sam Lantinga
b7240f9d22 Fixed divide by zero if the application has run out of GDI handles and is trying to show an error dialog 2015-09-14 11:15:25 -07:00
Sam Lantinga
56b58afdbe Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
Sam Lantinga
d7940a513e Fixed bug 2374 - Update copyright for 2014...
Is it that time already??
2014-02-02 00:53:27 -08:00
Ryan C. Gordon
82edee6971 Make internal SDL sources include SDL_internal.h instead of SDL_config.h
The new header will include SDL_config.h, but allows for other global stuff.

--HG--
extra : rebase_source : ddf4a4c0dc2c554b98c82700798f343cd91b16e3
2013-11-24 23:56:17 -05:00
Sam Lantinga
20e65317fa Fixed some warnings building for 64-bit Windows 2013-10-21 01:16:16 -07:00
Sam Lantinga
26b26c8f01 Removed redundant #ifdef 2013-10-17 23:05:40 -07:00
Sam Lantinga
a999af88e9 Fixed building using MinGW
Our SDL_windows.h needed to be included before anything else so UNICODE is defined.
2013-10-17 23:02:29 -07:00
Sam Lantinga
08dfaaa2e6 Christoph Mallon: Remove pointless if (x) before SDL_free(x) 2013-08-29 08:29:21 -07:00
Sam Lantinga
0cb6385637 File style cleanup for the SDL 2.0 release 2013-05-18 14:17:52 -07:00
Ryan C. Gordon
b58d643086 Compiler warning fixes for Windows message box code. 2013-04-03 11:48:03 -04:00
Sam Lantinga
75a30e72a0 Fixed compiler error with Cygwin 2013-03-26 05:09:09 -07:00
Sam Lantinga
1e10688f01 SDL message box improvements from Dan Thompson 2013-03-26 04:57:29 -07:00
Sam Lantinga
fb49761922 Fixed 64-bit compile warnings on Visual C++ 2013-03-06 11:59:19 -08:00
Sam Lantinga
95dcfa4c28 Happy New Year! 2013-02-15 08:47:44 -08:00
Sam Lantinga
f8a4c99701 Added Windows message box implementation, but it needs a little work on layout. 2012-10-30 18:59:56 -07:00