annotate include/SDL_version.h @ 4393:9afe12fb4c41 SDL-1.2

Fixed bug #901 Tim Angus 2009-12-11 11:45:46 PST Disable mouse event generation when state is not SDL_APPMOUSEFOCUS If a Windows SDL application is minimised by using alt-tab, SDL_APPMOUSEFOCUS is lost as part of the minimisation. Unfortunately, the directx driver doesn't pay any attention to this state when generating mouse button events, so clicking on the Desktop can cause mouse clicks in the SDL application, while it's still minimised. The attached patch fixes this. It looks much more complicated than it actually is due to indentation; here it is ignoring whitespace: tma@abraxas:~/sources/SDL-1.2-svn$ svn diff -x -b Index: src/video/windx5/SDL_dx5events.c =================================================================== --- src/video/windx5/SDL_dx5events.c (revision 5376) +++ src/video/windx5/SDL_dx5events.c (working copy) @@ -374,10 +374,9 @@ if ( !(SDL_GetAppState() & SDL_APPMOUSEFOCUS) ) { mouse_lost = 1; ClipCursor(NULL); - } - + } else { /* If the mouse was lost, regain some sense of mouse state */ - if ( mouse_lost && (SDL_GetAppState() & SDL_APPMOUSEFOCUS) ) { + if ( mouse_lost ) { POINT mouse_pos; Uint8 old_state; Uint8 new_state; @@ -548,6 +547,7 @@ if ( xrel || yrel ) { post_mouse_motion(1, xrel, yrel); } + } } /* The main Win32 event handler */
author Sam Lantinga <slouken@libsdl.org>
date Mon, 14 Dec 2009 22:41:31 +0000
parents 4c4113c2162c
children
rev   line source
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
1 /*
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
4159
a1b03ba2fcd0 Updated copyright date
Sam Lantinga <slouken@libsdl.org>
parents: 4110
diff changeset
3 Copyright (C) 1997-2009 Sam Lantinga
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
4
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1222
diff changeset
6 modify it under the terms of the GNU Lesser General Public
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1222
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
9
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1222
diff changeset
13 Lesser General Public License for more details.
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
14
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1222
diff changeset
15 You should have received a copy of the GNU Lesser General Public
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1222
diff changeset
16 License along with this library; if not, write to the Free Software
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1222
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
18
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
19 Sam Lantinga
251
b8688cfdc232 Updated the headers with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents: 241
diff changeset
20 slouken@libsdl.org
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
21 */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
22
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4208
diff changeset
23 /** @file SDL_version.h
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4208
diff changeset
24 * This header defines the current SDL version
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4208
diff changeset
25 */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
26
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
27 #ifndef _SDL_version_h
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
28 #define _SDL_version_h
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
29
1356
67114343400d *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
30 #include "SDL_stdinc.h"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
31
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
32 #include "begin_code.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
33 /* Set up for C function definitions, even when using C++ */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
34 #ifdef __cplusplus
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
35 extern "C" {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
36 #endif
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
37
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4208
diff changeset
38 /** @name Version Number
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4208
diff changeset
39 * Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4208
diff changeset
40 */
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4208
diff changeset
41 /*@{*/
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
42 #define SDL_MAJOR_VERSION 1
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
43 #define SDL_MINOR_VERSION 2
4208
453587d6dc87 Updated the version to 1.2.14 for the next release.
Sam Lantinga <slouken@libsdl.org>
parents: 4159
diff changeset
44 #define SDL_PATCHLEVEL 14
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4208
diff changeset
45 /*@}*/
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
46
911
04a403e4ccf5 Date: Mon, 3 May 2004 03:15:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 884
diff changeset
47 typedef struct SDL_version {
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
48 Uint8 major;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
49 Uint8 minor;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
50 Uint8 patch;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
51 } SDL_version;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
52
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4208
diff changeset
53 /**
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4208
diff changeset
54 * This macro can be used to fill a version structure with the compile-time
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
55 * version of the SDL library.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
56 */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
57 #define SDL_VERSION(X) \
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
58 { \
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
59 (X)->major = SDL_MAJOR_VERSION; \
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
60 (X)->minor = SDL_MINOR_VERSION; \
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
61 (X)->patch = SDL_PATCHLEVEL; \
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
62 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
63
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4208
diff changeset
64 /** This macro turns the version numbers into a numeric value:
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4208
diff changeset
65 * (1,2,3) -> (1203)
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4208
diff changeset
66 * This assumes that there will never be more than 100 patchlevels
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4208
diff changeset
67 */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
68 #define SDL_VERSIONNUM(X, Y, Z) \
1046
f09d5edfc7a3 Added some parentheses for a little more macro safety. Recommended by Petri
Ryan C. Gordon <icculus@icculus.org>
parents: 1024
diff changeset
69 ((X)*1000 + (Y)*100 + (Z))
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
70
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4208
diff changeset
71 /** This is the version number macro for the current SDL version */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
72 #define SDL_COMPILEDVERSION \
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
73 SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
74
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4208
diff changeset
75 /** This macro will evaluate to true if compiled with SDL at least X.Y.Z */
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
76 #define SDL_VERSION_ATLEAST(X, Y, Z) \
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
77 (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
78
4217
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4208
diff changeset
79 /** This function gets the version of the dynamically linked SDL library.
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4208
diff changeset
80 * it should NOT be used to fill a version structure, instead you should
4c4113c2162c Fixed bug #706
Sam Lantinga <slouken@libsdl.org>
parents: 4208
diff changeset
81 * use the SDL_Version() macro.
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
82 */
337
9154ec9ca3d2 Explicitly specify the SDL API calling convention (C by default)
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
83 extern DECLSPEC const SDL_version * SDLCALL SDL_Linked_Version(void);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
84
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
85 /* Ends C function definitions when using C++ */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
86 #ifdef __cplusplus
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
87 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
88 #endif
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
89 #include "close_code.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
90
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
91 #endif /* _SDL_version_h */