Commit aa3be46c authored by dewyatt's avatar dewyatt

Merge with main repo (mainly for non-printable character fix)

parents 34d5cdc7 bbf70270
...@@ -44,7 +44,7 @@ EMBEDSPU = @EMBEDSPU@ ...@@ -44,7 +44,7 @@ EMBEDSPU = @EMBEDSPU@
DIST = acinclude autogen.sh Borland.html Borland.zip BUGS build-scripts configure configure.in COPYING CREDITS include INSTALL Makefile.minimal Makefile.in README* sdl-config.in sdl.m4 sdl.pc.in SDL.spec SDL.spec.in src test TODO VisualC.html VisualC VisualCE Watcom-Win32.zip WhatsNew Xcode Xcode-iPhoneOS DIST = acinclude autogen.sh Borland.html Borland.zip BUGS build-scripts configure configure.in COPYING CREDITS include INSTALL Makefile.minimal Makefile.in README* sdl-config.in sdl.m4 sdl.pc.in SDL.spec SDL.spec.in src test TODO VisualC.html VisualC VisualCE Watcom-Win32.zip WhatsNew Xcode Xcode-iPhoneOS
HDRS = SDL.h SDL_assert.h SDL_atomic.h SDL_audio.h SDL_compat.h SDL_cpuinfo.h SDL_endian.h SDL_error.h SDL_events.h SDL_haptic.h SDL_input.h SDL_joystick.h SDL_keyboard.h SDL_keysym.h SDL_loadso.h SDL_main.h SDL_mouse.h SDL_mutex.h SDL_name.h SDL_opengl.h SDL_opengles.h SDL_pixels.h SDL_platform.h SDL_power.h SDL_quit.h SDL_rect.h SDL_revision.h SDL_rwops.h SDL_scancode.h SDL_stdinc.h SDL_surface.h SDL_syswm.h SDL_thread.h SDL_timer.h SDL_types.h SDL_version.h SDL_video.h begin_code.h close_code.h HDRS = SDL.h SDL_assert.h SDL_atomic.h SDL_audio.h SDL_clipboard.h SDL_compat.h SDL_cpuinfo.h SDL_endian.h SDL_error.h SDL_events.h SDL_haptic.h SDL_input.h SDL_joystick.h SDL_keyboard.h SDL_keysym.h SDL_loadso.h SDL_main.h SDL_mouse.h SDL_mutex.h SDL_name.h SDL_opengl.h SDL_opengles.h SDL_pixels.h SDL_platform.h SDL_power.h SDL_quit.h SDL_rect.h SDL_revision.h SDL_rwops.h SDL_scancode.h SDL_stdinc.h SDL_surface.h SDL_syswm.h SDL_thread.h SDL_timer.h SDL_types.h SDL_version.h SDL_video.h begin_code.h close_code.h
LT_AGE = @LT_AGE@ LT_AGE = @LT_AGE@
LT_CURRENT = @LT_CURRENT@ LT_CURRENT = @LT_CURRENT@
......
...@@ -235,6 +235,10 @@ ...@@ -235,6 +235,10 @@
RelativePath="..\..\include\SDL_audio.h" RelativePath="..\..\include\SDL_audio.h"
> >
</File> </File>
<File
RelativePath="..\..\include\SDL_clipboard.h"
>
</File>
<File <File
RelativePath="..\..\include\SDL_compat.h" RelativePath="..\..\include\SDL_compat.h"
> >
...@@ -560,6 +564,18 @@ ...@@ -560,6 +564,18 @@
RelativePath="..\..\src\video\SDL_bmp.c" RelativePath="..\..\src\video\SDL_bmp.c"
> >
</File> </File>
<File
RelativePath="..\..\src\video\SDL_clipboard.c"
>
</File>
<File
RelativePath="..\..\src\events\SDL_clipboardevents.c"
>
</File>
<File
RelativePath="..\..\src\events\SDL_clipboardevents_c.h"
>
</File>
<File <File
RelativePath="..\..\src\SDL_compat.c" RelativePath="..\..\src\SDL_compat.c"
> >
...@@ -840,10 +856,6 @@ ...@@ -840,10 +856,6 @@
RelativePath="..\..\src\video\SDL_stretch.c" RelativePath="..\..\src\video\SDL_stretch.c"
> >
</File> </File>
<File
RelativePath="..\..\src\video\SDL_stretch_c.h"
>
</File>
<File <File
RelativePath="..\..\src\stdlib\SDL_string.c" RelativePath="..\..\src\stdlib\SDL_string.c"
> >
...@@ -944,6 +956,14 @@ ...@@ -944,6 +956,14 @@
RelativePath="..\..\src\audio\SDL_wave.h" RelativePath="..\..\src\audio\SDL_wave.h"
> >
</File> </File>
<File
RelativePath="..\..\src\video\win32\SDL_win32clipboard.c"
>
</File>
<File
RelativePath="..\..\src\video\win32\SDL_win32clipboard.h"
>
</File>
<File <File
RelativePath="..\..\src\video\win32\SDL_win32events.c" RelativePath="..\..\src\video\win32\SDL_win32events.c"
> >
......
...@@ -382,6 +382,10 @@ ...@@ -382,6 +382,10 @@
RelativePath="..\..\include\SDL_audio.h" RelativePath="..\..\include\SDL_audio.h"
> >
</File> </File>
<File
RelativePath="..\..\include\SDL_clipboard.h"
>
</File>
<File <File
RelativePath="..\..\include\SDL_compat.h" RelativePath="..\..\include\SDL_compat.h"
> >
...@@ -715,6 +719,18 @@ ...@@ -715,6 +719,18 @@
RelativePath="..\..\src\video\SDL_bmp.c" RelativePath="..\..\src\video\SDL_bmp.c"
> >
</File> </File>
<File
RelativePath="..\..\src\video\SDL_clipboard.c"
>
</File>
<File
RelativePath="..\..\src\events\SDL_clipboardevents.c"
>
</File>
<File
RelativePath="..\..\src\events\SDL_clipboardevents_c.h"
>
</File>
<File <File
RelativePath="..\..\src\SDL_compat.c" RelativePath="..\..\src\SDL_compat.c"
> >
...@@ -995,10 +1011,6 @@ ...@@ -995,10 +1011,6 @@
RelativePath="..\..\src\video\SDL_stretch.c" RelativePath="..\..\src\video\SDL_stretch.c"
> >
</File> </File>
<File
RelativePath="..\..\src\video\SDL_stretch_c.h"
>
</File>
<File <File
RelativePath="..\..\src\stdlib\SDL_string.c" RelativePath="..\..\src\stdlib\SDL_string.c"
> >
...@@ -1099,6 +1111,14 @@ ...@@ -1099,6 +1111,14 @@
RelativePath="..\..\src\audio\SDL_wave.h" RelativePath="..\..\src\audio\SDL_wave.h"
> >
</File> </File>
<File
RelativePath="..\..\src\video\win32\SDL_win32clipboard.c"
>
</File>
<File
RelativePath="..\..\src\video\win32\SDL_win32clipboard.h"
>
</File>
<File <File
RelativePath="..\..\src\video\win32\SDL_win32events.c" RelativePath="..\..\src\video\win32\SDL_win32events.c"
> >
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
Description="Making sure basic SDL headers are in place..." Description="Making sure basic SDL headers are in place..."
CommandLine="if exist &quot;$(ProjectDir)\..\..\include\SDL_config.h&quot; goto SDLCONFIGOKAY&#x0D;&#x0A;echo Copying SDL_config_win32.h to SDL_config.h...&#x0D;&#x0A;copy &quot;$(ProjectDir)\..\..\include\SDL_config_win32.h&quot; &quot;$(ProjectDir)\..\..\include\SDL_config.h&quot;&#x0D;&#x0A;:SDLCONFIGOKAY&#x0D;&#x0A;&#x0D;&#x0A;if exist &quot;$(ProjectDir)\..\..\include\SDL_revision.h&quot; goto SDLREVISIONOKAY&#x0D;&#x0A;echo Creating stub SDL_revision.h file...&#x0D;&#x0A;echo #define SDL_REVISION 0 &gt;&quot;$(ProjectDir)\..\..\include\SDL_revision.h&quot;&#x0D;&#x0A;:SDLREVISIONOKAY" CommandLine="if exist &quot;$(ProjectDir)\..\..\include\SDL_config.h&quot; goto SDLCONFIGOKAY&#x0D;&#x0A;echo Copying SDL_config_win32.h to SDL_config.h...&#x0D;&#x0A;copy &quot;$(ProjectDir)\..\..\include\SDL_config_win32.h&quot; &quot;$(ProjectDir)\..\..\include\SDL_config.h&quot;&#x0D;&#x0A;:SDLCONFIGOKAY&#x0D;&#x0A;&#x0D;&#x0A;if exist &quot;$(ProjectDir)\..\..\include\SDL_revision.h&quot; goto SDLREVISIONOKAY&#x0D;&#x0A;echo Creating stub SDL_revision.h file...&#x0D;&#x0A;echo #define SDL_REVISION 0 &gt;&quot;$(ProjectDir)\..\..\include\SDL_revision.h&quot;&#x0D;&#x0A;:SDLREVISIONOKAY&#x0D;&#x0A;"
/> />
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
...@@ -166,7 +166,7 @@ ...@@ -166,7 +166,7 @@
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
Description="Making sure basic SDL headers are in place..." Description="Making sure basic SDL headers are in place..."
CommandLine="if exist &quot;$(ProjectDir)\..\..\include\SDL_config.h&quot; goto SDLCONFIGOKAY&#x0D;&#x0A;echo Copying SDL_config_win32.h to SDL_config.h...&#x0D;&#x0A;copy &quot;$(ProjectDir)\..\..\include\SDL_config_win32.h&quot; &quot;$(ProjectDir)\..\..\include\SDL_config.h&quot;&#x0D;&#x0A;:SDLCONFIGOKAY&#x0D;&#x0A;&#x0D;&#x0A;if exist &quot;$(ProjectDir)\..\..\include\SDL_revision.h&quot; goto SDLREVISIONOKAY&#x0D;&#x0A;echo Creating stub SDL_revision.h file...&#x0D;&#x0A;echo #define SDL_REVISION 0 &gt;&quot;$(ProjectDir)\..\..\include\SDL_revision.h&quot;&#x0D;&#x0A;:SDLREVISIONOKAY" CommandLine="if exist &quot;$(ProjectDir)\..\..\include\SDL_config.h&quot; goto SDLCONFIGOKAY&#x0D;&#x0A;echo Copying SDL_config_win32.h to SDL_config.h...&#x0D;&#x0A;copy &quot;$(ProjectDir)\..\..\include\SDL_config_win32.h&quot; &quot;$(ProjectDir)\..\..\include\SDL_config.h&quot;&#x0D;&#x0A;:SDLCONFIGOKAY&#x0D;&#x0A;&#x0D;&#x0A;if exist &quot;$(ProjectDir)\..\..\include\SDL_revision.h&quot; goto SDLREVISIONOKAY&#x0D;&#x0A;echo Creating stub SDL_revision.h file...&#x0D;&#x0A;echo #define SDL_REVISION 0 &gt;&quot;$(ProjectDir)\..\..\include\SDL_revision.h&quot;&#x0D;&#x0A;:SDLREVISIONOKAY&#x0D;&#x0A;"
/> />
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
...@@ -303,7 +303,7 @@ ...@@ -303,7 +303,7 @@
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
Description="Making sure basic SDL headers are in place..." Description="Making sure basic SDL headers are in place..."
CommandLine="if exist &quot;$(ProjectDir)\..\..\include\SDL_config.h&quot; goto SDLCONFIGOKAY&#x0D;&#x0A;echo Copying SDL_config_win32.h to SDL_config.h...&#x0D;&#x0A;copy &quot;$(ProjectDir)\..\..\include\SDL_config_win32.h&quot; &quot;$(ProjectDir)\..\..\include\SDL_config.h&quot;&#x0D;&#x0A;:SDLCONFIGOKAY&#x0D;&#x0A;&#x0D;&#x0A;if exist &quot;$(ProjectDir)\..\..\include\SDL_revision.h&quot; goto SDLREVISIONOKAY&#x0D;&#x0A;echo Creating stub SDL_revision.h file...&#x0D;&#x0A;echo #define SDL_REVISION 0 &gt;&quot;$(ProjectDir)\..\..\include\SDL_revision.h&quot;&#x0D;&#x0A;:SDLREVISIONOKAY" CommandLine="if exist &quot;$(ProjectDir)\..\..\include\SDL_config.h&quot; goto SDLCONFIGOKAY&#x0D;&#x0A;echo Copying SDL_config_win32.h to SDL_config.h...&#x0D;&#x0A;copy &quot;$(ProjectDir)\..\..\include\SDL_config_win32.h&quot; &quot;$(ProjectDir)\..\..\include\SDL_config.h&quot;&#x0D;&#x0A;:SDLCONFIGOKAY&#x0D;&#x0A;&#x0D;&#x0A;if exist &quot;$(ProjectDir)\..\..\include\SDL_revision.h&quot; goto SDLREVISIONOKAY&#x0D;&#x0A;echo Creating stub SDL_revision.h file...&#x0D;&#x0A;echo #define SDL_REVISION 0 &gt;&quot;$(ProjectDir)\..\..\include\SDL_revision.h&quot;&#x0D;&#x0A;:SDLREVISIONOKAY&#x0D;&#x0A;"
/> />
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
......
...@@ -105,6 +105,13 @@ ...@@ -105,6 +105,13 @@
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */ /* Begin PBXContainerItemProxy section */
04AB757011E563D200BE9753 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = FD1B48920E313154007AB34E /* SDLiPhoneOS.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 006E982211955059001DE610 /* testsdl.app */;
remoteInfo = testsdl;
};
FD1B489D0E313154007AB34E /* PBXContainerItemProxy */ = { FD1B489D0E313154007AB34E /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy; isa = PBXContainerItemProxy;
containerPortal = FD1B48920E313154007AB34E /* SDLiPhoneOS.xcodeproj */; containerPortal = FD1B48920E313154007AB34E /* SDLiPhoneOS.xcodeproj */;
...@@ -318,6 +325,7 @@ ...@@ -318,6 +325,7 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
FD1B489E0E313154007AB34E /* libSDLiPhoneOS.a */, FD1B489E0E313154007AB34E /* libSDLiPhoneOS.a */,
04AB757111E563D200BE9753 /* testsdl.app */,
); );
name = Products; name = Products;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -523,6 +531,13 @@ ...@@ -523,6 +531,13 @@
/* End PBXProject section */ /* End PBXProject section */
/* Begin PBXReferenceProxy section */ /* Begin PBXReferenceProxy section */
04AB757111E563D200BE9753 /* testsdl.app */ = {
isa = PBXReferenceProxy;
fileType = wrapper.application;
path = testsdl.app;
remoteRef = 04AB757011E563D200BE9753 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
FD1B489E0E313154007AB34E /* libSDLiPhoneOS.a */ = { FD1B489E0E313154007AB34E /* libSDLiPhoneOS.a */ = {
isa = PBXReferenceProxy; isa = PBXReferenceProxy;
fileType = archive.ar; fileType = archive.ar;
...@@ -731,7 +746,7 @@ ...@@ -731,7 +746,7 @@
OTHER_CFLAGS = ""; OTHER_CFLAGS = "";
PREBINDING = NO; PREBINDING = NO;
PRELINK_LIBS = ""; PRELINK_LIBS = "";
SDKROOT = iphoneos2.0; SDKROOT = iphoneos3.2;
}; };
name = Debug; name = Debug;
}; };
...@@ -749,7 +764,7 @@ ...@@ -749,7 +764,7 @@
OTHER_CFLAGS = ""; OTHER_CFLAGS = "";
PREBINDING = NO; PREBINDING = NO;
PRELINK_LIBS = ""; PRELINK_LIBS = "";
SDKROOT = iphoneos2.0; SDKROOT = iphoneos3.2;
}; };
name = Release; name = Release;
}; };
......
...@@ -430,9 +430,7 @@ main(int argc, char *argv[]) ...@@ -430,9 +430,7 @@ main(int argc, char *argv[])
done = 1; done = 1;
} }
if (event.type == SDL_MOUSEBUTTONDOWN) { if (event.type == SDL_MOUSEBUTTONDOWN) {
int which = event.button.which;
int x, y; int x, y;
SDL_SelectMouse(which);
SDL_GetMouseState(&x, &y); SDL_GetMouseState(&x, &y);
spawnEmitterParticle(x, y); spawnEmitterParticle(x, y);
} }
......
...@@ -124,10 +124,9 @@ handleMouseButtonDown(SDL_Event * event) ...@@ -124,10 +124,9 @@ handleMouseButtonDown(SDL_Event * event)
int x, y, mouseIndex, i, drumIndex; int x, y, mouseIndex, i, drumIndex;
mouseIndex = event->button.which; mouseIndex = 0;
drumIndex = -1; drumIndex = -1;
SDL_SelectMouse(mouseIndex);
SDL_GetMouseState(&x, &y); SDL_GetMouseState(&x, &y);
/* check if we hit any of the drum buttons */ /* check if we hit any of the drum buttons */
for (i = 0; i < NUM_DRUMS; i++) { for (i = 0; i < NUM_DRUMS; i++) {
...@@ -153,7 +152,7 @@ void ...@@ -153,7 +152,7 @@ void
handleMouseButtonUp(SDL_Event * event) handleMouseButtonUp(SDL_Event * event)
{ {
int i; int i;
int mouseIndex = event->button.which; int mouseIndex = 0;
/* check if this should cause any of the buttons to become unpressed */ /* check if this should cause any of the buttons to become unpressed */
for (i = 0; i < NUM_DRUMS; i++) { for (i = 0; i < NUM_DRUMS; i++) {
if (buttons[i].touchIndex == mouseIndex) { if (buttons[i].touchIndex == mouseIndex) {
......
...@@ -106,7 +106,6 @@ main(int argc, char *argv[]) ...@@ -106,7 +106,6 @@ main(int argc, char *argv[])
done = 1; done = 1;
break; break;
case SDL_MOUSEMOTION: case SDL_MOUSEMOTION:
SDL_SelectMouse(event.motion.which); /* select 'mouse' (touch) that moved */
state = SDL_GetMouseState(&x, &y); /* get its location */ state = SDL_GetMouseState(&x, &y); /* get its location */
SDL_GetRelativeMouseState(&dx, &dy); /* find how much the mouse moved */ SDL_GetRelativeMouseState(&dx, &dy); /* find how much the mouse moved */
if (state & SDL_BUTTON_LMASK) { /* is the mouse (touch) down? */ if (state & SDL_BUTTON_LMASK) { /* is the mouse (touch) down? */
......
...@@ -62,11 +62,16 @@ ...@@ -62,11 +62,16 @@
0098A5631195B4D900343137 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0098A5621195B4D900343137 /* OpenGLES.framework */; }; 0098A5631195B4D900343137 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0098A5621195B4D900343137 /* OpenGLES.framework */; };
0098A5651195B4D900343137 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0098A5641195B4D900343137 /* UIKit.framework */; }; 0098A5651195B4D900343137 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0098A5641195B4D900343137 /* UIKit.framework */; };
0098A5851195B5E200343137 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0098A5841195B5E200343137 /* QuartzCore.framework */; }; 0098A5851195B5E200343137 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0098A5841195B5E200343137 /* QuartzCore.framework */; };
0420497011E6F03D007E7EC9 /* SDL_clipboardevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420496E11E6F03D007E7EC9 /* SDL_clipboardevents_c.h */; };
0420497111E6F03D007E7EC9 /* SDL_clipboardevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 0420496F11E6F03D007E7EC9 /* SDL_clipboardevents.c */; };
043DD76F10FD8A0000DED673 /* SDL_alphamult.c in Sources */ = {isa = PBXBuildFile; fileRef = 043DD76B10FD8A0000DED673 /* SDL_alphamult.c */; }; 043DD76F10FD8A0000DED673 /* SDL_alphamult.c in Sources */ = {isa = PBXBuildFile; fileRef = 043DD76B10FD8A0000DED673 /* SDL_alphamult.c */; };
043DD77010FD8A0000DED673 /* SDL_alphamult.h in Headers */ = {isa = PBXBuildFile; fileRef = 043DD76C10FD8A0000DED673 /* SDL_alphamult.h */; }; 043DD77010FD8A0000DED673 /* SDL_alphamult.h in Headers */ = {isa = PBXBuildFile; fileRef = 043DD76C10FD8A0000DED673 /* SDL_alphamult.h */; };
043DD77110FD8A0000DED673 /* SDL_blendfillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 043DD76D10FD8A0000DED673 /* SDL_blendfillrect.c */; }; 043DD77110FD8A0000DED673 /* SDL_blendfillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 043DD76D10FD8A0000DED673 /* SDL_blendfillrect.c */; };
043DD77210FD8A0000DED673 /* SDL_drawrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 043DD76E10FD8A0000DED673 /* SDL_drawrect.c */; }; 043DD77210FD8A0000DED673 /* SDL_drawrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 043DD76E10FD8A0000DED673 /* SDL_drawrect.c */; };
04461DEE0EA76BA3006C462D /* SDL_haptic.h in Headers */ = {isa = PBXBuildFile; fileRef = 04461DED0EA76BA3006C462D /* SDL_haptic.h */; settings = {ATTRIBUTES = (Public, ); }; }; 04461DEE0EA76BA3006C462D /* SDL_haptic.h in Headers */ = {isa = PBXBuildFile; fileRef = 04461DED0EA76BA3006C462D /* SDL_haptic.h */; settings = {ATTRIBUTES = (Public, ); }; };
044E5FB511E6069F0076F181 /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 044E5FB311E6069F0076F181 /* SDL_clipboard.h */; };
044E5FB611E6069F0076F181 /* SDL_input.h in Headers */ = {isa = PBXBuildFile; fileRef = 044E5FB411E6069F0076F181 /* SDL_input.h */; };
044E5FB811E606EB0076F181 /* SDL_clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 044E5FB711E606EB0076F181 /* SDL_clipboard.c */; };
0463873F0F0B5B7D0041FD65 /* SDL_blendline.c in Sources */ = {isa = PBXBuildFile; fileRef = 046387370F0B5B7D0041FD65 /* SDL_blendline.c */; }; 0463873F0F0B5B7D0041FD65 /* SDL_blendline.c in Sources */ = {isa = PBXBuildFile; fileRef = 046387370F0B5B7D0041FD65 /* SDL_blendline.c */; };
046387400F0B5B7D0041FD65 /* SDL_blendpoint.c in Sources */ = {isa = PBXBuildFile; fileRef = 046387380F0B5B7D0041FD65 /* SDL_blendpoint.c */; }; 046387400F0B5B7D0041FD65 /* SDL_blendpoint.c in Sources */ = {isa = PBXBuildFile; fileRef = 046387380F0B5B7D0041FD65 /* SDL_blendpoint.c */; };
046387410F0B5B7D0041FD65 /* SDL_blendrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 046387390F0B5B7D0041FD65 /* SDL_blendrect.c */; }; 046387410F0B5B7D0041FD65 /* SDL_blendrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 046387390F0B5B7D0041FD65 /* SDL_blendrect.c */; };
...@@ -308,11 +313,16 @@ ...@@ -308,11 +313,16 @@
0098A5621195B4D900343137 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; 0098A5621195B4D900343137 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; };
0098A5641195B4D900343137 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 0098A5641195B4D900343137 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
0098A5841195B5E200343137 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 0098A5841195B5E200343137 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
0420496E11E6F03D007E7EC9 /* SDL_clipboardevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_clipboardevents_c.h; sourceTree = "<group>"; };
0420496F11E6F03D007E7EC9 /* SDL_clipboardevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_clipboardevents.c; sourceTree = "<group>"; };
043DD76B10FD8A0000DED673 /* SDL_alphamult.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_alphamult.c; sourceTree = "<group>"; }; 043DD76B10FD8A0000DED673 /* SDL_alphamult.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_alphamult.c; sourceTree = "<group>"; };
043DD76C10FD8A0000DED673 /* SDL_alphamult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_alphamult.h; sourceTree = "<group>"; }; 043DD76C10FD8A0000DED673 /* SDL_alphamult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_alphamult.h; sourceTree = "<group>"; };
043DD76D10FD8A0000DED673 /* SDL_blendfillrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendfillrect.c; sourceTree = "<group>"; }; 043DD76D10FD8A0000DED673 /* SDL_blendfillrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendfillrect.c; sourceTree = "<group>"; };
043DD76E10FD8A0000DED673 /* SDL_drawrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_drawrect.c; sourceTree = "<group>"; }; 043DD76E10FD8A0000DED673 /* SDL_drawrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_drawrect.c; sourceTree = "<group>"; };
04461DED0EA76BA3006C462D /* SDL_haptic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_haptic.h; path = ../../include/SDL_haptic.h; sourceTree = SOURCE_ROOT; }; 04461DED0EA76BA3006C462D /* SDL_haptic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_haptic.h; path = ../../include/SDL_haptic.h; sourceTree = SOURCE_ROOT; };
044E5FB311E6069F0076F181 /* SDL_clipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_clipboard.h; path = ../../include/SDL_clipboard.h; sourceTree = SOURCE_ROOT; };
044E5FB411E6069F0076F181 /* SDL_input.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_input.h; path = ../../include/SDL_input.h; sourceTree = SOURCE_ROOT; };
044E5FB711E606EB0076F181 /* SDL_clipboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_clipboard.c; sourceTree = "<group>"; };
046387370F0B5B7D0041FD65 /* SDL_blendline.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendline.c; sourceTree = "<group>"; }; 046387370F0B5B7D0041FD65 /* SDL_blendline.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendline.c; sourceTree = "<group>"; };
046387380F0B5B7D0041FD65 /* SDL_blendpoint.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendpoint.c; sourceTree = "<group>"; }; 046387380F0B5B7D0041FD65 /* SDL_blendpoint.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendpoint.c; sourceTree = "<group>"; };
046387390F0B5B7D0041FD65 /* SDL_blendrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendrect.c; sourceTree = "<group>"; }; 046387390F0B5B7D0041FD65 /* SDL_blendrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendrect.c; sourceTree = "<group>"; };
...@@ -826,19 +836,23 @@ ...@@ -826,19 +836,23 @@
FD99B8BC0DD52E5C00FB1D6B /* Public Headers */ = { FD99B8BC0DD52E5C00FB1D6B /* Public Headers */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
04F2AF531104ABC300D6DDF7 /* SDL_assert.h */,
04B2ECE61025CE4800F9BC5F /* SDL_atomic.h */,
FD99B8CC0DD52EB400FB1D6B /* begin_code.h */, FD99B8CC0DD52EB400FB1D6B /* begin_code.h */,
FD99B8CD0DD52EB400FB1D6B /* close_code.h */, FD99B8CD0DD52EB400FB1D6B /* close_code.h */,
FD99B8F50DD52EB400FB1D6B /* SDL.h */,
04F2AF531104ABC300D6DDF7 /* SDL_assert.h */,
04B2ECE61025CE4800F9BC5F /* SDL_atomic.h */,
FD99B8CF0DD52EB400FB1D6B /* SDL_audio.h */, FD99B8CF0DD52EB400FB1D6B /* SDL_audio.h */,
044E5FB311E6069F0076F181 /* SDL_clipboard.h */,
FD99B8D10DD52EB400FB1D6B /* SDL_compat.h */, FD99B8D10DD52EB400FB1D6B /* SDL_compat.h */,
04EC8B501025D12900431D42 /* SDL_config_iphoneos.h */,
04B2ED061025CF9E00F9BC5F /* SDL_config.h */, 04B2ED061025CF9E00F9BC5F /* SDL_config.h */,
04EC8B501025D12900431D42 /* SDL_config_iphoneos.h */,
FD99B8DA0DD52EB400FB1D6B /* SDL_copying.h */, FD99B8DA0DD52EB400FB1D6B /* SDL_copying.h */,
FD99B8DB0DD52EB400FB1D6B /* SDL_cpuinfo.h */, FD99B8DB0DD52EB400FB1D6B /* SDL_cpuinfo.h */,
FD99B8F60DD52EB400FB1D6B /* SDL_endian.h */,
FD99B8DC0DD52EB400FB1D6B /* SDL_error.h */, FD99B8DC0DD52EB400FB1D6B /* SDL_error.h */,
FD99B8DD0DD52EB400FB1D6B /* SDL_events.h */, FD99B8DD0DD52EB400FB1D6B /* SDL_events.h */,
04461DED0EA76BA3006C462D /* SDL_haptic.h */, 04461DED0EA76BA3006C462D /* SDL_haptic.h */,
044E5FB411E6069F0076F181 /* SDL_input.h */,
FD99B8DE0DD52EB400FB1D6B /* SDL_joystick.h */, FD99B8DE0DD52EB400FB1D6B /* SDL_joystick.h */,
FD99B8DF0DD52EB400FB1D6B /* SDL_keyboard.h */, FD99B8DF0DD52EB400FB1D6B /* SDL_keyboard.h */,
FD99B8E00DD52EB400FB1D6B /* SDL_keysym.h */, FD99B8E00DD52EB400FB1D6B /* SDL_keysym.h */,
...@@ -865,8 +879,6 @@ ...@@ -865,8 +879,6 @@
FD99B8F20DD52EB400FB1D6B /* SDL_types.h */, FD99B8F20DD52EB400FB1D6B /* SDL_types.h */,
FD99B8F30DD52EB400FB1D6B /* SDL_version.h */, FD99B8F30DD52EB400FB1D6B /* SDL_version.h */,
FD99B8F40DD52EB400FB1D6B /* SDL_video.h */, FD99B8F40DD52EB400FB1D6B /* SDL_video.h */,
FD99B8F50DD52EB400FB1D6B /* SDL.h */,
FD99B8F60DD52EB400FB1D6B /* SDL_endian.h */,
); );
name = "Public Headers"; name = "Public Headers";
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -950,6 +962,8 @@ ...@@ -950,6 +962,8 @@
FD99B9900DD52EDC00FB1D6B /* scancodes_linux.h */, FD99B9900DD52EDC00FB1D6B /* scancodes_linux.h */,
FD99B9910DD52EDC00FB1D6B /* scancodes_win32.h */, FD99B9910DD52EDC00FB1D6B /* scancodes_win32.h */,
FD99B9920DD52EDC00FB1D6B /* scancodes_xfree86.h */, FD99B9920DD52EDC00FB1D6B /* scancodes_xfree86.h */,
0420496E11E6F03D007E7EC9 /* SDL_clipboardevents_c.h */,
0420496F11E6F03D007E7EC9 /* SDL_clipboardevents.c */,
FD99B9930DD52EDC00FB1D6B /* SDL_events.c */, FD99B9930DD52EDC00FB1D6B /* SDL_events.c */,
FD99B9940DD52EDC00FB1D6B /* SDL_events_c.h */, FD99B9940DD52EDC00FB1D6B /* SDL_events_c.h */,
FD99B9950DD52EDC00FB1D6B /* SDL_keyboard.c */, FD99B9950DD52EDC00FB1D6B /* SDL_keyboard.c */,
...@@ -1023,6 +1037,7 @@ ...@@ -1023,6 +1037,7 @@
FDA682420DF2374D00F98A1A /* video */ = { FDA682420DF2374D00F98A1A /* video */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
044E5FB711E606EB0076F181 /* SDL_clipboard.c */,
FD689F090E26E5D900F90B21 /* uikit */, FD689F090E26E5D900F90B21 /* uikit */,
FDA685F40DF244C800F98A1A /* dummy */, FDA685F40DF244C800F98A1A /* dummy */,
0495E6850E97408800152DFE /* SDL_glfuncs.h */, 0495E6850E97408800152DFE /* SDL_glfuncs.h */,
...@@ -1173,6 +1188,9 @@ ...@@ -1173,6 +1188,9 @@
043DD77010FD8A0000DED673 /* SDL_alphamult.h in Headers */, 043DD77010FD8A0000DED673 /* SDL_alphamult.h in Headers */,
04F2AF541104ABC300D6DDF7 /* SDL_assert.h in Headers */, 04F2AF541104ABC300D6DDF7 /* SDL_assert.h in Headers */,
006E9888119552DD001DE610 /* SDL_rwopsbundlesupport.h in Headers */, 006E9888119552DD001DE610 /* SDL_rwopsbundlesupport.h in Headers */,
044E5FB511E6069F0076F181 /* SDL_clipboard.h in Headers */,
044E5FB611E6069F0076F181 /* SDL_input.h in Headers */,
0420497011E6F03D007E7EC9 /* SDL_clipboardevents_c.h in Headers */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -1411,6 +1429,8 @@ ...@@ -1411,6 +1429,8 @@
56ED04E1118A8EE200A56AA6 /* SDL_power.c in Sources */, 56ED04E1118A8EE200A56AA6 /* SDL_power.c in Sources */,
56ED04E3118A8EFD00A56AA6 /* SDL_syspower.m in Sources */, 56ED04E3118A8EFD00A56AA6 /* SDL_syspower.m in Sources */,
006E9889119552DD001DE610 /* SDL_rwopsbundlesupport.m in Sources */, 006E9889119552DD001DE610 /* SDL_rwopsbundlesupport.m in Sources */,
044E5FB811E606EB0076F181 /* SDL_clipboard.c in Sources */,
0420497111E6F03D007E7EC9 /* SDL_clipboardevents.c in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
......
...@@ -287,6 +287,13 @@ ...@@ -287,6 +287,13 @@
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */ /* Begin PBXContainerItemProxy section */
0466EE6F11E565E4000198A4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = FD1B48AC0E3131CA007AB34E /* SDLiPhoneOS.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 006E982211955059001DE610 /* testsdl.app */;
remoteInfo = testsdl;
};
FD1B48B70E3131CA007AB34E /* PBXContainerItemProxy */ = { FD1B48B70E3131CA007AB34E /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy; isa = PBXContainerItemProxy;
containerPortal = FD1B48AC0E3131CA007AB34E /* SDLiPhoneOS.xcodeproj */; containerPortal = FD1B48AC0E3131CA007AB34E /* SDLiPhoneOS.xcodeproj */;
...@@ -298,9 +305,7 @@ ...@@ -298,9 +305,7 @@
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
1D6058910D05DD3D006BFB54 /* testwm2.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testwm2.app; sourceTree = BUILT_PRODUCTS_DIR; }; 1D6058910D05DD3D006BFB54 /* testwm2.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testwm2.app; sourceTree = BUILT_PRODUCTS_DIR; };
56ED04F7118A8FCC00A56AA6 /* testpower-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "testpower-Info.plist"; sourceTree = "<group>"; };
56ED050D118A8FE400A56AA6 /* testpower.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testpower.app; sourceTree = BUILT_PRODUCTS_DIR; }; 56ED050D118A8FE400A56AA6 /* testpower.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testpower.app; sourceTree = BUILT_PRODUCTS_DIR; };
56ED050F118A8FE400A56AA6 /* Info copy.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info copy.plist"; sourceTree = "<group>"; };
56ED0510118A904200A56AA6 /* testpower.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testpower.c; path = ../../test/testpower.c; sourceTree = SOURCE_ROOT; }; 56ED0510118A904200A56AA6 /* testpower.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testpower.c; path = ../../test/testpower.c; sourceTree = SOURCE_ROOT; };
FD1B48AC0E3131CA007AB34E /* SDLiPhoneOS.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDLiPhoneOS.xcodeproj; path = ../SDL/SDLiPhoneOS.xcodeproj; sourceTree = SOURCE_ROOT; }; FD1B48AC0E3131CA007AB34E /* SDLiPhoneOS.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDLiPhoneOS.xcodeproj; path = ../SDL/SDLiPhoneOS.xcodeproj; sourceTree = SOURCE_ROOT; };
FDA8A7400E2D0F1600EA573E /* testalpha.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testalpha.c; path = ../../test/testalpha.c; sourceTree = SOURCE_ROOT; }; FDA8A7400E2D0F1600EA573E /* testalpha.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testalpha.c; path = ../../test/testalpha.c; sourceTree = SOURCE_ROOT; };
...@@ -861,14 +866,11 @@ ...@@ -861,14 +866,11 @@
29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
56ED0510118A904200A56AA6 /* testpower.c */,
FD1B48AC0E3131CA007AB34E /* SDLiPhoneOS.xcodeproj */, FD1B48AC0E3131CA007AB34E /* SDLiPhoneOS.xcodeproj */,
FDA8AAD60E2D339A00EA573E /* Resources */, FDA8AAD60E2D339A00EA573E /* Resources */,
FDA8A7C30E2D10FA00EA573E /* Linked Frameworks */, FDA8A7C30E2D10FA00EA573E /* Linked Frameworks */,
FDA8A73B0E2D0F0400EA573E /* src */, FDA8A73B0E2D0F0400EA573E /* src */,
19C28FACFE9D520D11CA2CBB /* Products */, 19C28FACFE9D520D11CA2CBB /* Products */,
56ED04F7118A8FCC00A56AA6 /* testpower-Info.plist */,
56ED050F118A8FE400A56AA6 /* Info copy.plist */,
); );
name = CustomTemplate; name = CustomTemplate;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -877,6 +879,7 @@ ...@@ -877,6 +879,7 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
FD1B48B80E3131CA007AB34E /* libSDLiPhoneOS.a */, FD1B48B80E3131CA007AB34E /* libSDLiPhoneOS.a */,
0466EE7011E565E4000198A4 /* testsdl.app */,
); );
name = Products; name = Products;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -910,6 +913,7 @@ ...@@ -910,6 +913,7 @@
FDA8A7540E2D0F1600EA573E /* testoverlay2.c */, FDA8A7540E2D0F1600EA573E /* testoverlay2.c */,
FDA8A7550E2D0F1600EA573E /* testpalette.c */, FDA8A7550E2D0F1600EA573E /* testpalette.c */,
FDA8A7560E2D0F1600EA573E /* testplatform.c */, FDA8A7560E2D0F1600EA573E /* testplatform.c */,
56ED0510118A904200A56AA6 /* testpower.c */,
FDA8A7570E2D0F1600EA573E /* testsem.c */, FDA8A7570E2D0F1600EA573E /* testsem.c */,
FDA8A7580E2D0F1600EA573E /* testsprite.c */, FDA8A7580E2D0F1600EA573E /* testsprite.c */,
FDA8A7590E2D0F1600EA573E /* testsprite2.c */, FDA8A7590E2D0F1600EA573E /* testsprite2.c */,
...@@ -1502,6 +1506,13 @@ ...@@ -1502,6 +1506,13 @@
/* End PBXProject section */ /* End PBXProject section */
/* Begin PBXReferenceProxy section */ /* Begin PBXReferenceProxy section */
0466EE7011E565E4000198A4 /* testsdl.app */ = {
isa = PBXReferenceProxy;
fileType = wrapper.application;
path = testsdl.app;
remoteRef = 0466EE6F11E565E4000198A4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
FD1B48B80E3131CA007AB34E /* libSDLiPhoneOS.a */ = { FD1B48B80E3131CA007AB34E /* libSDLiPhoneOS.a */ = {
isa = PBXReferenceProxy; isa = PBXReferenceProxy;
fileType = archive.ar; fileType = archive.ar;
...@@ -2034,7 +2045,7 @@ ...@@ -2034,7 +2045,7 @@
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
PREBINDING = NO; PREBINDING = NO;
"PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; "PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
SDKROOT = iphoneos2.2.1; SDKROOT = iphoneos3.2;
}; };
name = Debug; name = Debug;
}; };
...@@ -2049,7 +2060,7 @@ ...@@ -2049,7 +2060,7 @@
HEADER_SEARCH_PATHS = ../../include; HEADER_SEARCH_PATHS = ../../include;
PREBINDING = NO; PREBINDING = NO;
"PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; "PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
SDKROOT = iphoneos2.2.1; SDKROOT = iphoneos3.2;
}; };
name = Release; name = Release;
}; };
......
...@@ -438,6 +438,24 @@ ...@@ -438,6 +438,24 @@
00D8DA281195093100638393 /* SDL_at.c in Sources */ = {isa = PBXBuildFile; fileRef = 00D8DA151195093100638393 /* SDL_at.c */; }; 00D8DA281195093100638393 /* SDL_at.c in Sources */ = {isa = PBXBuildFile; fileRef = 00D8DA151195093100638393 /* SDL_at.c */; };
00D8DA291195093100638393 /* surface.c in Sources */ = {isa = PBXBuildFile; fileRef = 00D8DA181195093100638393 /* surface.c */; }; 00D8DA291195093100638393 /* surface.c in Sources */ = {isa = PBXBuildFile; fileRef = 00D8DA181195093100638393 /* surface.c */; };
00D8DA2A1195093100638393 /* testsdl.c in Sources */ = {isa = PBXBuildFile; fileRef = 00D8DA1A1195093100638393 /* testsdl.c */; }; 00D8DA2A1195093100638393 /* testsdl.c in Sources */ = {isa = PBXBuildFile; fileRef = 00D8DA1A1195093100638393 /* testsdl.c */; };
0420496111E6EFD3007E7EC9 /* SDL_clipboardevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420495F11E6EFD3007E7EC9 /* SDL_clipboardevents_c.h */; };
0420496211E6EFD3007E7EC9 /* SDL_clipboardevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 0420496011E6EFD3007E7EC9 /* SDL_clipboardevents.c */; };
0420496311E6EFD3007E7EC9 /* SDL_clipboardevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420495F11E6EFD3007E7EC9 /* SDL_clipboardevents_c.h */; };
0420496411E6EFD3007E7EC9 /* SDL_clipboardevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 0420496011E6EFD3007E7EC9 /* SDL_clipboardevents.c */; };
0420497A11E6F052007E7EC9 /* blank_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497411E6F052007E7EC9 /* blank_cursor.h */; };
0420497B11E6F052007E7EC9 /* default_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497511E6F052007E7EC9 /* default_cursor.h */; };
0420497C11E6F052007E7EC9 /* scancodes_darwin.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497611E6F052007E7EC9 /* scancodes_darwin.h */; };
0420497D11E6F052007E7EC9 /* scancodes_linux.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497711E6F052007E7EC9 /* scancodes_linux.h */; };
0420497E11E6F052007E7EC9 /* scancodes_win32.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497811E6F052007E7EC9 /* scancodes_win32.h */; };
0420497F11E6F052007E7EC9 /* scancodes_xfree86.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497911E6F052007E7EC9 /* scancodes_xfree86.h */; };
0420498011E6F052007E7EC9 /* blank_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497411E6F052007E7EC9 /* blank_cursor.h */; };
0420498111E6F052007E7EC9 /* default_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497511E6F052007E7EC9 /* default_cursor.h */; };
0420498211E6F052007E7EC9 /* scancodes_darwin.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497611E6F052007E7EC9 /* scancodes_darwin.h */; };
0420498311E6F052007E7EC9 /* scancodes_linux.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497711E6F052007E7EC9 /* scancodes_linux.h */; };
0420498411E6F052007E7EC9 /* scancodes_win32.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497811E6F052007E7EC9 /* scancodes_win32.h */; };
0420498511E6F052007E7EC9 /* scancodes_xfree86.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497911E6F052007E7EC9 /* scancodes_xfree86.h */; };
044E5F8511E6051C0076F181 /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 044E5F8411E6051C0076F181 /* SDL_clipboard.h */; settings = {ATTRIBUTES = (Public, ); }; };
044E5F8611E6051C0076F181 /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 044E5F8411E6051C0076F181 /* SDL_clipboard.h */; };
046B91EC0A11B53500FB151C /* SDL_sysloadso.c in Sources */ = {isa = PBXBuildFile; fileRef = 046B91E90A11B53500FB151C /* SDL_sysloadso.c */; }; 046B91EC0A11B53500FB151C /* SDL_sysloadso.c in Sources */ = {isa = PBXBuildFile; fileRef = 046B91E90A11B53500FB151C /* SDL_sysloadso.c */; };
046B91ED0A11B53500FB151C /* SDL_sysloadso.c in Sources */ = {isa = PBXBuildFile; fileRef = 046B91E90A11B53500FB151C /* SDL_sysloadso.c */; }; 046B91ED0A11B53500FB151C /* SDL_sysloadso.c in Sources */ = {isa = PBXBuildFile; fileRef = 046B91E90A11B53500FB151C /* SDL_sysloadso.c */; };
046B92130A11B8AD00FB151C /* SDL_dlcompat.c in Sources */ = {isa = PBXBuildFile; fileRef = 046B92100A11B8AD00FB151C /* SDL_dlcompat.c */; }; 046B92130A11B8AD00FB151C /* SDL_dlcompat.c in Sources */ = {isa = PBXBuildFile; fileRef = 046B92100A11B8AD00FB151C /* SDL_dlcompat.c */; };
...@@ -446,9 +464,17 @@ ...@@ -446,9 +464,17 @@
04DB838D10FD8C81000519B5 /* SDL_drawrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04DB838B10FD8C81000519B5 /* SDL_drawrect.c */; }; 04DB838D10FD8C81000519B5 /* SDL_drawrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04DB838B10FD8C81000519B5 /* SDL_drawrect.c */; };
04DB838E10FD8C81000519B5 /* SDL_blendfillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04DB838A10FD8C81000519B5 /* SDL_blendfillrect.c */; }; 04DB838E10FD8C81000519B5 /* SDL_blendfillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04DB838A10FD8C81000519B5 /* SDL_blendfillrect.c */; };
04DB838F10FD8C81000519B5 /* SDL_drawrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04DB838B10FD8C81000519B5 /* SDL_drawrect.c */; }; 04DB838F10FD8C81000519B5 /* SDL_drawrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04DB838B10FD8C81000519B5 /* SDL_drawrect.c */; };
04DEA57111E6006A00386CAC /* SDL_input.h in Headers */ = {isa = PBXBuildFile; fileRef = 04DEA56F11E6006A00386CAC /* SDL_input.h */; settings = {ATTRIBUTES = (Public, ); }; };
04DEA57311E6006A00386CAC /* SDL_input.h in Headers */ = {isa = PBXBuildFile; fileRef = 04DEA56F11E6006A00386CAC /* SDL_input.h */; };
04DEA57511E6009000386CAC /* SDL_clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04DEA57411E6009000386CAC /* SDL_clipboard.c */; };
04DEA57611E6009000386CAC /* SDL_clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04DEA57411E6009000386CAC /* SDL_clipboard.c */; };
04DEA57911E600A600386CAC /* SDL_cocoaclipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 04DEA57711E600A600386CAC /* SDL_cocoaclipboard.h */; };
04DEA57A11E600A600386CAC /* SDL_cocoaclipboard.m in Sources */ = {isa = PBXBuildFile; fileRef = 04DEA57811E600A600386CAC /* SDL_cocoaclipboard.m */; };
04DEA57B11E600A600386CAC /* SDL_cocoaclipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 04DEA57711E600A600386CAC /* SDL_cocoaclipboard.h */; };
04DEA57C11E600A600386CAC /* SDL_cocoaclipboard.m in Sources */ = {isa = PBXBuildFile; fileRef = 04DEA57811E600A600386CAC /* SDL_cocoaclipboard.m */; };
04F2AF661104AC0800D6DDF7 /* SDL_assert.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F2AF651104AC0800D6DDF7 /* SDL_assert.c */; }; 04F2AF661104AC0800D6DDF7 /* SDL_assert.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F2AF651104AC0800D6DDF7 /* SDL_assert.c */; };
04F2AF671104AC0800D6DDF7 /* SDL_assert.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F2AF651104AC0800D6DDF7 /* SDL_assert.c */; }; 04F2AF671104AC0800D6DDF7 /* SDL_assert.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F2AF651104AC0800D6DDF7 /* SDL_assert.c */; };
04F2AF691104AC4500D6DDF7 /* SDL_assert.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F2AF681104AC4500D6DDF7 /* SDL_assert.h */; }; 04F2AF691104AC4500D6DDF7 /* SDL_assert.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F2AF681104AC4500D6DDF7 /* SDL_assert.h */; settings = {ATTRIBUTES = (Public, ); }; };
04F2AF6A1104AC4500D6DDF7 /* SDL_assert.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F2AF681104AC4500D6DDF7 /* SDL_assert.h */; }; 04F2AF6A1104AC4500D6DDF7 /* SDL_assert.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F2AF681104AC4500D6DDF7 /* SDL_assert.h */; };
BECDF62E0761BA81005FE872 /* SDL_audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 01538330006D78D67F000001 /* SDL_audio.c */; }; BECDF62E0761BA81005FE872 /* SDL_audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 01538330006D78D67F000001 /* SDL_audio.c */; };
BECDF62F0761BA81005FE872 /* SDL_audiocvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 01538331006D78D67F000001 /* SDL_audiocvt.c */; }; BECDF62F0761BA81005FE872 /* SDL_audiocvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 01538331006D78D67F000001 /* SDL_audiocvt.c */; };
...@@ -795,10 +821,23 @@ ...@@ -795,10 +821,23 @@
01538439006D7D947F000001 /* SDL_fatal.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SDL_fatal.c; path = ../../src/SDL_fatal.c; sourceTree = SOURCE_ROOT; }; 01538439006D7D947F000001 /* SDL_fatal.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SDL_fatal.c; path = ../../src/SDL_fatal.c; sourceTree = SOURCE_ROOT; };
0153843C006D7D947F000001 /* SDL.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SDL.c; path = ../../src/SDL.c; sourceTree = SOURCE_ROOT; }; 0153843C006D7D947F000001 /* SDL.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SDL.c; path = ../../src/SDL.c; sourceTree = SOURCE_ROOT; };
01538445006D7EC67F000001 /* SDL_thread.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SDL_thread.c; path = ../../src/thread/SDL_thread.c; sourceTree = SOURCE_ROOT; }; 01538445006D7EC67F000001 /* SDL_thread.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SDL_thread.c; path = ../../src/thread/SDL_thread.c; sourceTree = SOURCE_ROOT; };
0420495F11E6EFD3007E7EC9 /* SDL_clipboardevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_clipboardevents_c.h; sourceTree = "<group>"; };
0420496011E6EFD3007E7EC9 /* SDL_clipboardevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_clipboardevents.c; sourceTree = "<group>"; };
0420497411E6F052007E7EC9 /* blank_cursor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = blank_cursor.h; sourceTree = "<group>"; };
0420497511E6F052007E7EC9 /* default_cursor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = default_cursor.h; sourceTree = "<group>"; };
0420497611E6F052007E7EC9 /* scancodes_darwin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scancodes_darwin.h; sourceTree = "<group>"; };
0420497711E6F052007E7EC9 /* scancodes_linux.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scancodes_linux.h; sourceTree = "<group>"; };
0420497811E6F052007E7EC9 /* scancodes_win32.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scancodes_win32.h; sourceTree = "<group>"; };
0420497911E6F052007E7EC9 /* scancodes_xfree86.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scancodes_xfree86.h; sourceTree = "<group>"; };
044E5F8411E6051C0076F181 /* SDL_clipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_clipboard.h; path = ../../include/SDL_clipboard.h; sourceTree = SOURCE_ROOT; };
046B91E90A11B53500FB151C /* SDL_sysloadso.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SDL_sysloadso.c; sourceTree = "<group>"; }; 046B91E90A11B53500FB151C /* SDL_sysloadso.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SDL_sysloadso.c; sourceTree = "<group>"; };
046B92100A11B8AD00FB151C /* SDL_dlcompat.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SDL_dlcompat.c; sourceTree = "<group>"; }; 046B92100A11B8AD00FB151C /* SDL_dlcompat.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SDL_dlcompat.c; sourceTree = "<group>"; };
04DB838A10FD8C81000519B5 /* SDL_blendfillrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendfillrect.c; sourceTree = "<group>"; }; 04DB838A10FD8C81000519B5 /* SDL_blendfillrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendfillrect.c; sourceTree = "<group>"; };
04DB838B10FD8C81000519B5 /* SDL_drawrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_drawrect.c; sourceTree = "<group>"; }; 04DB838B10FD8C81000519B5 /* SDL_drawrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_drawrect.c; sourceTree = "<group>"; };
04DEA56F11E6006A00386CAC /* SDL_input.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_input.h; path = ../../include/SDL_input.h; sourceTree = SOURCE_ROOT; };
04DEA57411E6009000386CAC /* SDL_clipboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_clipboard.c; sourceTree = "<group>"; };
04DEA57711E600A600386CAC /* SDL_cocoaclipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cocoaclipboard.h; sourceTree = "<group>"; };
04DEA57811E600A600386CAC /* SDL_cocoaclipboard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_cocoaclipboard.m; sourceTree = "<group>"; };
04F2AF651104AC0800D6DDF7 /* SDL_assert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_assert.c; path = ../../src/SDL_assert.c; sourceTree = SOURCE_ROOT; }; 04F2AF651104AC0800D6DDF7 /* SDL_assert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_assert.c; path = ../../src/SDL_assert.c; sourceTree = SOURCE_ROOT; };
04F2AF681104AC4500D6DDF7 /* SDL_assert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_assert.h; path = ../../include/SDL_assert.h; sourceTree = SOURCE_ROOT; }; 04F2AF681104AC4500D6DDF7 /* SDL_assert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_assert.h; path = ../../include/SDL_assert.h; sourceTree = SOURCE_ROOT; };
083E489D006D88D97F000001 /* SDL_joystick.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SDL_joystick.c; sourceTree = "<group>"; }; 083E489D006D88D97F000001 /* SDL_joystick.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SDL_joystick.c; sourceTree = "<group>"; };
...@@ -1033,6 +1072,8 @@ ...@@ -1033,6 +1072,8 @@
00CFA703106B498A00758660 /* cocoa */ = { 00CFA703106B498A00758660 /* cocoa */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
04DEA57711E600A600386CAC /* SDL_cocoaclipboard.h */,
04DEA57811E600A600386CAC /* SDL_cocoaclipboard.m */,
00CFA704106B498A00758660 /* SDL_cocoaevents.h */, 00CFA704106B498A00758660 /* SDL_cocoaevents.h */,
00CFA705106B498A00758660 /* SDL_cocoaevents.m */, 00CFA705106B498A00758660 /* SDL_cocoaevents.m */,
00CFA706106B498A00758660 /* SDL_cocoakeyboard.h */, 00CFA706106B498A00758660 /* SDL_cocoakeyboard.h */,
...@@ -1312,6 +1353,14 @@ ...@@ -1312,6 +1353,14 @@
01538367006D79147F000001 /* events */ = { 01538367006D79147F000001 /* events */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
0420497411E6F052007E7EC9 /* blank_cursor.h */,
0420497511E6F052007E7EC9 /* default_cursor.h */,
0420497611E6F052007E7EC9 /* scancodes_darwin.h */,
0420497711E6F052007E7EC9 /* scancodes_linux.h */,
0420497811E6F052007E7EC9 /* scancodes_win32.h */,
0420497911E6F052007E7EC9 /* scancodes_xfree86.h */,
0420495F11E6EFD3007E7EC9 /* SDL_clipboardevents_c.h */,
0420496011E6EFD3007E7EC9 /* SDL_clipboardevents.c */,
00CFA6C2106B480800758660 /* SDL_events_c.h */, 00CFA6C2106B480800758660 /* SDL_events_c.h */,
01538369006D79147F000001 /* SDL_events.c */, 01538369006D79147F000001 /* SDL_events.c */,
00CFA6C3106B480800758660 /* SDL_keyboard_c.h */, 00CFA6C3106B480800758660 /* SDL_keyboard_c.h */,
...@@ -1380,6 +1429,7 @@ ...@@ -1380,6 +1429,7 @@
00CFA7FA106B49B600758660 /* SDL_blit.c */, 00CFA7FA106B49B600758660 /* SDL_blit.c */,
00CFA7FB106B49B600758660 /* SDL_blit.h */, 00CFA7FB106B49B600758660 /* SDL_blit.h */,
00CFA7FC106B49B600758660 /* SDL_bmp.c */, 00CFA7FC106B49B600758660 /* SDL_bmp.c */,
04DEA57411E6009000386CAC /* SDL_clipboard.c */,
00CFA7FD106B49B600758660 /* SDL_draw.h */, 00CFA7FD106B49B600758660 /* SDL_draw.h */,
00CFA7FE106B49B600758660 /* SDL_drawline.c */, 00CFA7FE106B49B600758660 /* SDL_drawline.c */,
00CFA7FF106B49B600758660 /* SDL_drawpoint.c */, 00CFA7FF106B49B600758660 /* SDL_drawpoint.c */,
...@@ -1420,12 +1470,13 @@ ...@@ -1420,12 +1470,13 @@
0153844A006D81B07F000001 /* Public Headers */ = { 0153844A006D81B07F000001 /* Public Headers */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
04F2AF681104AC4500D6DDF7 /* SDL_assert.h */,
0C5AF5E501191D2B7F000001 /* begin_code.h */, 0C5AF5E501191D2B7F000001 /* begin_code.h */,
0C5AF5E601191D2B7F000001 /* close_code.h */, 0C5AF5E601191D2B7F000001 /* close_code.h */,
0C5AF5FF01191D2B7F000001 /* SDL.h */, 0C5AF5FF01191D2B7F000001 /* SDL.h */,
04F2AF681104AC4500D6DDF7 /* SDL_assert.h */,
00CFA67A106B44CE00758660 /* SDL_atomic.h */, 00CFA67A106B44CE00758660 /* SDL_atomic.h */,
0C5AF5E801191D2B7F000001 /* SDL_audio.h */, 0C5AF5E801191D2B7F000001 /* SDL_audio.h */,
044E5F8411E6051C0076F181 /* SDL_clipboard.h */,
00CFA67B106B44CE00758660 /* SDL_compat.h */, 00CFA67B106B44CE00758660 /* SDL_compat.h */,
00162D3709BD1FA90037C8D0 /* SDL_config.h */, 00162D3709BD1FA90037C8D0 /* SDL_config.h */,
00162D3409BD1FA90037C8D0 /* SDL_config_macosx.h */, 00162D3409BD1FA90037C8D0 /* SDL_config_macosx.h */,
...@@ -1435,6 +1486,7 @@ ...@@ -1435,6 +1486,7 @@
0C5AF5ED01191D2B7F000001 /* SDL_error.h */, 0C5AF5ED01191D2B7F000001 /* SDL_error.h */,
0C5AF5EE01191D2B7F000001 /* SDL_events.h */, 0C5AF5EE01191D2B7F000001 /* SDL_events.h */,
00CFA67C106B44CE00758660 /* SDL_haptic.h */, 00CFA67C106B44CE00758660 /* SDL_haptic.h */,
04DEA56F11E6006A00386CAC /* SDL_input.h */,
0C5AF5F001191D2B7F000001 /* SDL_joystick.h */, 0C5AF5F001191D2B7F000001 /* SDL_joystick.h */,
0C5AF5F101191D2B7F000001 /* SDL_keyboard.h */, 0C5AF5F101191D2B7F000001 /* SDL_keyboard.h */,
0C5AF5F201191D2B7F000001 /* SDL_keysym.h */, 0C5AF5F201191D2B7F000001 /* SDL_keysym.h */,
...@@ -1743,6 +1795,16 @@ ...@@ -1743,6 +1795,16 @@
00A6EBDA1078D569001EEA06 /* SDL_revision.h in Headers */, 00A6EBDA1078D569001EEA06 /* SDL_revision.h in Headers */,
04F2AF691104AC4500D6DDF7 /* SDL_assert.h in Headers */, 04F2AF691104AC4500D6DDF7 /* SDL_assert.h in Headers */,
006E95B011952992001DE610 /* SDL_rwopsbundlesupport.h in Headers */, 006E95B011952992001DE610 /* SDL_rwopsbundlesupport.h in Headers */,
04DEA57111E6006A00386CAC /* SDL_input.h in Headers */,
04DEA57911E600A600386CAC /* SDL_cocoaclipboard.h in Headers */,
044E5F8511E6051C0076F181 /* SDL_clipboard.h in Headers */,
0420496111E6EFD3007E7EC9 /* SDL_clipboardevents_c.h in Headers */,
0420497A11E6F052007E7EC9 /* blank_cursor.h in Headers */,
0420497B11E6F052007E7EC9 /* default_cursor.h in Headers */,
0420497C11E6F052007E7EC9 /* scancodes_darwin.h in Headers */,
0420497D11E6F052007E7EC9 /* scancodes_linux.h in Headers */,
0420497E11E6F052007E7EC9 /* scancodes_win32.h in Headers */,
0420497F11E6F052007E7EC9 /* scancodes_xfree86.h in Headers */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -1843,6 +1905,16 @@ ...@@ -1843,6 +1905,16 @@
00A6EBDB1078D569001EEA06 /* SDL_revision.h in Headers */, 00A6EBDB1078D569001EEA06 /* SDL_revision.h in Headers */,
04F2AF6A1104AC4500D6DDF7 /* SDL_assert.h in Headers */, 04F2AF6A1104AC4500D6DDF7 /* SDL_assert.h in Headers */,
006E95B211952992001DE610 /* SDL_rwopsbundlesupport.h in Headers */, 006E95B211952992001DE610 /* SDL_rwopsbundlesupport.h in Headers */,
04DEA57311E6006A00386CAC /* SDL_input.h in Headers */,
04DEA57B11E600A600386CAC /* SDL_cocoaclipboard.h in Headers */,
044E5F8611E6051C0076F181 /* SDL_clipboard.h in Headers */,
0420496311E6EFD3007E7EC9 /* SDL_clipboardevents_c.h in Headers */,
0420498011E6F052007E7EC9 /* blank_cursor.h in Headers */,
0420498111E6F052007E7EC9 /* default_cursor.h in Headers */,
0420498211E6F052007E7EC9 /* scancodes_darwin.h in Headers */,
0420498311E6F052007E7EC9 /* scancodes_linux.h in Headers */,
0420498411E6F052007E7EC9 /* scancodes_win32.h in Headers */,
0420498511E6F052007E7EC9 /* scancodes_xfree86.h in Headers */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -2035,7 +2107,7 @@ ...@@ -2035,7 +2107,7 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "# The underlying scripts require calling hg to get revision info.\n# Since hg may not be in the standard Xcode path, I am sourcing .bashrc\n# But I don't know what to do if people are using other shells.\nsource ~/.bashrc\nsh ../../build-scripts/updaterev.sh\n"; shellScript = "# The underlying scripts require calling hg to get revision info.\n# Since hg may not be in the standard Xcode path, I am sourcing .bashrc\n# But I don't know what to do if people are using other shells.\nif test -f ~/.bash_profile; then source ~/.bash_profile; fi\nif test -f ~/.bashrc; then source ~/.bashrc; fi\nsh ../../build-scripts/updaterev.sh\n";
}; };
0083103E1072EA5700A531F1 /* ShellScript */ = { 0083103E1072EA5700A531F1 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
...@@ -2202,6 +2274,9 @@ ...@@ -2202,6 +2274,9 @@
04DB838D10FD8C81000519B5 /* SDL_drawrect.c in Sources */, 04DB838D10FD8C81000519B5 /* SDL_drawrect.c in Sources */,
04F2AF661104AC0800D6DDF7 /* SDL_assert.c in Sources */, 04F2AF661104AC0800D6DDF7 /* SDL_assert.c in Sources */,
006E95B111952992001DE610 /* SDL_rwopsbundlesupport.m in Sources */, 006E95B111952992001DE610 /* SDL_rwopsbundlesupport.m in Sources */,
04DEA57511E6009000386CAC /* SDL_clipboard.c in Sources */,
04DEA57A11E600A600386CAC /* SDL_cocoaclipboard.m in Sources */,
0420496211E6EFD3007E7EC9 /* SDL_clipboardevents.c in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -2318,6 +2393,9 @@ ...@@ -2318,6 +2393,9 @@
04DB838F10FD8C81000519B5 /* SDL_drawrect.c in Sources */, 04DB838F10FD8C81000519B5 /* SDL_drawrect.c in Sources */,
04F2AF671104AC0800D6DDF7 /* SDL_assert.c in Sources */, 04F2AF671104AC0800D6DDF7 /* SDL_assert.c in Sources */,
006E95B311952992001DE610 /* SDL_rwopsbundlesupport.m in Sources */, 006E95B311952992001DE610 /* SDL_rwopsbundlesupport.m in Sources */,
04DEA57611E6009000386CAC /* SDL_clipboard.c in Sources */,
04DEA57C11E600A600386CAC /* SDL_cocoaclipboard.m in Sources */,
0420496411E6EFD3007E7EC9 /* SDL_clipboardevents.c in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
......
...@@ -78,6 +78,7 @@ ...@@ -78,6 +78,7 @@
#include "SDL_stdinc.h" #include "SDL_stdinc.h"
#include "SDL_atomic.h" #include "SDL_atomic.h"
#include "SDL_audio.h" #include "SDL_audio.h"
#include "SDL_clipboard.h"
#include "SDL_cpuinfo.h" #include "SDL_cpuinfo.h"
#include "SDL_endian.h" #include "SDL_endian.h"
#include "SDL_error.h" #include "SDL_error.h"
......
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
/**
* \file SDL_clipboard.h
*
* Include file for SDL clipboard handling
*/
#ifndef _SDL_clipboard_h
#define _SDL_clipboard_h
#include "SDL_stdinc.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
/* *INDENT-OFF* */
extern "C" {
/* *INDENT-ON* */
#endif
/* Function prototypes */
/**
* \brief Put UTF-8 text into the clipboard
*
* \sa SDL_GetClipboardText()
*/
extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text);
/**
* \brief Get UTF-8 text from the clipboard, which must be freed with SDL_free()
*
* \sa SDL_SetClipboardText()
*/
extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void);
/**
* \brief Returns whether the clipboard has text
*
* \sa SDL_GetClipboardText()
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
/* *INDENT-OFF* */
}
/* *INDENT-ON* */
#endif
#include "close_code.h"
#endif /* _SDL_clipboard_h */
/* vi: set ts=4 sw=4 expandtab: */
...@@ -145,12 +145,9 @@ typedef unsigned long uintptr_t; ...@@ -145,12 +145,9 @@ typedef unsigned long uintptr_t;
#define SDL_POWER_UIKIT 1 #define SDL_POWER_UIKIT 1
/* enable iPhone keyboard support */ /* enable iPhone keyboard support */
#define SDL_IPHONE_KEYBOARD 0 #define SDL_IPHONE_KEYBOARD 1
/* Enable emulation of multiple mice through multi-touch */ /* Set max recognized G-force from accelerometer
#define SDL_IPHONE_MULTIPLE_MICE 1
/* Set max recognized G-force from acceleromter
See src/joystick/uikit/SDLUIAccelerationDelegate.m for notes on why this is needed See src/joystick/uikit/SDLUIAccelerationDelegate.m for notes on why this is needed
*/ */
#define SDL_IPHONE_MAX_GFORCE 5.0 #define SDL_IPHONE_MAX_GFORCE 5.0
......
...@@ -90,6 +90,9 @@ typedef enum ...@@ -90,6 +90,9 @@ typedef enum
SDL_JOYBUTTONDOWN, /**< Joystick button pressed */ SDL_JOYBUTTONDOWN, /**< Joystick button pressed */
SDL_JOYBUTTONUP, /**< Joystick button released */ SDL_JOYBUTTONUP, /**< Joystick button released */
/* Clipboard events */
SDL_CLIPBOARDUPDATE = 0x700, /**< The clipboard changed */
/* Obsolete events */ /* Obsolete events */
SDL_EVENT_COMPAT1 = 0x7000, /**< SDL 1.2 events for compatibility */ SDL_EVENT_COMPAT1 = 0x7000, /**< SDL 1.2 events for compatibility */
SDL_EVENT_COMPAT2, SDL_EVENT_COMPAT2,
......
...@@ -112,8 +112,7 @@ enum ...@@ -112,8 +112,7 @@ enum
SDL_PACKEDLAYOUT_1010102 SDL_PACKEDLAYOUT_1010102
}; };
#define SDL_DEFINE_PIXELFOURCC(A, B, C, D) \ #define SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D)
((A) | ((B) << 8) | ((C) << 16) | ((D) << 24))
#define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \ #define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \
((1 << 31) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \ ((1 << 31) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \
......
/* /*
SDL - Simple DirectMedia Layer SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 Sam Lantinga Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga Sam Lantinga
slouken@libsdl.org slouken@libsdl.org
*/ */
/** /**
* \file SDL_stdinc.h * \file SDL_stdinc.h
* *
* This is a general header that includes C language support. * This is a general header that includes C language support.
*/ */
#ifndef _SDL_stdinc_h #ifndef _SDL_stdinc_h
#define _SDL_stdinc_h #define _SDL_stdinc_h
#include "SDL_config.h" #include "SDL_config.h"
#ifdef HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#ifdef HAVE_STDIO_H #ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
#endif #endif
#if defined(STDC_HEADERS) #if defined(STDC_HEADERS)
# include <stdlib.h> # include <stdlib.h>
# include <stddef.h> # include <stddef.h>
# include <stdarg.h> # include <stdarg.h>
#else #else
# if defined(HAVE_STDLIB_H) # if defined(HAVE_STDLIB_H)
# include <stdlib.h> # include <stdlib.h>
# elif defined(HAVE_MALLOC_H) # elif defined(HAVE_MALLOC_H)
# include <malloc.h> # include <malloc.h>
# endif # endif
# if defined(HAVE_STDDEF_H) # if defined(HAVE_STDDEF_H)
# include <stddef.h> # include <stddef.h>
# endif # endif
# if defined(HAVE_STDARG_H) # if defined(HAVE_STDARG_H)
# include <stdarg.h> # include <stdarg.h>
# endif # endif
#endif #endif
#ifdef HAVE_STRING_H #ifdef HAVE_STRING_H
# if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H) # if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
# include <memory.h> # include <memory.h>
# endif # endif
# include <string.h> # include <string.h>
#endif #endif
#ifdef HAVE_STRINGS_H #ifdef HAVE_STRINGS_H
# include <strings.h> # include <strings.h>
#endif #endif
#if defined(HAVE_INTTYPES_H) #if defined(HAVE_INTTYPES_H)
# include <inttypes.h> # include <inttypes.h>
#elif defined(HAVE_STDINT_H) #elif defined(HAVE_STDINT_H)
# include <stdint.h> # include <stdint.h>
#endif #endif
#ifdef HAVE_CTYPE_H #ifdef HAVE_CTYPE_H
# include <ctype.h> # include <ctype.h>
#endif #endif
#ifdef HAVE_MATH_H #ifdef HAVE_MATH_H
# include <math.h> # include <math.h>
#endif #endif
#if defined(HAVE_ICONV) && defined(HAVE_ICONV_H) #if defined(HAVE_ICONV) && defined(HAVE_ICONV_H)
# include <iconv.h> # include <iconv.h>
#endif #endif
/** /**
* The number of elements in an array. * The number of elements in an array.
*/ */
#define SDL_arraysize(array) (sizeof(array)/sizeof(array[0])) #define SDL_arraysize(array) (sizeof(array)/sizeof(array[0]))
#define SDL_TABLESIZE(table) SDL_arraysize(table) #define SDL_TABLESIZE(table) SDL_arraysize(table)
/** /**
* \name Cast operators * \name Cast operators
* *
* Use proper C++ casts when compiled as C++ to be compatible with the option * Use proper C++ casts when compiled as C++ to be compatible with the option
* -Wold-style-cast of GCC (and -Werror=old-style-cast in GCC 4.2 and above). * -Wold-style-cast of GCC (and -Werror=old-style-cast in GCC 4.2 and above).
*/ */
/*@{*/ /*@{*/
#ifdef __cplusplus #ifdef __cplusplus
#define SDL_reinterpret_cast(type, expression) reinterpret_cast<type>(expression) #define SDL_reinterpret_cast(type, expression) reinterpret_cast<type>(expression)
#define SDL_static_cast(type, expression) static_cast<type>(expression) #define SDL_static_cast(type, expression) static_cast<type>(expression)
#else #else
#define SDL_reinterpret_cast(type, expression) ((type)(expression)) #define SDL_reinterpret_cast(type, expression) ((type)(expression))
#define SDL_static_cast(type, expression) ((type)(expression)) #define SDL_static_cast(type, expression) ((type)(expression))
#endif #endif
/*@}*//*Cast operators*/ /*@}*//*Cast operators*/
/** /* Define a four character code as a Uint32 */
* \name Basic data types #define SDL_FOURCC(A, B, C, D) \
*/ ((SDL_static_cast(Uint32, SDL_static_cast(Uint8, (A))) << 0) | \
/*@{*/ (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (B))) << 8) | \
(SDL_static_cast(Uint32, SDL_static_cast(Uint8, (C))) << 16) | \
typedef enum (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (D))) << 24))
{
SDL_FALSE = 0, /**
SDL_TRUE = 1 * \name Basic data types
} SDL_bool; */
/*@{*/
/**
* \brief A signed 8-bit integer type. typedef enum
*/ {
typedef int8_t Sint8; SDL_FALSE = 0,
/** SDL_TRUE = 1
* \brief An unsigned 8-bit integer type. } SDL_bool;
*/
typedef uint8_t Uint8; /**
/** * \brief A signed 8-bit integer type.
* \brief A signed 16-bit integer type. */
*/ typedef int8_t Sint8;
typedef int16_t Sint16; /**
/** * \brief An unsigned 8-bit integer type.
* \brief An unsigned 16-bit integer type. */
*/ typedef uint8_t Uint8;
typedef uint16_t Uint16; /**
/** * \brief A signed 16-bit integer type.
* \brief A signed 32-bit integer type. */
*/ typedef int16_t Sint16;
typedef int32_t Sint32; /**
/** * \brief An unsigned 16-bit integer type.
* \brief An unsigned 32-bit integer type. */
*/ typedef uint16_t Uint16;
typedef uint32_t Uint32; /**
* \brief A signed 32-bit integer type.
#ifdef SDL_HAS_64BIT_TYPE */
/** typedef int32_t Sint32;
* \brief A signed 64-bit integer type. /**
* \warning On platforms without any sort of 64-bit datatype, this is equivalent to Sint32! * \brief An unsigned 32-bit integer type.
*/ */
typedef int64_t Sint64; typedef uint32_t Uint32;
/**
* \brief An unsigned 64-bit integer type. #ifdef SDL_HAS_64BIT_TYPE
* \warning On platforms without any sort of 64-bit datatype, this is equivalent to Uint32! /**
*/ * \brief A signed 64-bit integer type.
typedef uint64_t Uint64; * \warning On platforms without any sort of 64-bit datatype, this is equivalent to Sint32!
#else */
/* This is really just a hack to prevent the compiler from complaining */ typedef int64_t Sint64;
typedef Sint32 Sint64; /**
typedef Uint32 Uint64; * \brief An unsigned 64-bit integer type.
#endif * \warning On platforms without any sort of 64-bit datatype, this is equivalent to Uint32!
*/
/*@}*//*Basic data types*/ typedef uint64_t Uint64;
#else
/* This is really just a hack to prevent the compiler from complaining */
#define SDL_COMPILE_TIME_ASSERT(name, x) \ typedef Sint32 Sint64;
typedef int SDL_dummy_ ## name[(x) * 2 - 1] typedef Uint32 Uint64;
/** \cond */ #endif
#ifndef DOXYGEN_SHOULD_IGNORE_THIS
SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1); /*@}*//*Basic data types*/
SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1);
SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2);
SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2); #define SDL_COMPILE_TIME_ASSERT(name, x) \
SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4); typedef int SDL_dummy_ ## name[(x) * 2 - 1]
SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4); /** \cond */
#ifndef __NINTENDODS__ /* TODO: figure out why the following happens: #ifndef DOXYGEN_SHOULD_IGNORE_THIS
include/SDL_stdinc.h:150: error: size of array 'SDL_dummy_uint64' is negative SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1);
include/SDL_stdinc.h:151: error: size of array 'SDL_dummy_sint64' is negative */ SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1);
SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8); SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2);
SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8); SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2);
#endif SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4);
#endif /* DOXYGEN_SHOULD_IGNORE_THIS */ SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4);
/** \endcond */ #ifndef __NINTENDODS__ /* TODO: figure out why the following happens:
include/SDL_stdinc.h:150: error: size of array 'SDL_dummy_uint64' is negative
/* Check to make sure enums are the size of ints, for structure packing. include/SDL_stdinc.h:151: error: size of array 'SDL_dummy_sint64' is negative */
For both Watcom C/C++ and Borland C/C++ the compiler option that makes SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8);
enums having the size of an int must be enabled. SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11). #endif
*/ #endif /* DOXYGEN_SHOULD_IGNORE_THIS */
/* Enable enums always int in CodeWarrior (for MPW use "-enum int") */ /** \endcond */
#ifdef __MWERKS__
#pragma enumsalwaysint on /* Check to make sure enums are the size of ints, for structure packing.
#endif For both Watcom C/C++ and Borland C/C++ the compiler option that makes
enums having the size of an int must be enabled.
/** \cond */ This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11).
#ifndef DOXYGEN_SHOULD_IGNORE_THIS */
#ifndef __NINTENDODS__ /* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */ /* Enable enums always int in CodeWarrior (for MPW use "-enum int") */
typedef enum #ifdef __MWERKS__
{ #pragma enumsalwaysint on
DUMMY_ENUM_VALUE #endif
} SDL_DUMMY_ENUM;
/** \cond */
SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int)); #ifndef DOXYGEN_SHOULD_IGNORE_THIS
#endif #ifndef __NINTENDODS__ /* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */
#endif /* DOXYGEN_SHOULD_IGNORE_THIS */ typedef enum
/** \endcond */ {
DUMMY_ENUM_VALUE
#include "begin_code.h" } SDL_DUMMY_ENUM;
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int));
/* *INDENT-OFF* */ #endif
extern "C" { #endif /* DOXYGEN_SHOULD_IGNORE_THIS */
/* *INDENT-ON* */ /** \endcond */
#endif
#include "begin_code.h"
#ifdef HAVE_MALLOC /* Set up for C function definitions, even when using C++ */
#define SDL_malloc malloc #ifdef __cplusplus
#else /* *INDENT-OFF* */
extern DECLSPEC void *SDLCALL SDL_malloc(size_t size); extern "C" {
#endif /* *INDENT-ON* */
#endif
#ifdef HAVE_CALLOC
#define SDL_calloc calloc #ifdef HAVE_MALLOC
#else #define SDL_malloc malloc
extern DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size); #else
#endif extern DECLSPEC void *SDLCALL SDL_malloc(size_t size);
#endif
#ifdef HAVE_REALLOC
#define SDL_realloc realloc #ifdef HAVE_CALLOC
#else #define SDL_calloc calloc
extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size); #else
#endif extern DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size);
#endif
#ifdef HAVE_FREE
#define SDL_free free #ifdef HAVE_REALLOC
#else #define SDL_realloc realloc
extern DECLSPEC void SDLCALL SDL_free(void *mem); #else
#endif extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size);
#endif
#if defined(HAVE_ALLOCA) && !defined(alloca)
# if defined(HAVE_ALLOCA_H) #ifdef HAVE_FREE
# include <alloca.h> #define SDL_free free
# elif defined(__GNUC__) #else
# define alloca __builtin_alloca extern DECLSPEC void SDLCALL SDL_free(void *mem);
# elif defined(_MSC_VER) #endif
# include <malloc.h>
# define alloca _alloca #if defined(HAVE_ALLOCA) && !defined(alloca)
# elif defined(__WATCOMC__) # if defined(HAVE_ALLOCA_H)
# include <malloc.h> # include <alloca.h>
# elif defined(__BORLANDC__) # elif defined(__GNUC__)
# include <malloc.h> # define alloca __builtin_alloca
# elif defined(__DMC__) # elif defined(_MSC_VER)
# include <stdlib.h> # include <malloc.h>
# elif defined(__AIX__) # define alloca _alloca
#pragma alloca # elif defined(__WATCOMC__)
# elif defined(__MRC__) # include <malloc.h>
void *alloca(unsigned); # elif defined(__BORLANDC__)
# else # include <malloc.h>
char *alloca(); # elif defined(__DMC__)
# endif # include <stdlib.h>
#endif # elif defined(__AIX__)
#ifdef HAVE_ALLOCA #pragma alloca
#define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*(count)) # elif defined(__MRC__)
#define SDL_stack_free(data) void *alloca(unsigned);
#else # else
#define SDL_stack_alloc(type, count) (type*)SDL_malloc(sizeof(type)*(count)) char *alloca();
#define SDL_stack_free(data) SDL_free(data) # endif
#endif #endif
#ifdef HAVE_ALLOCA
#ifdef HAVE_GETENV #define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*(count))
#define SDL_getenv getenv #define SDL_stack_free(data)
#else #else
extern DECLSPEC char *SDLCALL SDL_getenv(const char *name); #define SDL_stack_alloc(type, count) (type*)SDL_malloc(sizeof(type)*(count))
#endif #define SDL_stack_free(data) SDL_free(data)
#endif
/* SDL_putenv() has moved to SDL_compat. */
#ifdef HAVE_SETENV #ifdef HAVE_GETENV
#define SDL_setenv setenv #define SDL_getenv getenv
#else #else
extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, extern DECLSPEC char *SDLCALL SDL_getenv(const char *name);
int overwrite); #endif
#endif
/* SDL_putenv() has moved to SDL_compat. */
#ifdef HAVE_QSORT #ifdef HAVE_SETENV
#define SDL_qsort qsort #define SDL_setenv setenv
#else #else
extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value,
int (*compare) (const void *, int overwrite);
const void *)); #endif
#endif
#ifdef HAVE_QSORT
#ifdef HAVE_ABS #define SDL_qsort qsort
#define SDL_abs abs #else
#else extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size,
#define SDL_abs(X) ((X) < 0 ? -(X) : (X)) int (*compare) (const void *,
#endif const void *));
#endif
#define SDL_min(x, y) (((x) < (y)) ? (x) : (y))
#define SDL_max(x, y) (((x) > (y)) ? (x) : (y)) #ifdef HAVE_ABS
#define SDL_abs abs
#ifdef HAVE_CTYPE_H #else
#define SDL_isdigit(X) isdigit(X) #define SDL_abs(X) ((X) < 0 ? -(X) : (X))
#define SDL_isspace(X) isspace(X) #endif
#define SDL_toupper(X) toupper(X)
#define SDL_tolower(X) tolower(X) #define SDL_min(x, y) (((x) < (y)) ? (x) : (y))
#else #define SDL_max(x, y) (((x) > (y)) ? (x) : (y))
#define SDL_isdigit(X) (((X) >= '0') && ((X) <= '9'))
#define SDL_isspace(X) (((X) == ' ') || ((X) == '\t') || ((X) == '\r') || ((X) == '\n')) #ifdef HAVE_CTYPE_H
#define SDL_toupper(X) (((X) >= 'a') && ((X) <= 'z') ? ('A'+((X)-'a')) : (X)) #define SDL_isdigit(X) isdigit(X)
#define SDL_tolower(X) (((X) >= 'A') && ((X) <= 'Z') ? ('a'+((X)-'A')) : (X)) #define SDL_isspace(X) isspace(X)
#endif #define SDL_toupper(X) toupper(X)
#define SDL_tolower(X) tolower(X)
#ifdef HAVE_MEMSET #else
#define SDL_memset memset #define SDL_isdigit(X) (((X) >= '0') && ((X) <= '9'))
#else #define SDL_isspace(X) (((X) == ' ') || ((X) == '\t') || ((X) == '\r') || ((X) == '\n'))
extern DECLSPEC void *SDLCALL SDL_memset(void *dst, int c, size_t len); #define SDL_toupper(X) (((X) >= 'a') && ((X) <= 'z') ? ('A'+((X)-'a')) : (X))
#endif #define SDL_tolower(X) (((X) >= 'A') && ((X) <= 'Z') ? ('a'+((X)-'A')) : (X))
#define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x))) #endif
#define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x)))
#ifdef HAVE_MEMSET
#if defined(__GNUC__) && defined(i386) #define SDL_memset memset
#define SDL_memset4(dst, val, len) \ #else
do { \ extern DECLSPEC void *SDLCALL SDL_memset(void *dst, int c, size_t len);
int u0, u1, u2; \ #endif
__asm__ __volatile__ ( \ #define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x)))
"cld\n\t" \ #define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x)))
"rep ; stosl\n\t" \
: "=&D" (u0), "=&a" (u1), "=&c" (u2) \ #if defined(__GNUC__) && defined(i386)
: "0" (dst), "1" (val), "2" (SDL_static_cast(Uint32, len)) \ #define SDL_memset4(dst, val, len) \
: "memory" ); \ do { \
} while(0) int u0, u1, u2; \
#endif __asm__ __volatile__ ( \
#ifndef SDL_memset4 "cld\n\t" \
#define SDL_memset4(dst, val, len) \ "rep ; stosl\n\t" \
do { \ : "=&D" (u0), "=&a" (u1), "=&c" (u2) \
unsigned _count = (len); \ : "0" (dst), "1" (val), "2" (SDL_static_cast(Uint32, len)) \
unsigned _n = (_count + 3) / 4; \ : "memory" ); \
Uint32 *_p = SDL_static_cast(Uint32 *, dst); \ } while(0)
Uint32 _val = (val); \ #endif
if (len == 0) break; \ #ifndef SDL_memset4
switch (_count % 4) { \ #define SDL_memset4(dst, val, len) \
case 0: do { *_p++ = _val; \ do { \
case 3: *_p++ = _val; \ unsigned _count = (len); \
case 2: *_p++ = _val; \ unsigned _n = (_count + 3) / 4; \
case 1: *_p++ = _val; \ Uint32 *_p = SDL_static_cast(Uint32 *, dst); \
} while ( --_n ); \ Uint32 _val = (val); \
} \ if (len == 0) break; \
} while(0) switch (_count % 4) { \
#endif case 0: do { *_p++ = _val; \
case 3: *_p++ = _val; \
/* We can count on memcpy existing on Mac OS X and being well-tuned. */ case 2: *_p++ = _val; \
#if defined(__MACH__) && defined(__APPLE__) case 1: *_p++ = _val; \
#define SDL_memcpy(dst, src, len) memcpy(dst, src, len) } while ( --_n ); \
#elif defined(__GNUC__) && defined(i386) } \
#define SDL_memcpy(dst, src, len) \ } while(0)
do { \ #endif
int u0, u1, u2; \
__asm__ __volatile__ ( \ /* We can count on memcpy existing on Mac OS X and being well-tuned. */
"cld\n\t" \ #if defined(__MACH__) && defined(__APPLE__)
"rep ; movsl\n\t" \ #define SDL_memcpy(dst, src, len) memcpy(dst, src, len)
"testb $2,%b4\n\t" \ #elif defined(__GNUC__) && defined(i386)
"je 1f\n\t" \ #define SDL_memcpy(dst, src, len) \
"movsw\n" \ do { \
"1:\ttestb $1,%b4\n\t" \ int u0, u1, u2; \
"je 2f\n\t" \ __asm__ __volatile__ ( \
"movsb\n" \ "cld\n\t" \
"2:" \ "rep ; movsl\n\t" \
: "=&c" (u0), "=&D" (u1), "=&S" (u2) \ "testb $2,%b4\n\t" \
: "0" (SDL_static_cast(unsigned, len)/4), "q" (len), "1" (dst),"2" (src) \ "je 1f\n\t" \
: "memory" ); \ "movsw\n" \
} while(0) "1:\ttestb $1,%b4\n\t" \
#endif "je 2f\n\t" \
#ifndef SDL_memcpy "movsb\n" \
#ifdef HAVE_MEMCPY "2:" \
#define SDL_memcpy memcpy : "=&c" (u0), "=&D" (u1), "=&S" (u2) \
#elif defined(HAVE_BCOPY) : "0" (SDL_static_cast(unsigned, len)/4), "q" (len), "1" (dst),"2" (src) \
#define SDL_memcpy(d, s, n) bcopy((s), (d), (n)) : "memory" ); \
#else } while(0)
extern DECLSPEC void *SDLCALL SDL_memcpy(void *dst, const void *src, #endif
size_t len); #ifndef SDL_memcpy
#endif #ifdef HAVE_MEMCPY
#endif #define SDL_memcpy memcpy
#elif defined(HAVE_BCOPY)
/* We can count on memcpy existing on Mac OS X and being well-tuned. */ #define SDL_memcpy(d, s, n) bcopy((s), (d), (n))
#if defined(__MACH__) && defined(__APPLE__) #else
#define SDL_memcpy4(dst, src, len) memcpy(dst, src, (len)*4) extern DECLSPEC void *SDLCALL SDL_memcpy(void *dst, const void *src,
#elif defined(__GNUC__) && defined(i386) size_t len);
#define SDL_memcpy4(dst, src, len) \ #endif
do { \ #endif
int ecx, edi, esi; \
__asm__ __volatile__ ( \ /* We can count on memcpy existing on Mac OS X and being well-tuned. */
"cld\n\t" \ #if defined(__MACH__) && defined(__APPLE__)
"rep ; movsl" \ #define SDL_memcpy4(dst, src, len) memcpy(dst, src, (len)*4)
: "=&c" (ecx), "=&D" (edi), "=&S" (esi) \ #elif defined(__GNUC__) && defined(i386)
: "0" (SDL_static_cast(unsigned, len)), "1" (dst), "2" (src) \ #define SDL_memcpy4(dst, src, len) \
: "memory" ); \ do { \
} while(0) int ecx, edi, esi; \
#endif __asm__ __volatile__ ( \
#ifndef SDL_memcpy4 "cld\n\t" \
#define SDL_memcpy4(dst, src, len) SDL_memcpy(dst, src, (len) << 2) "rep ; movsl" \
#endif : "=&c" (ecx), "=&D" (edi), "=&S" (esi) \
: "0" (SDL_static_cast(unsigned, len)), "1" (dst), "2" (src) \
#if defined(__GNUC__) && defined(i386) : "memory" ); \
#define SDL_revcpy(dst, src, len) \ } while(0)
do { \ #endif
int u0, u1, u2; \ #ifndef SDL_memcpy4
char *dstp = SDL_static_cast(char *, dst); \ #define SDL_memcpy4(dst, src, len) SDL_memcpy(dst, src, (len) << 2)
char *srcp = SDL_static_cast(char *, src); \ #endif
int n = (len); \
if ( n >= 4 ) { \ #if defined(__GNUC__) && defined(i386)
__asm__ __volatile__ ( \ #define SDL_revcpy(dst, src, len) \
"std\n\t" \ do { \
"rep ; movsl\n\t" \ int u0, u1, u2; \
"cld\n\t" \ char *dstp = SDL_static_cast(char *, dst); \
: "=&c" (u0), "=&D" (u1), "=&S" (u2) \ char *srcp = SDL_static_cast(char *, src); \
: "0" (n >> 2), \ int n = (len); \
"1" (dstp+(n-4)), "2" (srcp+(n-4)) \ if ( n >= 4 ) { \
: "memory" ); \ __asm__ __volatile__ ( \
} \ "std\n\t" \
switch (n & 3) { \ "rep ; movsl\n\t" \
case 3: dstp[2] = srcp[2]; \ "cld\n\t" \
case 2: dstp[1] = srcp[1]; \ : "=&c" (u0), "=&D" (u1), "=&S" (u2) \
case 1: dstp[0] = srcp[0]; \ : "0" (n >> 2), \
break; \ "1" (dstp+(n-4)), "2" (srcp+(n-4)) \
default: \ : "memory" ); \
break; \ } \
} \ switch (n & 3) { \
} while(0) case 3: dstp[2] = srcp[2]; \
#endif case 2: dstp[1] = srcp[1]; \
#ifndef SDL_revcpy case 1: dstp[0] = srcp[0]; \
extern DECLSPEC void *SDLCALL SDL_revcpy(void *dst, const void *src, break; \
size_t len); default: \
#endif break; \
} \
#ifdef HAVE_MEMMOVE } while(0)
#define SDL_memmove memmove #endif
#elif defined(HAVE_BCOPY) #ifndef SDL_revcpy
#define SDL_memmove(d, s, n) bcopy((s), (d), (n)) extern DECLSPEC void *SDLCALL SDL_revcpy(void *dst, const void *src,
#else size_t len);
#define SDL_memmove(dst, src, len) \ #endif
do { \
if ( dst < src ) { \ #ifdef HAVE_MEMMOVE
SDL_memcpy(dst, src, len); \ #define SDL_memmove memmove
} else { \ #elif defined(HAVE_BCOPY)
SDL_revcpy(dst, src, len); \ #define SDL_memmove(d, s, n) bcopy((s), (d), (n))
} \ #else
} while(0) #define SDL_memmove(dst, src, len) \
#endif do { \
if ( dst < src ) { \
#ifdef HAVE_MEMCMP SDL_memcpy(dst, src, len); \
#define SDL_memcmp memcmp } else { \
#else SDL_revcpy(dst, src, len); \
extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, } \
size_t len); } while(0)
#endif #endif
#ifdef HAVE_STRLEN #ifdef HAVE_MEMCMP
#define SDL_strlen strlen #define SDL_memcmp memcmp
#else #else
extern DECLSPEC size_t SDLCALL SDL_strlen(const char *string); extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2,
#endif size_t len);
#endif
#ifdef HAVE_WCSLEN
#define SDL_wcslen wcslen #ifdef HAVE_STRLEN
#else #define SDL_strlen strlen
#if !defined(wchar_t) && defined(__NINTENDODS__) #else
#define wchar_t short /* TODO: figure out why libnds doesn't have this */ extern DECLSPEC size_t SDLCALL SDL_strlen(const char *string);
#endif #endif
extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t * string);
#endif #ifdef HAVE_WCSLEN
#define SDL_wcslen wcslen
#ifdef HAVE_STRLCPY #else
#define SDL_strlcpy strlcpy #if !defined(wchar_t) && defined(__NINTENDODS__)
#else #define wchar_t short /* TODO: figure out why libnds doesn't have this */
extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src, #endif
size_t maxlen); extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t * string);
#endif #endif
#ifdef HAVE_STRLCPY
#define SDL_strlcpy strlcpy
#else
extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src,
size_t maxlen);
#endif
extern DECLSPEC size_t SDLCALL SDL_utf8strlcpy(char *dst, const char *src, extern DECLSPEC size_t SDLCALL SDL_utf8strlcpy(char *dst, const char *src,
size_t dst_bytes); size_t dst_bytes);
#ifdef HAVE_STRLCAT #ifdef HAVE_STRLCAT
#define SDL_strlcat strlcat #define SDL_strlcat strlcat
#else #else
extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src, extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src,
size_t maxlen); size_t maxlen);
#endif #endif
#ifdef HAVE_STRDUP #ifdef HAVE_STRDUP
#define SDL_strdup strdup #define SDL_strdup strdup
#else #else
extern DECLSPEC char *SDLCALL SDL_strdup(const char *string); extern DECLSPEC char *SDLCALL SDL_strdup(const char *string);
#endif #endif
#ifdef HAVE__STRREV #ifdef HAVE__STRREV
#define SDL_strrev _strrev #define SDL_strrev _strrev
#else #else
extern DECLSPEC char *SDLCALL SDL_strrev(char *string); extern DECLSPEC char *SDLCALL SDL_strrev(char *string);
#endif #endif
#ifdef HAVE__STRUPR #ifdef HAVE__STRUPR
#define SDL_strupr _strupr #define SDL_strupr _strupr
#else #else
extern DECLSPEC char *SDLCALL SDL_strupr(char *string); extern DECLSPEC char *SDLCALL SDL_strupr(char *string);
#endif #endif
#ifdef HAVE__STRLWR #ifdef HAVE__STRLWR
#define SDL_strlwr _strlwr #define SDL_strlwr _strlwr
#else #else
extern DECLSPEC char *SDLCALL SDL_strlwr(char *string); extern DECLSPEC char *SDLCALL SDL_strlwr(char *string);
#endif #endif
#ifdef HAVE_STRCHR #ifdef HAVE_STRCHR
#define SDL_strchr strchr #define SDL_strchr strchr
#elif defined(HAVE_INDEX) #elif defined(HAVE_INDEX)
#define SDL_strchr index #define SDL_strchr index
#else #else
extern DECLSPEC char *SDLCALL SDL_strchr(const char *string, int c); extern DECLSPEC char *SDLCALL SDL_strchr(const char *string, int c);
#endif #endif
#ifdef HAVE_STRRCHR #ifdef HAVE_STRRCHR
#define SDL_strrchr strrchr #define SDL_strrchr strrchr
#elif defined(HAVE_RINDEX) #elif defined(HAVE_RINDEX)
#define SDL_strrchr rindex #define SDL_strrchr rindex
#else #else
extern DECLSPEC char *SDLCALL SDL_strrchr(const char *string, int c); extern DECLSPEC char *SDLCALL SDL_strrchr(const char *string, int c);
#endif #endif
#ifdef HAVE_STRSTR #ifdef HAVE_STRSTR
#define SDL_strstr strstr #define SDL_strstr strstr
#else #else
extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack,
const char *needle); const char *needle);
#endif #endif
#ifdef HAVE_ITOA #ifdef HAVE_ITOA
#define SDL_itoa itoa #define SDL_itoa itoa
#else #else
#define SDL_itoa(value, string, radix) SDL_ltoa((long)value, string, radix) #define SDL_itoa(value, string, radix) SDL_ltoa((long)value, string, radix)
#endif #endif
#ifdef HAVE__LTOA #ifdef HAVE__LTOA
#define SDL_ltoa _ltoa #define SDL_ltoa _ltoa
#else #else
extern DECLSPEC char *SDLCALL SDL_ltoa(long value, char *string, int radix); extern DECLSPEC char *SDLCALL SDL_ltoa(long value, char *string, int radix);
#endif #endif
#ifdef HAVE__UITOA #ifdef HAVE__UITOA
#define SDL_uitoa _uitoa #define SDL_uitoa _uitoa
#else #else
#define SDL_uitoa(value, string, radix) SDL_ultoa((long)value, string, radix) #define SDL_uitoa(value, string, radix) SDL_ultoa((long)value, string, radix)
#endif #endif
#ifdef HAVE__ULTOA #ifdef HAVE__ULTOA
#define SDL_ultoa _ultoa #define SDL_ultoa _ultoa
#else #else
extern DECLSPEC char *SDLCALL SDL_ultoa(unsigned long value, char *string, extern DECLSPEC char *SDLCALL SDL_ultoa(unsigned long value, char *string,
int radix); int radix);
#endif #endif
#ifdef HAVE_STRTOL #ifdef HAVE_STRTOL
#define SDL_strtol strtol #define SDL_strtol strtol
#else #else
extern DECLSPEC long SDLCALL SDL_strtol(const char *string, char **endp, extern DECLSPEC long SDLCALL SDL_strtol(const char *string, char **endp,
int base); int base);
#endif #endif
#ifdef HAVE_STRTOUL #ifdef HAVE_STRTOUL
#define SDL_strtoul strtoul #define SDL_strtoul strtoul
#else #else
extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *string, extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *string,
char **endp, int base); char **endp, int base);
#endif #endif
#ifdef SDL_HAS_64BIT_TYPE #ifdef SDL_HAS_64BIT_TYPE
#ifdef HAVE__I64TOA #ifdef HAVE__I64TOA
#define SDL_lltoa _i64toa #define SDL_lltoa _i64toa
#else #else
extern DECLSPEC char *SDLCALL SDL_lltoa(Sint64 value, char *string, extern DECLSPEC char *SDLCALL SDL_lltoa(Sint64 value, char *string,
int radix); int radix);
#endif #endif
#ifdef HAVE__UI64TOA #ifdef HAVE__UI64TOA
#define SDL_ulltoa _ui64toa #define SDL_ulltoa _ui64toa
#else #else
extern DECLSPEC char *SDLCALL SDL_ulltoa(Uint64 value, char *string, extern DECLSPEC char *SDLCALL SDL_ulltoa(Uint64 value, char *string,
int radix); int radix);
#endif #endif
#ifdef HAVE_STRTOLL #ifdef HAVE_STRTOLL
#define SDL_strtoll strtoll #define SDL_strtoll strtoll
#else #else
extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *string, char **endp, extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *string, char **endp,
int base); int base);
#endif #endif
#ifdef HAVE_STRTOULL #ifdef HAVE_STRTOULL
#define SDL_strtoull strtoull #define SDL_strtoull strtoull
#else #else
extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *string, char **endp, extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *string, char **endp,
int base); int base);
#endif #endif
#endif /* SDL_HAS_64BIT_TYPE */ #endif /* SDL_HAS_64BIT_TYPE */
#ifdef HAVE_STRTOD #ifdef HAVE_STRTOD
#define SDL_strtod strtod #define SDL_strtod strtod
#else #else
extern DECLSPEC double SDLCALL SDL_strtod(const char *string, char **endp); extern DECLSPEC double SDLCALL SDL_strtod(const char *string, char **endp);
#endif #endif
#ifdef HAVE_ATOI #ifdef HAVE_ATOI
#define SDL_atoi atoi #define SDL_atoi atoi
#else #else
#define SDL_atoi(X) SDL_strtol(X, NULL, 0) #define SDL_atoi(X) SDL_strtol(X, NULL, 0)
#endif #endif
#ifdef HAVE_ATOF #ifdef HAVE_ATOF
#define SDL_atof atof #define SDL_atof atof
#else #else
#define SDL_atof(X) SDL_strtod(X, NULL) #define SDL_atof(X) SDL_strtod(X, NULL)
#endif #endif
#ifdef HAVE_STRCMP #ifdef HAVE_STRCMP
#define SDL_strcmp strcmp #define SDL_strcmp strcmp
#else #else
extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2); extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2);
#endif #endif
#ifdef HAVE_STRNCMP #ifdef HAVE_STRNCMP
#define SDL_strncmp strncmp #define SDL_strncmp strncmp
#else #else
extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2,
size_t maxlen); size_t maxlen);
#endif #endif
#ifdef HAVE_STRCASECMP #ifdef HAVE_STRCASECMP
#define SDL_strcasecmp strcasecmp #define SDL_strcasecmp strcasecmp
#elif defined(HAVE__STRICMP) #elif defined(HAVE__STRICMP)
#define SDL_strcasecmp _stricmp #define SDL_strcasecmp _stricmp
#else #else
extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1,
const char *str2); const char *str2);
#endif #endif
#ifdef HAVE_STRNCASECMP #ifdef HAVE_STRNCASECMP
#define SDL_strncasecmp strncasecmp #define SDL_strncasecmp strncasecmp
#elif defined(HAVE__STRNICMP) #elif defined(HAVE__STRNICMP)
#define SDL_strncasecmp _strnicmp #define SDL_strncasecmp _strnicmp
#else #else
extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1,
const char *str2, size_t maxlen); const char *str2, size_t maxlen);
#endif #endif
#ifdef HAVE_SSCANF #ifdef HAVE_SSCANF
#define SDL_sscanf sscanf #define SDL_sscanf sscanf
#else #else
extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, const char *fmt, extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, const char *fmt,
...); ...);
#endif #endif
#ifdef HAVE_SNPRINTF #ifdef HAVE_SNPRINTF
#define SDL_snprintf snprintf #define SDL_snprintf snprintf
#else #else
extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen, extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen,
const char *fmt, ...); const char *fmt, ...);
#endif #endif
#ifdef HAVE_VSNPRINTF #ifdef HAVE_VSNPRINTF
#define SDL_vsnprintf vsnprintf #define SDL_vsnprintf vsnprintf
#else #else
extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen,
const char *fmt, va_list ap); const char *fmt, va_list ap);
#endif #endif
#ifndef HAVE_M_PI #ifndef HAVE_M_PI
#define M_PI 3.14159265358979323846264338327950288 /* pi */ #define M_PI 3.14159265358979323846264338327950288 /* pi */
#endif #endif
#ifdef HAVE_CEIL #ifdef HAVE_CEIL
#define SDL_ceil ceil #define SDL_ceil ceil
#else #else
#define SDL_ceil(x) ((double)(int)((x)+0.5)) #define SDL_ceil(x) ((double)(int)((x)+0.5))
#endif #endif
#ifdef HAVE_COPYSIGN #ifdef HAVE_COPYSIGN
#define SDL_copysign copysign #define SDL_copysign copysign
#else #else
extern DECLSPEC double SDLCALL SDL_copysign(double x, double y); extern DECLSPEC double SDLCALL SDL_copysign(double x, double y);
#endif #endif
#ifdef HAVE_COS #ifdef HAVE_COS
#define SDL_cos cos #define SDL_cos cos
#else #else
extern DECLSPEC double SDLCALL SDL_cos(double x); extern DECLSPEC double SDLCALL SDL_cos(double x);
#endif #endif
#ifdef HAVE_COSF #ifdef HAVE_COSF
#define SDL_cosf cosf #define SDL_cosf cosf
#else #else
#define SDL_cosf(x) (float)SDL_cos((double)x) #define SDL_cosf(x) (float)SDL_cos((double)x)
#endif #endif
#ifdef HAVE_FABS #ifdef HAVE_FABS
#define SDL_fabs fabs #define SDL_fabs fabs
#else #else
extern DECLSPEC double SDLCALL SDL_fabs(double x); extern DECLSPEC double SDLCALL SDL_fabs(double x);
#endif #endif
#ifdef HAVE_FLOOR #ifdef HAVE_FLOOR
#define SDL_floor floor #define SDL_floor floor
#else #else
extern DECLSPEC double SDLCALL SDL_floor(double x); extern DECLSPEC double SDLCALL SDL_floor(double x);
#endif #endif
#ifdef HAVE_LOG #ifdef HAVE_LOG
#define SDL_log log #define SDL_log log
#else #else
extern DECLSPEC double SDLCALL SDL_log(double x); extern DECLSPEC double SDLCALL SDL_log(double x);
#endif #endif
#ifdef HAVE_POW #ifdef HAVE_POW
#define SDL_pow pow #define SDL_pow pow
#else #else
extern DECLSPEC double SDLCALL SDL_pow(double x, double y); extern DECLSPEC double SDLCALL SDL_pow(double x, double y);
#endif #endif
#ifdef HAVE_SCALBN #ifdef HAVE_SCALBN
#define SDL_scalbn scalbn #define SDL_scalbn scalbn
#else #else
extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n); extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n);
#endif #endif
#ifdef HAVE_SIN #ifdef HAVE_SIN
#define SDL_sin sin #define SDL_sin sin
#else #else
extern DECLSPEC double SDLCALL SDL_sin(double x); extern DECLSPEC double SDLCALL SDL_sin(double x);
#endif #endif
#ifdef HAVE_SINF #ifdef HAVE_SINF
#define SDL_sinf sinf #define SDL_sinf sinf
#else #else
#define SDL_sinf(x) (float)SDL_sin((double)x) #define SDL_sinf(x) (float)SDL_sin((double)x)
#endif #endif
#ifdef HAVE_SQRT #ifdef HAVE_SQRT
#define SDL_sqrt sqrt #define SDL_sqrt sqrt
#else #else
extern DECLSPEC double SDLCALL SDL_sqrt(double x); extern DECLSPEC double SDLCALL SDL_sqrt(double x);
#endif #endif
/* The SDL implementation of iconv() returns these error codes */ /* The SDL implementation of iconv() returns these error codes */
#define SDL_ICONV_ERROR (size_t)-1 #define SDL_ICONV_ERROR (size_t)-1
#define SDL_ICONV_E2BIG (size_t)-2 #define SDL_ICONV_E2BIG (size_t)-2
#define SDL_ICONV_EILSEQ (size_t)-3 #define SDL_ICONV_EILSEQ (size_t)-3
#define SDL_ICONV_EINVAL (size_t)-4 #define SDL_ICONV_EINVAL (size_t)-4
#if defined(HAVE_ICONV) && defined(HAVE_ICONV_H) #if defined(HAVE_ICONV) && defined(HAVE_ICONV_H)
#define SDL_iconv_t iconv_t #define SDL_iconv_t iconv_t
#define SDL_iconv_open iconv_open #define SDL_iconv_open iconv_open
#define SDL_iconv_close iconv_close #define SDL_iconv_close iconv_close
#else #else
typedef struct _SDL_iconv_t *SDL_iconv_t; typedef struct _SDL_iconv_t *SDL_iconv_t;
extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode, extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode,
const char *fromcode); const char *fromcode);
extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd); extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd);
#endif #endif
extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf, extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf,
size_t * inbytesleft, char **outbuf, size_t * inbytesleft, char **outbuf,
size_t * outbytesleft); size_t * outbytesleft);
/** /**
* This function converts a string between encodings in one pass, returning a * This function converts a string between encodings in one pass, returning a
* string that must be freed with SDL_free() or NULL on error. * string that must be freed with SDL_free() or NULL on error.
*/ */
extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode, extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode,
const char *fromcode, const char *fromcode,
const char *inbuf, const char *inbuf,
size_t inbytesleft); size_t inbytesleft);
#define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1) #define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1)
#define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2", "UTF-8", S, SDL_strlen(S)+1) #define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2", "UTF-8", S, SDL_strlen(S)+1)
#define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4", "UTF-8", S, SDL_strlen(S)+1) #define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4", "UTF-8", S, SDL_strlen(S)+1)
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */ /* *INDENT-OFF* */
} }
/* *INDENT-ON* */ /* *INDENT-ON* */
#endif #endif
#include "close_code.h" #include "close_code.h"
#endif /* _SDL_stdinc_h */ #endif /* _SDL_stdinc_h */
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
...@@ -106,24 +106,6 @@ struct SDL_SysWMinfo ...@@ -106,24 +106,6 @@ struct SDL_SysWMinfo
{ {
Display *display; /**< The X11 display */ Display *display; /**< The X11 display */
Window window; /**< The X11 display window */ Window window; /**< The X11 display window */
/**
* These locking functions should be called around
* any X11 functions using the display variable.
* They lock the event thread, so should not be
* called around event functions or from event filters.
*/
/*@{*/
void (*lock_func) (void);
void (*unlock_func) (void);
/*@}*/
/**
* Introduced in SDL 1.0.2.
*/
/*@{*/
Window fswindow; /**< The X11 fullscreen window */
Window wmwindow; /**< The X11 managed input window */
/*@}*/
} x11; } x11;
} info; } info;
}; };
...@@ -231,7 +213,7 @@ typedef struct SDL_SysWMinfo SDL_SysWMinfo; ...@@ -231,7 +213,7 @@ typedef struct SDL_SysWMinfo SDL_SysWMinfo;
/** /**
* \brief This function allows access to driver-dependent window information. * \brief This function allows access to driver-dependent window information.
* *
* \param windowID The window about which information is being requested * \param window The window about which information is being requested
* \param info This structure must be initialized with the SDL version, and is * \param info This structure must be initialized with the SDL version, and is
* then filled in with information about the given window. * then filled in with information about the given window.
* *
......
...@@ -287,6 +287,7 @@ SDL_StreamLength(SDL_AudioStreamer * stream) ...@@ -287,6 +287,7 @@ SDL_StreamLength(SDL_AudioStreamer * stream)
} }
/* Initialize the stream by allocating the buffer and setting the read/write heads to the beginning */ /* Initialize the stream by allocating the buffer and setting the read/write heads to the beginning */
#if 0
static int static int
SDL_StreamInit(SDL_AudioStreamer * stream, int max_len, Uint8 silence) SDL_StreamInit(SDL_AudioStreamer * stream, int max_len, Uint8 silence)
{ {
...@@ -305,6 +306,7 @@ SDL_StreamInit(SDL_AudioStreamer * stream, int max_len, Uint8 silence) ...@@ -305,6 +306,7 @@ SDL_StreamInit(SDL_AudioStreamer * stream, int max_len, Uint8 silence)
return 0; return 0;
} }
#endif
/* Deinitialize the stream simply by freeing the buffer */ /* Deinitialize the stream simply by freeing the buffer */
static void static void
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> /* For close() */
#include "SDL_stdinc.h" #include "SDL_stdinc.h"
#include "SDL_audiodev_c.h" #include "SDL_audiodev_c.h"
......
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
/* Clipboard event handling code for SDL */
#include "SDL_events.h"
#include "SDL_events_c.h"
#include "SDL_clipboardevents_c.h"
int
SDL_SendClipboardUpdate(void)
{
int posted;
/* Post the event, if desired */
posted = 0;
if (SDL_GetEventState(SDL_CLIPBOARDUPDATE) == SDL_ENABLE) {
SDL_Event event;
event.type = SDL_CLIPBOARDUPDATE;
posted = (SDL_PushEvent(&event) > 0);
}
return (posted);
}
/* vi: set ts=4 sw=4 expandtab: */
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
#ifndef _SDL_clipboardevents_c_h
#define _SDL_clipboardevents_c_h
extern int SDL_SendClipboardUpdate(void);
#endif /* _SDL_clipboardevents_c_h */
/* vi: set ts=4 sw=4 expandtab: */
...@@ -551,6 +551,10 @@ SDL_UCS4ToUTF8(Uint32 ch, char *dst) ...@@ -551,6 +551,10 @@ SDL_UCS4ToUTF8(Uint32 ch, char *dst)
int int
SDL_KeyboardInit(void) SDL_KeyboardInit(void)
{ {
SDL_Keyboard *keyboard = &SDL_keyboard;
/* Set the default keymap */
SDL_memcpy(keyboard->keymap, SDL_default_keymap, sizeof(SDL_default_keymap));
return (0); return (0);
} }
...@@ -760,6 +764,11 @@ SDL_SendKeyboardText(const char *text) ...@@ -760,6 +764,11 @@ SDL_SendKeyboardText(const char *text)
SDL_Keyboard *keyboard = &SDL_keyboard; SDL_Keyboard *keyboard = &SDL_keyboard;
int posted; int posted;
/* Don't post text events for unprintable characters */
if (*text < ' ') {
return 0;
}
/* Post the event, if desired */ /* Post the event, if desired */
posted = 0; posted = 0;
if (SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE) { if (SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE) {
......
...@@ -262,24 +262,24 @@ static const SDL_scancode xfree86_scancode_table2[] = { ...@@ -262,24 +262,24 @@ static const SDL_scancode xfree86_scancode_table2[] = {
/* 81 */ SDL_SCANCODE_KP_3, /* 81 */ SDL_SCANCODE_KP_3,
/* 82 */ SDL_SCANCODE_KP_0, /* 82 */ SDL_SCANCODE_KP_0,
/* 83 */ SDL_SCANCODE_KP_PERIOD, /* 83 */ SDL_SCANCODE_KP_PERIOD,
/* 84 */ SDL_SCANCODE_SYSREQ, /* ???? */ /* 84 */ SDL_SCANCODE_SYSREQ, /* ???? */
/* 85 */ SDL_SCANCODE_MODE, /* ???? */ /* 85 */ SDL_SCANCODE_MODE, /* ???? */
/* 86 */ SDL_SCANCODE_NONUSBACKSLASH, /* 86 */ SDL_SCANCODE_NONUSBACKSLASH,
/* 87 */ SDL_SCANCODE_F11, /* 87 */ SDL_SCANCODE_F11,
/* 88 */ SDL_SCANCODE_F12, /* 88 */ SDL_SCANCODE_F12,
/* 89 */ SDL_SCANCODE_UNKNOWN, /* 89 */ SDL_SCANCODE_UNKNOWN,
/* 90 */ SDL_SCANCODE_UNKNOWN, /* 90 */ SDL_SCANCODE_UNKNOWN, /* Katakana */
/* 91 */ SDL_SCANCODE_UNKNOWN, /* 91 */ SDL_SCANCODE_UNKNOWN, /* Hiragana */
/* 92 */ SDL_SCANCODE_UNKNOWN, /* 92 */ SDL_SCANCODE_UNKNOWN, /* Henkan_Mode */
/* 93 */ SDL_SCANCODE_UNKNOWN, /* 93 */ SDL_SCANCODE_UNKNOWN, /* Hiragana_Katakana */
/* 94 */ SDL_SCANCODE_UNKNOWN, /* 94 */ SDL_SCANCODE_UNKNOWN, /* Muhenkan */
/* 95 */ SDL_SCANCODE_UNKNOWN, /* 95 */ SDL_SCANCODE_UNKNOWN,
/* 96 */ SDL_SCANCODE_UNKNOWN, /* 96 */ SDL_SCANCODE_KP_ENTER,
/* 97 */ SDL_SCANCODE_RCTRL, /* 97 */ SDL_SCANCODE_RCTRL,
/* 98 */ SDL_SCANCODE_KP_DIVIDE, /* 98 */ SDL_SCANCODE_KP_DIVIDE,
/* 99 */ SDL_SCANCODE_UNKNOWN, /* 99 */ SDL_SCANCODE_PRINTSCREEN,
/* 100 */ SDL_SCANCODE_RALT, /* ISO_Level3_Shift, ALTGR, RALT */ /* 100 */ SDL_SCANCODE_RALT, /* ISO_Level3_Shift, ALTGR, RALT */
/* 101 */ SDL_SCANCODE_UNKNOWN, /* 101 */ SDL_SCANCODE_UNKNOWN, /* Linefeed */
/* 102 */ SDL_SCANCODE_HOME, /* 102 */ SDL_SCANCODE_HOME,
/* 103 */ SDL_SCANCODE_UP, /* 103 */ SDL_SCANCODE_UP,
/* 104 */ SDL_SCANCODE_PAGEUP, /* 104 */ SDL_SCANCODE_PAGEUP,
...@@ -291,40 +291,132 @@ static const SDL_scancode xfree86_scancode_table2[] = { ...@@ -291,40 +291,132 @@ static const SDL_scancode xfree86_scancode_table2[] = {
/* 110 */ SDL_SCANCODE_INSERT, /* 110 */ SDL_SCANCODE_INSERT,
/* 111 */ SDL_SCANCODE_DELETE, /* 111 */ SDL_SCANCODE_DELETE,
/* 112 */ SDL_SCANCODE_UNKNOWN, /* 112 */ SDL_SCANCODE_UNKNOWN,
/* 113 */ SDL_SCANCODE_UNKNOWN, /* 113 */ SDL_SCANCODE_MUTE,
/* 114 */ SDL_SCANCODE_UNKNOWN, /* 114 */ SDL_SCANCODE_VOLUMEDOWN,
/* 115 */ SDL_SCANCODE_UNKNOWN, /* 115 */ SDL_SCANCODE_VOLUMEUP,
/* 116 */ SDL_SCANCODE_UNKNOWN, /* 116 */ SDL_SCANCODE_POWER,
/* 117 */ SDL_SCANCODE_UNKNOWN, /* 117 */ SDL_SCANCODE_KP_EQUALS,
/* 118 */ SDL_SCANCODE_UNKNOWN, /* 118 */ SDL_SCANCODE_UNKNOWN, /* plusminus */
/* 119 */ SDL_SCANCODE_UNKNOWN, /* 119 */ SDL_SCANCODE_PAUSE,
/* 120 */ SDL_SCANCODE_UNKNOWN, /* 120 */ SDL_SCANCODE_UNKNOWN, /* XF86LaunchA */
/* 121 */ SDL_SCANCODE_PAUSE, /* 121 */ SDL_SCANCODE_UNKNOWN, /* KP_Decimal */
/* 122 */ SDL_SCANCODE_UNKNOWN, /* 122 */ SDL_SCANCODE_UNKNOWN, /* Hangul */
/* 123 */ SDL_SCANCODE_UNKNOWN, /* 123 */ SDL_SCANCODE_UNKNOWN, /* Hangul_Hanja */
/* 124 */ SDL_SCANCODE_UNKNOWN, /* 124 */ SDL_SCANCODE_UNKNOWN,
/* 125 */ SDL_SCANCODE_LGUI, /* 125 */ SDL_SCANCODE_LGUI,
/* 126 */ SDL_SCANCODE_RGUI, /* 126 */ SDL_SCANCODE_RGUI,
/* 127 */ SDL_SCANCODE_APPLICATION, /* 127 */ SDL_SCANCODE_APPLICATION,
/* 128 */ SDL_SCANCODE_UNKNOWN, /* 128 */ SDL_SCANCODE_CANCEL,
/* 129 */ SDL_SCANCODE_UNKNOWN, /* 129 */ SDL_SCANCODE_AGAIN,
/* 130 */ SDL_SCANCODE_UNKNOWN, /* 130 */ SDL_SCANCODE_UNKNOWN, /* SunProps */
/* 131 */ SDL_SCANCODE_UNKNOWN, /* 131 */ SDL_SCANCODE_UNDO,
/* 132 */ SDL_SCANCODE_UNKNOWN, /* 132 */ SDL_SCANCODE_UNKNOWN, /* SunFront */
/* 133 */ SDL_SCANCODE_UNKNOWN, /* 133 */ SDL_SCANCODE_COPY,
/* 134 */ SDL_SCANCODE_UNKNOWN, /* 134 */ SDL_SCANCODE_UNKNOWN, /* SunOpen */
/* 135 */ SDL_SCANCODE_UNKNOWN, /* 135 */ SDL_SCANCODE_PASTE,
/* 136 */ SDL_SCANCODE_UNKNOWN, /* 136 */ SDL_SCANCODE_FIND,
/* 137 */ SDL_SCANCODE_UNKNOWN, /* 137 */ SDL_SCANCODE_CUT,
/* 138 */ SDL_SCANCODE_UNKNOWN, /* 138 */ SDL_SCANCODE_HELP,
/* 139 */ SDL_SCANCODE_UNKNOWN, /* 139 */ SDL_SCANCODE_UNKNOWN, /* XF86MenuKB */
/* 140 */ SDL_SCANCODE_UNKNOWN, /* 140 */ SDL_SCANCODE_CALCULATOR,
/* 141 */ SDL_SCANCODE_UNKNOWN, /* 141 */ SDL_SCANCODE_UNKNOWN,
/* 142 */ SDL_SCANCODE_UNKNOWN, /* 142 */ SDL_SCANCODE_SLEEP,
/* 143 */ SDL_SCANCODE_UNKNOWN, /* 143 */ SDL_SCANCODE_UNKNOWN, /* XF86WakeUp */
/* 144 */ SDL_SCANCODE_UNKNOWN, /* 144 */ SDL_SCANCODE_UNKNOWN, /* XF86Explorer */
/* 145 */ SDL_SCANCODE_UNKNOWN, /* 145 */ SDL_SCANCODE_UNKNOWN, /* XF86Send */
/* 146 */ SDL_SCANCODE_UNKNOWN, /* 146 */ SDL_SCANCODE_UNKNOWN,
/* 147 */ SDL_SCANCODE_UNKNOWN, /* XF86Xfer */
/* 148 */ SDL_SCANCODE_UNKNOWN, /* XF86Launch1 */
/* 149 */ SDL_SCANCODE_UNKNOWN, /* XF86Launch2 */
/* 150 */ SDL_SCANCODE_WWW,
/* 151 */ SDL_SCANCODE_UNKNOWN, /* XF86DOS */
/* 152 */ SDL_SCANCODE_UNKNOWN, /* XF86ScreenSaver */
/* 153 */ SDL_SCANCODE_UNKNOWN,
/* 154 */ SDL_SCANCODE_UNKNOWN, /* XF86RotateWindows */
/* 155 */ SDL_SCANCODE_MAIL,
/* 156 */ SDL_SCANCODE_UNKNOWN, /* XF86Favorites */
/* 157 */ SDL_SCANCODE_COMPUTER,
/* 158 */ SDL_SCANCODE_AC_BACK,
/* 159 */ SDL_SCANCODE_AC_FORWARD,
/* 160 */ SDL_SCANCODE_UNKNOWN,
/* 161 */ SDL_SCANCODE_EJECT,
/* 162 */ SDL_SCANCODE_EJECT,
/* 163 */ SDL_SCANCODE_AUDIONEXT,
/* 164 */ SDL_SCANCODE_AUDIOPLAY,
/* 165 */ SDL_SCANCODE_AUDIOPREV,
/* 166 */ SDL_SCANCODE_AUDIOSTOP,
/* 167 */ SDL_SCANCODE_UNKNOWN, /* XF86AudioRecord */
/* 168 */ SDL_SCANCODE_UNKNOWN, /* XF86AudioRewind */
/* 169 */ SDL_SCANCODE_UNKNOWN, /* XF86Phone */
/* 170 */ SDL_SCANCODE_UNKNOWN,
/* 171 */ SDL_SCANCODE_UNKNOWN, /* XF86Tools */
/* 172 */ SDL_SCANCODE_AC_HOME,
/* 173 */ SDL_SCANCODE_AC_REFRESH,
/* 174 */ SDL_SCANCODE_UNKNOWN, /* XF86Close */
/* 175 */ SDL_SCANCODE_UNKNOWN,
/* 176 */ SDL_SCANCODE_UNKNOWN,
/* 177 */ SDL_SCANCODE_UNKNOWN, /* XF86ScrollUp */
/* 178 */ SDL_SCANCODE_UNKNOWN, /* XF86ScrollDown */
/* 179 */ SDL_SCANCODE_UNKNOWN, /* parenleft */
/* 180 */ SDL_SCANCODE_UNKNOWN, /* parenright */
/* 181 */ SDL_SCANCODE_UNKNOWN, /* XF86New */
/* 182 */ SDL_SCANCODE_AGAIN,
/* 183 */ SDL_SCANCODE_UNKNOWN, /* XF86Tools */
/* 184 */ SDL_SCANCODE_UNKNOWN, /* XF86Launch5 */
/* 185 */ SDL_SCANCODE_UNKNOWN, /* XF86MenuKB */
/* 186 */ SDL_SCANCODE_UNKNOWN,
/* 187 */ SDL_SCANCODE_UNKNOWN,
/* 188 */ SDL_SCANCODE_UNKNOWN,
/* 189 */ SDL_SCANCODE_UNKNOWN,
/* 190 */ SDL_SCANCODE_UNKNOWN,
/* 191 */ SDL_SCANCODE_UNKNOWN,
/* 192 */ SDL_SCANCODE_UNKNOWN, /* XF86TouchpadToggle */
/* 193 */ SDL_SCANCODE_UNKNOWN,
/* 194 */ SDL_SCANCODE_UNKNOWN,
/* 195 */ SDL_SCANCODE_MODE,
/* 196 */ SDL_SCANCODE_UNKNOWN,
/* 197 */ SDL_SCANCODE_UNKNOWN,
/* 198 */ SDL_SCANCODE_UNKNOWN,
/* 199 */ SDL_SCANCODE_UNKNOWN,
/* 200 */ SDL_SCANCODE_AUDIOPLAY,
/* 201 */ SDL_SCANCODE_UNKNOWN, /* XF86AudioPause */
/* 202 */ SDL_SCANCODE_UNKNOWN, /* XF86Launch3 */
/* 203 */ SDL_SCANCODE_UNKNOWN, /* XF86Launch4 */
/* 204 */ SDL_SCANCODE_UNKNOWN, /* XF86LaunchB */
/* 205 */ SDL_SCANCODE_UNKNOWN, /* XF86Suspend */
/* 206 */ SDL_SCANCODE_UNKNOWN, /* XF86Close */
/* 207 */ SDL_SCANCODE_AUDIOPLAY,
/* 208 */ SDL_SCANCODE_AUDIONEXT,
/* 209 */ SDL_SCANCODE_UNKNOWN,
/* 210 */ SDL_SCANCODE_PRINTSCREEN,
/* 211 */ SDL_SCANCODE_UNKNOWN,
/* 212 */ SDL_SCANCODE_UNKNOWN, /* XF86WebCam */
/* 213 */ SDL_SCANCODE_UNKNOWN,
/* 214 */ SDL_SCANCODE_UNKNOWN,
/* 215 */ SDL_SCANCODE_MAIL,
/* 216 */ SDL_SCANCODE_UNKNOWN,
/* 217 */ SDL_SCANCODE_AC_SEARCH,
/* 218 */ SDL_SCANCODE_UNKNOWN,
/* 219 */ SDL_SCANCODE_UNKNOWN, /* XF86Finance */
/* 220 */ SDL_SCANCODE_UNKNOWN,
/* 221 */ SDL_SCANCODE_UNKNOWN, /* XF86Shop */
/* 222 */ SDL_SCANCODE_UNKNOWN,
/* 223 */ SDL_SCANCODE_STOP,
/* 224 */ SDL_SCANCODE_BRIGHTNESSDOWN,
/* 225 */ SDL_SCANCODE_BRIGHTNESSUP,
/* 226 */ SDL_SCANCODE_MEDIASELECT,
/* 227 */ SDL_SCANCODE_DISPLAYSWITCH,
/* 228 */ SDL_SCANCODE_KBDILLUMTOGGLE,
/* 229 */ SDL_SCANCODE_KBDILLUMDOWN,
/* 230 */ SDL_SCANCODE_KBDILLUMUP,
/* 231 */ SDL_SCANCODE_UNKNOWN, /* XF86Send */
/* 232 */ SDL_SCANCODE_UNKNOWN, /* XF86Reply */
/* 233 */ SDL_SCANCODE_UNKNOWN, /* XF86MailForward */
/* 234 */ SDL_SCANCODE_UNKNOWN, /* XF86Save */
/* 235 */ SDL_SCANCODE_UNKNOWN, /* XF86Documents */
/* 236 */ SDL_SCANCODE_UNKNOWN, /* XF86Battery */
/* 237 */ SDL_SCANCODE_UNKNOWN, /* XF86Bluetooth */
/* 238 */ SDL_SCANCODE_UNKNOWN, /* XF86WLAN */
}; };
/* *INDENT-ON* */ /* *INDENT-ON* */
...@@ -254,8 +254,6 @@ SDL_SYS_HapticName(int index) ...@@ -254,8 +254,6 @@ SDL_SYS_HapticName(int index)
static int static int
SDL_SYS_HapticOpenFromFD(SDL_Haptic * haptic, int fd) SDL_SYS_HapticOpenFromFD(SDL_Haptic * haptic, int fd)
{ {
const char *name;
/* Allocate the hwdata */ /* Allocate the hwdata */
haptic->hwdata = (struct haptic_hwdata *) haptic->hwdata = (struct haptic_hwdata *)
SDL_malloc(sizeof(*haptic->hwdata)); SDL_malloc(sizeof(*haptic->hwdata));
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
#include <libusbhid.h> #include <libusbhid.h>
#endif #endif
#ifdef __FREEBSD__ #ifdef defined(__FREEBSD__) || defined(__FreeBSD_kernel__)
#ifndef __DragonFly__ #ifndef __DragonFly__
#include <osreldate.h> #include <osreldate.h>
#endif #endif
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
#define MAX_JOY_JOYS 2 #define MAX_JOY_JOYS 2
#define MAX_JOYS (MAX_UHID_JOYS + MAX_JOY_JOYS) #define MAX_JOYS (MAX_UHID_JOYS + MAX_JOY_JOYS)
#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063) #if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063) && false
struct usb_ctl_report { struct usb_ctl_report {
int ucr_report; int ucr_report;
u_char ucr_data[1024]; /* filled data size will vary */ u_char ucr_data[1024]; /* filled data size will vary */
...@@ -149,7 +149,7 @@ static char *joydevnames[MAX_JOYS]; ...@@ -149,7 +149,7 @@ static char *joydevnames[MAX_JOYS];
static int report_alloc(struct report *, struct report_desc *, int); static int report_alloc(struct report *, struct report_desc *, int);
static void report_free(struct report *); static void report_free(struct report *);
#if defined(USBHID_UCR_DATA) || (defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063)) #if defined(USBHID_UCR_DATA) || (defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063)) || defined(__FreeBSD_kernel__)
#define REP_BUF_DATA(rep) ((rep)->buf->ucr_data) #define REP_BUF_DATA(rep) ((rep)->buf->ucr_data)
#else #else
#define REP_BUF_DATA(rep) ((rep)->buf->data) #define REP_BUF_DATA(rep) ((rep)->buf->data)
...@@ -308,7 +308,7 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joy) ...@@ -308,7 +308,7 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joy)
goto usberr; goto usberr;
} }
rep = &hw->inreport; rep = &hw->inreport;
#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063) #if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063) || defined(__FreeBSD_kernel__)
rep->rid = hid_get_report_id(fd); rep->rid = hid_get_report_id(fd);
if (rep->rid < 0) { if (rep->rid < 0) {
#else #else
...@@ -324,7 +324,7 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joy) ...@@ -324,7 +324,7 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joy)
hw->path); hw->path);
goto usberr; goto usberr;
} }
#if defined(USBHID_NEW) || (defined(__FREEBSD__) && __FreeBSD_kernel_version >= 500111) #if defined(USBHID_NEW) || (defined(__FREEBSD__) && __FreeBSD_kernel_version >= 500111) || defined(__FreeBSD_kernel__)
hdata = hid_start_parse(hw->repdesc, 1 << hid_input, rep->rid); hdata = hid_start_parse(hw->repdesc, 1 << hid_input, rep->rid);
#else #else
hdata = hid_start_parse(hw->repdesc, 1 << hid_input); hdata = hid_start_parse(hw->repdesc, 1 << hid_input);
...@@ -409,7 +409,7 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joy) ...@@ -409,7 +409,7 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joy)
int nbutton, naxe = -1; int nbutton, naxe = -1;
Sint32 v; Sint32 v;
#if defined(__FREEBSD__) || SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H #if defined(__FREEBSD__) || SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H || defined(__FreeBSD_kernel__)
struct joystick gameport; struct joystick gameport;
static int x, y, xmin = 0xffff, ymin = 0xffff, xmax = 0, ymax = 0; static int x, y, xmin = 0xffff, ymin = 0xffff, xmax = 0, ymax = 0;
...@@ -466,7 +466,7 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joy) ...@@ -466,7 +466,7 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joy)
if (read(joy->hwdata->fd, REP_BUF_DATA(rep), rep->size) != rep->size) { if (read(joy->hwdata->fd, REP_BUF_DATA(rep), rep->size) != rep->size) {
return; return;
} }
#if defined(USBHID_NEW) || (defined(__FREEBSD__) && __FreeBSD_kernel_version >= 500111) #if defined(USBHID_NEW) || (defined(__FREEBSD__) && __FreeBSD_kernel_version >= 500111) || defined(__FreeBSD_kernel__)
hdata = hid_start_parse(joy->hwdata->repdesc, 1 << hid_input, rep->rid); hdata = hid_start_parse(joy->hwdata->repdesc, 1 << hid_input, rep->rid);
#else #else
hdata = hid_start_parse(joy->hwdata->repdesc, 1 << hid_input); hdata = hid_start_parse(joy->hwdata->repdesc, 1 << hid_input);
......
...@@ -71,6 +71,7 @@ ParseCommandLine(char *cmdline, char **argv) ...@@ -71,6 +71,7 @@ ParseCommandLine(char *cmdline, char **argv)
++argc; ++argc;
} }
/* Skip over word */ /* Skip over word */
lastp = bufp;
while (*bufp && (*bufp != '"' || *lastp == '\\')) { while (*bufp && (*bufp != '"' || *lastp == '\\')) {
lastp = bufp; lastp = bufp;
++bufp; ++bufp;
......
...@@ -38,4 +38,5 @@ extern int SDL_SYS_StartTimer(void); ...@@ -38,4 +38,5 @@ extern int SDL_SYS_StartTimer(void);
/* Stop a previously started timer */ /* Stop a previously started timer */
extern void SDL_SYS_StopTimer(void); extern void SDL_SYS_StopTimer(void);
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <errno.h> #include <errno.h>
#include "SDL_timer.h" #include "SDL_timer.h"
#include "../SDL_systimer.h"
#include "../SDL_timer_c.h" #include "../SDL_timer_c.h"
/* The clock_gettime provides monotonous time, so we should use it if /* The clock_gettime provides monotonous time, so we should use it if
......
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
#include "SDL_clipboard.h"
#include "SDL_sysvideo.h"
int
SDL_SetClipboardText(const char *text)
{
SDL_VideoDevice *_this = SDL_GetVideoDevice();
if (!text) {
text = "";
}
if (_this->SetClipboardText) {
return _this->SetClipboardText(_this, text);
} else {
_this->clipboard_text = SDL_strdup(text);
return 0;
}
}
char *
SDL_GetClipboardText(void)
{
SDL_VideoDevice *_this = SDL_GetVideoDevice();
if (_this->GetClipboardText) {
return _this->GetClipboardText(_this);
} else {
const char *text = _this->clipboard_text;
if (!text) {
text = "";
}
return SDL_strdup(text);
}
}
SDL_bool
SDL_HasClipboardText(void)
{
SDL_VideoDevice *_this = SDL_GetVideoDevice();
if (_this->HasClipboardText) {
return _this->HasClipboardText(_this);
} else {
if (_this->clipboard_text) {
return SDL_TRUE;
} else {
return SDL_FALSE;
}
}
}
/* vi: set ts=4 sw=4 expandtab: */
...@@ -822,20 +822,25 @@ GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -822,20 +822,25 @@ GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
maybe it'd be a good idea to keep a temp buffer around maybe it'd be a good idea to keep a temp buffer around
for this purpose rather than allocating it each time for this purpose rather than allocating it each time
*/ */
temp_buffer = SDL_malloc(rect->w * rect->h * bpp); if( rect->x == 0 && rect->w * bpp == pitch ) {
temp_ptr = temp_buffer; temp_buffer = pixels; /* Updating whole texture, no need to reformat */
for (i = 0; i < rect->h; i++) { } else {
SDL_memcpy(temp_ptr, pixels, rect->w * bpp); temp_buffer = SDL_malloc(rect->w * rect->h * bpp);
temp_ptr += rect->w * bpp; temp_ptr = temp_buffer;
pixels += pitch; for (i = 0; i < rect->h; i++) {
SDL_memcpy(temp_ptr, pixels, rect->w * bpp);
temp_ptr += rect->w * bpp;
pixels += pitch;
}
} }
data->glTexSubImage2D(texturedata->type, 0, rect->x, rect->y, data->glTexSubImage2D(texturedata->type, 0, rect->x, rect->y,
rect->w, rect->h, texturedata->format, rect->w, rect->h, texturedata->format,
texturedata->formattype, temp_buffer); texturedata->formattype, temp_buffer);
SDL_free(temp_buffer); if( temp_buffer != pixels ) {
SDL_free(temp_buffer);
}
} }
SDL_ClearDirtyRects(&texturedata->dirty); SDL_ClearDirtyRects(&texturedata->dirty);
} }
......
...@@ -795,7 +795,6 @@ SW_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -795,7 +795,6 @@ SW_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * srcrect, const SDL_Rect * dstrect) const SDL_Rect * srcrect, const SDL_Rect * dstrect)
{ {
SW_RenderData *data = (SW_RenderData *) renderer->driverdata; SW_RenderData *data = (SW_RenderData *) renderer->driverdata;
SDL_Window *window = renderer->window;
int status; int status;
if (data->renderer->info.flags & SDL_RENDERER_PRESENTCOPY) { if (data->renderer->info.flags & SDL_RENDERER_PRESENTCOPY) {
......
...@@ -80,7 +80,7 @@ generate_rowbytes(int src_w, int dst_w, int bpp) ...@@ -80,7 +80,7 @@ generate_rowbytes(int src_w, int dst_w, int bpp)
int i; int i;
int pos, inc; int pos, inc;
unsigned char *eip; unsigned char *eip, *fence;
unsigned char load, store; unsigned char load, store;
/* See if we need to regenerate the copy buffer */ /* See if we need to regenerate the copy buffer */
...@@ -116,14 +116,21 @@ generate_rowbytes(int src_w, int dst_w, int bpp) ...@@ -116,14 +116,21 @@ generate_rowbytes(int src_w, int dst_w, int bpp)
pos = 0x10000; pos = 0x10000;
inc = (src_w << 16) / dst_w; inc = (src_w << 16) / dst_w;
eip = copy_row; eip = copy_row;
fence = copy_row + sizeof(copy_row)-2;
for (i = 0; i < dst_w; ++i) { for (i = 0; i < dst_w; ++i) {
while (pos >= 0x10000L) { while (pos >= 0x10000L) {
if (eip == fence) {
return -1;
}
if (bpp == 2) { if (bpp == 2) {
*eip++ = PREFIX16; *eip++ = PREFIX16;
} }
*eip++ = load; *eip++ = load;
pos -= 0x10000L; pos -= 0x10000L;
} }
if (eip == fence) {
return -1;
}
if (bpp == 2) { if (bpp == 2) {
*eip++ = PREFIX16; *eip++ = PREFIX16;
} }
...@@ -132,11 +139,6 @@ generate_rowbytes(int src_w, int dst_w, int bpp) ...@@ -132,11 +139,6 @@ generate_rowbytes(int src_w, int dst_w, int bpp)
} }
*eip++ = RETURN; *eip++ = RETURN;
/* Verify that we didn't overflow (too late!!!) */
if (eip > (copy_row + sizeof(copy_row))) {
SDL_SetError("Copy buffer overflow");
return (-1);
}
#ifdef HAVE_MPROTECT #ifdef HAVE_MPROTECT
/* Make the code executable but not writeable */ /* Make the code executable but not writeable */
if (mprotect(copy_row, sizeof(copy_row), PROT_READ | PROT_EXEC) < 0) { if (mprotect(copy_row, sizeof(copy_row), PROT_READ | PROT_EXEC) < 0) {
......
...@@ -851,7 +851,7 @@ SDL_ConvertSurface(SDL_Surface * surface, SDL_PixelFormat * format, ...@@ -851,7 +851,7 @@ SDL_ConvertSurface(SDL_Surface * surface, SDL_PixelFormat * format,
/* Enable alpha blending by default if the new surface has an /* Enable alpha blending by default if the new surface has an
* alpha channel or alpha modulation */ * alpha channel or alpha modulation */
if ((surface->format->Amask && format->Amask) || if ((surface->format->Amask && format->Amask) ||
(copy_flags & SDL_COPY_MODULATE_ALPHA)) { (copy_flags & (SDL_COPY_COLORKEY|SDL_COPY_MODULATE_ALPHA))) {
SDL_SetSurfaceBlendMode(convert, SDL_BLENDMODE_BLEND); SDL_SetSurfaceBlendMode(convert, SDL_BLENDMODE_BLEND);
} }
if ((copy_flags & SDL_COPY_RLE_DESIRED) || (flags & SDL_RLEACCEL)) { if ((copy_flags & SDL_COPY_RLE_DESIRED) || (flags & SDL_RLEACCEL)) {
......
...@@ -303,6 +303,11 @@ struct SDL_VideoDevice ...@@ -303,6 +303,11 @@ struct SDL_VideoDevice
void (*StopTextInput) (_THIS); void (*StopTextInput) (_THIS);
void (*SetTextInputRect) (_THIS, SDL_Rect *rect); void (*SetTextInputRect) (_THIS, SDL_Rect *rect);
/* Clipboard */
int (*SetClipboardText) (_THIS, const char *text);
char * (*GetClipboardText) (_THIS);
SDL_bool (*HasClipboardText) (_THIS);
/* * * */ /* * * */
/* Data common to all drivers */ /* Data common to all drivers */
SDL_bool suspend_screensaver; SDL_bool suspend_screensaver;
...@@ -312,6 +317,7 @@ struct SDL_VideoDevice ...@@ -312,6 +317,7 @@ struct SDL_VideoDevice
Uint8 window_magic; Uint8 window_magic;
Uint8 texture_magic; Uint8 texture_magic;
Uint32 next_object_id; Uint32 next_object_id;
char * clipboard_text;
/* * * */ /* * * */
/* Data used by the GL drivers */ /* Data used by the GL drivers */
......
...@@ -2833,6 +2833,10 @@ SDL_VideoQuit(void) ...@@ -2833,6 +2833,10 @@ SDL_VideoQuit(void)
SDL_free(_this->displays); SDL_free(_this->displays);
_this->displays = NULL; _this->displays = NULL;
} }
if (_this->clipboard_text) {
SDL_free(_this->clipboard_text);
_this->clipboard_text = NULL;
}
_this->free(_this); _this->free(_this);
_this = NULL; _this = NULL;
} }
...@@ -3267,7 +3271,7 @@ SDL_GL_SwapWindow(SDL_Window * window) ...@@ -3267,7 +3271,7 @@ SDL_GL_SwapWindow(SDL_Window * window)
void void
SDL_GL_DeleteContext(SDL_GLContext context) SDL_GL_DeleteContext(SDL_GLContext context)
{ {
if (!_this || !context) { if (!_this || !_this->gl_data || !context) {
return; return;
} }
_this->GL_MakeCurrent(_this, NULL, NULL); _this->GL_MakeCurrent(_this, NULL, NULL);
......
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
#ifndef _SDL_cocoaclipboard_h
#define _SDL_cocoaclipboard_h
/* Forward declaration */
struct SDL_VideoData;
extern int Cocoa_SetClipboardText(_THIS, const char *text);
extern char *Cocoa_GetClipboardText(_THIS);
extern SDL_bool Cocoa_HasClipboardText(_THIS);
extern void Cocoa_CheckClipboardUpdate(struct SDL_VideoData * data);
#endif /* _SDL_cocoaclipboard_h */
/* vi: set ts=4 sw=4 expandtab: */
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
#include "SDL_cocoavideo.h"
#include "../../events/SDL_clipboardevents_c.h"
static NSString *
GetTextFormat(_THIS)
{
#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
return NSStringPboardType;
#else
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
if (data->osversion >= 0x1060) {
return NSPasteboardTypeString;
} else {
return NSStringPboardType;
}
#endif
}
int
Cocoa_SetClipboardText(_THIS, const char *text)
{
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
NSAutoreleasePool *pool;
NSPasteboard *pasteboard;
NSString *format = GetTextFormat(_this);
pool = [[NSAutoreleasePool alloc] init];
pasteboard = [NSPasteboard generalPasteboard];
data->clipboard_count = [pasteboard declareTypes:[NSArray arrayWithObject:format] owner:nil];
[pasteboard setString:[NSString stringWithUTF8String:text] forType:format];
[pool release];
return 0;
}
char *
Cocoa_GetClipboardText(_THIS)
{
NSAutoreleasePool *pool;
NSPasteboard *pasteboard;
NSString *format = GetTextFormat(_this);
NSString *available;
char *text;
pool = [[NSAutoreleasePool alloc] init];
pasteboard = [NSPasteboard generalPasteboard];
available = [pasteboard availableTypeFromArray: [NSArray arrayWithObject:format]];
if ([available isEqualToString:format]) {
NSString* string;
const char *utf8;
string = [pasteboard stringForType:format];
if (string == nil) {
utf8 = "";
} else {
utf8 = [string UTF8String];
}
text = SDL_strdup(utf8);
} else {
text = SDL_strdup("");
}
[pool release];
return text;
}
SDL_bool
Cocoa_HasClipboardText(_THIS)
{
NSAutoreleasePool *pool;
NSPasteboard *pasteboard;
NSString *format = GetTextFormat(_this);
NSString *available;
SDL_bool result;
pool = [[NSAutoreleasePool alloc] init];
pasteboard = [NSPasteboard generalPasteboard];
available = [pasteboard availableTypeFromArray: [NSArray arrayWithObject:format]];
if ([available isEqualToString:format]) {
result = SDL_TRUE;
} else {
result = SDL_FALSE;
}
[pool release];
return result;
}
void
Cocoa_CheckClipboardUpdate(struct SDL_VideoData * data)
{
NSAutoreleasePool *pool;
NSPasteboard *pasteboard;
NSInteger count;
pool = [[NSAutoreleasePool alloc] init];
pasteboard = [NSPasteboard generalPasteboard];
count = [pasteboard changeCount];
if (count != data->clipboard_count) {
if (data->clipboard_count) {
SDL_SendClipboardUpdate();
}
data->clipboard_count = count;
}
[pool release];
}
/* vi: set ts=4 sw=4 expandtab: */
/* /*
SDL - Simple DirectMedia Layer SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public modify it under the terms of the GNU Lesser General Public
......
/* /*
SDL - Simple DirectMedia Layer SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public modify it under the terms of the GNU Lesser General Public
......
/* /*
SDL - Simple DirectMedia Layer SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public modify it under the terms of the GNU Lesser General Public
......
/* /*
SDL - Simple DirectMedia Layer SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public modify it under the terms of the GNU Lesser General Public
......
/* /*
SDL - Simple DirectMedia Layer SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public modify it under the terms of the GNU Lesser General Public
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "SDL_keysym.h" #include "SDL_keysym.h"
#include "../SDL_sysvideo.h" #include "../SDL_sysvideo.h"
#include "SDL_cocoaclipboard.h"
#include "SDL_cocoaevents.h" #include "SDL_cocoaevents.h"
#include "SDL_cocoakeyboard.h" #include "SDL_cocoakeyboard.h"
#include "SDL_cocoamodes.h" #include "SDL_cocoamodes.h"
...@@ -59,6 +60,7 @@ typedef struct SDL_VideoData ...@@ -59,6 +60,7 @@ typedef struct SDL_VideoData
unsigned int modifierFlags; unsigned int modifierFlags;
void *key_layout; void *key_layout;
SDLTranslatorResponder *fieldEdit; SDLTranslatorResponder *fieldEdit;
NSInteger clipboard_count;
Uint32 screensaver_activity; Uint32 screensaver_activity;
} SDL_VideoData; } SDL_VideoData;
......
/* /*
SDL - Simple DirectMedia Layer SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public modify it under the terms of the GNU Lesser General Public
...@@ -108,6 +108,10 @@ Cocoa_CreateDevice(int devindex) ...@@ -108,6 +108,10 @@ Cocoa_CreateDevice(int devindex)
device->StopTextInput = Cocoa_StopTextInput; device->StopTextInput = Cocoa_StopTextInput;
device->SetTextInputRect = Cocoa_SetTextInputRect; device->SetTextInputRect = Cocoa_SetTextInputRect;
device->SetClipboardText = Cocoa_SetClipboardText;
device->GetClipboardText = Cocoa_GetClipboardText;
device->HasClipboardText = Cocoa_HasClipboardText;
device->free = Cocoa_DeleteDevice; device->free = Cocoa_DeleteDevice;
return device; return device;
......
/* /*
SDL - Simple DirectMedia Layer SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public modify it under the terms of the GNU Lesser General Public
...@@ -128,6 +128,9 @@ static __inline__ void ConvertNSRect(NSRect *r) ...@@ -128,6 +128,9 @@ static __inline__ void ConvertNSRect(NSRect *r)
{ {
/* We're going to get keyboard events, since we're key. */ /* We're going to get keyboard events, since we're key. */
SDL_SetKeyboardFocus(_data->window); SDL_SetKeyboardFocus(_data->window);
/* Check to see if someone updated the clipboard */
Cocoa_CheckClipboardUpdate(_data->videodata);
} }
- (void)windowDidResignKey:(NSNotification *)aNotification - (void)windowDidResignKey:(NSNotification *)aNotification
......
...@@ -42,11 +42,12 @@ int main(int argc, char **argv) { ...@@ -42,11 +42,12 @@ int main(int argc, char **argv) {
/* store arguments */ /* store arguments */
forward_argc = argc; forward_argc = argc;
forward_argv = (char **)malloc(argc * sizeof(char *)); forward_argv = (char **)malloc((argc+1) * sizeof(char *));
for (i=0; i<argc; i++) { for (i=0; i<argc; i++) {
forward_argv[i] = malloc( (strlen(argv[i])+1) * sizeof(char)); forward_argv[i] = malloc( (strlen(argv[i])+1) * sizeof(char));
strcpy(forward_argv[i], argv[i]); strcpy(forward_argv[i], argv[i]);
} }
forward_argv[i] = NULL;
/* Give over control to run loop, SDLUIKitDelegate will handle most things from here */ /* Give over control to run loop, SDLUIKitDelegate will handle most things from here */
UIApplicationMain(argc, argv, NULL, @"SDLUIKitDelegate"); UIApplicationMain(argc, argv, NULL, @"SDLUIKitDelegate");
......
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
#include "SDL_uikitwindow.h" #include "SDL_uikitwindow.h"
#include "jumphack.h" #include "jumphack.h"
#include "SDL_sysvideo.h" #include "SDL_sysvideo.h"
#include "../../events/SDL_keyboard_c.h"
#include "../../events/SDL_mouse_c.h"
#include "SDL_loadso.h" #include "SDL_loadso.h"
#include <dlfcn.h> #include <dlfcn.h>
...@@ -125,7 +127,11 @@ SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window * window) ...@@ -125,7 +127,11 @@ SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window * window)
UIKit_GL_DeleteContext(_this, view); UIKit_GL_DeleteContext(_this, view);
return NULL; return NULL;
} }
/* Make this window the current mouse focus for touch input */
SDL_SetMouseFocus(window);
SDL_SetKeyboardFocus(window);
return view; return view;
} }
......
...@@ -22,8 +22,6 @@ ...@@ -22,8 +22,6 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#include "SDL_stdinc.h" #include "SDL_stdinc.h"
#include "SDL_mouse.h"
#include "SDL_mouse_c.h"
#include "SDL_events.h" #include "SDL_events.h"
#if SDL_IPHONE_MULTIPLE_MICE #if SDL_IPHONE_MULTIPLE_MICE
...@@ -38,7 +36,7 @@ ...@@ -38,7 +36,7 @@
#else #else
@interface SDL_uikitview : UIView { @interface SDL_uikitview : UIView {
#endif #endif
#if FIXME_MULTITOUCH #if FIXME_MULTITOUCH
SDL_Mouse mice[MAX_SIMULTANEOUS_TOUCHES]; SDL_Mouse mice[MAX_SIMULTANEOUS_TOUCHES];
#endif #endif
......
...@@ -22,8 +22,10 @@ ...@@ -22,8 +22,10 @@
#import "SDL_uikitview.h" #import "SDL_uikitview.h"
#include "../../events/SDL_keyboard_c.h"
#include "../../events/SDL_mouse_c.h"
#if SDL_IPHONE_KEYBOARD #if SDL_IPHONE_KEYBOARD
#import "SDL_keyboard_c.h"
#import "keyinfotable.h" #import "keyinfotable.h"
#import "SDL_uikitappdelegate.h" #import "SDL_uikitappdelegate.h"
#import "SDL_uikitwindow.h" #import "SDL_uikitwindow.h"
...@@ -33,7 +35,6 @@ ...@@ -33,7 +35,6 @@
- (void)dealloc { - (void)dealloc {
#if SDL_IPHONE_KEYBOARD #if SDL_IPHONE_KEYBOARD
SDL_DelKeyboard(0);
[textField release]; [textField release];
#endif #endif
[super dealloc]; [super dealloc];
...@@ -64,7 +65,7 @@ ...@@ -64,7 +65,7 @@
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
NSEnumerator *enumerator = [touches objectEnumerator]; NSEnumerator *enumerator = [touches objectEnumerator];
UITouch *touch =(UITouch*)[enumerator nextObject]; UITouch *touch = (UITouch*)[enumerator nextObject];
#if FIXME_MULTITOUCH #if FIXME_MULTITOUCH
/* associate touches with mice, so long as we have slots */ /* associate touches with mice, so long as we have slots */
...@@ -101,12 +102,21 @@ ...@@ -101,12 +102,21 @@
/* re-calibrate relative mouse motion */ /* re-calibrate relative mouse motion */
SDL_GetRelativeMouseState(i, NULL, NULL); SDL_GetRelativeMouseState(i, NULL, NULL);
/* grab next touch */
touch = (UITouch*)[enumerator nextObject];
/* switch back to our old mouse */ /* switch back to our old mouse */
SDL_SelectMouse(oldMouse); SDL_SelectMouse(oldMouse);
/* grab next touch */
touch = (UITouch*)[enumerator nextObject];
}
#else
if (touch) {
CGPoint locationInView = [touch locationInView: self];
/* send moved event */
SDL_SendMouseMotion(NULL, 0, locationInView.x, locationInView.y);
/* send mouse down event */
SDL_SendMouseButton(NULL, SDL_PRESSED, SDL_BUTTON_LEFT);
} }
#endif #endif
} }
...@@ -114,10 +124,10 @@ ...@@ -114,10 +124,10 @@
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
NSEnumerator *enumerator = [touches objectEnumerator]; NSEnumerator *enumerator = [touches objectEnumerator];
UITouch *touch=nil; UITouch *touch = (UITouch*)[enumerator nextObject];
#if FIXME_MULTITOUCH #if FIXME_MULTITOUCH
while(touch = (UITouch *)[enumerator nextObject]) { while(touch) {
/* search for the mouse slot associated with this touch */ /* search for the mouse slot associated with this touch */
int i, found = NO; int i, found = NO;
for (i=0; i<MAX_SIMULTANEOUS_TOUCHES && !found; i++) { for (i=0; i<MAX_SIMULTANEOUS_TOUCHES && !found; i++) {
...@@ -131,6 +141,14 @@ ...@@ -131,6 +141,14 @@
found = YES; found = YES;
} }
} }
/* grab next touch */
touch = (UITouch*)[enumerator nextObject];
}
#else
if (touch) {
/* send mouse up */
SDL_SendMouseButton(NULL, SDL_RELEASED, SDL_BUTTON_LEFT);
} }
#endif #endif
} }
...@@ -147,10 +165,10 @@ ...@@ -147,10 +165,10 @@
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
NSEnumerator *enumerator = [touches objectEnumerator]; NSEnumerator *enumerator = [touches objectEnumerator];
UITouch *touch=nil; UITouch *touch = (UITouch*)[enumerator nextObject];
#if FIXME_MULTITOUCH #if FIXME_MULTITOUCH
while(touch = (UITouch *)[enumerator nextObject]) { while(touch) {
/* try to find the mouse associated with this touch */ /* try to find the mouse associated with this touch */
int i, found = NO; int i, found = NO;
for (i=0; i<MAX_SIMULTANEOUS_TOUCHES && !found; i++) { for (i=0; i<MAX_SIMULTANEOUS_TOUCHES && !found; i++) {
...@@ -163,6 +181,16 @@ ...@@ -163,6 +181,16 @@
found = YES; found = YES;
} }
} }
/* grab next touch */
touch = (UITouch*)[enumerator nextObject];
}
#else
if (touch) {
CGPoint locationInView = [touch locationInView: self];
/* send moved event */
SDL_SendMouseMotion(NULL, 0, locationInView.x, locationInView.y);
} }
#endif #endif
} }
...@@ -198,15 +226,6 @@ ...@@ -198,15 +226,6 @@
keyboardVisible = NO; keyboardVisible = NO;
/* add the UITextField (hidden) to our view */ /* add the UITextField (hidden) to our view */
[self addSubview: textField]; [self addSubview: textField];
/* create our SDL_Keyboard */
SDL_Keyboard keyboard;
SDL_zero(keyboard);
SDL_AddKeyboard(&keyboard, 0);
SDLKey keymap[SDL_NUM_SCANCODES];
SDL_GetDefaultKeymap(keymap);
SDL_SetKeymap(0, 0, keymap, SDL_NUM_SCANCODES);
} }
/* reveal onscreen virtual keyboard */ /* reveal onscreen virtual keyboard */
...@@ -226,8 +245,8 @@ ...@@ -226,8 +245,8 @@
if ([string length] == 0) { if ([string length] == 0) {
/* it wants to replace text with nothing, ie a delete */ /* it wants to replace text with nothing, ie a delete */
SDL_SendKeyboardKey( 0, SDL_PRESSED, SDL_SCANCODE_DELETE); SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_DELETE);
SDL_SendKeyboardKey( 0, SDL_RELEASED, SDL_SCANCODE_DELETE); SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_DELETE);
} }
else { else {
/* go through all the characters in the string we've been sent /* go through all the characters in the string we've been sent
...@@ -253,14 +272,14 @@ ...@@ -253,14 +272,14 @@
if (mod & KMOD_SHIFT) { if (mod & KMOD_SHIFT) {
/* If character uses shift, press shift down */ /* If character uses shift, press shift down */
SDL_SendKeyboardKey( 0, SDL_PRESSED, SDL_SCANCODE_LSHIFT); SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LSHIFT);
} }
/* send a keydown and keyup even for the character */ /* send a keydown and keyup even for the character */
SDL_SendKeyboardKey( 0, SDL_PRESSED, code); SDL_SendKeyboardKey(SDL_PRESSED, code);
SDL_SendKeyboardKey( 0, SDL_RELEASED, code); SDL_SendKeyboardKey(SDL_RELEASED, code);
if (mod & KMOD_SHIFT) { if (mod & KMOD_SHIFT) {
/* If character uses shift, press shift back up */ /* If character uses shift, press shift back up */
SDL_SendKeyboardKey( 0, SDL_RELEASED, SDL_SCANCODE_LSHIFT); SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LSHIFT);
} }
} }
} }
......
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
#include "SDL_win32video.h"
#include "SDL_win32window.h"
#include "../../events/SDL_clipboardevents_c.h"
#ifdef UNICODE
#define TEXT_FORMAT CF_UNICODETEXT
#else
#define TEXT_FORMAT CF_TEXT
#endif
/* Get any application owned window handle for clipboard association */
static HWND
GetWindowHandle(_THIS)
{
SDL_VideoDisplay *display;
SDL_Window *window;
display = _this->displays;
if (display) {
window = display->windows;
if (window) {
return ((SDL_WindowData *) window->driverdata)->hwnd;
}
}
return NULL;
}
int
WIN_SetClipboardText(_THIS, const char *text)
{
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
int result = 0;
if (OpenClipboard(GetWindowHandle(_this))) {
HANDLE hMem;
LPTSTR tstr;
SIZE_T i, size;
/* Convert the text from UTF-8 to Windows Unicode */
tstr = WIN_UTF8ToString(text);
if (!tstr) {
return -1;
}
/* Find out the size of the data */
for (size = 0, i = 0; tstr[i]; ++i, ++size) {
if (tstr[i] == '\n' && (i == 0 || tstr[i-1] != '\r')) {
/* We're going to insert a carriage return */
++size;
}
}
size = (size+1)*sizeof(*tstr);
/* Save the data to the clipboard */
hMem = GlobalAlloc(GMEM_MOVEABLE, size);
if (hMem) {
LPTSTR dst = (LPTSTR)GlobalLock(hMem);
/* Copy the text over, adding carriage returns as necessary */
for (i = 0; tstr[i]; ++i) {
if (tstr[i] == '\n' && (i == 0 || tstr[i-1] != '\r')) {
*dst++ = '\r';
}
*dst++ = tstr[i];
}
*dst = 0;
GlobalUnlock(hMem);
EmptyClipboard();
if (!SetClipboardData(TEXT_FORMAT, hMem)) {
WIN_SetError("Couldn't set clipboard data");
result = -1;
}
data->clipboard_count = GetClipboardSequenceNumber();
}
SDL_free(tstr);
CloseClipboard();
} else {
WIN_SetError("Couldn't open clipboard");
result = -1;
}
return result;
}
char *
WIN_GetClipboardText(_THIS)
{
char *text;
text = NULL;
if (IsClipboardFormatAvailable(TEXT_FORMAT) &&
OpenClipboard(GetWindowHandle(_this))) {
HANDLE hMem;
LPTSTR tstr;
hMem = GetClipboardData(TEXT_FORMAT);
if (hMem) {
tstr = (LPTSTR)GlobalLock(hMem);
text = WIN_StringToUTF8(tstr);
GlobalUnlock(hMem);
} else {
WIN_SetError("Couldn't get clipboard data");
}
CloseClipboard();
}
if (!text) {
text = SDL_strdup("");
}
return text;
}
SDL_bool
WIN_HasClipboardText(_THIS)
{
if (IsClipboardFormatAvailable(TEXT_FORMAT)) {
return SDL_TRUE;
} else {
return SDL_FALSE;
}
}
void
WIN_CheckClipboardUpdate(struct SDL_VideoData * data)
{
DWORD count;
count = GetClipboardSequenceNumber();
if (count != data->clipboard_count) {
if (data->clipboard_count) {
SDL_SendClipboardUpdate();
}
data->clipboard_count = count;
}
}
/* vi: set ts=4 sw=4 expandtab: */
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
#ifndef _SDL_win32clipboard_h
#define _SDL_win32clipboard_h
/* Forward declaration */
struct SDL_VideoData;
extern int WIN_SetClipboardText(_THIS, const char *text);
extern char *WIN_GetClipboardText(_THIS);
extern SDL_bool WIN_HasClipboardText(_THIS);
extern void WIN_CheckClipboardUpdate(struct SDL_VideoData * data);
#endif /* _SDL_win32clipboard_h */
/* vi: set ts=4 sw=4 expandtab: */
...@@ -164,7 +164,10 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) ...@@ -164,7 +164,10 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
if (SDL_GetKeyboardFocus() != data->window) { if (SDL_GetKeyboardFocus() != data->window) {
SDL_SetKeyboardFocus(data->window); SDL_SetKeyboardFocus(data->window);
} }
/* FIXME: Update keyboard state */ /*
* FIXME: Update keyboard state
*/
WIN_CheckClipboardUpdate(data->videodata);
} else { } else {
if (SDL_GetKeyboardFocus() == data->window) { if (SDL_GetKeyboardFocus() == data->window) {
SDL_SetKeyboardFocus(NULL); SDL_SetKeyboardFocus(NULL);
...@@ -587,17 +590,4 @@ SDL_UnregisterApp() ...@@ -587,17 +590,4 @@ SDL_UnregisterApp()
} }
} }
/* Sets an error message based on GetLastError() */
void
WIN_SetError(const char *prefix)
{
TCHAR buffer[1024];
char *message;
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0,
buffer, SDL_arraysize(buffer), NULL);
message = WIN_StringToUTF8(buffer);
SDL_SetError("%s%s%s", prefix ? prefix : "", prefix ? ": " : "", message);
SDL_free(message);
}
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
...@@ -31,7 +31,6 @@ extern HINSTANCE SDL_Instance; ...@@ -31,7 +31,6 @@ extern HINSTANCE SDL_Instance;
extern LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, extern LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam,
LPARAM lParam); LPARAM lParam);
extern void WIN_PumpEvents(_THIS); extern void WIN_PumpEvents(_THIS);
extern void WIN_SetError(const char *prefix);
#endif /* _SDL_win32events_h */ #endif /* _SDL_win32events_h */
......
/* /*
SDL - Simple DirectMedia Layer SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 Sam Lantinga Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga Sam Lantinga
slouken@libsdl.org slouken@libsdl.org
*/ */
#include "SDL_config.h" #include "SDL_config.h"
#include "SDL_main.h" #include "SDL_main.h"
#include "SDL_video.h" #include "SDL_video.h"
#include "SDL_mouse.h" #include "SDL_mouse.h"
#include "../SDL_sysvideo.h" #include "../SDL_sysvideo.h"
#include "../SDL_pixels_c.h" #include "../SDL_pixels_c.h"
#include "SDL_win32video.h" #include "SDL_win32video.h"
#include "SDL_d3drender.h" #include "SDL_d3drender.h"
#include "SDL_gdirender.h" #include "SDL_gdirender.h"
/* Initialization/Query functions */ /* Initialization/Query functions */
static int WIN_VideoInit(_THIS); static int WIN_VideoInit(_THIS);
static void WIN_VideoQuit(_THIS); static void WIN_VideoQuit(_THIS);
/* WIN32 driver bootstrap functions */ /* Sets an error message based on GetLastError() */
void
static int WIN_SetError(const char *prefix)
WIN_Available(void) {
{ TCHAR buffer[1024];
return (1); char *message;
} FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0,
buffer, SDL_arraysize(buffer), NULL);
static void message = WIN_StringToUTF8(buffer);
WIN_DeleteDevice(SDL_VideoDevice * device) SDL_SetError("%s%s%s", prefix ? prefix : "", prefix ? ": " : "", message);
{ SDL_free(message);
SDL_VideoData *data = (SDL_VideoData *) device->driverdata; }
SDL_UnregisterApp(); /* WIN32 driver bootstrap functions */
#if SDL_VIDEO_RENDER_D3D
if (data->d3d) { static int
IDirect3D9_Release(data->d3d); WIN_Available(void)
FreeLibrary(data->d3dDLL); {
} return (1);
#endif }
#if SDL_VIDEO_RENDER_DDRAW
if (data->ddraw) { static void
data->ddraw->lpVtbl->Release(data->ddraw); WIN_DeleteDevice(SDL_VideoDevice * device)
FreeLibrary(data->ddrawDLL); {
} SDL_VideoData *data = (SDL_VideoData *) device->driverdata;
#endif
SDL_free(device->driverdata); SDL_UnregisterApp();
SDL_free(device); #if SDL_VIDEO_RENDER_D3D
} if (data->d3d) {
IDirect3D9_Release(data->d3d);
static SDL_VideoDevice * FreeLibrary(data->d3dDLL);
WIN_CreateDevice(int devindex) }
{ #endif
SDL_VideoDevice *device; #if SDL_VIDEO_RENDER_DDRAW
SDL_VideoData *data; if (data->ddraw) {
data->ddraw->lpVtbl->Release(data->ddraw);
SDL_RegisterApp(NULL, 0, NULL); FreeLibrary(data->ddrawDLL);
}
/* Initialize all variables that we clean on shutdown */ #endif
device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); SDL_free(device->driverdata);
if (device) { SDL_free(device);
data = (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData)); }
} else {
data = NULL; static SDL_VideoDevice *
} WIN_CreateDevice(int devindex)
if (!data) { {
SDL_OutOfMemory(); SDL_VideoDevice *device;
if (device) { SDL_VideoData *data;
SDL_free(device);
} SDL_RegisterApp(NULL, 0, NULL);
return NULL;
} /* Initialize all variables that we clean on shutdown */
device->driverdata = data; device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
if (device) {
#if SDL_VIDEO_RENDER_D3D data = (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
data->d3dDLL = LoadLibrary(TEXT("D3D9.DLL")); } else {
if (data->d3dDLL) { data = NULL;
IDirect3D9 *(WINAPI * D3DCreate) (UINT SDKVersion); }
if (!data) {
D3DCreate = SDL_OutOfMemory();
(IDirect3D9 * (WINAPI *) (UINT)) GetProcAddress(data->d3dDLL, if (device) {
"Direct3DCreate9"); SDL_free(device);
if (D3DCreate) { }
data->d3d = D3DCreate(D3D_SDK_VERSION); return NULL;
} }
if (!data->d3d) { device->driverdata = data;
FreeLibrary(data->d3dDLL);
data->d3dDLL = NULL; #if SDL_VIDEO_RENDER_D3D
} data->d3dDLL = LoadLibrary(TEXT("D3D9.DLL"));
} if (data->d3dDLL) {
#endif /* SDL_VIDEO_RENDER_D3D */ IDirect3D9 *(WINAPI * D3DCreate) (UINT SDKVersion);
#if SDL_VIDEO_RENDER_DDRAW
data->ddrawDLL = LoadLibrary(TEXT("ddraw.dll")); D3DCreate =
if (data->ddrawDLL) { (IDirect3D9 * (WINAPI *) (UINT)) GetProcAddress(data->d3dDLL,
IDirectDraw *(WINAPI * DDCreate) (GUID FAR * lpGUID, "Direct3DCreate9");
LPDIRECTDRAW FAR * lplpDD, if (D3DCreate) {
IUnknown FAR * pUnkOuter); data->d3d = D3DCreate(D3D_SDK_VERSION);
}
DDCreate = if (!data->d3d) {
(IDirectDraw * FreeLibrary(data->d3dDLL);
(WINAPI *) (GUID FAR *, LPDIRECTDRAW FAR *, IUnknown FAR *)) data->d3dDLL = NULL;
GetProcAddress(data->ddrawDLL, TEXT("DirectDrawCreate")); }
if (!DDCreate || DDCreate(NULL, &data->ddraw, NULL) != DD_OK) { }
FreeLibrary(data->ddrawDLL); #endif /* SDL_VIDEO_RENDER_D3D */
data->ddrawDLL = NULL; #if SDL_VIDEO_RENDER_DDRAW
data->ddraw = NULL; data->ddrawDLL = LoadLibrary(TEXT("ddraw.dll"));
} if (data->ddrawDLL) {
} IDirectDraw *(WINAPI * DDCreate) (GUID FAR * lpGUID,
#endif /* SDL_VIDEO_RENDER_DDRAW */ LPDIRECTDRAW FAR * lplpDD,
IUnknown FAR * pUnkOuter);
/* Set the function pointers */
device->VideoInit = WIN_VideoInit; DDCreate =
device->VideoQuit = WIN_VideoQuit; (IDirectDraw *
device->GetDisplayBounds = WIN_GetDisplayBounds; (WINAPI *) (GUID FAR *, LPDIRECTDRAW FAR *, IUnknown FAR *))
device->GetDisplayModes = WIN_GetDisplayModes; GetProcAddress(data->ddrawDLL, TEXT("DirectDrawCreate"));
device->SetDisplayMode = WIN_SetDisplayMode; if (!DDCreate || DDCreate(NULL, &data->ddraw, NULL) != DD_OK) {
device->SetDisplayGammaRamp = WIN_SetDisplayGammaRamp; FreeLibrary(data->ddrawDLL);
device->GetDisplayGammaRamp = WIN_GetDisplayGammaRamp; data->ddrawDLL = NULL;
device->PumpEvents = WIN_PumpEvents; data->ddraw = NULL;
}
#undef CreateWindow }
device->CreateWindow = WIN_CreateWindow; #endif /* SDL_VIDEO_RENDER_DDRAW */
device->CreateWindowFrom = WIN_CreateWindowFrom;
device->SetWindowTitle = WIN_SetWindowTitle; /* Set the function pointers */
device->SetWindowIcon = WIN_SetWindowIcon; device->VideoInit = WIN_VideoInit;
device->SetWindowPosition = WIN_SetWindowPosition; device->VideoQuit = WIN_VideoQuit;
device->SetWindowSize = WIN_SetWindowSize; device->GetDisplayBounds = WIN_GetDisplayBounds;
device->ShowWindow = WIN_ShowWindow; device->GetDisplayModes = WIN_GetDisplayModes;
device->HideWindow = WIN_HideWindow; device->SetDisplayMode = WIN_SetDisplayMode;
device->RaiseWindow = WIN_RaiseWindow; device->SetDisplayGammaRamp = WIN_SetDisplayGammaRamp;
device->MaximizeWindow = WIN_MaximizeWindow; device->GetDisplayGammaRamp = WIN_GetDisplayGammaRamp;
device->MinimizeWindow = WIN_MinimizeWindow; device->PumpEvents = WIN_PumpEvents;
device->RestoreWindow = WIN_RestoreWindow;
device->SetWindowGrab = WIN_SetWindowGrab; #undef CreateWindow
device->DestroyWindow = WIN_DestroyWindow; device->CreateWindow = WIN_CreateWindow;
device->GetWindowWMInfo = WIN_GetWindowWMInfo; device->CreateWindowFrom = WIN_CreateWindowFrom;
#ifdef SDL_VIDEO_OPENGL_WGL device->SetWindowTitle = WIN_SetWindowTitle;
device->GL_LoadLibrary = WIN_GL_LoadLibrary; device->SetWindowIcon = WIN_SetWindowIcon;
device->GL_GetProcAddress = WIN_GL_GetProcAddress; device->SetWindowPosition = WIN_SetWindowPosition;
device->GL_UnloadLibrary = WIN_GL_UnloadLibrary; device->SetWindowSize = WIN_SetWindowSize;
device->GL_CreateContext = WIN_GL_CreateContext; device->ShowWindow = WIN_ShowWindow;
device->GL_MakeCurrent = WIN_GL_MakeCurrent; device->HideWindow = WIN_HideWindow;
device->GL_SetSwapInterval = WIN_GL_SetSwapInterval; device->RaiseWindow = WIN_RaiseWindow;
device->GL_GetSwapInterval = WIN_GL_GetSwapInterval; device->MaximizeWindow = WIN_MaximizeWindow;
device->GL_SwapWindow = WIN_GL_SwapWindow; device->MinimizeWindow = WIN_MinimizeWindow;
device->GL_DeleteContext = WIN_GL_DeleteContext; device->RestoreWindow = WIN_RestoreWindow;
#endif device->SetWindowGrab = WIN_SetWindowGrab;
device->StartTextInput = WIN_StartTextInput; device->DestroyWindow = WIN_DestroyWindow;
device->StopTextInput = WIN_StopTextInput; device->GetWindowWMInfo = WIN_GetWindowWMInfo;
device->SetTextInputRect = WIN_SetTextInputRect; #ifdef SDL_VIDEO_OPENGL_WGL
device->GL_LoadLibrary = WIN_GL_LoadLibrary;
device->free = WIN_DeleteDevice; device->GL_GetProcAddress = WIN_GL_GetProcAddress;
device->GL_UnloadLibrary = WIN_GL_UnloadLibrary;
return device; device->GL_CreateContext = WIN_GL_CreateContext;
} device->GL_MakeCurrent = WIN_GL_MakeCurrent;
device->GL_SetSwapInterval = WIN_GL_SetSwapInterval;
VideoBootStrap WIN32_bootstrap = { device->GL_GetSwapInterval = WIN_GL_GetSwapInterval;
"win32", "SDL Win32/64 video driver", WIN_Available, WIN_CreateDevice device->GL_SwapWindow = WIN_GL_SwapWindow;
}; device->GL_DeleteContext = WIN_GL_DeleteContext;
#endif
device->StartTextInput = WIN_StartTextInput;
int device->StopTextInput = WIN_StopTextInput;
WIN_VideoInit(_THIS) device->SetTextInputRect = WIN_SetTextInputRect;
{
if (WIN_InitModes(_this) < 0) { device->SetClipboardText = WIN_SetClipboardText;
return -1; device->GetClipboardText = WIN_GetClipboardText;
} device->HasClipboardText = WIN_HasClipboardText;
#if SDL_VIDEO_RENDER_D3D device->free = WIN_DeleteDevice;
D3D_AddRenderDriver(_this);
#endif return device;
#if SDL_VIDEO_RENDER_DDRAW }
DDRAW_AddRenderDriver(_this);
#endif VideoBootStrap WIN32_bootstrap = {
#if SDL_VIDEO_RENDER_GDI "win32", "SDL Win32/64 video driver", WIN_Available, WIN_CreateDevice
GDI_AddRenderDriver(_this); };
#endif
#if SDL_VIDEO_RENDER_GAPI
GAPI_AddRenderDriver(_this); int
#endif WIN_VideoInit(_THIS)
{
WIN_InitKeyboard(_this); if (WIN_InitModes(_this) < 0) {
WIN_InitMouse(_this); return -1;
}
return 0;
} #if SDL_VIDEO_RENDER_D3D
D3D_AddRenderDriver(_this);
void #endif
WIN_VideoQuit(_THIS) #if SDL_VIDEO_RENDER_DDRAW
{ DDRAW_AddRenderDriver(_this);
WIN_QuitModes(_this); #endif
WIN_QuitKeyboard(_this); #if SDL_VIDEO_RENDER_GDI
WIN_QuitMouse(_this); GDI_AddRenderDriver(_this);
} #endif
#if SDL_VIDEO_RENDER_GAPI
/* vim: set ts=4 sw=4 expandtab: */ GAPI_AddRenderDriver(_this);
#endif
WIN_InitKeyboard(_this);
WIN_InitMouse(_this);
return 0;
}
void
WIN_VideoQuit(_THIS)
{
WIN_QuitModes(_this);
WIN_QuitKeyboard(_this);
WIN_QuitMouse(_this);
}
/* vim: set ts=4 sw=4 expandtab: */
/* /*
SDL - Simple DirectMedia Layer SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 Sam Lantinga Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga Sam Lantinga
slouken@libsdl.org slouken@libsdl.org
*/ */
#include "SDL_config.h" #include "SDL_config.h"
#ifndef _SDL_win32video_h #ifndef _SDL_win32video_h
#define _SDL_win32video_h #define _SDL_win32video_h
#include "../SDL_sysvideo.h" #include "../SDL_sysvideo.h"
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#define STRICT #define STRICT
#define UNICODE #define UNICODE
#undef WINVER #undef WINVER
#define WINVER 0x500 /* Need 0x410 for AlphaBlend() and 0x500 for EnumDisplayDevices() */ #define WINVER 0x500 /* Need 0x410 for AlphaBlend() and 0x500 for EnumDisplayDevices() */
#include <windows.h> #include <windows.h>
#if SDL_VIDEO_RENDER_D3D #if SDL_VIDEO_RENDER_D3D
//#include <d3d9.h> //#include <d3d9.h>
#define D3D_DEBUG_INFO #define D3D_DEBUG_INFO
#include "d3d9.h" #include "d3d9.h"
#endif #endif
#if SDL_VIDEO_RENDER_DDRAW #if SDL_VIDEO_RENDER_DDRAW
/* WIN32_LEAN_AND_MEAN was defined, so we have to include this by hand */ /* WIN32_LEAN_AND_MEAN was defined, so we have to include this by hand */
#include <objbase.h> #include <objbase.h>
#include "ddraw.h" #include "ddraw.h"
#endif #endif
#include "SDL_win32events.h" #include "SDL_win32clipboard.h"
#include "SDL_win32gamma.h" #include "SDL_win32events.h"
#include "SDL_win32keyboard.h" #include "SDL_win32gamma.h"
#include "SDL_win32modes.h" #include "SDL_win32keyboard.h"
#include "SDL_win32mouse.h" #include "SDL_win32modes.h"
#include "SDL_win32opengl.h" #include "SDL_win32mouse.h"
#include "SDL_win32window.h" #include "SDL_win32opengl.h"
#include "SDL_win32window.h"
#ifdef UNICODE
#define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "UCS-2", (char *)S, (SDL_wcslen(S)+1)*sizeof(WCHAR)) #ifdef UNICODE
#define WIN_UTF8ToString(S) (WCHAR *)SDL_iconv_string("UCS-2", "UTF-8", (char *)S, SDL_strlen(S)+1) #define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "UCS-2", (char *)S, (SDL_wcslen(S)+1)*sizeof(WCHAR))
#else #define WIN_UTF8ToString(S) (WCHAR *)SDL_iconv_string("UCS-2", "UTF-8", (char *)S, SDL_strlen(S)+1)
#define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "ASCII", (char *)S, (SDL_strlen(S)+1)) #else
#define WIN_UTF8ToString(S) SDL_iconv_string("ASCII", "UTF-8", (char *)S, SDL_strlen(S)+1) #define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "ASCII", (char *)S, (SDL_strlen(S)+1))
#endif #define WIN_UTF8ToString(S) SDL_iconv_string("ASCII", "UTF-8", (char *)S, SDL_strlen(S)+1)
#endif
/* Private display data */ extern void WIN_SetError(const char *prefix);
typedef struct SDL_VideoData /* Private display data */
{
#if SDL_VIDEO_RENDER_D3D typedef struct SDL_VideoData
HANDLE d3dDLL; {
IDirect3D9 *d3d; #if SDL_VIDEO_RENDER_D3D
#endif HANDLE d3dDLL;
#if SDL_VIDEO_RENDER_DDRAW IDirect3D9 *d3d;
HANDLE ddrawDLL; #endif
IDirectDraw *ddraw; #if SDL_VIDEO_RENDER_DDRAW
#endif HANDLE ddrawDLL;
IDirectDraw *ddraw;
const SDL_scancode *key_layout; #endif
SDL_bool ime_com_initialized; const SDL_scancode *key_layout;
struct ITfThreadMgr *ime_thread_mgr; DWORD clipboard_count;
SDL_bool ime_initialized;
SDL_bool ime_enabled; SDL_bool ime_com_initialized;
SDL_bool ime_available; struct ITfThreadMgr *ime_thread_mgr;
HWND ime_hwnd_main; SDL_bool ime_initialized;
HWND ime_hwnd_current; SDL_bool ime_enabled;
HIMC ime_himc; SDL_bool ime_available;
HWND ime_hwnd_main;
} SDL_VideoData; HWND ime_hwnd_current;
HIMC ime_himc;
#endif /* _SDL_win32video_h */
} SDL_VideoData;
/* vi: set ts=4 sw=4 expandtab: */
#endif /* _SDL_win32video_h */
/* vi: set ts=4 sw=4 expandtab: */
...@@ -635,8 +635,7 @@ SDL_HelperWindowCreate(void) ...@@ -635,8 +635,7 @@ SDL_HelperWindowCreate(void)
/* Register the class. */ /* Register the class. */
SDL_HelperWindowClass = RegisterClass(&wce); SDL_HelperWindowClass = RegisterClass(&wce);
if (SDL_HelperWindowClass == 0) { if (SDL_HelperWindowClass == 0) {
SDL_SetError("Unable to create Helper Window Class: error %d.", WIN_SetError("Unable to create Helper Window Class");
GetLastError());
return -1; return -1;
} }
...@@ -654,8 +653,7 @@ SDL_HelperWindowCreate(void) ...@@ -654,8 +653,7 @@ SDL_HelperWindowCreate(void)
hInstance, NULL); hInstance, NULL);
if (SDL_HelperWindow == NULL) { if (SDL_HelperWindow == NULL) {
UnregisterClass(SDL_HelperWindowClassName, hInstance); UnregisterClass(SDL_HelperWindowClassName, hInstance);
SDL_SetError("Unable to create Helper Window: error %d.", WIN_SetError("Unable to create Helper Window");
GetLastError());
return -1; return -1;
} }
...@@ -674,8 +672,7 @@ SDL_HelperWindowDestroy(void) ...@@ -674,8 +672,7 @@ SDL_HelperWindowDestroy(void)
/* Destroy the window. */ /* Destroy the window. */
if (SDL_HelperWindow != NULL) { if (SDL_HelperWindow != NULL) {
if (DestroyWindow(SDL_HelperWindow) == 0) { if (DestroyWindow(SDL_HelperWindow) == 0) {
SDL_SetError("Unable to destroy Helper Window: error %d.", WIN_SetError("Unable to destroy Helper Window");
GetLastError());
return; return;
} }
SDL_HelperWindow = NULL; SDL_HelperWindow = NULL;
...@@ -684,8 +681,7 @@ SDL_HelperWindowDestroy(void) ...@@ -684,8 +681,7 @@ SDL_HelperWindowDestroy(void)
/* Unregister the class. */ /* Unregister the class. */
if (SDL_HelperWindowClass != 0) { if (SDL_HelperWindowClass != 0) {
if ((UnregisterClass(SDL_HelperWindowClassName, hInstance)) == 0) { if ((UnregisterClass(SDL_HelperWindowClassName, hInstance)) == 0) {
SDL_SetError("Unable to destroy Helper Window Class: error %d.", WIN_SetError("Unable to destroy Helper Window Class");
GetLastError());
return; return;
} }
SDL_HelperWindowClass = 0; SDL_HelperWindowClass = 0;
......
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
#include <limits.h> /* For INT_MAX */
#include "SDL_events.h"
#include "SDL_x11video.h"
/* If you don't support UTF-8, you might use XA_STRING here */
#ifdef X_HAVE_UTF8_STRING
#define TEXT_FORMAT XInternAtom(display, "UTF8_STRING", False)
#else
#define TEXT_FORMAT XA_STRING
#endif
/* Get any application owned window handle for clipboard association */
static Window
GetWindow(_THIS)
{
SDL_VideoDisplay *display;
SDL_Window *window;
display = _this->displays;
if (display) {
window = display->windows;
if (window) {
return ((SDL_WindowData *) window->driverdata)->xwindow;
}
}
return None;
}
int
X11_SetClipboardText(_THIS, const char *text)
{
Display *display = ((SDL_VideoData *) _this->driverdata)->display;
Atom format;
Window window;
/* Get the SDL window that will own the selection */
window = GetWindow(_this);
if (window == None) {
SDL_SetError("Couldn't find a window to own the selection");
return -1;
}
/* Save the selection on the root window */
format = TEXT_FORMAT;
XChangeProperty(display, DefaultRootWindow(display),
XA_CUT_BUFFER0, format, 8, PropModeReplace,
(const unsigned char *)text, SDL_strlen(text));
if (XGetSelectionOwner(display, XA_PRIMARY) != window) {
XSetSelectionOwner(display, XA_PRIMARY, window, CurrentTime);
}
return 0;
}
char *
X11_GetClipboardText(_THIS)
{
SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
Display *display = videodata->display;
Atom format;
Window window;
Window owner;
Atom selection;
Atom seln_type;
int seln_format;
unsigned long nbytes;
unsigned long overflow;
unsigned char *src;
char *text;
text = NULL;
/* Get the window that holds the selection */
window = GetWindow(_this);
format = TEXT_FORMAT;
owner = XGetSelectionOwner(display, XA_PRIMARY);
if ((owner == None) || (owner == window)) {
owner = DefaultRootWindow(display);
selection = XA_CUT_BUFFER0;
} else {
/* Request that the selection owner copy the data to our window */
owner = window;
selection = XInternAtom(display, "SDL_SELECTION", False);
XConvertSelection(display, XA_PRIMARY, format, selection, owner,
CurrentTime);
/* FIXME: Should we have a timeout here? */
videodata->selection_waiting = SDL_TRUE;
while (videodata->selection_waiting) {
SDL_PumpEvents();
}
}
if (XGetWindowProperty(display, owner, selection, 0, INT_MAX/4, False,
format, &seln_type, &seln_format, &nbytes, &overflow, &src)
== Success) {
if (seln_type == format) {
text = (char *)SDL_malloc(nbytes+1);
if (text) {
SDL_memcpy(text, src, nbytes);
text[nbytes] = '\0';
}
}
XFree(src);
}
if (!text) {
text = SDL_strdup("");
}
return text;
}
SDL_bool
X11_HasClipboardText(_THIS)
{
/* Not an easy way to tell with X11, as far as I know... */
char *text;
SDL_bool retval;
text = X11_GetClipboardText(_this);
if (*text) {
retval = SDL_TRUE;
} else {
retval = SDL_FALSE;
}
SDL_free(text);
return retval;
}
/* vi: set ts=4 sw=4 expandtab: */
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
#ifndef _SDL_x11clipboard_h
#define _SDL_x11clipboard_h
extern int X11_SetClipboardText(_THIS, const char *text);
extern char *X11_GetClipboardText(_THIS);
extern SDL_bool X11_HasClipboardText(_THIS);
#endif /* _SDL_x11clipboard_h */
/* vi: set ts=4 sw=4 expandtab: */
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <sys/time.h> #include <sys/time.h>
#include <signal.h> #include <signal.h>
#include <unistd.h> #include <unistd.h>
#include <limits.h> /* For INT_MAX */
#include "SDL_x11video.h" #include "SDL_x11video.h"
#include "../../events/SDL_events_c.h" #include "../../events/SDL_events_c.h"
...@@ -33,16 +34,19 @@ ...@@ -33,16 +34,19 @@
#include "SDL_timer.h" #include "SDL_timer.h"
#include "SDL_syswm.h" #include "SDL_syswm.h"
#define DEBUG_XEVENTS
static void static void
X11_DispatchEvent(_THIS) X11_DispatchEvent(_THIS)
{ {
SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
Display *display = videodata->display;
SDL_WindowData *data; SDL_WindowData *data;
XEvent xevent; XEvent xevent;
int i; int i;
SDL_zero(xevent); /* valgrind fix. --ryan. */ SDL_zero(xevent); /* valgrind fix. --ryan. */
XNextEvent(videodata->display, &xevent); XNextEvent(display, &xevent);
/* filter events catchs XIM events and sends them to the correct /* filter events catchs XIM events and sends them to the correct
handler */ handler */
...@@ -77,6 +81,7 @@ X11_DispatchEvent(_THIS) ...@@ -77,6 +81,7 @@ X11_DispatchEvent(_THIS)
if (!data) { if (!data) {
return; return;
} }
#if 0 #if 0
printf("type = %d display = %d window = %d\n", printf("type = %d display = %d window = %d\n",
xevent.type, xevent.xany.display, xevent.xany.window); xevent.type, xevent.xany.display, xevent.xany.window);
...@@ -176,12 +181,11 @@ X11_DispatchEvent(_THIS) ...@@ -176,12 +181,11 @@ X11_DispatchEvent(_THIS)
printf("KeyPress (X11 keycode = 0x%X)\n", xevent.xkey.keycode); printf("KeyPress (X11 keycode = 0x%X)\n", xevent.xkey.keycode);
#endif #endif
SDL_SendKeyboardKey(SDL_PRESSED, videodata->key_layout[keycode]); SDL_SendKeyboardKey(SDL_PRESSED, videodata->key_layout[keycode]);
#if 0 #if 1
if (videodata->key_layout[keycode] == SDLK_UNKNOWN) { if (videodata->key_layout[keycode] == SDLK_UNKNOWN) {
int min_keycode, max_keycode; int min_keycode, max_keycode;
XDisplayKeycodes(videodata->display, &min_keycode, XDisplayKeycodes(display, &min_keycode, &max_keycode);
&max_keycode); keysym = XKeycodeToKeysym(display, keycode, 0);
keysym = XKeycodeToKeysym(videodata->display, keycode, 0);
fprintf(stderr, fprintf(stderr,
"The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL mailing list <sdl@libsdl.org> X11 KeyCode %d (%d), X11 KeySym 0x%X (%s).\n", "The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL mailing list <sdl@libsdl.org> X11 KeyCode %d (%d), X11 KeySym 0x%X (%s).\n",
keycode, keycode - min_keycode, keysym, keycode, keycode - min_keycode, keysym,
...@@ -286,6 +290,130 @@ X11_DispatchEvent(_THIS) ...@@ -286,6 +290,130 @@ X11_DispatchEvent(_THIS)
} }
break; break;
case PropertyNotify:{
#ifdef DEBUG_XEVENTS
unsigned char *propdata;
int status, real_format;
Atom real_type;
unsigned long items_read, items_left, i;
char *name = XGetAtomName(display, xevent.xproperty.atom);
if (name) {
printf("PropertyNotify: %s\n", name);
XFree(name);
}
status = XGetWindowProperty(display, data->xwindow, xevent.xproperty.atom, 0L, 8192L, False, AnyPropertyType, &real_type, &real_format, &items_read, &items_left, &propdata);
if (status == Success) {
if (real_type == XA_INTEGER) {
int *values = (int *)propdata;
printf("{");
for (i = 0; i < items_read; i++) {
printf(" %d", values[i]);
}
printf(" }\n");
} else if (real_type == XA_CARDINAL) {
if (real_format == 32) {
Uint32 *values = (Uint32 *)propdata;
printf("{");
for (i = 0; i < items_read; i++) {
printf(" %d", values[i]);
}
printf(" }\n");
} else if (real_format == 16) {
Uint16 *values = (Uint16 *)propdata;
printf("{");
for (i = 0; i < items_read; i++) {
printf(" %d", values[i]);
}
printf(" }\n");
} else if (real_format == 8) {
Uint8 *values = (Uint8 *)propdata;
printf("{");
for (i = 0; i < items_read; i++) {
printf(" %d", values[i]);
}
printf(" }\n");
}
} else if (real_type == XA_STRING ||
real_type == videodata->UTF8_STRING) {
printf("{ \"%s\" }\n", propdata);
} else if (real_type == XA_ATOM) {
Atom *atoms = (Atom *)propdata;
printf("{");
for (i = 0; i < items_read; i++) {
char *name = XGetAtomName(display, atoms[i]);
if (name) {
printf(" %s", name);
XFree(name);
}
}
printf(" }\n");
} else {
char *name = XGetAtomName(display, real_type);
printf("Unknown type: %ld (%s)\n", real_type, name ? name : "UNKNOWN");
if (name) {
XFree(name);
}
}
}
#endif
}
break;
/* Copy the selection from XA_CUT_BUFFER0 to the requested property */
case SelectionRequest: {
XSelectionRequestEvent *req;
XEvent sevent;
int seln_format;
unsigned long nbytes;
unsigned long overflow;
unsigned char *seln_data;
req = &xevent.xselectionrequest;
#ifdef DEBUG_XEVENTS
printf("SelectionRequest (requestor = %ld, target = %ld)\n",
req->requestor, req->target);
#endif
SDL_zero(sevent);
sevent.xany.type = SelectionNotify;
sevent.xselection.selection = req->selection;
sevent.xselection.target = None;
sevent.xselection.property = None;
sevent.xselection.requestor = req->requestor;
sevent.xselection.time = req->time;
if (XGetWindowProperty(display, DefaultRootWindow(display),
XA_CUT_BUFFER0, 0, INT_MAX/4, False, req->target,
&sevent.xselection.target, &seln_format, &nbytes,
&overflow, &seln_data) == Success) {
if (sevent.xselection.target == req->target) {
XChangeProperty(display, req->requestor, req->property,
sevent.xselection.target, seln_format, PropModeReplace,
seln_data, nbytes);
sevent.xselection.property = req->property;
}
XFree(seln_data);
}
XSendEvent(display, req->requestor, False, 0, &sevent);
XSync(display, False);
}
break;
case SelectionNotify: {
#ifdef DEBUG_XEVENTS
printf("SelectionNotify (requestor = %ld, target = %ld)\n",
xevent.xselection.requestor, xevent.xselection.target);
#endif
videodata->selection_waiting = SDL_FALSE;
}
break;
default:{ default:{
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
printf("Unhandled event %d\n", xevent.type); printf("Unhandled event %d\n", xevent.type);
......
...@@ -211,7 +211,9 @@ X11_InitKeyboard(_THIS) ...@@ -211,7 +211,9 @@ X11_InitKeyboard(_THIS)
} }
} }
if (j == SDL_arraysize(fingerprint)) { if (j == SDL_arraysize(fingerprint)) {
/* printf("Using scancode set %d\n", i); */ #ifdef DEBUG_KEYBOARD
printf("Using scancode set %d, min_keycode = %d, max_keycode = %d, table_size = %d\n", i, min_keycode, max_keycode, scancode_set[i].table_size);
#endif
SDL_memcpy(&data->key_layout[min_keycode], scancode_set[i].table, SDL_memcpy(&data->key_layout[min_keycode], scancode_set[i].table,
sizeof(SDL_scancode) * scancode_set[i].table_size); sizeof(SDL_scancode) * scancode_set[i].table_size);
fingerprint_detected = SDL_TRUE; fingerprint_detected = SDL_TRUE;
......
...@@ -23,10 +23,7 @@ ...@@ -23,10 +23,7 @@
#include "SDL_x11video.h" #include "SDL_x11video.h"
//#define X11MODES_DEBUG /*#define X11MODES_DEBUG*/
#undef SDL_VIDEO_DRIVER_X11_XINERAMA
#undef SDL_VIDEO_DRIVER_X11_XRANDR
#undef SDL_VIDEO_DRIVER_X11_VIDMODE
static int static int
get_visualinfo(Display * display, int screen, XVisualInfo * vinfo) get_visualinfo(Display * display, int screen, XVisualInfo * vinfo)
...@@ -253,6 +250,7 @@ CheckVidMode(Display * display, int *major, int *minor) ...@@ -253,6 +250,7 @@ CheckVidMode(Display * display, int *major, int *minor)
return SDL_TRUE; return SDL_TRUE;
} }
static
Bool SDL_NAME(XF86VidModeGetModeInfo) (Display * dpy, int scr, Bool SDL_NAME(XF86VidModeGetModeInfo) (Display * dpy, int scr,
SDL_NAME(XF86VidModeModeInfo) * info) SDL_NAME(XF86VidModeModeInfo) * info)
{ {
...@@ -296,6 +294,7 @@ save_mode(Display * display, SDL_DisplayData * data) ...@@ -296,6 +294,7 @@ save_mode(Display * display, SDL_DisplayData * data)
&data->saved_view.y); &data->saved_view.y);
} }
/*
static void static void
restore_mode(Display * display, SDL_DisplayData * data) restore_mode(Display * display, SDL_DisplayData * data)
{ {
...@@ -313,6 +312,7 @@ restore_mode(Display * display, SDL_DisplayData * data) ...@@ -313,6 +312,7 @@ restore_mode(Display * display, SDL_DisplayData * data)
data->saved_view.y); data->saved_view.y);
} }
} }
*/
#endif /* SDL_VIDEO_DRIVER_X11_VIDMODE */ #endif /* SDL_VIDEO_DRIVER_X11_VIDMODE */
void void
......
...@@ -37,6 +37,7 @@ SDL_X11_SYM(int,XChangeWindowAttributes,(Display* a,Window b,unsigned long c,XSe ...@@ -37,6 +37,7 @@ SDL_X11_SYM(int,XChangeWindowAttributes,(Display* a,Window b,unsigned long c,XSe
SDL_X11_SYM(Bool,XCheckWindowEvent,(Display* a,Window b,long c,XEvent* d),(a,b,c,d),return) SDL_X11_SYM(Bool,XCheckWindowEvent,(Display* a,Window b,long c,XEvent* d),(a,b,c,d),return)
SDL_X11_SYM(int,XClearWindow,(Display* a,Window b),(a,b),return) SDL_X11_SYM(int,XClearWindow,(Display* a,Window b),(a,b),return)
SDL_X11_SYM(int,XCloseDisplay,(Display* a),(a),return) SDL_X11_SYM(int,XCloseDisplay,(Display* a),(a),return)
SDL_X11_SYM(int,XConvertSelection,(Display* a,Atom b,Atom c,Atom d,Window e,Time f),(a,b,c,d,e,f),return)
SDL_X11_SYM(int,XCopyArea,(Display* a,Drawable b,Drawable c,GC d,int e,int f,unsigned int g,unsigned int h,int i,int j),(a,b,c,d,e,f,g,h,i,j),return) SDL_X11_SYM(int,XCopyArea,(Display* a,Drawable b,Drawable c,GC d,int e,int f,unsigned int g,unsigned int h,int i,int j),(a,b,c,d,e,f,g,h,i,j),return)
SDL_X11_SYM(Colormap,XCreateColormap,(Display* a,Window b,Visual* c,int d),(a,b,c,d),return) SDL_X11_SYM(Colormap,XCreateColormap,(Display* a,Window b,Visual* c,int d),(a,b,c,d),return)
SDL_X11_SYM(Cursor,XCreatePixmapCursor,(Display* a,Pixmap b,Pixmap c,XColor* d,XColor* e,unsigned int f,unsigned int g),(a,b,c,d,e,f,g),return) SDL_X11_SYM(Cursor,XCreatePixmapCursor,(Display* a,Pixmap b,Pixmap c,XColor* d,XColor* e,unsigned int f,unsigned int g),(a,b,c,d,e,f,g),return)
...@@ -66,15 +67,18 @@ SDL_X11_SYM(int,XFreeCursor,(Display* a,Cursor b),(a,b),return) ...@@ -66,15 +67,18 @@ SDL_X11_SYM(int,XFreeCursor,(Display* a,Cursor b),(a,b),return)
SDL_X11_SYM(int,XFreeGC,(Display* a,GC b),(a,b),return) SDL_X11_SYM(int,XFreeGC,(Display* a,GC b),(a,b),return)
SDL_X11_SYM(int,XFreeModifiermap,(XModifierKeymap* a),(a),return) SDL_X11_SYM(int,XFreeModifiermap,(XModifierKeymap* a),(a),return)
SDL_X11_SYM(int,XFreePixmap,(Display* a,Pixmap b),(a,b),return) SDL_X11_SYM(int,XFreePixmap,(Display* a,Pixmap b),(a,b),return)
SDL_X11_SYM(char*,XGetAtomName,(Display *a,Atom b),(a,b),return)
SDL_X11_SYM(int,XGetErrorDatabaseText,(Display* a,_Xconst char* b,_Xconst char* c,_Xconst char* d,char* e,int f),(a,b,c,d,e,f),return) SDL_X11_SYM(int,XGetErrorDatabaseText,(Display* a,_Xconst char* b,_Xconst char* c,_Xconst char* d,char* e,int f),(a,b,c,d,e,f),return)
SDL_X11_SYM(XImage*,XGetImage,(Display* a,Drawable b,int c,int d,unsigned int e,unsigned int f,unsigned long g, int h),(a,b,c,d,e,f,g,h),return) SDL_X11_SYM(XImage*,XGetImage,(Display* a,Drawable b,int c,int d,unsigned int e,unsigned int f,unsigned long g, int h),(a,b,c,d,e,f,g,h),return)
SDL_X11_SYM(XModifierKeymap*,XGetModifierMapping,(Display* a),(a),return) SDL_X11_SYM(XModifierKeymap*,XGetModifierMapping,(Display* a),(a),return)
SDL_X11_SYM(int,XGetPointerControl,(Display* a,int* b,int* c,int* d),(a,b,c,d),return) SDL_X11_SYM(int,XGetPointerControl,(Display* a,int* b,int* c,int* d),(a,b,c,d),return)
SDL_X11_SYM(int,XGetRGBColormaps,(Display* a,Window b,XStandardColormap **c,int *d,Atom e),(a,b,c,d,e),return) SDL_X11_SYM(int,XGetRGBColormaps,(Display* a,Window b,XStandardColormap **c,int *d,Atom e),(a,b,c,d,e),return)
SDL_X11_SYM(Window,XGetSelectionOwner,(Display* a,Atom b),(a,b),return)
SDL_X11_SYM(Status,XGetTextProperty,(Display *a,Window b,XTextProperty *c,Atom d),(a,b,c,d),return)
SDL_X11_SYM(XVisualInfo*,XGetVisualInfo,(Display* a,long b,XVisualInfo* c,int* d),(a,b,c,d),return) SDL_X11_SYM(XVisualInfo*,XGetVisualInfo,(Display* a,long b,XVisualInfo* c,int* d),(a,b,c,d),return)
SDL_X11_SYM(XWMHints*,XGetWMHints,(Display* a,Window b),(a,b),return)
SDL_X11_SYM(Status,XGetWindowAttributes,(Display* a,Window b,XWindowAttributes* c),(a,b,c),return) SDL_X11_SYM(Status,XGetWindowAttributes,(Display* a,Window b,XWindowAttributes* c),(a,b,c),return)
SDL_X11_SYM(int,XGetWindowProperty,(Display* a,Window b,Atom c,long d,long e,Bool f,Atom g,Atom* h,int* i,unsigned long* j,unsigned long *k,unsigned char **l),(a,b,c,d,e,f,g,h,i,j,k,l),return) SDL_X11_SYM(int,XGetWindowProperty,(Display* a,Window b,Atom c,long d,long e,Bool f,Atom g,Atom* h,int* i,unsigned long* j,unsigned long *k,unsigned char **l),(a,b,c,d,e,f,g,h,i,j,k,l),return)
SDL_X11_SYM(XWMHints*,XGetWMHints,(Display* a,Window b),(a,b),return)
SDL_X11_SYM(int,XGrabKeyboard,(Display* a,Window b,Bool c,int d,int e,Time f),(a,b,c,d,e,f),return) SDL_X11_SYM(int,XGrabKeyboard,(Display* a,Window b,Bool c,int d,int e,Time f),(a,b,c,d,e,f),return)
SDL_X11_SYM(int,XGrabPointer,(Display* a,Window b,Bool c,unsigned int d,int e,int f,Window g,Cursor h,Time i),(a,b,c,d,e,f,g,h,i),return) SDL_X11_SYM(int,XGrabPointer,(Display* a,Window b,Bool c,unsigned int d,int e,int f,Window g,Cursor h,Time i),(a,b,c,d,e,f,g,h,i),return)
SDL_X11_SYM(int,XGrabServer,(Display* a),(a),return) SDL_X11_SYM(int,XGrabServer,(Display* a),(a),return)
...@@ -114,14 +118,15 @@ SDL_X11_SYM(int,XSetForeground,(Display* a,GC b,unsigned long c),(a,b,c),return) ...@@ -114,14 +118,15 @@ SDL_X11_SYM(int,XSetForeground,(Display* a,GC b,unsigned long c),(a,b,c),return)
SDL_X11_SYM(XErrorHandler,XSetErrorHandler,(XErrorHandler a),(a),return) SDL_X11_SYM(XErrorHandler,XSetErrorHandler,(XErrorHandler a),(a),return)
SDL_X11_SYM(XIOErrorHandler,XSetIOErrorHandler,(XIOErrorHandler a),(a),return) SDL_X11_SYM(XIOErrorHandler,XSetIOErrorHandler,(XIOErrorHandler a),(a),return)
SDL_X11_SYM(void,XSetRGBColormaps,( Display *a,Window b,XStandardColormap *c,int d,Atom e),(a,b,c,d,e),return) SDL_X11_SYM(void,XSetRGBColormaps,( Display *a,Window b,XStandardColormap *c,int d,Atom e),(a,b,c,d,e),return)
SDL_X11_SYM(int,XSetSelectionOwner,(Display* a,Atom b,Window c,Time d),(a,b,c,d),return)
SDL_X11_SYM(int,XSetTransientForHint,(Display* a,Window b,Window c),(a,b,c),return) SDL_X11_SYM(int,XSetTransientForHint,(Display* a,Window b,Window c),(a,b,c),return)
SDL_X11_SYM(int,XSetWMHints,(Display* a,Window b,XWMHints* c),(a,b,c),return)
SDL_X11_SYM(void,XSetTextProperty,(Display* a,Window b,XTextProperty* c,Atom d),(a,b,c,d),) SDL_X11_SYM(void,XSetTextProperty,(Display* a,Window b,XTextProperty* c,Atom d),(a,b,c,d),)
SDL_X11_SYM(void,XSetWMNormalHints,(Display* a,Window b,XSizeHints* c),(a,b,c),)
SDL_X11_SYM(Status,XSetWMProtocols,(Display* a,Window b,Atom* c,int d),(a,b,c,d),return)
SDL_X11_SYM(int,XSetWindowBackground,(Display* a,Window b,unsigned long c),(a,b,c),return) SDL_X11_SYM(int,XSetWindowBackground,(Display* a,Window b,unsigned long c),(a,b,c),return)
SDL_X11_SYM(int,XSetWindowBackgroundPixmap,(Display* a,Window b,Pixmap c),(a,b,c),return) SDL_X11_SYM(int,XSetWindowBackgroundPixmap,(Display* a,Window b,Pixmap c),(a,b,c),return)
SDL_X11_SYM(int,XSetWindowColormap,(Display* a,Window b,Colormap c),(a,b,c),return) SDL_X11_SYM(int,XSetWindowColormap,(Display* a,Window b,Colormap c),(a,b,c),return)
SDL_X11_SYM(int,XSetWMHints,(Display* a,Window b,XWMHints* c),(a,b,c),return)
SDL_X11_SYM(void,XSetWMNormalHints,(Display* a,Window b,XSizeHints* c),(a,b,c),)
SDL_X11_SYM(Status,XSetWMProtocols,(Display* a,Window b,Atom* c,int d),(a,b,c,d),return)
SDL_X11_SYM(int,XStoreColors,(Display* a,Colormap b,XColor* c,int d),(a,b,c,d),return) SDL_X11_SYM(int,XStoreColors,(Display* a,Colormap b,XColor* c,int d),(a,b,c,d),return)
SDL_X11_SYM(Status,XStringListToTextProperty,(char** a,int b,XTextProperty* c),(a,b,c),return) SDL_X11_SYM(Status,XStringListToTextProperty,(char** a,int b,XTextProperty* c),(a,b,c),return)
SDL_X11_SYM(int,XSync,(Display* a,Bool b),(a,b),return) SDL_X11_SYM(int,XSync,(Display* a,Bool b),(a,b),return)
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
*/ */
#include "SDL_config.h" #include "SDL_config.h"
#include <unistd.h> /* For getpid() and readlink() */
#include "SDL_video.h" #include "SDL_video.h"
#include "SDL_mouse.h" #include "SDL_mouse.h"
#include "../SDL_sysvideo.h" #include "../SDL_sysvideo.h"
...@@ -225,6 +227,10 @@ X11_CreateDevice(int devindex) ...@@ -225,6 +227,10 @@ X11_CreateDevice(int devindex)
device->GL_DeleteContext = X11_GLES_DeleteContext; device->GL_DeleteContext = X11_GLES_DeleteContext;
#endif #endif
device->SetClipboardText = X11_SetClipboardText;
device->GetClipboardText = X11_GetClipboardText;
device->HasClipboardText = X11_HasClipboardText;
device->free = X11_DeleteDevice; device->free = X11_DeleteDevice;
return device; return device;
...@@ -236,6 +242,43 @@ VideoBootStrap X11_bootstrap = { ...@@ -236,6 +242,43 @@ VideoBootStrap X11_bootstrap = {
}; };
static void
X11_CheckWindowManager(_THIS)
{
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
Display *display = data->display;
Atom _NET_SUPPORTING_WM_CHECK;
int status, real_format;
Atom real_type;
unsigned long items_read, items_left;
unsigned char *propdata;
Window wm_window = 0;
#ifdef DEBUG_WINDOW_MANAGER
char *wm_name;
#endif
_NET_SUPPORTING_WM_CHECK = XInternAtom(display, "_NET_SUPPORTING_WM_CHECK", False);
status = XGetWindowProperty(display, DefaultRootWindow(display), _NET_SUPPORTING_WM_CHECK, 0L, 1L, False, XA_WINDOW, &real_type, &real_format, &items_read, &items_left, &propdata);
if (status == Success && items_read) {
wm_window = ((Window*)propdata)[0];
}
XFree(propdata);
if (!wm_window) {
#ifdef DEBUG_WINDOW_MANAGER
printf("Couldn't get _NET_SUPPORTING_WM_CHECK property\n");
#endif
return;
}
data->net_wm = SDL_TRUE;
#ifdef DEBUG_WINDOW_MANAGER
wm_name = X11_GetWindowTitle(_this, wm_window);
printf("Window manager: %s\n", wm_name);
SDL_free(wm_name);
#endif
}
int int
X11_VideoInit(_THIS) X11_VideoInit(_THIS)
{ {
...@@ -253,8 +296,20 @@ X11_VideoInit(_THIS) ...@@ -253,8 +296,20 @@ X11_VideoInit(_THIS)
#endif #endif
/* Look up some useful Atoms */ /* Look up some useful Atoms */
data->WM_DELETE_WINDOW = #define GET_ATOM(X) data->X = XInternAtom(data->display, #X, False)
XInternAtom(data->display, "WM_DELETE_WINDOW", False); GET_ATOM(WM_DELETE_WINDOW);
GET_ATOM(_NET_WM_STATE);
GET_ATOM(_NET_WM_STATE_HIDDEN);
GET_ATOM(_NET_WM_STATE_MAXIMIZED_VERT);
GET_ATOM(_NET_WM_STATE_MAXIMIZED_HORZ);
GET_ATOM(_NET_WM_STATE_FULLSCREEN);
GET_ATOM(_NET_WM_NAME);
GET_ATOM(_NET_WM_ICON_NAME);
GET_ATOM(_NET_WM_ICON);
GET_ATOM(UTF8_STRING);
/* Detect the window manager */
X11_CheckWindowManager(_this);
if (X11_InitModes(_this) < 0) { if (X11_InitModes(_this) < 0) {
return -1; return -1;
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
#include "SDL_x11dyn.h" #include "SDL_x11dyn.h"
#include "SDL_x11clipboard.h"
#include "SDL_x11events.h" #include "SDL_x11events.h"
#include "SDL_x11gamma.h" #include "SDL_x11gamma.h"
#include "SDL_x11keyboard.h" #include "SDL_x11keyboard.h"
...@@ -67,8 +68,24 @@ typedef struct SDL_VideoData ...@@ -67,8 +68,24 @@ typedef struct SDL_VideoData
int numwindows; int numwindows;
SDL_WindowData **windowlist; SDL_WindowData **windowlist;
int windowlistlength; int windowlistlength;
/* This is true for ICCCM2.0-compliant window managers */
SDL_bool net_wm;
/* Useful atoms */
Atom WM_DELETE_WINDOW; Atom WM_DELETE_WINDOW;
Atom _NET_WM_STATE;
Atom _NET_WM_STATE_HIDDEN;
Atom _NET_WM_STATE_MAXIMIZED_VERT;
Atom _NET_WM_STATE_MAXIMIZED_HORZ;
Atom _NET_WM_STATE_FULLSCREEN;
Atom _NET_WM_NAME;
Atom _NET_WM_ICON_NAME;
Atom _NET_WM_ICON;
Atom UTF8_STRING;
SDL_scancode key_layout[256]; SDL_scancode key_layout[256];
SDL_bool selection_waiting;
} SDL_VideoData; } SDL_VideoData;
extern SDL_bool X11_UseDirectColorVisuals(void); extern SDL_bool X11_UseDirectColorVisuals(void);
......
...@@ -42,6 +42,50 @@ ...@@ -42,6 +42,50 @@
#define _NET_WM_STATE_ADD 1l #define _NET_WM_STATE_ADD 1l
#define _NET_WM_STATE_TOGGLE 2l #define _NET_WM_STATE_TOGGLE 2l
static SDL_bool
X11_IsWindowOldFullscreen(_THIS, SDL_Window * window)
{
SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
/* ICCCM2.0-compliant window managers can handle fullscreen windows */
if ((window->flags & SDL_WINDOW_FULLSCREEN) && !videodata->net_wm) {
return SDL_TRUE;
} else {
return SDL_FALSE;
}
}
static SDL_bool
X11_IsWindowMapped(_THIS, SDL_Window * window)
{
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
XWindowAttributes attr;
XGetWindowAttributes(videodata->display, data->xwindow, &attr);
if (attr.map_state != IsUnmapped) {
return SDL_TRUE;
} else {
return SDL_FALSE;
}
}
static int
X11_GetWMStateProperty(_THIS, SDL_Window * window, Atom atoms[3])
{
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
int count = 0;
if (window->flags & SDL_WINDOW_FULLSCREEN) {
atoms[count++] = data->_NET_WM_STATE_FULLSCREEN;
}
if (window->flags & SDL_WINDOW_MAXIMIZED) {
atoms[count++] = data->_NET_WM_STATE_MAXIMIZED_VERT;
atoms[count++] = data->_NET_WM_STATE_MAXIMIZED_HORZ;
}
return count;
}
static void static void
X11_GetDisplaySize(_THIS, SDL_Window * window, int *w, int *h) X11_GetDisplaySize(_THIS, SDL_Window * window, int *w, int *h)
{ {
...@@ -128,14 +172,10 @@ SetupWindowData(_THIS, SDL_Window * window, Window w, BOOL created) ...@@ -128,14 +172,10 @@ SetupWindowData(_THIS, SDL_Window * window, Window w, BOOL created)
} }
{ {
Atom _NET_WM_STATE = Atom _NET_WM_STATE = data->videodata->_NET_WM_STATE;
XInternAtom(data->videodata->display, "_NET_WM_STATE", False); Atom _NET_WM_STATE_MAXIMIZED_VERT = data->videodata->_NET_WM_STATE_MAXIMIZED_VERT;
Atom _NET_WM_STATE_MAXIMIZED_VERT = Atom _NET_WM_STATE_MAXIMIZED_HORZ = data->videodata->_NET_WM_STATE_MAXIMIZED_HORZ;
XInternAtom(data->videodata->display, Atom _NET_WM_STATE_FULLSCREEN = data->videodata->_NET_WM_STATE_FULLSCREEN;
"_NET_WM_STATE_MAXIMIZED_VERT", False);
Atom _NET_WM_STATE_MAXIMIZED_HORZ =
XInternAtom(data->videodata->display,
"_NET_WM_STATE_MAXIMIZED_HORZ", False);
Atom actualType; Atom actualType;
int actualFormat; int actualFormat;
unsigned long i, numItems, bytesAfter; unsigned long i, numItems, bytesAfter;
...@@ -148,19 +188,21 @@ SetupWindowData(_THIS, SDL_Window * window, Window w, BOOL created) ...@@ -148,19 +188,21 @@ SetupWindowData(_THIS, SDL_Window * window, Window w, BOOL created)
&propertyValue) == Success) { &propertyValue) == Success) {
Atom *atoms = (Atom *) propertyValue; Atom *atoms = (Atom *) propertyValue;
int maximized = 0; int maximized = 0;
int fullscreen = 0;
for (i = 0; i < numItems; ++i) { for (i = 0; i < numItems; ++i) {
if (atoms[i] == _NET_WM_STATE_MAXIMIZED_VERT) { if (atoms[i] == _NET_WM_STATE_MAXIMIZED_VERT) {
maximized |= 1; maximized |= 1;
} else if (atoms[i] == _NET_WM_STATE_MAXIMIZED_HORZ) { } else if (atoms[i] == _NET_WM_STATE_MAXIMIZED_HORZ) {
maximized |= 2; maximized |= 2;
} else if ( atoms[i] == _NET_WM_STATE_FULLSCREEN) {
fullscreen = 1;
} }
/* Might also want to check the following properties:
_NET_WM_STATE_ABOVE, _NET_WM_STATE_FULLSCREEN
*/
} }
if (maximized == 3) { if (maximized == 3) {
window->flags |= SDL_WINDOW_MAXIMIZED; window->flags |= SDL_WINDOW_MAXIMIZED;
} else if (fullscreen == 1) {
window->flags |= SDL_WINDOW_FULLSCREEN;
} }
XFree(propertyValue); XFree(propertyValue);
} }
...@@ -180,11 +222,6 @@ SetupWindowData(_THIS, SDL_Window * window, Window w, BOOL created) ...@@ -180,11 +222,6 @@ SetupWindowData(_THIS, SDL_Window * window, Window w, BOOL created)
} else { } else {
window->flags &= ~SDL_WINDOW_RESIZABLE; window->flags &= ~SDL_WINDOW_RESIZABLE;
} }
if (style & WS_MAXIMIZE) {
window->flags |= SDL_WINDOW_MAXIMIZED;
} else {
window->flags &= ~SDL_WINDOW_MAXIMIZED;
}
if (style & WS_MINIMIZE) { if (style & WS_MINIMIZE) {
window->flags |= SDL_WINDOW_MINIMIZED; window->flags |= SDL_WINDOW_MINIMIZED;
} else { } else {
...@@ -217,6 +254,8 @@ X11_CreateWindow(_THIS, SDL_Window * window) ...@@ -217,6 +254,8 @@ X11_CreateWindow(_THIS, SDL_Window * window)
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
SDL_DisplayData *displaydata = SDL_DisplayData *displaydata =
(SDL_DisplayData *) window->display->driverdata; (SDL_DisplayData *) window->display->driverdata;
Display *display = data->display;
int screen = displaydata->screen;
Visual *visual; Visual *visual;
int depth; int depth;
XSetWindowAttributes xattr; XSetWindowAttributes xattr;
...@@ -225,6 +264,14 @@ X11_CreateWindow(_THIS, SDL_Window * window) ...@@ -225,6 +264,14 @@ X11_CreateWindow(_THIS, SDL_Window * window)
XSizeHints *sizehints; XSizeHints *sizehints;
XWMHints *wmhints; XWMHints *wmhints;
XClassHint *classhints; XClassHint *classhints;
SDL_bool oldstyle_fullscreen;
Atom _NET_WM_WINDOW_TYPE;
Atom _NET_WM_WINDOW_TYPE_NORMAL;
int wmstate_count;
Atom wmstate_atoms[3];
/* ICCCM2.0-compliant window managers can handle fullscreen windows */
oldstyle_fullscreen = X11_IsWindowOldFullscreen(_this, window);
#if SDL_VIDEO_DRIVER_X11_XINERAMA #if SDL_VIDEO_DRIVER_X11_XINERAMA
/* FIXME /* FIXME
...@@ -238,7 +285,7 @@ X11_CreateWindow(_THIS, SDL_Window * window) ...@@ -238,7 +285,7 @@ X11_CreateWindow(_THIS, SDL_Window * window)
if (window->flags & SDL_WINDOW_OPENGL) { if (window->flags & SDL_WINDOW_OPENGL) {
XVisualInfo *vinfo; XVisualInfo *vinfo;
vinfo = X11_GL_GetVisual(_this, data->display, displaydata->screen); vinfo = X11_GL_GetVisual(_this, display, screen);
if (!vinfo) { if (!vinfo) {
return -1; return -1;
} }
...@@ -251,7 +298,7 @@ X11_CreateWindow(_THIS, SDL_Window * window) ...@@ -251,7 +298,7 @@ X11_CreateWindow(_THIS, SDL_Window * window)
if (window->flags & SDL_WINDOW_OPENGL) { if (window->flags & SDL_WINDOW_OPENGL) {
XVisualInfo *vinfo; XVisualInfo *vinfo;
vinfo = X11_GLES_GetVisual(_this, data->display, displaydata->screen); vinfo = X11_GLES_GetVisual(_this, display, screen);
if (!vinfo) { if (!vinfo) {
return -1; return -1;
} }
...@@ -265,7 +312,7 @@ X11_CreateWindow(_THIS, SDL_Window * window) ...@@ -265,7 +312,7 @@ X11_CreateWindow(_THIS, SDL_Window * window)
depth = displaydata->depth; depth = displaydata->depth;
} }
if (window->flags & SDL_WINDOW_FULLSCREEN) { if (oldstyle_fullscreen) {
xattr.override_redirect = True; xattr.override_redirect = True;
} else { } else {
xattr.override_redirect = False; xattr.override_redirect = False;
...@@ -289,16 +336,13 @@ X11_CreateWindow(_THIS, SDL_Window * window) ...@@ -289,16 +336,13 @@ X11_CreateWindow(_THIS, SDL_Window * window)
Sint32 r, g, b; Sint32 r, g, b;
/* Is the colormap we need already registered in SDL? */ /* Is the colormap we need already registered in SDL? */
if (colormap = if ((colormap =
X11_LookupColormap(data->display, X11_LookupColormap(display, screen, visual->visualid))) {
displaydata->screen, visual->visualid)) {
xattr.colormap = colormap; xattr.colormap = colormap;
/* printf("found existing colormap\n"); */ /* printf("found existing colormap\n"); */
} else { } else {
/* The colormap is not known to SDL so we will create it */ /* The colormap is not known to SDL so we will create it */
colormap = XCreateColormap(data->display, colormap = XCreateColormap(display, RootWindow(display, screen),
RootWindow(data->display,
displaydata->screen),
visual, AllocAll); visual, AllocAll);
/* printf("colormap = %x\n", colormap); */ /* printf("colormap = %x\n", colormap); */
...@@ -377,11 +421,10 @@ X11_CreateWindow(_THIS, SDL_Window * window) ...@@ -377,11 +421,10 @@ X11_CreateWindow(_THIS, SDL_Window * window)
} }
/* status = */ /* status = */
/* XStoreColors(data->display, colormap, colorcells, ncolors); */ /* XStoreColors(display, colormap, colorcells, ncolors); */
xattr.colormap = colormap; xattr.colormap = colormap;
X11_TrackColormap(data->display, displaydata->screen, X11_TrackColormap(display, screen, colormap, visual, NULL);
colormap, visual, NULL);
SDL_free(colorcells); SDL_free(colorcells);
} }
...@@ -397,15 +440,12 @@ X11_CreateWindow(_THIS, SDL_Window * window) ...@@ -397,15 +440,12 @@ X11_CreateWindow(_THIS, SDL_Window * window)
/* Is the colormap we need already registered in SDL? */ /* Is the colormap we need already registered in SDL? */
if ((colormap = if ((colormap =
X11_LookupColormap(data->display, X11_LookupColormap(display, screen, visual->visualid))) {
displaydata->screen, visual->visualid))) {
xattr.colormap = colormap; xattr.colormap = colormap;
/* printf("found existing colormap\n"); */ /* printf("found existing colormap\n"); */
} else { } else {
/* The colormap is not known to SDL so we will create it */ /* The colormap is not known to SDL so we will create it */
colormap = XCreateColormap(data->display, colormap = XCreateColormap(display, RootWindow(display, screen),
RootWindow(data->display,
displaydata->screen),
visual, AllocAll); visual, AllocAll);
/* printf("colormap = %x\n", colormap); */ /* printf("colormap = %x\n", colormap); */
...@@ -417,7 +457,6 @@ X11_CreateWindow(_THIS, SDL_Window * window) ...@@ -417,7 +457,6 @@ X11_CreateWindow(_THIS, SDL_Window * window)
} }
/* OK, we got a colormap, now fill it in as best as we can */ /* OK, we got a colormap, now fill it in as best as we can */
colorcells = SDL_malloc(visual->map_entries * sizeof(XColor)); colorcells = SDL_malloc(visual->map_entries * sizeof(XColor));
if (NULL == colorcells) { if (NULL == colorcells) {
SDL_SetError("out of memory in X11_CreateWindow"); SDL_SetError("out of memory in X11_CreateWindow");
...@@ -479,22 +518,20 @@ X11_CreateWindow(_THIS, SDL_Window * window) ...@@ -479,22 +518,20 @@ X11_CreateWindow(_THIS, SDL_Window * window)
} }
status = status =
XStoreColors(data->display, colormap, colorcells, ncolors); XStoreColors(display, colormap, colorcells, ncolors);
xattr.colormap = colormap; xattr.colormap = colormap;
X11_TrackColormap(data->display, displaydata->screen, X11_TrackColormap(display, screen, colormap, visual, colorcells);
colormap, visual, colorcells);
SDL_free(colorcells); SDL_free(colorcells);
} }
} else { } else {
xattr.colormap = xattr.colormap =
XCreateColormap(data->display, XCreateColormap(display, RootWindow(display, screen),
RootWindow(data->display, displaydata->screen),
visual, AllocNone); visual, AllocNone);
} }
if ((window->flags & SDL_WINDOW_FULLSCREEN) if (oldstyle_fullscreen
|| window->x == SDL_WINDOWPOS_CENTERED) { || window->x == SDL_WINDOWPOS_CENTERED) {
X11_GetDisplaySize(_this, window, &x, NULL); X11_GetDisplaySize(_this, window, &x, NULL);
x = (x - window->w) / 2; x = (x - window->w) / 2;
...@@ -503,7 +540,7 @@ X11_CreateWindow(_THIS, SDL_Window * window) ...@@ -503,7 +540,7 @@ X11_CreateWindow(_THIS, SDL_Window * window)
} else { } else {
x = window->x; x = window->x;
} }
if ((window->flags & SDL_WINDOW_FULLSCREEN) if (oldstyle_fullscreen
|| window->y == SDL_WINDOWPOS_CENTERED) { || window->y == SDL_WINDOWPOS_CENTERED) {
X11_GetDisplaySize(_this, window, NULL, &y); X11_GetDisplaySize(_this, window, NULL, &y);
y = (y - window->h) / 2; y = (y - window->h) / 2;
...@@ -513,8 +550,7 @@ X11_CreateWindow(_THIS, SDL_Window * window) ...@@ -513,8 +550,7 @@ X11_CreateWindow(_THIS, SDL_Window * window)
y = window->y; y = window->y;
} }
w = XCreateWindow(data->display, w = XCreateWindow(display, RootWindow(display, screen), x, y,
RootWindow(data->display, displaydata->screen), x, y,
window->w, window->h, 0, depth, InputOutput, visual, window->w, window->h, 0, depth, InputOutput, visual,
(CWOverrideRedirect | CWBackPixel | CWBorderPixel | (CWOverrideRedirect | CWBackPixel | CWBorderPixel |
CWColormap), &xattr); CWColormap), &xattr);
...@@ -539,23 +575,23 @@ X11_CreateWindow(_THIS, SDL_Window * window) ...@@ -539,23 +575,23 @@ X11_CreateWindow(_THIS, SDL_Window * window)
sizehints = XAllocSizeHints(); sizehints = XAllocSizeHints();
if (sizehints) { if (sizehints) {
if (!(window->flags & SDL_WINDOW_RESIZABLE) if (!(window->flags & SDL_WINDOW_RESIZABLE)
|| (window->flags & SDL_WINDOW_FULLSCREEN)) { || oldstyle_fullscreen) {
sizehints->min_width = sizehints->max_width = window->w; sizehints->min_width = sizehints->max_width = window->w;
sizehints->min_height = sizehints->max_height = window->h; sizehints->min_height = sizehints->max_height = window->h;
sizehints->flags = PMaxSize | PMinSize; sizehints->flags = PMaxSize | PMinSize;
} }
if (!(window->flags & SDL_WINDOW_FULLSCREEN) if (!oldstyle_fullscreen
&& window->x != SDL_WINDOWPOS_UNDEFINED && window->x != SDL_WINDOWPOS_UNDEFINED
&& window->y != SDL_WINDOWPOS_UNDEFINED) { && window->y != SDL_WINDOWPOS_UNDEFINED) {
sizehints->x = x; sizehints->x = x;
sizehints->y = y; sizehints->y = y;
sizehints->flags |= USPosition; sizehints->flags |= USPosition;
} }
XSetWMNormalHints(data->display, w, sizehints); XSetWMNormalHints(display, w, sizehints);
XFree(sizehints); XFree(sizehints);
} }
if (window->flags & (SDL_WINDOW_BORDERLESS | SDL_WINDOW_FULLSCREEN)) { if ((window->flags & SDL_WINDOW_BORDERLESS) || oldstyle_fullscreen) {
SDL_bool set; SDL_bool set;
Atom WM_HINTS; Atom WM_HINTS;
...@@ -563,7 +599,7 @@ X11_CreateWindow(_THIS, SDL_Window * window) ...@@ -563,7 +599,7 @@ X11_CreateWindow(_THIS, SDL_Window * window)
set = SDL_FALSE; set = SDL_FALSE;
/* First try to set MWM hints */ /* First try to set MWM hints */
WM_HINTS = XInternAtom(data->display, "_MOTIF_WM_HINTS", True); WM_HINTS = XInternAtom(display, "_MOTIF_WM_HINTS", True);
if (WM_HINTS != None) { if (WM_HINTS != None) {
/* Hints used by Motif compliant window managers */ /* Hints used by Motif compliant window managers */
struct struct
...@@ -576,40 +612,36 @@ X11_CreateWindow(_THIS, SDL_Window * window) ...@@ -576,40 +612,36 @@ X11_CreateWindow(_THIS, SDL_Window * window)
} MWMHints = { } MWMHints = {
(1L << 1), 0, 0, 0, 0}; (1L << 1), 0, 0, 0, 0};
XChangeProperty(data->display, w, WM_HINTS, WM_HINTS, 32, XChangeProperty(display, w, WM_HINTS, WM_HINTS, 32,
PropModeReplace, (unsigned char *) &MWMHints, PropModeReplace, (unsigned char *) &MWMHints,
sizeof(MWMHints) / sizeof(long)); sizeof(MWMHints) / 4);
set = SDL_TRUE; set = SDL_TRUE;
} }
/* Now try to set KWM hints */ /* Now try to set KWM hints */
WM_HINTS = XInternAtom(data->display, "KWM_WIN_DECORATION", True); WM_HINTS = XInternAtom(display, "KWM_WIN_DECORATION", True);
if (WM_HINTS != None) { if (WM_HINTS != None) {
long KWMHints = 0; long KWMHints = 0;
XChangeProperty(data->display, w, XChangeProperty(display, w, WM_HINTS, WM_HINTS, 32,
WM_HINTS, WM_HINTS, 32,
PropModeReplace, PropModeReplace,
(unsigned char *) &KWMHints, (unsigned char *) &KWMHints,
sizeof(KWMHints) / sizeof(long)); sizeof(KWMHints) / 4);
set = SDL_TRUE; set = SDL_TRUE;
} }
/* Now try to set GNOME hints */ /* Now try to set GNOME hints */
WM_HINTS = XInternAtom(data->display, "_WIN_HINTS", True); WM_HINTS = XInternAtom(display, "_WIN_HINTS", True);
if (WM_HINTS != None) { if (WM_HINTS != None) {
long GNOMEHints = 0; long GNOMEHints = 0;
XChangeProperty(data->display, w, XChangeProperty(display, w, WM_HINTS, WM_HINTS, 32,
WM_HINTS, WM_HINTS, 32,
PropModeReplace, PropModeReplace,
(unsigned char *) &GNOMEHints, (unsigned char *) &GNOMEHints,
sizeof(GNOMEHints) / sizeof(long)); sizeof(GNOMEHints) / 4);
set = SDL_TRUE; set = SDL_TRUE;
} }
/* Finally set the transient hints if necessary */ /* Finally set the transient hints if necessary */
if (!set) { if (!set) {
XSetTransientForHint(data->display, w, XSetTransientForHint(display, w, RootWindow(display, screen));
RootWindow(data->display,
displaydata->screen));
} }
} else { } else {
SDL_bool set; SDL_bool set;
...@@ -619,53 +651,36 @@ X11_CreateWindow(_THIS, SDL_Window * window) ...@@ -619,53 +651,36 @@ X11_CreateWindow(_THIS, SDL_Window * window)
set = SDL_FALSE; set = SDL_FALSE;
/* First try to unset MWM hints */ /* First try to unset MWM hints */
WM_HINTS = XInternAtom(data->display, "_MOTIF_WM_HINTS", True); WM_HINTS = XInternAtom(display, "_MOTIF_WM_HINTS", True);
if (WM_HINTS != None) { if (WM_HINTS != None) {
XDeleteProperty(data->display, w, WM_HINTS); XDeleteProperty(display, w, WM_HINTS);
set = SDL_TRUE; set = SDL_TRUE;
} }
/* Now try to unset KWM hints */ /* Now try to unset KWM hints */
WM_HINTS = XInternAtom(data->display, "KWM_WIN_DECORATION", True); WM_HINTS = XInternAtom(display, "KWM_WIN_DECORATION", True);
if (WM_HINTS != None) { if (WM_HINTS != None) {
XDeleteProperty(data->display, w, WM_HINTS); XDeleteProperty(display, w, WM_HINTS);
set = SDL_TRUE; set = SDL_TRUE;
} }
/* Now try to unset GNOME hints */ /* Now try to unset GNOME hints */
WM_HINTS = XInternAtom(data->display, "_WIN_HINTS", True); WM_HINTS = XInternAtom(display, "_WIN_HINTS", True);
if (WM_HINTS != None) { if (WM_HINTS != None) {
XDeleteProperty(data->display, w, WM_HINTS); XDeleteProperty(display, w, WM_HINTS);
set = SDL_TRUE; set = SDL_TRUE;
} }
/* Finally unset the transient hints if necessary */ /* Finally unset the transient hints if necessary */
if (!set) { if (!set) {
/* NOTE: Does this work? */ /* NOTE: Does this work? */
XSetTransientForHint(data->display, w, None); XSetTransientForHint(display, w, None);
} }
} }
/* Tell KDE to keep fullscreen windows on top */
if (window->flags & SDL_WINDOW_FULLSCREEN) {
XEvent ev;
SDL_zero(ev);
ev.xclient.type = ClientMessage;
ev.xclient.window = RootWindow(data->display, displaydata->screen);
ev.xclient.message_type =
XInternAtom(data->display, "KWM_KEEP_ON_TOP", False);
ev.xclient.format = 32;
ev.xclient.data.l[0] = w;
ev.xclient.data.l[1] = CurrentTime;
XSendEvent(data->display,
RootWindow(data->display, displaydata->screen), False,
SubstructureRedirectMask, &ev);
}
/* Set the input hints so we get keyboard input */ /* Set the input hints so we get keyboard input */
wmhints = XAllocWMHints(); wmhints = XAllocWMHints();
if (wmhints) { if (wmhints) {
wmhints->input = True; wmhints->input = True;
wmhints->flags = InputHint; wmhints->flags = InputHint;
XSetWMHints(data->display, w, wmhints); XSetWMHints(display, w, wmhints);
XFree(wmhints); XFree(wmhints);
} }
...@@ -674,15 +689,32 @@ X11_CreateWindow(_THIS, SDL_Window * window) ...@@ -674,15 +689,32 @@ X11_CreateWindow(_THIS, SDL_Window * window)
if (classhints != NULL) { if (classhints != NULL) {
classhints->res_name = data->classname; classhints->res_name = data->classname;
classhints->res_class = data->classname; classhints->res_class = data->classname;
XSetClassHint(data->display, w, classhints); XSetClassHint(display, w, classhints);
XFree(classhints); XFree(classhints);
} }
/* Set the window manager state */
wmstate_count = X11_GetWMStateProperty(_this, window, wmstate_atoms);
if (wmstate_count > 0) {
XChangeProperty(display, w, data->_NET_WM_STATE, XA_ATOM, 32,
PropModeReplace,
(unsigned char *)wmstate_atoms, wmstate_count);
} else {
XDeleteProperty(display, w, data->_NET_WM_STATE);
}
/* Let the window manager know we're a "normal" window */
_NET_WM_WINDOW_TYPE = XInternAtom(display, "_NET_WM_WINDOW_TYPE", False);
_NET_WM_WINDOW_TYPE_NORMAL = XInternAtom(display, "_NET_WM_WINDOW_TYPE_NORMAL", False);
XChangeProperty(display, w, _NET_WM_WINDOW_TYPE, XA_ATOM, 32,
PropModeReplace,
(unsigned char *)&_NET_WM_WINDOW_TYPE_NORMAL, 1);
/* Allow the window to be deleted by the window manager */ /* Allow the window to be deleted by the window manager */
XSetWMProtocols(data->display, w, &data->WM_DELETE_WINDOW, 1); XSetWMProtocols(display, w, &data->WM_DELETE_WINDOW, 1);
if (SetupWindowData(_this, window, w, SDL_TRUE) < 0) { if (SetupWindowData(_this, window, w, SDL_TRUE) < 0) {
XDestroyWindow(data->display, w); XDestroyWindow(display, w);
return -1; return -1;
} }
#ifdef X_HAVE_UTF8_STRING #ifdef X_HAVE_UTF8_STRING
...@@ -690,7 +722,7 @@ X11_CreateWindow(_THIS, SDL_Window * window) ...@@ -690,7 +722,7 @@ X11_CreateWindow(_THIS, SDL_Window * window)
Uint32 fevent = 0; Uint32 fevent = 0;
pXGetICValues(((SDL_WindowData *) window->driverdata)->ic, pXGetICValues(((SDL_WindowData *) window->driverdata)->ic,
XNFilterEvents, &fevent, NULL); XNFilterEvents, &fevent, NULL);
XSelectInput(data->display, w, XSelectInput(display, w,
(FocusChangeMask | EnterWindowMask | LeaveWindowMask | (FocusChangeMask | EnterWindowMask | LeaveWindowMask |
ExposureMask | ButtonPressMask | ButtonReleaseMask | ExposureMask | ButtonPressMask | ButtonReleaseMask |
PointerMotionMask | KeyPressMask | KeyReleaseMask | PointerMotionMask | KeyPressMask | KeyReleaseMask |
...@@ -699,7 +731,7 @@ X11_CreateWindow(_THIS, SDL_Window * window) ...@@ -699,7 +731,7 @@ X11_CreateWindow(_THIS, SDL_Window * window)
} }
#else #else
{ {
XSelectInput(data->display, w, XSelectInput(display, w,
(FocusChangeMask | EnterWindowMask | LeaveWindowMask | (FocusChangeMask | EnterWindowMask | LeaveWindowMask |
ExposureMask | ButtonPressMask | ButtonReleaseMask | ExposureMask | ButtonPressMask | ButtonReleaseMask |
PointerMotionMask | KeyPressMask | KeyReleaseMask | PointerMotionMask | KeyPressMask | KeyReleaseMask |
...@@ -716,7 +748,7 @@ X11_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) ...@@ -716,7 +748,7 @@ X11_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
{ {
Window w = (Window) data; Window w = (Window) data;
/* FIXME: Query the title from the existing window */ window->title = X11_GetWindowTitle(_this, w);
if (SetupWindowData(_this, window, w, SDL_FALSE) < 0) { if (SetupWindowData(_this, window, w, SDL_FALSE) < 0) {
return -1; return -1;
...@@ -724,6 +756,36 @@ X11_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) ...@@ -724,6 +756,36 @@ X11_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
return 0; return 0;
} }
char *
X11_GetWindowTitle(_THIS, Window xwindow)
{
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
Display *display = data->display;
int status, real_format;
Atom real_type;
unsigned long items_read, items_left;
unsigned char *propdata;
char *title = NULL;
status = XGetWindowProperty(display, xwindow, data->_NET_WM_NAME,
0L, 8192L, False, data->UTF8_STRING, &real_type, &real_format,
&items_read, &items_left, &propdata);
if (status == Success) {
title = SDL_strdup(SDL_static_cast(char*, propdata));
XFree(propdata);
} else {
status = XGetWindowProperty(display, xwindow, XA_WM_NAME,
0L, 8192L, False, XA_STRING, &real_type, &real_format,
&items_read, &items_left, &propdata);
if (status == Success) {
title = SDL_iconv_string("UTF-8", "", SDL_static_cast(char*, propdata), items_read+1);
} else {
title = SDL_strdup("");
}
}
return title;
}
void void
X11_SetWindowTitle(_THIS, SDL_Window * window) X11_SetWindowTitle(_THIS, SDL_Window * window)
{ {
...@@ -735,14 +797,8 @@ X11_SetWindowTitle(_THIS, SDL_Window * window) ...@@ -735,14 +797,8 @@ X11_SetWindowTitle(_THIS, SDL_Window * window)
const char *icon = NULL; const char *icon = NULL;
#ifdef X_HAVE_UTF8_STRING #ifdef X_HAVE_UTF8_STRING
Atom _NET_WM_NAME = 0; Atom _NET_WM_NAME = data->videodata->_NET_WM_NAME;
Atom _NET_WM_ICON_NAME = 0; Atom _NET_WM_ICON_NAME = data->videodata->_NET_WM_ICON_NAME;
/* Look up some useful Atoms */
if (SDL_X11_HAVE_UTF8) {
_NET_WM_NAME = XInternAtom(display, "_NET_WM_NAME", False);
_NET_WM_ICON_NAME = XInternAtom(display, "_NET_WM_ICON_NAME", False);
}
#endif #endif
if (title != NULL) { if (title != NULL) {
...@@ -803,13 +859,13 @@ X11_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) ...@@ -803,13 +859,13 @@ X11_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
{ {
SDL_WindowData *data = (SDL_WindowData *) window->driverdata; SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
Display *display = data->videodata->display; Display *display = data->videodata->display;
Atom _NET_WM_ICON = XInternAtom(display, "_NET_WM_ICON", False); Atom _NET_WM_ICON = data->videodata->_NET_WM_ICON;
if (icon) { if (icon) {
SDL_PixelFormat format; SDL_PixelFormat format;
SDL_Surface *surface; SDL_Surface *surface;
int propsize; int propsize;
Uint32 *propdata; long *propdata;
/* Convert the icon to ARGB for modern window managers */ /* Convert the icon to ARGB for modern window managers */
SDL_InitFormat(&format, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, SDL_InitFormat(&format, 32, 0x00FF0000, 0x0000FF00, 0x000000FF,
...@@ -823,10 +879,19 @@ X11_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) ...@@ -823,10 +879,19 @@ X11_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
propsize = 2 + (icon->w * icon->h); propsize = 2 + (icon->w * icon->h);
propdata = SDL_malloc(propsize * sizeof(Uint32)); propdata = SDL_malloc(propsize * sizeof(Uint32));
if (propdata) { if (propdata) {
int x, y;
Uint32 *src;
long *dst;
propdata[0] = icon->w; propdata[0] = icon->w;
propdata[1] = icon->h; propdata[1] = icon->h;
SDL_memcpy(&propdata[2], surface->pixels, dst = &propdata[2];
surface->h * surface->pitch); for (y = 0; y < icon->h; ++y) {
src = (Uint32*)((Uint8*)surface->pixels + y * surface->pitch);
for (x = 0; x < icon->w; ++x) {
*dst++ = *src++;
}
}
XChangeProperty(display, data->xwindow, _NET_WM_ICON, XA_CARDINAL, XChangeProperty(display, data->xwindow, _NET_WM_ICON, XA_CARDINAL,
32, PropModeReplace, (unsigned char *) propdata, 32, PropModeReplace, (unsigned char *) propdata,
propsize); propsize);
...@@ -842,16 +907,20 @@ X11_SetWindowPosition(_THIS, SDL_Window * window) ...@@ -842,16 +907,20 @@ X11_SetWindowPosition(_THIS, SDL_Window * window)
{ {
SDL_WindowData *data = (SDL_WindowData *) window->driverdata; SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
Display *display = data->videodata->display; Display *display = data->videodata->display;
SDL_bool oldstyle_fullscreen;
int x, y; int x, y;
if ((window->flags & SDL_WINDOW_FULLSCREEN) /* ICCCM2.0-compliant window managers can handle fullscreen windows */
oldstyle_fullscreen = X11_IsWindowOldFullscreen(_this, window);
if (oldstyle_fullscreen
|| window->x == SDL_WINDOWPOS_CENTERED) { || window->x == SDL_WINDOWPOS_CENTERED) {
X11_GetDisplaySize(_this, window, &x, NULL); X11_GetDisplaySize(_this, window, &x, NULL);
x = (x - window->w) / 2; x = (x - window->w) / 2;
} else { } else {
x = window->x; x = window->x;
} }
if ((window->flags & SDL_WINDOW_FULLSCREEN) if (oldstyle_fullscreen
|| window->y == SDL_WINDOWPOS_CENTERED) { || window->y == SDL_WINDOWPOS_CENTERED) {
X11_GetDisplaySize(_this, window, NULL, &y); X11_GetDisplaySize(_this, window, NULL, &y);
y = (y - window->h) / 2; y = (y - window->h) / 2;
...@@ -904,26 +973,45 @@ X11_SetWindowMaximized(_THIS, SDL_Window * window, SDL_bool maximized) ...@@ -904,26 +973,45 @@ X11_SetWindowMaximized(_THIS, SDL_Window * window, SDL_bool maximized)
SDL_DisplayData *displaydata = SDL_DisplayData *displaydata =
(SDL_DisplayData *) window->display->driverdata; (SDL_DisplayData *) window->display->driverdata;
Display *display = data->videodata->display; Display *display = data->videodata->display;
Atom _NET_WM_STATE = XInternAtom(display, "_NET_WM_STATE", False); Atom _NET_WM_STATE = data->videodata->_NET_WM_STATE;
Atom _NET_WM_STATE_MAXIMIZED_VERT = Atom _NET_WM_STATE_MAXIMIZED_VERT = data->videodata->_NET_WM_STATE_MAXIMIZED_VERT;
XInternAtom(display, "_NET_WM_STATE_MAXIMIZED_VERT", False); Atom _NET_WM_STATE_MAXIMIZED_HORZ = data->videodata->_NET_WM_STATE_MAXIMIZED_HORZ;
Atom _NET_WM_STATE_MAXIMIZED_HORZ = Atom _NET_WM_STATE_FULLSCREEN = data->videodata->_NET_WM_STATE_FULLSCREEN;
XInternAtom(display, "_NET_WM_STATE_MAXIMIZED_HORZ", False);
XEvent e; if (X11_IsWindowMapped(_this, window)) {
XEvent e;
e.xany.type = ClientMessage;
e.xany.window = data->xwindow; SDL_zero(e);
e.xclient.message_type = _NET_WM_STATE; e.xany.type = ClientMessage;
e.xclient.format = 32; e.xclient.message_type = _NET_WM_STATE;
e.xclient.data.l[0] = e.xclient.format = 32;
maximized ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE; e.xclient.window = data->xwindow;
e.xclient.data.l[1] = _NET_WM_STATE_MAXIMIZED_VERT; e.xclient.data.l[0] =
e.xclient.data.l[2] = _NET_WM_STATE_MAXIMIZED_HORZ; maximized ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE;
e.xclient.data.l[3] = 0l; e.xclient.data.l[1] = _NET_WM_STATE_MAXIMIZED_VERT;
e.xclient.data.l[4] = 0l; e.xclient.data.l[2] = _NET_WM_STATE_MAXIMIZED_HORZ;
e.xclient.data.l[3] = 0l;
XSendEvent(display, RootWindow(display, displaydata->screen), 0,
SubstructureNotifyMask | SubstructureRedirectMask, &e); XSendEvent(display, RootWindow(display, displaydata->screen), 0,
SubstructureNotifyMask | SubstructureRedirectMask, &e);
} else {
int count = 0;
Atom atoms[3];
if (window->flags & SDL_WINDOW_FULLSCREEN) {
atoms[count++] = _NET_WM_STATE_FULLSCREEN;
}
if (maximized) {
atoms[count++] = _NET_WM_STATE_MAXIMIZED_VERT;
atoms[count++] = _NET_WM_STATE_MAXIMIZED_HORZ;
}
if (count > 0) {
XChangeProperty(display, data->xwindow, _NET_WM_STATE, XA_ATOM, 32,
PropModeReplace, (unsigned char *)atoms, count);
} else {
XDeleteProperty(display, data->xwindow, _NET_WM_STATE);
}
}
} }
void void
...@@ -935,7 +1023,12 @@ X11_MaximizeWindow(_THIS, SDL_Window * window) ...@@ -935,7 +1023,12 @@ X11_MaximizeWindow(_THIS, SDL_Window * window)
void void
X11_MinimizeWindow(_THIS, SDL_Window * window) X11_MinimizeWindow(_THIS, SDL_Window * window)
{ {
X11_HideWindow(_this, window); SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
SDL_DisplayData *displaydata =
(SDL_DisplayData *) window->display->driverdata;
Display *display = data->videodata->display;
XIconifyWindow(display, data->xwindow, displaydata->screen);
} }
void void
...@@ -950,8 +1043,12 @@ X11_SetWindowGrab(_THIS, SDL_Window * window) ...@@ -950,8 +1043,12 @@ X11_SetWindowGrab(_THIS, SDL_Window * window)
{ {
SDL_WindowData *data = (SDL_WindowData *) window->driverdata; SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
Display *display = data->videodata->display; Display *display = data->videodata->display;
SDL_bool oldstyle_fullscreen;
if ((window->flags & (SDL_WINDOW_INPUT_GRABBED | SDL_WINDOW_FULLSCREEN)) /* ICCCM2.0-compliant window managers can handle fullscreen windows */
oldstyle_fullscreen = X11_IsWindowOldFullscreen(_this, window);
if (((window->flags & SDL_WINDOW_INPUT_GRABBED) || oldstyle_fullscreen)
&& (window->flags & SDL_WINDOW_INPUT_FOCUS)) { && (window->flags & SDL_WINDOW_INPUT_FOCUS)) {
/* Try to grab the mouse */ /* Try to grab the mouse */
for (;;) { for (;;) {
...@@ -1014,8 +1111,14 @@ X11_DestroyWindow(_THIS, SDL_Window * window) ...@@ -1014,8 +1111,14 @@ X11_DestroyWindow(_THIS, SDL_Window * window)
SDL_bool SDL_bool
X11_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) X11_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
{ {
if (info->version.major <= SDL_MAJOR_VERSION) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
/* FIXME! */ Display *display = data->videodata->display;
if (info->version.major == SDL_MAJOR_VERSION &&
info->version.minor == SDL_MINOR_VERSION) {
info->subsystem = SDL_SYSWM_X11;
info->info.x11.display = display;
info->info.x11.window = data->xwindow;
return SDL_TRUE; return SDL_TRUE;
} else { } else {
SDL_SetError("Application not compiled with SDL %d.%d\n", SDL_SetError("Application not compiled with SDL %d.%d\n",
......
...@@ -35,6 +35,7 @@ typedef struct ...@@ -35,6 +35,7 @@ typedef struct
extern int X11_CreateWindow(_THIS, SDL_Window * window); extern int X11_CreateWindow(_THIS, SDL_Window * window);
extern int X11_CreateWindowFrom(_THIS, SDL_Window * window, const void *data); extern int X11_CreateWindowFrom(_THIS, SDL_Window * window, const void *data);
extern char *X11_GetWindowTitle(_THIS, Window xwindow);
extern void X11_SetWindowTitle(_THIS, SDL_Window * window); extern void X11_SetWindowTitle(_THIS, SDL_Window * window);
extern void X11_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon); extern void X11_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon);
extern void X11_SetWindowPosition(_THIS, SDL_Window * window); extern void X11_SetWindowPosition(_THIS, SDL_Window * window);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include "common.h" #include "common.h"
#define VIDEO_USAGE \ #define VIDEO_USAGE \
"[--video driver] [--renderer driver] [--info all|video|modes|render|event] [--display N] [--fullscreen | --windows N] [--title title] [--center | --position X,Y] [--geometry WxH] [--depth N] [--refresh R] [--vsync] [--noframe] [--resize] [--minimize] [--maximize] [--grab] [--double] [--triple]" "[--video driver] [--renderer driver] [--info all|video|modes|render|event] [--display N] [--fullscreen | --windows N] [--title title] [--icon icon.bmp] [--center | --position X,Y] [--geometry WxH] [--depth N] [--refresh R] [--vsync] [--noframe] [--resize] [--minimize] [--maximize] [--grab] [--double] [--triple]"
#define AUDIO_USAGE \ #define AUDIO_USAGE \
"[--rate N] [--format U8|S8|U16|U16LE|U16BE|S16|S16LE|S16BE] [--channels N] [--samples N]" "[--rate N] [--format U8|S8|U16|U16LE|U16BE|S16|S16LE|S16BE] [--channels N] [--samples N]"
...@@ -192,6 +192,14 @@ CommonArg(CommonState * state, int index) ...@@ -192,6 +192,14 @@ CommonArg(CommonState * state, int index)
state->window_title = argv[index]; state->window_title = argv[index];
return 2; return 2;
} }
if (SDL_strcasecmp(argv[index], "--icon") == 0) {
++index;
if (!argv[index]) {
return -1;
}
state->window_icon = argv[index];
return 2;
}
if (SDL_strcasecmp(argv[index], "--center") == 0) { if (SDL_strcasecmp(argv[index], "--center") == 0) {
state->window_x = SDL_WINDOWPOS_CENTERED; state->window_x = SDL_WINDOWPOS_CENTERED;
state->window_y = SDL_WINDOWPOS_CENTERED; state->window_y = SDL_WINDOWPOS_CENTERED;
...@@ -611,6 +619,30 @@ PrintRenderer(SDL_RendererInfo * info) ...@@ -611,6 +619,30 @@ PrintRenderer(SDL_RendererInfo * info)
} }
} }
static SDL_Surface *
LoadIcon(const char *file)
{
SDL_Surface *icon;
/* Load the icon surface */
icon = SDL_LoadBMP(file);
if (icon == NULL) {
fprintf(stderr, "Couldn't load %s: %s\n", file, SDL_GetError());
return (NULL);
}
if (icon->format->palette == NULL) {
fprintf(stderr, "Icon must have a palette!\n");
SDL_FreeSurface(icon);
return (NULL);
}
/* Set the colorkey */
SDL_SetColorKey(icon, 1, *((Uint8 *) icon->pixels));
return (icon);
}
SDL_bool SDL_bool
CommonInit(CommonState * state) CommonInit(CommonState * state)
{ {
...@@ -791,6 +823,15 @@ CommonInit(CommonState * state) ...@@ -791,6 +823,15 @@ CommonInit(CommonState * state)
SDL_GetError()); SDL_GetError());
return SDL_FALSE; return SDL_FALSE;
} }
if (state->window_icon) {
SDL_Surface *icon = LoadIcon(state->window_icon);
if (icon) {
SDL_SetWindowIcon(state->windows[i], icon);
SDL_FreeSurface(icon);
}
}
SDL_ShowWindow(state->windows[i]); SDL_ShowWindow(state->windows[i]);
if (!state->skip_renderer if (!state->skip_renderer
...@@ -1017,6 +1058,9 @@ PrintEvent(SDL_Event * event) ...@@ -1017,6 +1058,9 @@ PrintEvent(SDL_Event * event)
fprintf(stderr, "Joystick %d: button %d released", fprintf(stderr, "Joystick %d: button %d released",
event->jbutton.which, event->jbutton.button); event->jbutton.which, event->jbutton.button);
break; break;
case SDL_CLIPBOARDUPDATE:
fprintf(stderr, "Clipboard updated");
break;
case SDL_QUIT: case SDL_QUIT:
fprintf(stderr, "Quit requested"); fprintf(stderr, "Quit requested");
break; break;
...@@ -1050,11 +1094,43 @@ CommonEvent(CommonState * state, SDL_Event * event, int *done) ...@@ -1050,11 +1094,43 @@ CommonEvent(CommonState * state, SDL_Event * event, int *done)
case SDL_KEYDOWN: case SDL_KEYDOWN:
switch (event->key.keysym.sym) { switch (event->key.keysym.sym) {
/* Add hotkeys here */ /* Add hotkeys here */
case SDLK_c:
if (event->key.keysym.mod & KMOD_CTRL) {
/* Ctrl-C copy awesome text! */
SDL_SetClipboardText("SDL rocks!\nYou know it!");
printf("Copied text to clipboard\n");
}
break;
case SDLK_v:
if (event->key.keysym.mod & KMOD_CTRL) {
/* Ctrl-V paste awesome text! */
char *text = SDL_GetClipboardText();
if (*text) {
printf("Clipboard: %s\n", text);
} else {
printf("Clipboard is empty\n");
}
SDL_free(text);
}
break;
case SDLK_g: case SDLK_g:
if (event->key.keysym.mod & KMOD_CTRL) { if (event->key.keysym.mod & KMOD_CTRL) {
/* Ctrl-G toggle grab */ /* Ctrl-G toggle grab */
} }
break; break;
case SDLK_m:
if (event->key.keysym.mod & KMOD_CTRL) {
/* Ctrl-M maximize */
/* FIXME: Which window has focus for this keyboard? */
for (i = 0; i < state->num_windows; ++i) {
if (SDL_GetWindowFlags(state->windows[i]) & SDL_WINDOW_MAXIMIZED) {
SDL_RestoreWindow(state->windows[i]);
} else {
SDL_MaximizeWindow(state->windows[i]);
}
}
}
break;
case SDLK_z: case SDLK_z:
if (event->key.keysym.mod & KMOD_CTRL) { if (event->key.keysym.mod & KMOD_CTRL) {
/* Ctrl-Z minimize */ /* Ctrl-Z minimize */
......
...@@ -24,6 +24,7 @@ typedef struct ...@@ -24,6 +24,7 @@ typedef struct
const char *videodriver; const char *videodriver;
int display; int display;
const char *window_title; const char *window_title;
const char *window_icon;
Uint32 window_flags; Uint32 window_flags;
int window_x; int window_x;
int window_y; int window_y;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment