Commit graph

3061 commits

Author SHA1 Message Date
Sam Lantinga
0e0b96d72f Added mouse position for button handling
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404293
2009-12-12 00:08:02 +00:00
Sam Lantinga
279b20b6d6 minor notes to self
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404292
2009-12-12 00:07:26 +00:00
Sam Lantinga
3e4cece769 Fixed X11 line implementation - clip lines that are going to go outside the window.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404287
2009-12-11 09:59:36 +00:00
Sam Lantinga
60b65d182a Make sure we fully clip the first point before starting to adjust the second point.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404286
2009-12-11 09:57:54 +00:00
Sam Lantinga
1ba0c1618e Added an automated test for rectangle routines, currently only testing line clipping.
Use the Cohen-Sutherland algorithm for line clipping which uses integer math and preserves ordering of clipped points.

Removed getopt() support in testsdl.c, replaced with simple argv scanning.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404285
2009-12-11 09:22:34 +00:00
Sam Lantinga
4672f074e0 Fixed constness in RenderRects() parameter
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404284
2009-12-11 09:13:51 +00:00
Sam Lantinga
74c8c77e81 Fixed bug #896
John Popplewell      2009-12-08 23:05:50 PST

Originally reported by AKFoerster on the mailing list.

Error decoding UTF8 Russian text to UTF-16LE on Windows, but specifically on
platforms without iconv support (the default on Windows).

Valid UTF8 characters are flagged as being overlong and then substituted by the
UNKNOWN_UNICODE character.

After studying the testiconv.c example program, reading the RFCs and putting
some printf statements in SDL_iconv.c the problem is in a test for 'Maximum
overlong sequences', specifically 4.2.1, which is carried out by the following
code:

      } else if ( p[0] >= 0xC0 ) {
        if ( (p[0] & 0xE0) != 0xC0 ) {
          /* Skip illegal sequences
            return SDL_ICONV_EILSEQ;
          */
          ch = UNKNOWN_UNICODE;
        } else {
          if ( (p[0] & 0xCE) == 0xC0 ) {    <<<<<<<< here
            overlong = SDL_TRUE;
          }
          ch = (Uint32)(p[0] & 0x1F);
          left = 1;
        }
      } else {

Here is the 2-byte encoding of a character in range 00000080 - 000007FF
    110xxxxx 10xxxxxx

The line in question is supposed to be checking for an overlong sequence which
would be less than
    11000001 10111111

which should be represented as a single byte.

BUT, the mask value (0xCE) is wrong, it isn't checking the top-most bit:
    11000001     value
    11001110     mask (incorrect)
       ^
and should be (0xDE):
    11000001     value
    11011110     mask (correct)

making the above code:

      } else if ( p[0] >= 0xC0 ) {
        if ( (p[0] & 0xE0) != 0xC0 ) {
          /* Skip illegal sequences
            return SDL_ICONV_EILSEQ;
          */
          ch = UNKNOWN_UNICODE;
        } else {
          if ( (p[0] & 0xDE) == 0xC0 ) {    <<<<<<<< here
            overlong = SDL_TRUE;
          }
          ch = (Uint32)(p[0] & 0x1F);
          left = 1;
        }
      } else {

I can supply a test program and/or a patch if required,

best regards,
John Popplewell

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404283
2009-12-11 08:03:43 +00:00
Sam Lantinga
021fe81f73 X11 driver compiles again, lines are not yet implemented
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404281
2009-12-10 09:27:23 +00:00
Sam Lantinga
d86e44de65 Switch to mixed case for consistency with other enumerations
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404280
2009-12-10 08:28:26 +00:00
Sam Lantinga
8ee9720297 Added interfaces for batch drawing of points, lines and rects:
SDL_DrawPoints()
    SDL_BlendPoints()
    SDL_BlendLines()
    SDL_DrawLines()
    SDL_FillRects()
    SDL_BlendRects()
    SDL_RenderPoints()
    SDL_RenderLines()
    SDL_RenderRects()
Renamed SDL_RenderFill() to SDL_RenderRect()

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404279
2009-12-09 15:56:56 +00:00
Sam Lantinga
304a6bbb6c Hey, those automated tests are coming in handy! Fixed GDI rendering semantics
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404278
2009-12-07 10:08:24 +00:00
Sam Lantinga
5a45284f55 Implemented RenderReadPixels() and RenderWritePixels() for GDI renderer.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404277
2009-12-07 09:44:55 +00:00
Sam Lantinga
5d686e407c This fixes the OpenGL rendering test, at least with my ATI card...
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404276
2009-12-07 08:02:20 +00:00
Sam Lantinga
ea76da001c Fixed crash initializing the dummy driver
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404275
2009-12-07 08:01:58 +00:00
Sam Lantinga
ce410261ab On Windows the minimum window size may be larger than 80, so explicitly request the expected rectangle.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404274
2009-12-07 08:01:20 +00:00
Sam Lantinga
5c77d00a62 The window position is display relative, at least for now...
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404273
2009-12-06 08:39:01 +00:00
Sam Lantinga
712ccbd13c Fixed crash
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404272
2009-12-06 08:16:23 +00:00
Sam Lantinga
52f2433c29 Added an API function to query geometry of multiple monitors:
SDL_GetDisplayBounds()

Implemented multi-monitor window positions on Windows

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404271
2009-12-06 08:03:38 +00:00
Sam Lantinga
540357e23a Fixed to use the correct display adapter
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404270
2009-12-06 06:21:39 +00:00
Sam Lantinga
656ee60af0 Fixed compiler warnings
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404269
2009-12-05 22:13:36 +00:00
Sam Lantinga
e2ff36e2a3 Fixed compilation on Mac OS X 10.4
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404268
2009-12-05 19:57:49 +00:00
Sam Lantinga
21f0a00736 Allow overriding the number of build jobs
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404267
2009-12-05 19:46:24 +00:00
Sam Lantinga
e7a9fc5a82 Made the window flag comments more consistent
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404266
2009-12-05 05:13:17 +00:00
Sam Lantinga
1f1d8b4e67 Added related functions
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404265
2009-12-05 04:39:59 +00:00
Sam Lantinga
a5eb078863 Don't add any renderers if you can't add any displays
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404264
2009-12-04 09:01:48 +00:00
Sam Lantinga
b6b1631cb5 Fixed calls to SDL_AddRenderDriver()
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404263
2009-12-04 08:45:08 +00:00
Sam Lantinga
678d68d0f6 Fixed compiling the D3D renderer
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404262
2009-12-04 08:26:32 +00:00
Sam Lantinga
5bb70a9b91 Added support for SDL 1.2 environment variables:
SDL_VIDEO_FULLSCREEN_DISPLAY, SDL_VIDEO_FULLSCREEN_HEAD

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404261
2009-12-03 08:43:12 +00:00
Sam Lantinga
e12e0c04d3 Fixed mouse events for fullscreen windows on Mac OS X
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404260
2009-12-03 08:33:39 +00:00
Sam Lantinga
013a718a1f Restore the video mode after shutting down the renderer, which fixes an error deleting the OpenGL context on Mac OS X.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404259
2009-12-03 05:05:26 +00:00
Sam Lantinga
ca0eb1c533 Missing pop over a jump
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404258
2009-12-03 04:33:05 +00:00
Sam Lantinga
3c1211c031 Added Ctrl-Z common key binding
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404255
2009-12-02 07:56:09 +00:00
Sam Lantinga
b5fc901837 Restore the desktop mode when requested
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404254
2009-12-02 07:55:23 +00:00
Sam Lantinga
ae0f3ac642 If we're fullscreen on a single-head system and lose focus, minimize
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404253
2009-12-02 07:42:10 +00:00
Sam Lantinga
e4f2557276 On multi-display systems it's perfectly reasonable to have focus on a window on another monitor while the application is fullscreen.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404252
2009-12-02 07:38:28 +00:00
Sam Lantinga
615000a3bd Don't need to hide the menu bar if we're not on the main display
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404251
2009-12-02 07:28:58 +00:00
Sam Lantinga
c1b86636fe Changed so that it's obvious that the two code blocks are related.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404250
2009-12-02 07:25:06 +00:00
Sam Lantinga
437235f9d4 Fixed mouse coordinates for fullscreen mode
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404249
2009-12-02 06:10:18 +00:00
Sam Lantinga
15a731ac2a The window positions are relative to the origin of the windowing system (upper left of the primary display).
Fixed the mouse positions for windowed mouse movement.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404248
2009-12-01 12:08:34 +00:00
Sam Lantinga
10bd98ffe5 Added support for placing windows on different displays
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404247
2009-12-01 11:50:00 +00:00
Sam Lantinga
eceb2d3dbe Ensure that the main display is picked up first
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404246
2009-12-01 10:41:58 +00:00
Sam Lantinga
df27e595ca Allow mirrored displays, but only the primary display in a mirrored set.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404245
2009-12-01 10:34:01 +00:00
Sam Lantinga
eac4a9bf35 Explicitly clear fullscreen status rather than relying on the window focus behavior.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404244
2009-12-01 09:04:28 +00:00
Sam Lantinga
b98089ee2a Whenever a window becomes fullscreen, shown, unminimized, and has input focus it will change the display to the corresponding fullscreen video mode.
If it loses any of those properties the desktop mode will be restored.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404243
2009-12-01 08:56:12 +00:00
Sam Lantinga
c77842705f Removed a little redundancy in the naming
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404242
2009-12-01 06:15:10 +00:00
Sam Lantinga
1cd715e9db Work in progress on multi-display support:
* Added display parameter to many internal functions so video modes can be set on displays that aren't the public current one.
* The fullscreen mode is associated with fullscreen windows - not displays, so different windows more naturally have a mode associated with them based on their width and height.  It's no longer necessary to specify a fullscreen mode, a default one will be picked automatically for fullscreen windows.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404241
2009-12-01 05:57:15 +00:00
Sam Lantinga
3e860cdcf9 Reduced the push/pop sequence to a single pair, and ported this fix over to the other architectures.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404240
2009-11-30 21:04:25 +00:00
Sam Lantinga
604fbcb387 Fixed crash - need to save and restore rbx around cpuid, since the compiler may be assuming the stack pointer isn't being modified when filling in %0.
I did it around each call to cpuid which isn't strictly necessary, but is definitely future proof. :)

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404239
2009-11-30 19:52:34 +00:00
Sam Lantinga
a8a1831e74 Added support for 32-bit BMP files with an alpha channel
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404238
2009-11-30 17:57:12 +00:00
Sam Lantinga
215689096f Joe 2009-11-23 21:31:10 PST
If type is ::SDL_HAPTIC_CARTESIAN, direction is encoded by three positions
367     *  (X axis, Y axis and Z axis (with 3 axes)).  ::SDL_HAPTIC_CARTESIAN
uses
368     *  the first three \c dir parameters.  The cardinal directions would
be:
369     *   - North:  0,-1, 0
370     *   - East:  -1, 0, 0
371     *   - South:  0, 1, 0
372     *   - West:   1, 0, 0

typedef struct SDL_HapticDirection
{
    Uint8 type;         /**< The type of encoding. */
    Uint16 dir[3];      /**< The encoded direction. */
} SDL_HapticDirection;

An unsigned int can't store negative values and I don't see an alternate way to
encode them in the docs or source. The best I have been able to come up with is
using a negative magnitude for the effect but this will only get me 2 of the 4
quadrants in the plane for 2d effects. I looked at the win32 and linux
implementations and I believe is is safe to use signed ints in the direction
struct. I am unfamiliar with the darwin haptics API so I don't know if it is
safe.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404237
2009-11-27 19:29:27 +00:00