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;
}; };
......
This diff is collapsed.
...@@ -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) | \
......
This diff is collapsed.
...@@ -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 */
......
This diff is collapsed.
/* /*
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);
......
This diff is collapsed.
...@@ -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