Date: Mon, 2 Mar 2009 16:27:42 +0200
authorSam Lantinga <slouken@libsdl.org>
Tue, 03 Mar 2009 04:21:51 +0000
changeset 30830bc41e0361d3
parent 3082 1c85c44557de
child 3084 fb256fee28d8
Date: Mon, 2 Mar 2009 16:27:42 +0200
From: "Mike Gorchak"
Subject: About QNX support in SDL 1.3

Right now I'm working on QNX SDL 1.3 drivers implementation and looks like a
lot of code must be completely reworked. But I'm ready for it :) Also I want
to add QNX Graphics Framework SDL driver, which is fullscreen graphics
framework, with support of hardware accelerated OpenGL ES implementations.
This Graphics Framework (called GF in QNX) could also use QNX Photon (window
manager GUI) as window manager.

In the attachment initial patch for QNX support in SDL 1.3
README.QNX
SDL.qpg.in
configure.in
include/SDL_config.h.in
include/SDL_opengles.h
src/video/SDL_sysvideo.h
src/video/SDL_video.c
src/video/photon/SDL_ph_events.c
src/video/photon/SDL_ph_events_c.h
src/video/photon/SDL_ph_gl.c
src/video/photon/SDL_ph_gl.h
src/video/photon/SDL_ph_image.c
src/video/photon/SDL_ph_image_c.h
src/video/photon/SDL_ph_modes.c
src/video/photon/SDL_ph_modes_c.h
src/video/photon/SDL_ph_mouse.c
src/video/photon/SDL_ph_mouse_c.h
src/video/photon/SDL_ph_video.c
src/video/photon/SDL_ph_video.h
src/video/photon/SDL_ph_wm.c
src/video/photon/SDL_ph_wm_c.h
src/video/photon/SDL_phyuv.c
src/video/photon/SDL_phyuv_c.h
src/video/qnxgf/SDL_qnxgf.c
     1.1 --- a/README.QNX	Fri Feb 27 09:51:55 2009 +0000
     1.2 +++ b/README.QNX	Tue Mar 03 04:21:51 2009 +0000
     1.3 @@ -1,155 +1,4 @@
     1.4  README.QNX by Mike Gorchak <mike@malva.ua>, <lestat@i.com.ua>
     1.5 -Last changed at 24 Apr 2004.
     1.6 +Last changed at 02 Mar 2009.
     1.7  
     1.8 -======================================================================
     1.9 -Table of Contents:
    1.10 -
    1.11 -1. OpenGL.
    1.12 -2. Wheel and multi-button mouses.
    1.13 -3. CDROM handling issues.
    1.14 -4. Hardware video overlays.
    1.15 -5. Shared library building.
    1.16 -6. Some building issues.
    1.17 -7. Environment variables.
    1.18 -
    1.19 -======================================================================
    1.20 -1. OpenGL:
    1.21 -
    1.22 -    OpenGL works well and is stable, but fullscreen mode has not  been
    1.23 -heavily tested yet.
    1.24 -    If you have QNX RtP version 6.1.0 or above you must  download  the
    1.25 -Photon3D runtime from http://developers.qnx.com or install it from the
    1.26 -public repository or from the public CD, available with QNX. OS versi-
    1.27 -ons below 6.1.0 are not supported.
    1.28 -    When creating an OpenGL context, software renderer mode is artifi-
    1.29 -cially selected (QSSL made acceleration  only  for  Voodoo  boards  in
    1.30 -fullscreen mode, sorry but I don't have this board  to  test  OpenGL -
    1.31 -maybe it works or maybe not :)). If you  want  acceleration - you  can
    1.32 -remove one line in the source code: find the  file SDL_ph_image.c  and
    1.33 -remove the following
    1.34 -
    1.35 -    OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FORCE_SW;
    1.36 -     
    1.37 -line in the ph_SetupOpenGLContext() function or change the argument to
    1.38 -PHOGL_ATTRIB_FORCE_HW or PHOGL_ATTRIB_FAVOR_HW.
    1.39 -
    1.40 -======================================================================
    1.41 -2. Wheel and multi-button mouses:
    1.42 -
    1.43 -    Photon emits  keyboard  events (key up and  down)  when the  mouse
    1.44 -wheel is moved. The key_scan field appears valid, and it contains zero.
    1.45 -That is a basic method of detecting  mouse  wheel events under Photon.
    1.46 -It looks like a hack, but it  works for me :) on various PC configura-
    1.47 -tions.
    1.48 -
    1.49 -I've tested it on:
    1.50 -
    1.51 -1. Genius Optical NetScroll/+ PS/2 (1 wheel)
    1.52 -2. A4Tech Optical GreatEye WheelMouse PS/2,  model: WOP-35.  (2 wheels
    1.53 -   + 2 additional buttons). The wheel for vertical scrolling  works as
    1.54 -   usual, but the second wheel for horizontal scrolling emits  two se-
    1.55 -   quential events up or down, so it can provide faster scrolling than
    1.56 -   the first wheel. Additional buttons don't emit  any  events, but it
    1.57 -   looks like they're handled by photon in an unusual way - like click
    1.58 -   to front, but works not with any window, looks like a fun bug-o-fe-
    1.59 -   ature :).
    1.60 -
    1.61 -======================================================================
    1.62 -3. CDROM handling issues:
    1.63 -
    1.64 -    Access to CDROM can only be  provided  with  'root'  privileges. I
    1.65 -can't do anything about that, /dev/cd0 has brw------- permissions  and
    1.66 -root:root rights.
    1.67 -
    1.68 -======================================================================
    1.69 -4. Hardware video overlays:
    1.70 -
    1.71 -    Overlays can flicker  during  window  movement,  resizing, etc. It
    1.72 -happens because the photon driver updates the real window contents be-
    1.73 -hind the overlay, then draws the temporary chroma key color  over  the
    1.74 -window contents. It can be done without using the chroma key but  that
    1.75 -causes the overlay to always be on top. So  flickering  during  window
    1.76 -movement is preferred instead.
    1.77 -    Double buffering code is temporarily disabled in the photon driver
    1.78 -code, because on my GF2-MX it can accidentally cause a buffer  switch,
    1.79 -which causes the old frame to show. S3 Savage4 has the  same  problem,
    1.80 -but ATI Rage 128 doesn't. I think it can be fixed later. Current  code
    1.81 -works very well, so maybe double buffering is not needed right now.
    1.82 -    Something strange happens when you try to move the window with the
    1.83 -overlay beyond the left border  of the screen. The  overlay  tries  to
    1.84 -stay at position x=0, but when attempting to move it  a  bit  more  it
    1.85 -jumps to position x=-60 (on GF2-MX, on ATI Rage128 this  value  a  bit
    1.86 -smaller). It's really strange, looks  like  the  overlay  doesn't like
    1.87 -negative coordinates.
    1.88 -
    1.89 -=======================================================================
    1.90 -5. Shared library building:
    1.91 -
    1.92 -    A shared library can be built, but before running  the  autogen.sh
    1.93 -script you must manually delete the libtool.m4 stuff from the acinclu-
    1.94 -de.m4 file (it comes after the ESD detection code up to the end of the
    1.95 -file), because the libtool stuff in the acinclude.m4 file was very old
    1.96 -in SDL distribution before the version 1.2.7 and doesn't knew anything
    1.97 -about QNX. SDL 1.2.7 distribution contains the  new libtool.m4 script,
    1.98 -but anyway  it  is  broken :), Just  remove  it, then  run "libtoolize
    1.99 ---force --copy",  delete the file aclocal.m4 if it is exists and after
   1.100 -that run the  autogen.sh script. SDL 1.2.8 contains  fixed libtool.m4,
   1.101 -ltmain.sh and config.sub files, so you  can  just  run  the autogen.sh
   1.102 -script.
   1.103 -
   1.104 -======================================================================
   1.105 -6. Some building issues:
   1.106 -
   1.107 -    Feel free to not use the --disable-shared configure option if you'
   1.108 -ve read the above comment about 'Shared  library  building'. Otherwise
   1.109 -this  option  is  strongly  recommended, as  without it the sdl-config
   1.110 -script will be broken.
   1.111 -
   1.112 -    Run the configure script without x11 support, e.g.:
   1.113 -
   1.114 -    a) for OpenGL support:
   1.115 -    ./configure --prefix=/usr           \
   1.116 -                --disable-video-x11     \
   1.117 -                --disable-shared
   1.118 -
   1.119 -    b) without OpenGL support:
   1.120 -    ./configure --prefix=/usr           \
   1.121 -                --disable-video-x11     \
   1.122 -                --disable-shared        \
   1.123 -                --disable-video-opengl
   1.124 -
   1.125 -    And of course dont forget to specify --disable-debug, which  is on
   1.126 -by default, to disable debug and enable the expensive optimizations.
   1.127 -
   1.128 -    In the test directory also run the ./configure script without
   1.129 -x11 support, e.g.:
   1.130 -
   1.131 -    ./configure  --with-sdl-prefix=/usr            \
   1.132 -                 --with-sdl-exec-prefix=/usr       \
   1.133 -                 --prefix=/usr --without-x
   1.134 -
   1.135 -======================================================================
   1.136 -7. Environment variables:
   1.137 -
   1.138 -    Please note that the photon driver  is  sensible to the  following
   1.139 -environmental variables:
   1.140 -
   1.141 - * SDL_PHOTON_FULLSCREEN_REFRESH - this environment variable  controls
   1.142 -the refresh  rate  in  all  fullscreen  modes. Be  carefull !!! Photon
   1.143 -drivers usually do not checking the maximum  refresh rate, which video
   1.144 -adapter or monitor supports.
   1.145 -
   1.146 - * SDL_VIDEO_WINDOW_POS - can be  set in the "X,Y" format.  If X and Y
   1.147 -coordinates are bigger than the current desktop resolution, then  win-
   1.148 -dow positioning across  virtual  consoles is activated. If X and Y are
   1.149 -smaller than the desktop resolution  then  window  positioning  in the
   1.150 -current console is activated. The word "center" can be used instead of
   1.151 -coordinates, it  produces  the  same  behavior  as  SDL_VIDEO_CENTERED
   1.152 -environmental variable.
   1.153 -
   1.154 - * SDL_VIDEO_CENTERED - if this environmental variable exists then the
   1.155 -window centering is perfomed in the current virtual console.
   1.156 -
   1.157 -Notes: The SDL_VIDEO_CENTERED enviromental  variable  has greater pri-
   1.158 -ority than the SDL_VIDEO_WINDOW_POS in case if both variables are sup-
   1.159 -plied to the application.
   1.160 +QNX Photon and GF drivers are under construction. Please be patient.
     2.1 --- a/SDL.qpg.in	Fri Feb 27 09:51:55 2009 +0000
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,140 +0,0 @@
     2.4 -<QPG:Generation>
     2.5 -   <QPG:Options>
     2.6 -      <QPG:User unattended="yes" verbosity="0" listfiles="yes"/>
     2.7 -      <QPG:Defaults type="qnx_package"/>
     2.8 -      <QPG:Source></QPG:Source>
     2.9 -      <QPG:Release date="today" number="+"/>
    2.10 -      <QPG:Build></QPG:Build>
    2.11 -      <QPG:FileSorting strip="yes"/>
    2.12 -      <QPG:Package targets="standart"/>
    2.13 -      <QPG:Repository generate="yes"/>
    2.14 -      <QPG:FinalDir></QPG:FinalDir>
    2.15 -      <QPG:Cleanup></QPG:Cleanup>
    2.16 -   </QPG:Options>
    2.17 -
    2.18 -   <QPG:Responsible>
    2.19 -      <QPG:Company>QNX.ORG.RU Community</QPG:Company>
    2.20 -      <QPG:Department></QPG:Department>
    2.21 -      <QPG:Group></QPG:Group>
    2.22 -      <QPG:Team>QNX.ORG.RU Team</QPG:Team>
    2.23 -      <QPG:Employee>Mike Gorchak</QPG:Employee>
    2.24 -      <QPG:EmailAddress>mike@malva.ua</QPG:EmailAddress>
    2.25 -   </QPG:Responsible>
    2.26 -
    2.27 -   <QPG:Values>
    2.28 -      <QPG:Files>
    2.29 -         <QPG:Add file="./COPYING" install="LicenseUrl/" handling="repdata"/>
    2.30 -         <QPG:Add permissions="0755" file="./src/.libs/libSDL-@SDL_MAJOR_VERSION@.@SDL_MINOR_VERSION@.so.@LT_AGE@" install="/usr/lib/"/>
    2.31 -         <QPG:Add filetype="symlink" file="libSDL.so" install="/usr/lib/" linkto="libSDL-@SDL_MAJOR_VERSION@.@SDL_MINOR_VERSION@.so.@LT_AGE@"/>
    2.32 -         <QPG:Add permissions="0644" file="./src/.libs/libSDL.a" install="/usr/lib/"/>
    2.33 -         <QPG:Add permissions="0644" file="./src/.libs/libSDL.lai" install="/usr/lib/libSDL.la"/>
    2.34 -         <QPG:Add permissions="0644" file="./src/main/libSDLmain.a" install="/usr/lib/"/>
    2.35 -         <QPG:Add permissions="0644" file="./include/*.h" install="/usr/include/SDL/"/>
    2.36 -         <QPG:Add permissions="0755" file="./sdl-config" install="/usr/bin/"/>
    2.37 -         <QPG:Add permissions="0644" file="./BUGS" install="/usr/share/doc/SDL12/"/>
    2.38 -         <QPG:Add permissions="0644" file="./COPYING" install="/usr/share/doc/SDL12/"/>
    2.39 -         <QPG:Add permissions="0644" file="./CREDITS" install="/usr/share/doc/SDL12/"/>
    2.40 -         <QPG:Add permissions="0644" file="./INSTALL" install="/usr/share/doc/SDL12/"/>
    2.41 -         <QPG:Add permissions="0644" file="./README" install="/usr/share/doc/SDL12/"/>
    2.42 -         <QPG:Add permissions="0644" file="./README-SDL.txt" install="/usr/share/doc/SDL12/"/>
    2.43 -         <QPG:Add permissions="0644" file="./README.CVS" install="/usr/share/doc/SDL12/"/>
    2.44 -         <QPG:Add permissions="0644" file="./README.QNX" install="/usr/share/doc/SDL12/"/>
    2.45 -         <QPG:Add permissions="0644" file="./TODO" install="/usr/share/doc/SDL12/"/>
    2.46 -         <QPG:Add permissions="0644" file="./WhatsNew" install="/usr/share/doc/SDL12/"/>
    2.47 -         <QPG:Add permissions="0644" file="./docs.html" install="/usr/share/doc/SDL12/Changes.html"/>
    2.48 -         <QPG:Add permissions="0644" file="./docs/index.html" install="/usr/share/doc/SDL12/docs/"/>
    2.49 -         <QPG:Add permissions="0644" file="./docs/html/*.html" install="/usr/share/doc/SDL12/docs/html/"/>
    2.50 -         <QPG:Add permissions="0644" file="./docs/man3/*.3" install="/usr/share/man/man3/"/>
    2.51 -         <QPG:Add permissions="0644" file="./sdl.m4" install="/usr/share/aclocal/"/>
    2.52 -      </QPG:Files>
    2.53 -      <QPG:PackageFilter>
    2.54 -         <QPM:PackageManifest>
    2.55 -
    2.56 -            <QPM:PackageDescription>
    2.57 -               <QPM:PackageType>Library</QPM:PackageType>
    2.58 -               <QPM:PackageName>SDL</QPM:PackageName>
    2.59 -               <QPM:PackageReleaseNumber>1</QPM:PackageReleaseNumber>
    2.60 -               <QPM:PackageRepository>http://qnx.org.ru/repository</QPM:PackageRepository>
    2.61 -               <QPM:FileVersion>2.6</QPM:FileVersion>
    2.62 -            </QPM:PackageDescription>
    2.63 -
    2.64 -            <QPM:ProductDescription>
    2.65 -               <QPM:ProductName>Simple DirectMedia Layer (SDL)</QPM:ProductName>
    2.66 -               <QPM:ProductIdentifier>SDL</QPM:ProductIdentifier>
    2.67 -               <QPM:ProductEmail>slouken@libsdl.org</QPM:ProductEmail>
    2.68 -               <QPM:VendorName>Public</QPM:VendorName>
    2.69 -               <QPM:VendorInstallName>public</QPM:VendorInstallName>
    2.70 -               <QPM:VendorURL>http://www.libsdl.org</QPM:VendorURL>
    2.71 -               <QPM:VendorEmbedURL/>
    2.72 -               <QPM:VendorEmail>slouken@libsdl.org</QPM:VendorEmail>
    2.73 -               <QPM:AuthorName>Sam Lantinga</QPM:AuthorName>
    2.74 -               <QPM:AuthorURL>http://www.libsdl.org</QPM:AuthorURL>
    2.75 -               <QPM:AuthorEmbedURL/>
    2.76 -               <QPM:AuthorEmail>slouken@libsdl.org</QPM:AuthorEmail>
    2.77 -               <QPM:ProductIconSmall/>
    2.78 -               <QPM:ProductIconLarge/>
    2.79 -               <QPM:ProductDescriptionShort>This is the Simple DirectMedia Layer (SDL), a generic API that provides low level access to audio, keyboard, mouse, and display framebuffer across multiple platforms.</QPM:ProductDescriptionShort>
    2.80 -               <QPM:ProductDescriptionLong>This is the Simple DirectMedia Layer (SDL), a generic API that provides low level access to audio, keyboard, mouse, and display framebuffer across multiple platforms. This is the libraries, include files and other resources you can use to develop and run SDL applications.</QPM:ProductDescriptionLong>
    2.81 -               <QPM:ProductDescriptionURL>http://www.libsdl.org</QPM:ProductDescriptionURL>
    2.82 -               <QPM:ProductDescriptionEmbedURL/>
    2.83 -            </QPM:ProductDescription>
    2.84 -
    2.85 -            <QPM:ReleaseDescription>
    2.86 -               <QPM:ReleaseVersion>@VERSION@</QPM:ReleaseVersion>
    2.87 -               <QPM:ReleaseUrgency>Medium</QPM:ReleaseUrgency>
    2.88 -               <QPM:ReleaseStability>Stable</QPM:ReleaseStability>
    2.89 -               <QPM:ReleaseNoteMinor/>
    2.90 -               <QPM:ReleaseNoteMajor/>
    2.91 -               <QPM:ReleaseBuild>1</QPM:ReleaseBuild>
    2.92 -               <QPM:CountryExclude/>
    2.93 -               <QPM:ReleaseCopyright>GNU Lesser General Public License</QPM:ReleaseCopyright>
    2.94 -            </QPM:ReleaseDescription>
    2.95 -
    2.96 -            <QPM:ContentDescription>
    2.97 -               <QPM:ContentTopic xmlmultiple="true">Software Development/Libraries and Extensions/C Libraries</QPM:ContentTopic>
    2.98 -               <QPM:ContentKeyword>SDL,audio,graphics,demos,games,emulators,direct,media,layer</QPM:ContentKeyword>
    2.99 -               <QPM:TargetOS>qnx6</QPM:TargetOS>
   2.100 -               <QPM:HostOS>none</QPM:HostOS>
   2.101 -               <QPM:DisplayEnvironment xmlmultiple="true">Photon</QPM:DisplayEnvironment>
   2.102 -               <QPM:DisplayEnvironment xmlmultiple="true">Console</QPM:DisplayEnvironment>
   2.103 -               <QPM:TargetAudience xmlmultiple="true">Developer</QPM:TargetAudience>
   2.104 -               <QPM:TargetAudience xmlmultiple="true">User</QPM:TargetAudience>
   2.105 -            </QPM:ContentDescription>
   2.106 -            <QPM:LicenseUrl>repdata://LicenseUrl/COPYING</QPM:LicenseUrl>
   2.107 -         </QPM:PackageManifest>
   2.108 -      </QPG:PackageFilter>
   2.109 -
   2.110 -      <QPG:PackageFilter proc="none" target="none">
   2.111 -         <QPM:PackageManifest>
   2.112 -            <QPM:ProductInstallationDependencies>
   2.113 -               <QPM:ProductRequirements></QPM:ProductRequirements>
   2.114 -            </QPM:ProductInstallationDependencies>
   2.115 -         </QPM:PackageManifest>
   2.116 -      </QPG:PackageFilter>
   2.117 -
   2.118 -      <QPG:PackageFilter proc="x86" target="none">
   2.119 -         <QPM:PackageManifest>
   2.120 -            <QPM:ProductInstallationDependencies>
   2.121 -               <QPM:ProductRequirements></QPM:ProductRequirements>
   2.122 -            </QPM:ProductInstallationDependencies>
   2.123 -         </QPM:PackageManifest>
   2.124 -      </QPG:PackageFilter>
   2.125 -
   2.126 -      <QPG:PackageFilter proc="none" target="x86">
   2.127 -         <QPM:PackageManifest>
   2.128 -            <QPM:ProductInstallationDependencies>
   2.129 -               <QPM:ProductRequirements></QPM:ProductRequirements>
   2.130 -            </QPM:ProductInstallationDependencies>
   2.131 -         </QPM:PackageManifest>
   2.132 -      </QPG:PackageFilter>
   2.133 -
   2.134 -      <QPG:PackageFilter proc="x86" target="x86">
   2.135 -         <QPM:PackageManifest>
   2.136 -            <QPM:ProductInstallationDependencies>
   2.137 -               <QPM:ProductRequirements></QPM:ProductRequirements>
   2.138 -            </QPM:ProductInstallationDependencies>
   2.139 -         </QPM:PackageManifest>
   2.140 -      </QPG:PackageFilter>
   2.141 -
   2.142 -   </QPG:Values>
   2.143 -</QPG:Generation>
     3.1 --- a/configure.in	Fri Feb 27 09:51:55 2009 +0000
     3.2 +++ b/configure.in	Tue Mar 03 04:21:51 2009 +0000
     3.3 @@ -1256,6 +1256,35 @@
     3.4      fi
     3.5  }
     3.6  
     3.7 +dnl Check for QNX photon video driver
     3.8 +CheckQNXGF()
     3.9 +{
    3.10 +    AC_ARG_ENABLE(video-qnxgf,
    3.11 +                  AC_HELP_STRING([--enable-video-qnxgf], [use QNX GF video driver [[default=yes]]]),
    3.12 +                  , enable_video_qnxgf=yes)
    3.13 +    if test x$enable_video = xyes -a x$enable_video_qnxgf = xyes; then
    3.14 +        AC_MSG_CHECKING(for QNX GF support)
    3.15 +        video_qnxgf=no
    3.16 +        AC_TRY_COMPILE([
    3.17 +          #include <gf/gf.h>
    3.18 +          #include <gf/gf3d.h>
    3.19 +        ],[
    3.20 +         gf_3d_config_info_t* gfinfo;
    3.21 +        ],[
    3.22 +        video_qnxgf=yes
    3.23 +        ])
    3.24 +        AC_MSG_RESULT($video_qnxgf)
    3.25 +        if test x$video_qnxgf = xyes; then
    3.26 +            AC_DEFINE(SDL_VIDEO_DRIVER_QNXGF)
    3.27 +            SOURCES="$SOURCES $srcdir/src/video/qnxgf/*.c"
    3.28 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lgf"
    3.29 +            have_video=yes
    3.30 +
    3.31 +            CheckOpenGLESQNX
    3.32 +        fi
    3.33 +    fi
    3.34 +}
    3.35 +
    3.36  dnl Set up the BWindow video driver if enabled
    3.37  CheckBWINDOW()
    3.38  {
    3.39 @@ -1639,11 +1668,11 @@
    3.40      fi
    3.41  }
    3.42  
    3.43 -dnl Find QNX RtP OpenGL
    3.44 +dnl Find QNX 6.x Software OpenGL
    3.45  CheckOpenGLQNX()
    3.46  {
    3.47      if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
    3.48 -        AC_MSG_CHECKING(for OpenGL (Photon) support)
    3.49 +        AC_MSG_CHECKING(for QNX 6.x Photon OpenGL support)
    3.50          video_opengl=no
    3.51          AC_TRY_COMPILE([
    3.52           #include <GL/gl.h>
    3.53 @@ -1660,6 +1689,43 @@
    3.54      fi
    3.55  }
    3.56  
    3.57 +dnl Find QNX 6.3 and above OpenGL ES implementation
    3.58 +CheckOpenGLESQNX()
    3.59 +{
    3.60 +    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
    3.61 +        AC_MSG_CHECKING(for QNX OpenGL ES (CM) support)
    3.62 +        video_opengl=no
    3.63 +        AC_TRY_COMPILE([
    3.64 +         #include <GLES/egl.h>
    3.65 +        ],[
    3.66 +        ],[
    3.67 +        video_opengl=yes
    3.68 +        ])
    3.69 +        AC_MSG_RESULT($video_opengl)
    3.70 +        if test x$video_opengl = xyes; then
    3.71 +            AC_DEFINE(SDL_VIDEO_OPENGL_ES)
    3.72 +            AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES)
    3.73 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGLES_CM"
    3.74 +        else
    3.75 +            AC_MSG_CHECKING(for QNX OpenGL ES (CL) support)
    3.76 +            video_opengl=no
    3.77 +            AC_TRY_COMPILE([
    3.78 +             #include <GLES/egl.h>
    3.79 +            ],[
    3.80 +            ],[
    3.81 +            video_opengl=yes
    3.82 +            ])
    3.83 +            AC_MSG_RESULT($video_opengl)
    3.84 +            if test x$video_opengl = xyes; then
    3.85 +                AC_DEFINE(SDL_VIDEO_OPENGL_ES)
    3.86 +                AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES)
    3.87 +                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGLES_CL"
    3.88 +            fi
    3.89 +        fi
    3.90 +    fi
    3.91 +}
    3.92 +
    3.93 +
    3.94  dnl Check for Win32 OpenGL
    3.95  CheckWIN32GL()
    3.96  {
    3.97 @@ -2406,16 +2472,27 @@
    3.98          fi
    3.99          ;;
   3.100      *-*-qnx*)
   3.101 +
   3.102 +        EXTRA_CFLAGS="-I/usr/include $CFLAGS"
   3.103 +        EXTRA_LDLAGS="-L/usr/lib $LDFLAGS"
   3.104 +
   3.105          ARCH=qnx
   3.106 +        CheckVisibilityHidden
   3.107          CheckDummyVideo
   3.108          CheckDiskAudio
   3.109          CheckDummyAudio
   3.110          CheckDLOPEN
   3.111 +        CheckPulseAudio
   3.112 +        CheckESD
   3.113          CheckNAS
   3.114          CheckPHOTON
   3.115 +        CheckQNXGF
   3.116          CheckX11
   3.117          CheckOpenGLX11
   3.118          CheckPTHREAD
   3.119 +        CheckClockGettime
   3.120 +
   3.121 +
   3.122          # Set up files for the audio library
   3.123          if test x$enable_audio = xyes; then
   3.124              AC_DEFINE(SDL_AUDIO_DRIVER_QNXNTO)
   3.125 @@ -2435,6 +2512,18 @@
   3.126              SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
   3.127              have_timers=yes
   3.128          fi
   3.129 +        # Set up dummy files for the joystick for now
   3.130 +        if test x$enable_joystick = xyes; then
   3.131 +            AC_DEFINE(SDL_JOYSTICK_DUMMY)
   3.132 +            SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
   3.133 +            have_joystick=yes
   3.134 +        fi
   3.135 +        # Set up dummy files for the haptic for now
   3.136 +        if test x$enable_haptic = xyes; then
   3.137 +            AC_DEFINE(SDL_HAPTIC_DUMMY)
   3.138 +            SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c"
   3.139 +            have_haptic=yes
   3.140 +        fi
   3.141          ;;
   3.142      *-*-cygwin* | *-*-mingw32*)
   3.143          ARCH=win32
   3.144 @@ -2865,7 +2954,7 @@
   3.145  AC_SUBST(WINDRES)
   3.146  
   3.147  AC_OUTPUT([
   3.148 -    Makefile sdl-config SDL.spec SDL.qpg sdl.pc
   3.149 +    Makefile sdl-config SDL.spec sdl.pc
   3.150  ], [
   3.151      : >build-deps
   3.152      if test x"$MAKE" = x; then MAKE=make; fi; $MAKE depend
     4.1 --- a/include/SDL_config.h.in	Fri Feb 27 09:51:55 2009 +0000
     4.2 +++ b/include/SDL_config.h.in	Tue Mar 03 04:21:51 2009 +0000
     4.3 @@ -285,6 +285,7 @@
     4.4  #undef SDL_VIDEO_DRIVER_NDS
     4.5  #undef SDL_VIDEO_DRIVER_OS2FS
     4.6  #undef SDL_VIDEO_DRIVER_PHOTON
     4.7 +#undef SDL_VIDEO_DRIVER_QNXGF
     4.8  #undef SDL_VIDEO_DRIVER_PS2GS
     4.9  #undef SDL_VIDEO_DRIVER_RISCOS
    4.10  #undef SDL_VIDEO_DRIVER_SVGALIB
     5.1 --- a/include/SDL_opengles.h	Fri Feb 27 09:51:55 2009 +0000
     5.2 +++ b/include/SDL_opengles.h	Tue Mar 03 04:21:51 2009 +0000
     5.3 @@ -40,6 +40,10 @@
     5.4  #include <OpenGLES/ES1/gl.h>    /* Header File For The OpenGL ES Library */
     5.5  #endif
     5.6  
     5.7 +#if defined(__QNXNTO__) && defined(SDL_VIDEO_OPENGL_ES)
     5.8 +#include <GLES/egl.h>
     5.9 +#endif
    5.10 +
    5.11  #ifndef APIENTRY
    5.12  #define APIENTRY
    5.13  #endif
     6.1 --- a/src/video/SDL_sysvideo.h	Fri Feb 27 09:51:55 2009 +0000
     6.2 +++ b/src/video/SDL_sysvideo.h	Tue Mar 03 04:21:51 2009 +0000
     6.3 @@ -369,7 +369,10 @@
     6.4  extern VideoBootStrap BWINDOW_bootstrap;
     6.5  #endif
     6.6  #if SDL_VIDEO_DRIVER_PHOTON
     6.7 -extern VideoBootStrap ph_bootstrap;
     6.8 +extern VideoBootStrap photon_bootstrap;
     6.9 +#endif
    6.10 +#if SDL_VIDEO_DRIVER_QNXGF
    6.11 +extern VideoBootStrap qnxgf_bootstrap;
    6.12  #endif
    6.13  #if SDL_VIDEO_DRIVER_EPOC
    6.14  extern VideoBootStrap EPOC_bootstrap;
     7.1 --- a/src/video/SDL_video.c	Fri Feb 27 09:51:55 2009 +0000
     7.2 +++ b/src/video/SDL_video.c	Tue Mar 03 04:21:51 2009 +0000
     7.3 @@ -89,7 +89,10 @@
     7.4      &BWINDOW_bootstrap,
     7.5  #endif
     7.6  #if SDL_VIDEO_DRIVER_PHOTON
     7.7 -    &ph_bootstrap,
     7.8 +    &photon_bootstrap,
     7.9 +#endif
    7.10 +#if SDL_VIDEO_DRIVER_QNXGF
    7.11 +    &qnxgf_bootstrap,
    7.12  #endif
    7.13  #if SDL_VIDEO_DRIVER_EPOC
    7.14      &EPOC_bootstrap,
     8.1 --- a/src/video/photon/SDL_ph_events.c	Fri Feb 27 09:51:55 2009 +0000
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,622 +0,0 @@
     8.4 -/*
     8.5 -    SDL - Simple DirectMedia Layer
     8.6 -    Copyright (C) 1997-2009 Sam Lantinga
     8.7 -
     8.8 -    This library is free software; you can redistribute it and/or
     8.9 -    modify it under the terms of the GNU Lesser General Public
    8.10 -    License as published by the Free Software Foundation; either
    8.11 -    version 2.1 of the License, or (at your option) any later version.
    8.12 -
    8.13 -    This library is distributed in the hope that it will be useful,
    8.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
    8.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    8.16 -    Lesser General Public License for more details.
    8.17 -
    8.18 -    You should have received a copy of the GNU Lesser General Public
    8.19 -    License along with this library; if not, write to the Free Software
    8.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    8.21 -
    8.22 -    Sam Lantinga
    8.23 -    slouken@libsdl.org
    8.24 -*/
    8.25 -#include "SDL_config.h"
    8.26 -
    8.27 -/* Handle the event stream, converting photon events into SDL events */
    8.28 -
    8.29 -#include <stdio.h>
    8.30 -#include <setjmp.h>
    8.31 -#include <sys/time.h>
    8.32 -
    8.33 -#include <Ph.h>
    8.34 -#include <photon/PkKeyDef.h>
    8.35 -
    8.36 -#include "SDL_syswm.h"
    8.37 -#include "../SDL_sysvideo.h"
    8.38 -#include "../../events/SDL_sysevents.h"
    8.39 -#include "../../events/SDL_events_c.h"
    8.40 -#include "SDL_ph_video.h"
    8.41 -#include "SDL_ph_modes_c.h"
    8.42 -#include "SDL_ph_image_c.h"
    8.43 -#include "SDL_ph_events_c.h"
    8.44 -#include "SDL_phyuv_c.h"
    8.45 -
    8.46 -/* The translation tables from a photon keysym to a SDL keysym */
    8.47 -static SDLKey ODD_keymap[256];
    8.48 -static SDLKey MISC_keymap[0xFF + 1];
    8.49 -SDL_keysym *ph_TranslateKey(PhKeyEvent_t * key, SDL_keysym * keysym);
    8.50 -
    8.51 -/* Check to see if this is a repeated key.
    8.52 -   (idea shamelessly lifted from GII -- thanks guys! :) */
    8.53 -static int
    8.54 -ph_WarpedMotion(_THIS, PhEvent_t * winEvent)
    8.55 -{
    8.56 -    PhRect_t *rect = PhGetRects(winEvent);
    8.57 -
    8.58 -    int centre_x, centre_y;
    8.59 -    int dx, dy;
    8.60 -    short abs_x, abs_y;
    8.61 -    int posted;
    8.62 -
    8.63 -    centre_x = SDL_VideoSurface->w / 2;
    8.64 -    centre_y = SDL_VideoSurface->h / 2;
    8.65 -
    8.66 -    dx = rect->ul.x - centre_x;
    8.67 -    dy = rect->ul.y - centre_y;
    8.68 -
    8.69 -    posted = SDL_PrivateMouseMotion(0, 1, dx, dy);
    8.70 -
    8.71 -    /* Move mouse cursor to middle of the window */
    8.72 -    PtGetAbsPosition(window, &abs_x, &abs_y);
    8.73 -    PhMoveCursorAbs(PhInputGroup(NULL), abs_x + centre_x, abs_y + centre_y);
    8.74 -
    8.75 -    return (posted);
    8.76 -}
    8.77 -
    8.78 -/* Control which motion flags the window has set, a flags value of -1 sets
    8.79 - * MOTION_BUTTON and MOTION_NOBUTTON */
    8.80 -
    8.81 -static void
    8.82 -set_motion_sensitivity(_THIS, unsigned int flags)
    8.83 -{
    8.84 -    int rid;
    8.85 -    int fields = Ph_EV_PTR_MOTION_BUTTON | Ph_EV_PTR_MOTION_NOBUTTON;
    8.86 -    PhRegion_t region;
    8.87 -
    8.88 -    if (window) {
    8.89 -        rid = PtWidgetRid(window);
    8.90 -        if (rid != 0 && PhRegionQuery(rid, &region, NULL, NULL, 0) == 0) {
    8.91 -            region.events_sense =
    8.92 -                (region.events_sense & ~fields) | (flags & fields);
    8.93 -            PhRegionChange(Ph_REGION_EV_SENSE, 0, &region, NULL, NULL);
    8.94 -        }
    8.95 -    }
    8.96 -}
    8.97 -
    8.98 -/* Convert the photon button state value to an SDL value */
    8.99 -static Uint8
   8.100 -ph2sdl_mousebutton(unsigned short button_state)
   8.101 -{
   8.102 -    Uint8 mouse_button = 0;
   8.103 -
   8.104 -    if (button_state & Ph_BUTTON_SELECT)
   8.105 -        mouse_button |= SDL_BUTTON_LEFT;
   8.106 -    if (button_state & Ph_BUTTON_MENU)
   8.107 -        mouse_button |= SDL_BUTTON_RIGHT;
   8.108 -    if (button_state & Ph_BUTTON_ADJUST)
   8.109 -        mouse_button |= SDL_BUTTON_MIDDLE;
   8.110 -
   8.111 -    return (mouse_button);
   8.112 -}
   8.113 -
   8.114 -static int
   8.115 -ph_DispatchEvent(_THIS)
   8.116 -{
   8.117 -    int posted;
   8.118 -    PhRect_t *rect;
   8.119 -    PhPointerEvent_t *pointerEvent;
   8.120 -    PhKeyEvent_t *keyEvent;
   8.121 -    PhWindowEvent_t *winEvent;
   8.122 -    int i, buttons;
   8.123 -    SDL_Rect sdlrects[PH_SDL_MAX_RECTS];
   8.124 -
   8.125 -    posted = 0;
   8.126 -
   8.127 -    switch (phevent->type) {
   8.128 -    case Ph_EV_BOUNDARY:
   8.129 -        {
   8.130 -            if (phevent->subtype == Ph_EV_PTR_ENTER) {
   8.131 -                posted = SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
   8.132 -            } else if (phevent->subtype == Ph_EV_PTR_LEAVE) {
   8.133 -                posted = SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS);
   8.134 -            }
   8.135 -        }
   8.136 -        break;
   8.137 -
   8.138 -    case Ph_EV_PTR_MOTION_BUTTON:
   8.139 -    case Ph_EV_PTR_MOTION_NOBUTTON:
   8.140 -        {
   8.141 -            if (SDL_VideoSurface) {
   8.142 -                pointerEvent = PhGetData(phevent);
   8.143 -                rect = PhGetRects(phevent);
   8.144 -
   8.145 -                if (mouse_relative) {
   8.146 -                    posted = ph_WarpedMotion(this, phevent);
   8.147 -                } else {
   8.148 -                    posted =
   8.149 -                        SDL_PrivateMouseMotion(0, 0, rect->ul.x, rect->ul.y);
   8.150 -                }
   8.151 -            }
   8.152 -        }
   8.153 -        break;
   8.154 -
   8.155 -    case Ph_EV_BUT_PRESS:
   8.156 -        {
   8.157 -            pointerEvent = PhGetData(phevent);
   8.158 -            buttons = ph2sdl_mousebutton(pointerEvent->buttons);
   8.159 -            if (buttons != 0) {
   8.160 -                posted = SDL_PrivateMouseButton(SDL_PRESSED, buttons, 0, 0);
   8.161 -            }
   8.162 -        }
   8.163 -        break;
   8.164 -
   8.165 -    case Ph_EV_BUT_RELEASE:
   8.166 -        {
   8.167 -            pointerEvent = PhGetData(phevent);
   8.168 -            buttons = ph2sdl_mousebutton(pointerEvent->buttons);
   8.169 -            if (phevent->subtype == Ph_EV_RELEASE_REAL && buttons != 0) {
   8.170 -                posted = SDL_PrivateMouseButton(SDL_RELEASED, buttons, 0, 0);
   8.171 -            } else if (phevent->subtype == Ph_EV_RELEASE_PHANTOM) {
   8.172 -                /* If the mouse is outside the window,
   8.173 -                 * only a phantom release event is sent, so
   8.174 -                 * check if the window doesn't have mouse focus.
   8.175 -                 * Not perfect, maybe checking the mouse button
   8.176 -                 * state for Ph_EV_BOUNDARY events would be
   8.177 -                 * better. */
   8.178 -                if ((SDL_GetAppState() & SDL_APPMOUSEFOCUS) == 0) {
   8.179 -                    posted =
   8.180 -                        SDL_PrivateMouseButton(SDL_RELEASED, buttons, 0, 0);
   8.181 -                }
   8.182 -            }
   8.183 -        }
   8.184 -        break;
   8.185 -
   8.186 -    case Ph_EV_WM:
   8.187 -        {
   8.188 -            winEvent = PhGetData(phevent);
   8.189 -
   8.190 -            /* losing focus */
   8.191 -            if ((winEvent->event_f == Ph_WM_FOCUS)
   8.192 -                && (winEvent->event_state == Ph_WM_EVSTATE_FOCUSLOST)) {
   8.193 -                set_motion_sensitivity(this, Ph_EV_PTR_MOTION_BUTTON);
   8.194 -                posted = SDL_PrivateAppActive(0, SDL_APPINPUTFOCUS);
   8.195 -            }
   8.196 -            /* gaining focus */
   8.197 -            else if ((winEvent->event_f == Ph_WM_FOCUS)
   8.198 -                     && (winEvent->event_state == Ph_WM_EVSTATE_FOCUS)) {
   8.199 -                set_motion_sensitivity(this, -1);
   8.200 -                posted = SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS);
   8.201 -            }
   8.202 -            /* request quit */
   8.203 -            else if (winEvent->event_f == Ph_WM_CLOSE) {
   8.204 -                posted = SDL_PrivateQuit();
   8.205 -            }
   8.206 -            /* request hide/unhide */
   8.207 -            else if (winEvent->event_f == Ph_WM_HIDE) {
   8.208 -                if (currently_hided) {
   8.209 -                    /* got unhide window event                                */
   8.210 -                    /* TODO: restore application's palette if in palette mode */
   8.211 -                    currently_hided = 0;
   8.212 -                } else {
   8.213 -                    /* got hide window event                                  */
   8.214 -                    /* TODO: restore original palette if in palette mode      */
   8.215 -                    currently_hided = 1;
   8.216 -                }
   8.217 -            }
   8.218 -            /* request to resize */
   8.219 -            else if (winEvent->event_f == Ph_WM_RESIZE) {
   8.220 -                currently_maximized = 0;
   8.221 -#if (_NTO_VERSION < 630)
   8.222 -                SDL_PrivateResize(winEvent->size.w + 1, winEvent->size.h + 1);
   8.223 -#else
   8.224 -                /* QNX 6.3.0 have this bug fixed */
   8.225 -                SDL_PrivateResize(winEvent->size.w, winEvent->size.h);
   8.226 -#endif /* _NTO_VERSION */
   8.227 -            }
   8.228 -            /* request to move */
   8.229 -            else if (winEvent->event_f == Ph_WM_MOVE) {
   8.230 -                if (current_overlay != NULL) {
   8.231 -                    int lockedstate = current_overlay->hwdata->locked;
   8.232 -                    int chromastate = current_overlay->hwdata->ischromakey;
   8.233 -                    int error;
   8.234 -                    SDL_Rect src, dst;
   8.235 -
   8.236 -                    current_overlay->hwdata->locked = 1;
   8.237 -                    src.x = 0;
   8.238 -                    src.y = 0;
   8.239 -                    src.w = current_overlay->w;
   8.240 -                    src.y = current_overlay->h;
   8.241 -                    dst.x = current_overlay->hwdata->CurrentViewPort.pos.x;
   8.242 -                    dst.y = current_overlay->hwdata->CurrentViewPort.pos.y;
   8.243 -                    dst.w = current_overlay->hwdata->CurrentViewPort.size.w;
   8.244 -                    dst.h = current_overlay->hwdata->CurrentViewPort.size.h;
   8.245 -                    current_overlay->hwdata->ischromakey = 0;
   8.246 -                    error =
   8.247 -                        ph_DisplayYUVOverlay(this, current_overlay,
   8.248 -                                             &src, &dst);
   8.249 -                    if (!error) {
   8.250 -                        current_overlay->hwdata->ischromakey = chromastate;
   8.251 -                        current_overlay->hwdata->locked = lockedstate;
   8.252 -                    }
   8.253 -                }
   8.254 -            }
   8.255 -            /* maximize request */
   8.256 -            else if (winEvent->event_f == Ph_WM_MAX) {
   8.257 -                /* window already moved and resized here */
   8.258 -                currently_maximized = 1;
   8.259 -            }
   8.260 -            /* restore request */
   8.261 -            else if (winEvent->event_f == Ph_WM_RESTORE) {
   8.262 -                /* window already moved and resized here */
   8.263 -                currently_maximized = 0;
   8.264 -            }
   8.265 -        }
   8.266 -        break;
   8.267 -
   8.268 -        /* window has been resized, moved or removed */
   8.269 -    case Ph_EV_EXPOSE:
   8.270 -        {
   8.271 -            if (phevent->num_rects != 0) {
   8.272 -                int numrects;
   8.273 -
   8.274 -                if (SDL_VideoSurface) {
   8.275 -                    rect = PhGetRects(phevent);
   8.276 -                    if (phevent->num_rects > PH_SDL_MAX_RECTS) {
   8.277 -                        /* sorry, buffers underrun, we'll update only first PH_SDL_MAX_RECTS rects */
   8.278 -                        numrects = PH_SDL_MAX_RECTS;
   8.279 -                    }
   8.280 -
   8.281 -                    for (i = 0; i < phevent->num_rects; i++) {
   8.282 -                        sdlrects[i].x = rect[i].ul.x;
   8.283 -                        sdlrects[i].y = rect[i].ul.y;
   8.284 -                        sdlrects[i].w = rect[i].lr.x - rect[i].ul.x + 1;
   8.285 -                        sdlrects[i].h = rect[i].lr.y - rect[i].ul.y + 1;
   8.286 -                    }
   8.287 -
   8.288 -                    this->UpdateRects(this, phevent->num_rects, sdlrects);
   8.289 -
   8.290 -                    if (current_overlay != NULL) {
   8.291 -                        int lockedstate = current_overlay->hwdata->locked;
   8.292 -                        int error;
   8.293 -                        SDL_Rect src, dst;
   8.294 -
   8.295 -                        current_overlay->hwdata->locked = 1;
   8.296 -                        src.x = 0;
   8.297 -                        src.y = 0;
   8.298 -                        src.w = current_overlay->w;
   8.299 -                        src.y = current_overlay->h;
   8.300 -                        dst.x =
   8.301 -                            current_overlay->hwdata->CurrentViewPort.pos.x;
   8.302 -                        dst.y =
   8.303 -                            current_overlay->hwdata->CurrentViewPort.pos.y;
   8.304 -                        dst.w =
   8.305 -                            current_overlay->hwdata->CurrentViewPort.size.w;
   8.306 -                        dst.h =
   8.307 -                            current_overlay->hwdata->CurrentViewPort.size.h;
   8.308 -                        current_overlay->hwdata->forcedredraw = 1;
   8.309 -                        error =
   8.310 -                            ph_DisplayYUVOverlay(this,
   8.311 -                                                 current_overlay, &src, &dst);
   8.312 -                        if (!error) {
   8.313 -                            current_overlay->hwdata->forcedredraw = 0;
   8.314 -                            current_overlay->hwdata->locked = lockedstate;
   8.315 -                        }
   8.316 -                    }
   8.317 -                }
   8.318 -            }
   8.319 -        }
   8.320 -        break;
   8.321 -
   8.322 -    case Ph_EV_KEY:
   8.323 -        {
   8.324 -            SDL_keysym keysym;
   8.325 -
   8.326 -            posted = 0;
   8.327 -
   8.328 -            keyEvent = PhGetData(phevent);
   8.329 -
   8.330 -            if (Pk_KF_Key_Down & keyEvent->key_flags) {
   8.331 -                /* split the wheel events from real key events */
   8.332 -                if ((keyEvent->key_cap == Pk_Up)
   8.333 -                    && (keyEvent->key_scan == 0)
   8.334 -                    && ((keyEvent->key_flags & Pk_KF_Scan_Valid) ==
   8.335 -                        Pk_KF_Scan_Valid)) {
   8.336 -                    posted =
   8.337 -                        SDL_PrivateMouseButton(SDL_PRESSED,
   8.338 -                                               SDL_BUTTON_WHEELUP, 0, 0);
   8.339 -                    break;
   8.340 -                }
   8.341 -                if ((keyEvent->key_cap == Pk_Down)
   8.342 -                    && (keyEvent->key_scan == 0)
   8.343 -                    && ((keyEvent->key_flags & Pk_KF_Scan_Valid) ==
   8.344 -                        Pk_KF_Scan_Valid)) {
   8.345 -                    posted =
   8.346 -                        SDL_PrivateMouseButton(SDL_PRESSED,
   8.347 -                                               SDL_BUTTON_WHEELDOWN, 0, 0);
   8.348 -                    break;
   8.349 -                }
   8.350 -                posted =
   8.351 -                    SDL_PrivateKeyboard(SDL_PRESSED,
   8.352 -                                        ph_TranslateKey(keyEvent, &keysym));
   8.353 -            } else {            /* must be key release */
   8.354 -
   8.355 -                /* split the wheel events from real key events */
   8.356 -                if ((keyEvent->key_cap == Pk_Up)
   8.357 -                    && (keyEvent->key_scan == 0)
   8.358 -                    && ((keyEvent->key_flags & Pk_KF_Scan_Valid) ==
   8.359 -                        Pk_KF_Scan_Valid)) {
   8.360 -                    posted =
   8.361 -                        SDL_PrivateMouseButton(SDL_RELEASED,
   8.362 -                                               SDL_BUTTON_WHEELUP, 0, 0);
   8.363 -                    break;
   8.364 -                }
   8.365 -                if ((keyEvent->key_cap == Pk_Down)
   8.366 -                    && (keyEvent->key_scan == 0)
   8.367 -                    && ((keyEvent->key_flags & Pk_KF_Scan_Valid) ==
   8.368 -                        Pk_KF_Scan_Valid)) {
   8.369 -                    posted =
   8.370 -                        SDL_PrivateMouseButton(SDL_RELEASED,
   8.371 -                                               SDL_BUTTON_WHEELDOWN, 0, 0);
   8.372 -                    break;
   8.373 -                }
   8.374 -                posted =
   8.375 -                    SDL_PrivateKeyboard(SDL_RELEASED,
   8.376 -                                        ph_TranslateKey(keyEvent, &keysym));
   8.377 -            }
   8.378 -        }
   8.379 -        break;
   8.380 -
   8.381 -    case Ph_EV_INFO:
   8.382 -        {
   8.383 -            if (phevent->subtype == Ph_OFFSCREEN_INVALID) {
   8.384 -                unsigned long *EvInfoData;
   8.385 -
   8.386 -                EvInfoData = (unsigned long *) PhGetData(phevent);
   8.387 -
   8.388 -                switch (*EvInfoData) {
   8.389 -                case Pg_VIDEO_MODE_SWITCHED:
   8.390 -                    {
   8.391 -                    }
   8.392 -                    break;
   8.393 -                case Pg_ENTERED_DIRECT:
   8.394 -                    {
   8.395 -                    }
   8.396 -                    break;
   8.397 -                case Pg_EXITED_DIRECT:
   8.398 -                    {
   8.399 -                    }
   8.400 -                    break;
   8.401 -                case Pg_DRIVER_STARTED:
   8.402 -                    {
   8.403 -                    }
   8.404 -                    break;
   8.405 -                }
   8.406 -            }
   8.407 -        }
   8.408 -        break;
   8.409 -    }
   8.410 -
   8.411 -    return (posted);
   8.412 -}
   8.413 -
   8.414 -/* perform a blocking read if no events available */
   8.415 -int
   8.416 -ph_Pending(_THIS)
   8.417 -{
   8.418 -    /* Flush the display connection and look to see if events are queued */
   8.419 -    PgFlush();
   8.420 -
   8.421 -    while (1) {
   8.422 -        switch (PhEventPeek(phevent, EVENT_SIZE)) {
   8.423 -        case Ph_EVENT_MSG:
   8.424 -            return 1;
   8.425 -        case -1:
   8.426 -            SDL_SetError("ph_Pending(): PhEventNext failed.\n");
   8.427 -            return 0;
   8.428 -        default:
   8.429 -            return 0;
   8.430 -        }
   8.431 -    }
   8.432 -
   8.433 -    /* Oh well, nothing is ready .. */
   8.434 -    return (0);
   8.435 -}
   8.436 -
   8.437 -void
   8.438 -ph_PumpEvents(_THIS)
   8.439 -{
   8.440 -    /* Flush the display connection and look to see if events are queued */
   8.441 -    PgFlush();
   8.442 -
   8.443 -    while (ph_Pending(this)) {
   8.444 -        PtEventHandler(phevent);
   8.445 -        ph_DispatchEvent(this);
   8.446 -    }
   8.447 -}
   8.448 -
   8.449 -void
   8.450 -ph_InitKeymap(void)
   8.451 -{
   8.452 -    int i;
   8.453 -
   8.454 -    /* Odd keys used in international keyboards */
   8.455 -    for (i = 0; i < SDL_arraysize(ODD_keymap); ++i) {
   8.456 -        ODD_keymap[i] = SDLK_UNKNOWN;
   8.457 -    }
   8.458 -
   8.459 -    /* Map the miscellaneous keys */
   8.460 -    for (i = 0; i < SDL_arraysize(MISC_keymap); ++i) {
   8.461 -        MISC_keymap[i] = SDLK_UNKNOWN;
   8.462 -    }
   8.463 -
   8.464 -    MISC_keymap[Pk_BackSpace & 0xFF] = SDLK_BACKSPACE;
   8.465 -    MISC_keymap[Pk_Tab & 0xFF] = SDLK_TAB;
   8.466 -    MISC_keymap[Pk_Clear & 0xFF] = SDLK_CLEAR;
   8.467 -    MISC_keymap[Pk_Return & 0xFF] = SDLK_RETURN;
   8.468 -    MISC_keymap[Pk_Pause & 0xFF] = SDLK_PAUSE;
   8.469 -    MISC_keymap[Pk_Escape & 0xFF] = SDLK_ESCAPE;
   8.470 -    MISC_keymap[Pk_Delete & 0xFF] = SDLK_DELETE;
   8.471 -
   8.472 -    MISC_keymap[Pk_KP_0 & 0xFF] = SDLK_KP0;
   8.473 -    MISC_keymap[Pk_KP_1 & 0xFF] = SDLK_KP1;
   8.474 -    MISC_keymap[Pk_KP_2 & 0xFF] = SDLK_KP2;
   8.475 -    MISC_keymap[Pk_KP_3 & 0xFF] = SDLK_KP3;
   8.476 -    MISC_keymap[Pk_KP_4 & 0xFF] = SDLK_KP4;
   8.477 -    MISC_keymap[Pk_KP_5 & 0xFF] = SDLK_KP5;
   8.478 -    MISC_keymap[Pk_KP_6 & 0xFF] = SDLK_KP6;
   8.479 -    MISC_keymap[Pk_KP_7 & 0xFF] = SDLK_KP7;
   8.480 -    MISC_keymap[Pk_KP_8 & 0xFF] = SDLK_KP8;
   8.481 -    MISC_keymap[Pk_KP_9 & 0xFF] = SDLK_KP9;
   8.482 -
   8.483 -    MISC_keymap[Pk_KP_Decimal & 0xFF] = SDLK_KP_PERIOD;
   8.484 -    MISC_keymap[Pk_KP_Divide & 0xFF] = SDLK_KP_DIVIDE;
   8.485 -    MISC_keymap[Pk_KP_Multiply & 0xFF] = SDLK_KP_MULTIPLY;
   8.486 -    MISC_keymap[Pk_KP_Subtract & 0xFF] = SDLK_KP_MINUS;
   8.487 -    MISC_keymap[Pk_KP_Add & 0xFF] = SDLK_KP_PLUS;
   8.488 -    MISC_keymap[Pk_KP_Enter & 0xFF] = SDLK_KP_ENTER;
   8.489 -    MISC_keymap[Pk_KP_Equal & 0xFF] = SDLK_KP_EQUALS;
   8.490 -
   8.491 -    MISC_keymap[Pk_Up & 0xFF] = SDLK_UP;
   8.492 -    MISC_keymap[Pk_Down & 0xFF] = SDLK_DOWN;
   8.493 -    MISC_keymap[Pk_Right & 0xFF] = SDLK_RIGHT;
   8.494 -    MISC_keymap[Pk_Left & 0xFF] = SDLK_LEFT;
   8.495 -    MISC_keymap[Pk_Insert & 0xFF] = SDLK_INSERT;
   8.496 -    MISC_keymap[Pk_Home & 0xFF] = SDLK_HOME;
   8.497 -    MISC_keymap[Pk_End & 0xFF] = SDLK_END;
   8.498 -    MISC_keymap[Pk_Pg_Up & 0xFF] = SDLK_PAGEUP;
   8.499 -    MISC_keymap[Pk_Pg_Down & 0xFF] = SDLK_PAGEDOWN;
   8.500 -
   8.501 -    MISC_keymap[Pk_F1 & 0xFF] = SDLK_F1;
   8.502 -    MISC_keymap[Pk_F2 & 0xFF] = SDLK_F2;
   8.503 -    MISC_keymap[Pk_F3 & 0xFF] = SDLK_F3;
   8.504 -    MISC_keymap[Pk_F4 & 0xFF] = SDLK_F4;
   8.505 -    MISC_keymap[Pk_F5 & 0xFF] = SDLK_F5;
   8.506 -    MISC_keymap[Pk_F6 & 0xFF] = SDLK_F6;
   8.507 -    MISC_keymap[Pk_F7 & 0xFF] = SDLK_F7;
   8.508 -    MISC_keymap[Pk_F8 & 0xFF] = SDLK_F8;
   8.509 -    MISC_keymap[Pk_F9 & 0xFF] = SDLK_F9;
   8.510 -    MISC_keymap[Pk_F10 & 0xFF] = SDLK_F10;
   8.511 -    MISC_keymap[Pk_F11 & 0xFF] = SDLK_F11;
   8.512 -    MISC_keymap[Pk_F12 & 0xFF] = SDLK_F12;
   8.513 -    MISC_keymap[Pk_F13 & 0xFF] = SDLK_F13;
   8.514 -    MISC_keymap[Pk_F14 & 0xFF] = SDLK_F14;
   8.515 -    MISC_keymap[Pk_F15 & 0xFF] = SDLK_F15;
   8.516 -
   8.517 -    MISC_keymap[Pk_Num_Lock & 0xFF] = SDLK_NUMLOCK;
   8.518 -    MISC_keymap[Pk_Caps_Lock & 0xFF] = SDLK_CAPSLOCK;
   8.519 -    MISC_keymap[Pk_Scroll_Lock & 0xFF] = SDLK_SCROLLOCK;
   8.520 -    MISC_keymap[Pk_Shift_R & 0xFF] = SDLK_RSHIFT;
   8.521 -    MISC_keymap[Pk_Shift_L & 0xFF] = SDLK_LSHIFT;
   8.522 -    MISC_keymap[Pk_Control_R & 0xFF] = SDLK_RCTRL;
   8.523 -    MISC_keymap[Pk_Control_L & 0xFF] = SDLK_LCTRL;
   8.524 -    MISC_keymap[Pk_Alt_R & 0xFF] = SDLK_RALT;
   8.525 -    MISC_keymap[Pk_Alt_L & 0xFF] = SDLK_LALT;
   8.526 -    MISC_keymap[Pk_Meta_R & 0xFF] = SDLK_RMETA;
   8.527 -    MISC_keymap[Pk_Meta_L & 0xFF] = SDLK_LMETA;
   8.528 -    MISC_keymap[Pk_Super_L & 0xFF] = SDLK_LSUPER;
   8.529 -    MISC_keymap[Pk_Super_R & 0xFF] = SDLK_RSUPER;
   8.530 -    MISC_keymap[Pk_Mode_switch & 0xFF] = SDLK_MODE;     /* "Alt Gr" key    */
   8.531 -
   8.532 -    MISC_keymap[Pk_Help & 0xFF] = SDLK_HELP;
   8.533 -    MISC_keymap[Pk_Print & 0xFF] = SDLK_PRINT;
   8.534 -    MISC_keymap[Pk_Break & 0xFF] = SDLK_BREAK;
   8.535 -    MISC_keymap[Pk_Menu & 0xFF] = SDLK_MENU;    /* Windows "Menu" key */
   8.536 -
   8.537 -    MISC_keymap[Pk_Hyper_R & 0xFF] = SDLK_RSUPER;       /* Right "Windows" */
   8.538 -
   8.539 -    /* Left "Windows" key, but it can't be catched by application */
   8.540 -    MISC_keymap[Pk_Hyper_L & 0xFF] = SDLK_LSUPER;
   8.541 -}
   8.542 -
   8.543 -static unsigned long cap;
   8.544 -
   8.545 -SDL_keysym *
   8.546 -ph_TranslateKey(PhKeyEvent_t * key, SDL_keysym * keysym)
   8.547 -{
   8.548 -    /* 'sym' is set to the value of the key with modifiers applied to it.
   8.549 -       This member is valid only if Pk_KF_Sym_Valid is set in the key_flags.
   8.550 -       We will assume it is valid. */
   8.551 -
   8.552 -    /* FIXME: This needs to check whether the cap & scancode is valid */
   8.553 -
   8.554 -    cap = key->key_cap;
   8.555 -
   8.556 -    switch (cap >> 8) {
   8.557 -    case 0x00:                 /* Latin 1 */
   8.558 -    case 0x01:                 /* Latin 2 */
   8.559 -    case 0x02:                 /* Latin 3 */
   8.560 -    case 0x03:                 /* Latin 4 */
   8.561 -    case 0x04:                 /* Katakana */
   8.562 -    case 0x05:                 /* Arabic */
   8.563 -    case 0x06:                 /* Cyrillic */
   8.564 -    case 0x07:                 /* Greek */
   8.565 -    case 0x08:                 /* Technical */
   8.566 -    case 0x0A:                 /* Publishing */
   8.567 -    case 0x0C:                 /* Hebrew */
   8.568 -    case 0x0D:                 /* Thai */
   8.569 -        keysym->sym = (SDLKey) (cap & 0xFF);
   8.570 -        /* Map capital letter syms to lowercase */
   8.571 -        if ((keysym->sym >= 'A') && (keysym->sym <= 'Z'))
   8.572 -            keysym->sym += ('a' - 'A');
   8.573 -        break;
   8.574 -    case 0xF0:
   8.575 -        keysym->sym = MISC_keymap[cap & 0xFF];
   8.576 -        break;
   8.577 -    default:
   8.578 -        keysym->sym = SDLK_UNKNOWN;
   8.579 -        break;
   8.580 -    }
   8.581 -
   8.582 -    keysym->scancode = key->key_scan;
   8.583 -    keysym->unicode = 0;
   8.584 -
   8.585 -    if (SDL_TranslateUNICODE) {
   8.586 -        char utf8[MB_CUR_MAX];
   8.587 -        int utf8len;
   8.588 -        wchar_t unicode;
   8.589 -
   8.590 -        switch (keysym->scancode) {
   8.591 -            /* Esc key */
   8.592 -        case 0x01:
   8.593 -            keysym->unicode = 27;
   8.594 -            break;
   8.595 -            /* BackSpace key */
   8.596 -        case 0x0E:
   8.597 -            keysym->unicode = 127;
   8.598 -            break;
   8.599 -            /* Enter key */
   8.600 -        case 0x1C:
   8.601 -            keysym->unicode = 10;
   8.602 -            break;
   8.603 -        default:
   8.604 -            utf8len = PhKeyToMb(utf8, key);
   8.605 -            if (utf8len > 0) {
   8.606 -                utf8len = mbtowc(&unicode, utf8, utf8len);
   8.607 -                if (utf8len > 0) {
   8.608 -                    keysym->unicode = unicode;
   8.609 -                }
   8.610 -            }
   8.611 -            break;
   8.612 -        }
   8.613 -
   8.614 -    }
   8.615 -
   8.616 -    return (keysym);
   8.617 -}
   8.618 -
   8.619 -void
   8.620 -ph_InitOSKeymap(_THIS)
   8.621 -{
   8.622 -    ph_InitKeymap();
   8.623 -}
   8.624 -
   8.625 -/* vi: set ts=4 sw=4 expandtab: */
     9.1 --- a/src/video/photon/SDL_ph_events_c.h	Fri Feb 27 09:51:55 2009 +0000
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,38 +0,0 @@
     9.4 -/*
     9.5 -    SDL - Simple DirectMedia Layer
     9.6 -    Copyright (C) 1997-2009 Sam Lantinga
     9.7 -
     9.8 -    This library is free software; you can redistribute it and/or
     9.9 -    modify it under the terms of the GNU Lesser General Public
    9.10 -    License as published by the Free Software Foundation; either
    9.11 -    version 2.1 of the License, or (at your option) any later version.
    9.12 -
    9.13 -    This library is distributed in the hope that it will be useful,
    9.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
    9.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    9.16 -    Lesser General Public License for more details.
    9.17 -
    9.18 -    You should have received a copy of the GNU Lesser General Public
    9.19 -    License along with this library; if not, write to the Free Software
    9.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    9.21 -
    9.22 -    Sam Lantinga
    9.23 -    slouken@libsdl.org
    9.24 -*/
    9.25 -#include "SDL_config.h"
    9.26 -
    9.27 -#ifndef __SDL_PH_EVENTS_H__
    9.28 -#define __SDL_PH_EVENTS_H__
    9.29 -
    9.30 -#include "SDL_ph_video.h"
    9.31 -
    9.32 -#define PH_SDL_MAX_RECTS 256
    9.33 -#define PH_EVENT_SAFETY_POOL 512
    9.34 -#define EVENT_SIZE (sizeof(PhEvent_t) + 1000 + PH_EVENT_SAFETY_POOL)
    9.35 -
    9.36 -/* Functions to be exported */
    9.37 -extern void ph_InitOSKeymap(_THIS);
    9.38 -extern void ph_PumpEvents(_THIS);
    9.39 -
    9.40 -#endif /* __SDL_PH_EVENTS_H__ */
    9.41 -/* vi: set ts=4 sw=4 expandtab: */
    10.1 --- a/src/video/photon/SDL_ph_gl.c	Fri Feb 27 09:51:55 2009 +0000
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,408 +0,0 @@
    10.4 -/*
    10.5 -    SDL - Simple DirectMedia Layer
    10.6 -    Copyright (C) 1997-2009 Sam Lantinga
    10.7 -
    10.8 -    This library is free software; you can redistribute it and/or
    10.9 -    modify it under the terms of the GNU Lesser General Public
   10.10 -    License as published by the Free Software Foundation; either
   10.11 -    version 2.1 of the License, or (at your option) any later version.
   10.12 -
   10.13 -    This library is distributed in the hope that it will be useful,
   10.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   10.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   10.16 -    Lesser General Public License for more details.
   10.17 -
   10.18 -    You should have received a copy of the GNU Lesser General Public
   10.19 -    License along with this library; if not, write to the Free Software
   10.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   10.21 -
   10.22 -    Sam Lantinga
   10.23 -    slouken@libsdl.org
   10.24 -*/
   10.25 -#include "SDL_config.h"
   10.26 -
   10.27 -#include <dlfcn.h>
   10.28 -#include "SDL_ph_gl.h"
   10.29 -
   10.30 -#if SDL_VIDEO_OPENGL
   10.31 -
   10.32 -#if (_NTO_VERSION >= 630)
   10.33 -    /* PhotonGL functions */
   10.34 -GLPH_DECLARE_FUNCS;
   10.35 -#endif /* 6.3.0 */
   10.36 -
   10.37 -#if (_NTO_VERSION < 630)
   10.38 -void
   10.39 -ph_GL_SwapBuffers(_THIS)
   10.40 -{
   10.41 -    PgSetRegion(PtWidgetRid(window));
   10.42 -    PdOpenGLContextSwapBuffers(oglctx);
   10.43 -}
   10.44 -#else
   10.45 -void
   10.46 -ph_GL_SwapBuffers(_THIS)
   10.47 -{
   10.48 -    qnxgl_swap_buffers(oglbuffers);
   10.49 -}
   10.50 -#endif /* 6.3.0 */
   10.51 -
   10.52 -int
   10.53 -ph_GL_GetAttribute(_THIS, SDL_GLattr attrib, int *value)
   10.54 -{
   10.55 -    switch (attrib) {
   10.56 -    case SDL_GL_DOUBLEBUFFER:
   10.57 -        *value = this->gl_config.double_buffer;
   10.58 -        break;
   10.59 -    case SDL_GL_STENCIL_SIZE:
   10.60 -        *value = this->gl_config.stencil_size;
   10.61 -        break;
   10.62 -    case SDL_GL_DEPTH_SIZE:
   10.63 -        *value = this->gl_config.depth_size;
   10.64 -        break;
   10.65 -#if (_NTO_VERSION >= 630)
   10.66 -    case SDL_GL_RED_SIZE:
   10.67 -        *value = this->gl_config.red_size;
   10.68 -        break;
   10.69 -    case SDL_GL_GREEN_SIZE:
   10.70 -        *value = this->gl_config.green_size;
   10.71 -        break;
   10.72 -    case SDL_GL_BLUE_SIZE:
   10.73 -        *value = this->gl_config.blue_size;
   10.74 -        break;
   10.75 -    case SDL_GL_ALPHA_SIZE:
   10.76 -        *value = this->gl_config.alpha_size;
   10.77 -        break;
   10.78 -    case SDL_GL_ACCUM_RED_SIZE:
   10.79 -        *value = this->gl_config.accum_red_size;
   10.80 -        break;
   10.81 -    case SDL_GL_ACCUM_GREEN_SIZE:
   10.82 -        *value = this->gl_config.accum_green_size;
   10.83 -        break;
   10.84 -    case SDL_GL_ACCUM_BLUE_SIZE:
   10.85 -        *value = this->gl_config.accum_blue_size;
   10.86 -        break;
   10.87 -    case SDL_GL_ACCUM_ALPHA_SIZE:
   10.88 -        *value = this->gl_config.accum_alpha_size;
   10.89 -        break;
   10.90 -    case SDL_GL_STEREO:
   10.91 -        *value = this->gl_config.stereo;
   10.92 -        break;
   10.93 -#endif /* 6.3.0 */
   10.94 -    default:
   10.95 -        *value = 0;
   10.96 -        return (-1);
   10.97 -    }
   10.98 -    return 0;
   10.99 -}
  10.100 -
  10.101 -#if (_NTO_VERSION < 630)
  10.102 -int
  10.103 -ph_GL_LoadLibrary(_THIS, const char *path)
  10.104 -{
  10.105 -    /* if code compiled with SDL_VIDEO_OPENGL, that mean that library already linked */
  10.106 -    this->gl_config.driver_loaded = 1;
  10.107 -
  10.108 -    return 0;
  10.109 -}
  10.110 -#else
  10.111 -int
  10.112 -ph_GL_LoadLibrary(_THIS, const char *path)
  10.113 -{
  10.114 -    void *handle;
  10.115 -    int dlopen_flags = RTLD_WORLD | RTLD_GROUP;
  10.116 -
  10.117 -    if (this->gl_config.dll_handle != NULL) {
  10.118 -        return 0;
  10.119 -    }
  10.120 -
  10.121 -    handle = dlopen(path, dlopen_flags);
  10.122 -
  10.123 -    if (handle == NULL) {
  10.124 -        SDL_SetError("ph_GL_LoadLibrary(): Could not load OpenGL library");
  10.125 -        return -1;
  10.126 -    }
  10.127 -
  10.128 -    this->gl_config.dll_handle = handle;
  10.129 -    this->gl_config.driver_loaded = 1;
  10.130 -
  10.131 -    SDL_strlcpy(this->gl_config.driver_path, path,
  10.132 -                SDL_arraysize(this->gl_config.driver_path));
  10.133 -
  10.134 -    return 0;
  10.135 -}
  10.136 -#endif /* 6.3.0 */
  10.137 -
  10.138 -#if (_NTO_VERSION < 630)
  10.139 -void *
  10.140 -ph_GL_GetProcAddress(_THIS, const char *proc)
  10.141 -{
  10.142 -    return NULL;
  10.143 -}
  10.144 -#else
  10.145 -void *
  10.146 -ph_GL_GetProcAddress(_THIS, const char *proc)
  10.147 -{
  10.148 -    void *function;
  10.149 -
  10.150 -    if (this->gl_config.dll_handle == NULL) {
  10.151 -        ph_GL_LoadLibrary(this, DEFAULT_OPENGL);
  10.152 -        if (this->gl_config.dll_handle == NULL) {
  10.153 -            return NULL;
  10.154 -        }
  10.155 -    }
  10.156 -
  10.157 -    function = qnxgl_get_func(proc, oglctx, 0);
  10.158 -    if (function == NULL) {
  10.159 -        function = dlsym(this->gl_config.dll_handle, proc);
  10.160 -    }
  10.161 -
  10.162 -    return function;
  10.163 -}
  10.164 -#endif /* 6.3.0 */
  10.165 -
  10.166 -#if (_NTO_VERSION < 630)
  10.167 -int
  10.168 -ph_GL_MakeCurrent(_THIS)
  10.169 -{
  10.170 -    PgSetRegion(PtWidgetRid(window));
  10.171 -
  10.172 -    if (oglctx != NULL) {
  10.173 -        PhDCSetCurrent(oglctx);
  10.174 -    }
  10.175 -
  10.176 -    return 0;
  10.177 -}
  10.178 -#else
  10.179 -int
  10.180 -ph_GL_MakeCurrent(_THIS)
  10.181 -{
  10.182 -    PgSetRegion(PtWidgetRid(window));
  10.183 -
  10.184 -    if (oglctx != NULL) {
  10.185 -        if (qnxgl_set_current(oglctx) == -1) {
  10.186 -            return -1;
  10.187 -        }
  10.188 -    }
  10.189 -
  10.190 -    return 0;
  10.191 -}
  10.192 -#endif /* 6.3.0 */
  10.193 -
  10.194 -#if (_NTO_VERSION < 630)
  10.195 -
  10.196 -/* This code is actual for the Photon3D Runtime which was available prior to 6.3 only */
  10.197 -
  10.198 -int
  10.199 -ph_SetupOpenGLContext(_THIS, int width, int height, int bpp, Uint32 flags)
  10.200 -{
  10.201 -    PhDim_t dim;
  10.202 -    uint64_t OGLAttrib[PH_OGL_MAX_ATTRIBS];
  10.203 -    int exposepost = 0;
  10.204 -    int OGLargc;
  10.205 -
  10.206 -    dim.w = width;
  10.207 -    dim.h = height;
  10.208 -
  10.209 -    if ((oglctx != NULL) && (oglflags == flags) && (oglbpp == bpp)) {
  10.210 -        PdOpenGLContextResize(oglctx, &dim);
  10.211 -        PhDCSetCurrent(oglctx);
  10.212 -        return 0;
  10.213 -    } else {
  10.214 -        if (oglctx != NULL) {
  10.215 -            PhDCSetCurrent(NULL);
  10.216 -            PhDCRelease(oglctx);
  10.217 -            oglctx = NULL;
  10.218 -            exposepost = 1;
  10.219 -        }
  10.220 -    }
  10.221 -
  10.222 -    OGLargc = 0;
  10.223 -    if (this->gl_config.depth_size) {
  10.224 -        OGLAttrib[OGLargc++] = PHOGL_ATTRIB_DEPTH_BITS;
  10.225 -        OGLAttrib[OGLargc++] = this->gl_config.depth_size;
  10.226 -    }
  10.227 -    if (this->gl_config.stencil_size) {
  10.228 -        OGLAttrib[OGLargc++] = PHOGL_ATTRIB_STENCIL_BITS;
  10.229 -        OGLAttrib[OGLargc++] = this->gl_config.stencil_size;
  10.230 -    }
  10.231 -    OGLAttrib[OGLargc++] = PHOGL_ATTRIB_FORCE_SW;
  10.232 -    if (flags & SDL_FULLSCREEN) {
  10.233 -        OGLAttrib[OGLargc++] = PHOGL_ATTRIB_FULLSCREEN;
  10.234 -        OGLAttrib[OGLargc++] = PHOGL_ATTRIB_DIRECT;
  10.235 -        OGLAttrib[OGLargc++] = PHOGL_ATTRIB_FULLSCREEN_BEST;
  10.236 -        OGLAttrib[OGLargc++] = PHOGL_ATTRIB_FULLSCREEN_CENTER;
  10.237 -    }
  10.238 -    OGLAttrib[OGLargc++] = PHOGL_ATTRIB_NONE;
  10.239 -
  10.240 -    if (this->gl_config.double_buffer) {
  10.241 -        oglctx = PdCreateOpenGLContext(2, &dim, 0, OGLAttrib);
  10.242 -    } else {
  10.243 -        oglctx = PdCreateOpenGLContext(1, &dim, 0, OGLAttrib);
  10.244 -    }
  10.245 -
  10.246 -    if (oglctx == NULL) {
  10.247 -        SDL_SetError
  10.248 -            ("ph_SetupOpenGLContext(): cannot create OpenGL context !\n");
  10.249 -        return -1;
  10.250 -    }
  10.251 -
  10.252 -    PhDCSetCurrent(oglctx);
  10.253 -
  10.254 -    PtFlush();
  10.255 -
  10.256 -    oglflags = flags;
  10.257 -    oglbpp = bpp;
  10.258 -
  10.259 -    if (exposepost != 0) {
  10.260 -        /* OpenGL context has been recreated, so report about this fact */
  10.261 -        SDL_PrivateExpose();
  10.262 -    }
  10.263 -
  10.264 -    return 0;
  10.265 -}
  10.266 -
  10.267 -#else /* _NTO_VERSION */
  10.268 -
  10.269 -/* This code is actual for the built-in PhGL support, which became available since 6.3 */
  10.270 -
  10.271 -int
  10.272 -ph_SetupOpenGLContext(_THIS, int width, int height, int bpp, Uint32 flags)
  10.273 -{
  10.274 -    qnxgl_buf_attrib_t qnxgl_attribs[PH_OGL_MAX_ATTRIBS];
  10.275 -    qnxgl_buf_attrib_t *qnxgl_attribs_slide;
  10.276 -    int num_interfaces = 0;
  10.277 -    int num_buffers = 0;
  10.278 -
  10.279 -    /* Initialize the OpenGL subsystem */
  10.280 -
  10.281 -    num_interfaces = qnxgl_init(NULL, NULL, 0);
  10.282 -
  10.283 -    if (num_interfaces < 0) {
  10.284 -        SDL_SetError
  10.285 -            ("ph_SetupOpenGLContext(): cannot initialize OpenGL subsystem !\n");
  10.286 -        return -1;
  10.287 -    }
  10.288 -    if (num_interfaces == 0) {
  10.289 -        SDL_SetError
  10.290 -            ("ph_SetupOpenGLContext(): there are no available OpenGL renderers was found !\n");
  10.291 -        return -1;
  10.292 -    }
  10.293 -
  10.294 -    /* Driver is linked */
  10.295 -    this->gl_config.driver_loaded = 1;
  10.296 -
  10.297 -    /* Initialize the OpenGL context attributes */
  10.298 -    qnxgl_attribs_slide = qnxgl_attribs;
  10.299 -
  10.300 -    /* Depth size */
  10.301 -    if (this->gl_config.depth_size) {
  10.302 -        fprintf(stderr, "setted depth size %d\n", this->gl_config.depth_size);
  10.303 -        qnxgl_attribs_slide =
  10.304 -            qnxgl_attrib_set_depth(qnxgl_attribs_slide,
  10.305 -                                   this->gl_config.depth_size);
  10.306 -    }
  10.307 -
  10.308 -    /* Stencil size */
  10.309 -    if (this->gl_config.stencil_size) {
  10.310 -        qnxgl_attribs_slide =
  10.311 -            qnxgl_attrib_set_stencil(qnxgl_attribs_slide,
  10.312 -                                     this->gl_config.stencil_size);
  10.313 -    }
  10.314 -
  10.315 -    /* The sum of the accum bits of each channel */
  10.316 -    if ((this->gl_config.accum_red_size != 0)
  10.317 -        && (this->gl_config.accum_blue_size != 0)
  10.318 -        && (this->gl_config.accum_green_size != 0)) {
  10.319 -        qnxgl_attribs_slide = qnxgl_attrib_set_accum(qnxgl_attribs_slide,
  10.320 -                                                     this->
  10.321 -                                                     gl_config.accum_red_size
  10.322 -                                                     +
  10.323 -                                                     this->
  10.324 -                                                     gl_config.accum_blue_size
  10.325 -                                                     +
  10.326 -                                                     this->
  10.327 -                                                     gl_config.
  10.328 -                                                     accum_green_size +
  10.329 -                                                     this->gl_config.
  10.330 -                                                     accum_alpha_size);
  10.331 -    }
  10.332 -
  10.333 -    /* Stereo mode */
  10.334 -    if (this->gl_config.stereo) {
  10.335 -        qnxgl_attribs_slide = qnxgl_attrib_set_stereo(qnxgl_attribs_slide);
  10.336 -    }
  10.337 -
  10.338 -    /* Fullscreen mode */
  10.339 -    if ((flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) {
  10.340 -        qnxgl_attribs_slide =
  10.341 -            qnxgl_attrib_set_hint_fullscreen(qnxgl_attribs_slide);
  10.342 -    }
  10.343 -
  10.344 -    /* Double buffering mode */
  10.345 -    if (this->gl_config.double_buffer) {
  10.346 -        num_buffers = 2;
  10.347 -    } else {
  10.348 -        num_buffers = 1;
  10.349 -    }
  10.350 -
  10.351 -    /* Loading the function pointers so we can use the extensions */
  10.352 -    GLPH_LOAD_FUNCS_GC(oglctx);
  10.353 -
  10.354 -    /* Set the buffers region to be that of our window's region */
  10.355 -    qnxgl_attribs_slide =
  10.356 -        glph_attrib_set_region(qnxgl_attribs_slide, PtWidgetRid(window));
  10.357 -
  10.358 -    /* End of the attributes array */
  10.359 -    qnxgl_attribs_slide = qnxgl_attrib_set_end(qnxgl_attribs_slide);
  10.360 -
  10.361 -    /* Create the buffers with the specified color model */
  10.362 -    fprintf(stderr, "ARGB: %d, %d, %d, %d\n", this->gl_config.alpha_size,
  10.363 -            this->gl_config.red_size, this->gl_config.green_size,
  10.364 -            this->gl_config.blue_size);
  10.365 -    oglbuffers = qnxgl_buffers_create(QNXGL_FORMAT_BEST_RGB,
  10.366 -/*                 __QNXGL_BUILD_FORMAT(0, __QNXGL_COLOR_MODEL_RGB, this->gl_config.alpha_size,
  10.367 -                     this->gl_config.red_size, this->gl_config.green_size, this->gl_config.blue_size), */
  10.368 -                                      num_buffers, width, height,
  10.369 -                                      qnxgl_attribs, -1);
  10.370 -
  10.371 -
  10.372 -    if (oglbuffers == NULL) {
  10.373 -        SDL_SetError
  10.374 -            ("ph_SetupOpenGLContext(): failed to create OpenGL buffers !\n");
  10.375 -        qnxgl_finish();
  10.376 -        return -1;
  10.377 -    }
  10.378 -
  10.379 -    /* Create a QNXGL context for the previously created buffer */
  10.380 -    oglctx = qnxgl_context_create(oglbuffers, NULL);
  10.381 -
  10.382 -    if (oglctx == NULL) {
  10.383 -        SDL_SetError
  10.384 -            ("ph_SetupOpenGLContext(): failed to create OpenGL context !\n");
  10.385 -        qnxgl_buffers_destroy(oglbuffers);
  10.386 -        qnxgl_finish();
  10.387 -        return -1;
  10.388 -    }
  10.389 -
  10.390 -    /* Attempt to make the context current so we can use OpenGL commands */
  10.391 -    if (qnxgl_set_current(oglctx) == -1) {
  10.392 -        SDL_SetError
  10.393 -            ("ph_SetupOpenGLContext(): failed to make the OpenGL context current !\n");
  10.394 -        qnxgl_context_destroy(oglctx);
  10.395 -        qnxgl_buffers_destroy(oglbuffers);
  10.396 -        qnxgl_finish();
  10.397 -        return -1;
  10.398 -    }
  10.399 -
  10.400 -    PtFlush();
  10.401 -
  10.402 -    oglflags = flags;
  10.403 -    oglbpp = bpp;
  10.404 -
  10.405 -    return 0;
  10.406 -}
  10.407 -
  10.408 -#endif /* _NTO_VERSION */
  10.409 -
  10.410 -#endif /* SDL_VIDEO_OPENGL */
  10.411 -/* vi: set ts=4 sw=4 expandtab: */
    11.1 --- a/src/video/photon/SDL_ph_gl.h	Fri Feb 27 09:51:55 2009 +0000
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,43 +0,0 @@
    11.4 -/*
    11.5 -    SDL - Simple DirectMedia Layer
    11.6 -    Copyright (C) 1997-2009 Sam Lantinga
    11.7 -
    11.8 -    This library is free software; you can redistribute it and/or
    11.9 -    modify it under the terms of the GNU Lesser General Public
   11.10 -    License as published by the Free Software Foundation; either
   11.11 -    version 2.1 of the License, or (at your option) any later version.
   11.12 -
   11.13 -    This library is distributed in the hope that it will be useful,
   11.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   11.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   11.16 -    Lesser General Public License for more details.
   11.17 -
   11.18 -    You should have received a copy of the GNU Lesser General Public
   11.19 -    License along with this library; if not, write to the Free Software
   11.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   11.21 -
   11.22 -    Sam Lantinga
   11.23 -    slouken@libsdl.org
   11.24 -*/
   11.25 -#include "SDL_config.h"
   11.26 -
   11.27 -#ifndef __SDL_PH_GL_H__
   11.28 -#define __SDL_PH_GL_H__
   11.29 -
   11.30 -#include "SDL_ph_video.h"
   11.31 -
   11.32 -#define DEFAULT_OPENGL "/usr/lib/libGL.so"
   11.33 -
   11.34 -#if SDL_VIDEO_OPENGL
   11.35 -void ph_GL_SwapBuffers(_THIS);
   11.36 -int ph_GL_GetAttribute(_THIS, SDL_GLattr attrib, int *value);
   11.37 -int ph_GL_LoadLibrary(_THIS, const char *path);
   11.38 -void *ph_GL_GetProcAddress(_THIS, const char *proc);
   11.39 -int ph_GL_MakeCurrent(_THIS);
   11.40 -
   11.41 -int ph_SetupOpenGLContext(_THIS, int width, int height, int bpp,
   11.42 -                          Uint32 flags);
   11.43 -#endif /* SDL_VIDEO_OPENGL */
   11.44 -
   11.45 -#endif /* __SDL_PH_GL_H__ */
   11.46 -/* vi: set ts=4 sw=4 expandtab: */
    12.1 --- a/src/video/photon/SDL_ph_image.c	Fri Feb 27 09:51:55 2009 +0000
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,1029 +0,0 @@
    12.4 -/*
    12.5 -    SDL - Simple DirectMedia Layer
    12.6 -    Copyright (C) 1997-2009 Sam Lantinga
    12.7 -
    12.8 -    This library is free software; you can redistribute it and/or
    12.9 -    modify it under the terms of the GNU Lesser General Public
   12.10 -    License as published by the Free Software Foundation; either
   12.11 -    version 2.1 of the License, or (at your option) any later version.
   12.12 -
   12.13 -    This library is distributed in the hope that it will be useful,
   12.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   12.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   12.16 -    Lesser General Public License for more details.
   12.17 -
   12.18 -    You should have received a copy of the GNU Lesser General Public
   12.19 -    License along with this library; if not, write to the Free Software
   12.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   12.21 -
   12.22 -    Sam Lantinga
   12.23 -    slouken@libsdl.org
   12.24 -*/
   12.25 -#include "SDL_config.h"
   12.26 -
   12.27 -#include <Ph.h>
   12.28 -#include <photon/Pg.h>
   12.29 -
   12.30 -#include "SDL_endian.h"
   12.31 -#include "SDL_video.h"
   12.32 -#include "../SDL_pixels_c.h"
   12.33 -#include "SDL_ph_video.h"
   12.34 -#include "SDL_ph_image_c.h"
   12.35 -#include "SDL_ph_modes_c.h"
   12.36 -#include "SDL_ph_gl.h"
   12.37 -
   12.38 -int
   12.39 -ph_SetupImage(_THIS, SDL_Surface * screen)
   12.40 -{
   12.41 -    PgColor_t *palette = NULL;
   12.42 -    int type = 0;
   12.43 -    int bpp;
   12.44 -
   12.45 -    bpp = screen->format->BitsPerPixel;
   12.46 -
   12.47 -    /* Determine image type */
   12.48 -    switch (bpp) {
   12.49 -    case 8:
   12.50 -        {
   12.51 -            type = Pg_IMAGE_PALETTE_BYTE;
   12.52 -        }
   12.53 -        break;
   12.54 -    case 15:
   12.55 -        {
   12.56 -            type = Pg_IMAGE_DIRECT_555;
   12.57 -        }
   12.58 -        break;
   12.59 -    case 16:
   12.60 -        {
   12.61 -            type = Pg_IMAGE_DIRECT_565;
   12.62 -        }
   12.63 -        break;
   12.64 -    case 24:
   12.65 -        {
   12.66 -            type = Pg_IMAGE_DIRECT_888;
   12.67 -        }
   12.68 -        break;
   12.69 -    case 32:
   12.70 -        {
   12.71 -            type = Pg_IMAGE_DIRECT_8888;
   12.72 -        }
   12.73 -        break;
   12.74 -    default:
   12.75 -        {
   12.76 -            SDL_SetError("ph_SetupImage(): unsupported bpp=%d !\n", bpp);
   12.77 -            return -1;
   12.78 -        }
   12.79 -        break;
   12.80 -    }
   12.81 -
   12.82 -    /* palette emulation code */
   12.83 -    if ((bpp == 8) && (desktoppal == SDLPH_PAL_EMULATE)) {
   12.84 -        /* creating image palette */
   12.85 -        palette = SDL_malloc(_Pg_MAX_PALETTE * sizeof(PgColor_t));
   12.86 -        if (palette == NULL) {
   12.87 -            SDL_SetError
   12.88 -                ("ph_SetupImage(): can't allocate memory for palette !\n");
   12.89 -            return -1;
   12.90 -        }
   12.91 -        PgGetPalette(palette);
   12.92 -
   12.93 -        /* using shared memory for speed (set last param to 1) */
   12.94 -        if ((SDL_Image =
   12.95 -             PhCreateImage(NULL, screen->w, screen->h, type, palette,
   12.96 -                           _Pg_MAX_PALETTE, 1)) == NULL) {
   12.97 -            SDL_SetError
   12.98 -                ("ph_SetupImage(): PhCreateImage() failed for bpp=8 !\n");
   12.99 -            SDL_free(palette);
  12.100 -            return -1;
  12.101 -        }
  12.102 -    } else {
  12.103 -        /* using shared memory for speed (set last param to 1) */
  12.104 -        if ((SDL_Image =
  12.105 -             PhCreateImage(NULL, screen->w, screen->h, type, NULL, 0,
  12.106 -                           1)) == NULL) {
  12.107 -            SDL_SetError
  12.108 -                ("ph_SetupImage(): PhCreateImage() failed for bpp=%d !\n",
  12.109 -                 bpp);
  12.110 -            return -1;
  12.111 -        }
  12.112 -    }
  12.113 -
  12.114 -    screen->pixels = SDL_Image->image;
  12.115 -    screen->pitch = SDL_Image->bpl;
  12.116 -
  12.117 -    this->UpdateRects = ph_NormalUpdate;
  12.118 -
  12.119 -    return 0;
  12.120 -}
  12.121 -
  12.122 -int
  12.123 -ph_SetupOCImage(_THIS, SDL_Surface * screen)
  12.124 -{
  12.125 -    int type = 0;
  12.126 -    int bpp;
  12.127 -
  12.128 -    OCImage.flags = screen->flags;
  12.129 -
  12.130 -    bpp = screen->format->BitsPerPixel;
  12.131 -
  12.132 -    /* Determine image type */
  12.133 -    switch (bpp) {
  12.134 -    case 8:
  12.135 -        {
  12.136 -            type = Pg_IMAGE_PALETTE_BYTE;
  12.137 -        }
  12.138 -        break;
  12.139 -    case 15:
  12.140 -        {
  12.141 -            type = Pg_IMAGE_DIRECT_555;
  12.142 -        }
  12.143 -        break;
  12.144 -    case 16:
  12.145 -        {
  12.146 -            type = Pg_IMAGE_DIRECT_565;
  12.147 -        }
  12.148 -        break;
  12.149 -    case 24:
  12.150 -        {
  12.151 -            type = Pg_IMAGE_DIRECT_888;
  12.152 -        }
  12.153 -        break;
  12.154 -    case 32:
  12.155 -        {
  12.156 -            type = Pg_IMAGE_DIRECT_8888;
  12.157 -        }
  12.158 -        break;
  12.159 -    default:
  12.160 -        {
  12.161 -            SDL_SetError("ph_SetupOCImage(): unsupported bpp=%d !\n", bpp);
  12.162 -            return -1;
  12.163 -        }
  12.164 -        break;
  12.165 -    }
  12.166 -
  12.167 -    /* Currently offscreen contexts with the same bit depth as display bpp only can be created */
  12.168 -    OCImage.offscreen_context =
  12.169 -        PdCreateOffscreenContext(0, screen->w, screen->h,
  12.170 -                                 Pg_OSC_MEM_PAGE_ALIGN);
  12.171 -
  12.172 -    if (OCImage.offscreen_context == NULL) {
  12.173 -        SDL_SetError
  12.174 -            ("ph_SetupOCImage(): PdCreateOffscreenContext() function failed !\n");
  12.175 -        return -1;
  12.176 -    }
  12.177 -
  12.178 -    screen->pitch = OCImage.offscreen_context->pitch;
  12.179 -
  12.180 -    OCImage.dc_ptr =
  12.181 -        (unsigned char *) PdGetOffscreenContextPtr(OCImage.offscreen_context);
  12.182 -
  12.183 -    if (OCImage.dc_ptr == NULL) {
  12.184 -        SDL_SetError
  12.185 -            ("ph_SetupOCImage(): PdGetOffscreenContextPtr function failed !\n");
  12.186 -        PhDCRelease(OCImage.offscreen_context);
  12.187 -        return -1;
  12.188 -    }
  12.189 -
  12.190 -    OCImage.FrameData0 = OCImage.dc_ptr;
  12.191 -    OCImage.CurrentFrameData = OCImage.FrameData0;
  12.192 -    OCImage.current = 0;
  12.193 -
  12.194 -    PhDCSetCurrent(OCImage.offscreen_context);
  12.195 -
  12.196 -    screen->pixels = OCImage.CurrentFrameData;
  12.197 -
  12.198 -    this->UpdateRects = ph_OCUpdate;
  12.199 -
  12.200 -    return 0;
  12.201 -}
  12.202 -
  12.203 -int
  12.204 -ph_SetupFullScreenImage(_THIS, SDL_Surface * screen)
  12.205 -{
  12.206 -    OCImage.flags = screen->flags;
  12.207 -
  12.208 -    /* Begin direct and fullscreen mode */
  12.209 -    if (!ph_EnterFullScreen(this, screen, PH_ENTER_DIRECTMODE)) {
  12.210 -        return -1;
  12.211 -    }
  12.212 -
  12.213 -    /* store palette for fullscreen */
  12.214 -    if ((screen->format->BitsPerPixel == 8) && (desktopbpp != 8)) {
  12.215 -        PgGetPalette(savedpal);
  12.216 -        PgGetPalette(syspalph);
  12.217 -    }
  12.218 -
  12.219 -    OCImage.offscreen_context =
  12.220 -        PdCreateOffscreenContext(0, 0, 0,
  12.221 -                                 Pg_OSC_MAIN_DISPLAY | Pg_OSC_MEM_PAGE_ALIGN
  12.222 -                                 | Pg_OSC_CRTC_SAFE);
  12.223 -    if (OCImage.offscreen_context == NULL) {
  12.224 -        SDL_SetError
  12.225 -            ("ph_SetupFullScreenImage(): PdCreateOffscreenContext() function failed !\n");
  12.226 -        return -1;
  12.227 -    }
  12.228 -
  12.229 -    if ((screen->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF) {
  12.230 -        OCImage.offscreen_backcontext =
  12.231 -            PdDupOffscreenContext(OCImage.offscreen_context,
  12.232 -                                  Pg_OSC_MEM_PAGE_ALIGN | Pg_OSC_CRTC_SAFE);
  12.233 -        if (OCImage.offscreen_backcontext == NULL) {
  12.234 -            SDL_SetError
  12.235 -                ("ph_SetupFullScreenImage(): PdCreateOffscreenContext(back) function failed !\n");
  12.236 -            return -1;
  12.237 -        }
  12.238 -    }
  12.239 -
  12.240 -    OCImage.FrameData0 =
  12.241 -        (unsigned char *) PdGetOffscreenContextPtr(OCImage.offscreen_context);
  12.242 -    if (OCImage.FrameData0 == NULL) {
  12.243 -        SDL_SetError
  12.244 -            ("ph_SetupFullScreenImage(): PdGetOffscreenContextPtr() function failed !\n");
  12.245 -        ph_DestroyImage(this, screen);
  12.246 -        return -1;
  12.247 -    }
  12.248 -
  12.249 -    if ((screen->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF) {
  12.250 -        OCImage.FrameData1 = (unsigned char *)
  12.251 -            PdGetOffscreenContextPtr(OCImage.offscreen_backcontext);
  12.252 -        if (OCImage.FrameData1 == NULL) {
  12.253 -            SDL_SetError
  12.254 -                ("ph_SetupFullScreenImage(back): PdGetOffscreenContextPtr() function failed !\n");
  12.255 -            ph_DestroyImage(this, screen);
  12.256 -            return -1;
  12.257 -        }
  12.258 -    }
  12.259 -
  12.260 -    /* wait for the hardware */
  12.261 -    PgFlush();
  12.262 -    PgWaitHWIdle();
  12.263 -
  12.264 -    if ((screen->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF) {
  12.265 -        OCImage.current = 0;
  12.266 -        PhDCSetCurrent(OCImage.offscreen_context);
  12.267 -        screen->pitch = OCImage.offscreen_context->pitch;
  12.268 -        screen->pixels = OCImage.FrameData0;
  12.269 -
  12.270 -        /* emulate 640x400 videomode */
  12.271 -        if (videomode_emulatemode == 1) {
  12.272 -            int i;
  12.273 -
  12.274 -            for (i = 0; i < 40; i++) {
  12.275 -                SDL_memset(screen->pixels + screen->pitch * i, 0x00,
  12.276 -                           screen->pitch);
  12.277 -            }
  12.278 -            for (i = 440; i < 480; i++) {
  12.279 -                SDL_memset(screen->pixels + screen->pitch * i, 0x00,
  12.280 -                           screen->pitch);
  12.281 -            }
  12.282 -            screen->pixels += screen->pitch * 40;
  12.283 -        }
  12.284 -        PgSwapDisplay(OCImage.offscreen_backcontext, 0);
  12.285 -    } else {
  12.286 -        OCImage.current = 0;
  12.287 -        PhDCSetCurrent(OCImage.offscreen_context);
  12.288 -        screen->pitch = OCImage.offscreen_context->pitch;
  12.289 -        screen->pixels = OCImage.FrameData0;
  12.290 -
  12.291 -        /* emulate 640x400 videomode */
  12.292 -        if (videomode_emulatemode == 1) {
  12.293 -            int i;
  12.294 -
  12.295 -            for (i = 0; i < 40; i++) {
  12.296 -                SDL_memset(screen->pixels + screen->pitch * i, 0x00,
  12.297 -                           screen->pitch);
  12.298 -            }
  12.299 -            for (i = 440; i < 480; i++) {
  12.300 -                SDL_memset(screen->pixels + screen->pitch * i, 0x00,
  12.301 -                           screen->pitch);
  12.302 -            }
  12.303 -            screen->pixels += screen->pitch * 40;
  12.304 -        }
  12.305 -    }
  12.306 -
  12.307 -    this->UpdateRects = ph_OCDCUpdate;
  12.308 -
  12.309 -    /* wait for the hardware */
  12.310 -    PgFlush();
  12.311 -    PgWaitHWIdle();
  12.312 -
  12.313 -    return 0;
  12.314 -}
  12.315 -
  12.316 -#if SDL_VIDEO_OPENGL
  12.317 -
  12.318 -int
  12.319 -ph_SetupOpenGLImage(_THIS, SDL_Surface * screen)
  12.320 -{
  12.321 -    this->UpdateRects = ph_OpenGLUpdate;
  12.322 -    screen->pixels = NULL;
  12.323 -    screen->pitch = NULL;
  12.324 -
  12.325 -#if (_NTO_VERSION >= 630)
  12.326 -    if ((screen->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) {
  12.327 -        if (!ph_EnterFullScreen(this, screen, PH_IGNORE_DIRECTMODE)) {
  12.328 -            screen->flags &= ~SDL_FULLSCREEN;
  12.329 -            return -1;
  12.330 -        }
  12.331 -    }
  12.332 -#endif /* 6.3.0 */
  12.333 -
  12.334 -    if (ph_SetupOpenGLContext
  12.335 -        (this, screen->w, screen->h, screen->format->BitsPerPixel,
  12.336 -         screen->flags) != 0) {
  12.337 -        screen->flags &= ~SDL_INTERNALOPENGL;
  12.338 -        return -1;
  12.339 -    }
  12.340 -
  12.341 -    return 0;
  12.342 -}
  12.343 -
  12.344 -#endif /* SDL_VIDEO_OPENGL */
  12.345 -
  12.346 -void
  12.347 -ph_DestroyImage(_THIS, SDL_Surface * screen)
  12.348 -{
  12.349 -
  12.350 -#if SDL_VIDEO_OPENGL
  12.351 -    if (screen->flags & SDL_INTERNALOPENGL) {
  12.352 -        if (oglctx) {
  12.353 -#if (_NTO_VERSION < 630)
  12.354 -            PhDCSetCurrent(NULL);
  12.355 -            PhDCRelease(oglctx);
  12.356 -#else
  12.357 -            qnxgl_context_destroy(oglctx);
  12.358 -            qnxgl_buffers_destroy(oglbuffers);
  12.359 -            qnxgl_finish();
  12.360 -#endif /* 6.3.0 */
  12.361 -            oglctx = NULL;
  12.362 -            oglbuffers = NULL;
  12.363 -            oglflags = 0;
  12.364 -            oglbpp = 0;
  12.365 -        }
  12.366 -#if (_NTO_VERSION >= 630)
  12.367 -        if (currently_fullscreen) {
  12.368 -            ph_LeaveFullScreen(this);
  12.369 -        }
  12.370 -#endif /* 6.3.0 */
  12.371 -
  12.372 -        return;
  12.373 -    }
  12.374 -#endif /* SDL_VIDEO_OPENGL */
  12.375 -
  12.376 -    if (currently_fullscreen) {
  12.377 -        /* if we right now in 8bpp fullscreen we must release palette */
  12.378 -        if ((screen->format->BitsPerPixel == 8) && (desktopbpp != 8)) {
  12.379 -            PgSetPalette(syspalph, 0, -1, 0, 0, 0);
  12.380 -            PgSetPalette(savedpal, 0, 0, _Pg_MAX_PALETTE,
  12.381 -                         Pg_PALSET_GLOBAL | Pg_PALSET_FORCE_EXPOSE, 0);
  12.382 -            PgFlush();
  12.383 -        }
  12.384 -        ph_LeaveFullScreen(this);
  12.385 -    }
  12.386 -
  12.387 -    if (OCImage.offscreen_context != NULL) {
  12.388 -        PhDCRelease(OCImage.offscreen_context);
  12.389 -        OCImage.offscreen_context = NULL;
  12.390 -        OCImage.FrameData0 = NULL;
  12.391 -    }
  12.392 -    if (OCImage.offscreen_backcontext != NULL) {
  12.393 -        PhDCRelease(OCImage.offscreen_backcontext);
  12.394 -        OCImage.offscreen_backcontext = NULL;
  12.395 -        OCImage.FrameData1 = NULL;
  12.396 -    }
  12.397 -    OCImage.CurrentFrameData = NULL;
  12.398 -
  12.399 -    if (SDL_Image) {
  12.400 -        /* if palette allocated, free it */
  12.401 -        if (SDL_Image->palette) {
  12.402 -            SDL_free(SDL_Image->palette);
  12.403 -        }
  12.404 -        PgShmemDestroy(SDL_Image->image);
  12.405 -        SDL_free(SDL_Image);
  12.406 -    }
  12.407 -
  12.408 -    /* Must be zeroed everytime */
  12.409 -    SDL_Image = NULL;
  12.410 -
  12.411 -    if (screen) {
  12.412 -        screen->pixels = NULL;
  12.413 -    }
  12.414 -}
  12.415 -
  12.416 -int
  12.417 -ph_UpdateHWInfo(_THIS)
  12.418 -{
  12.419 -    PgVideoModeInfo_t vmode;
  12.420 -    PgHWCaps_t hwcaps;
  12.421 -
  12.422 -    /* Update video ram amount */
  12.423 -    if (PgGetGraphicsHWCaps(&hwcaps) < 0) {
  12.424 -        SDL_SetError
  12.425 -            ("ph_UpdateHWInfo(): GetGraphicsHWCaps() function failed !\n");
  12.426 -        return -1;
  12.427 -    }
  12.428 -    this->info.video_mem = hwcaps.currently_available_video_ram / 1024;
  12.429 -
  12.430 -    /* obtain current mode capabilities */
  12.431 -    if (PgGetVideoModeInfo(hwcaps.current_video_mode, &vmode) < 0) {
  12.432 -        SDL_SetError
  12.433 -            ("ph_UpdateHWInfo(): GetVideoModeInfo() function failed !\n");
  12.434 -        return -1;
  12.435 -    }
  12.436 -
  12.437 -    if ((vmode.mode_capabilities1 & PgVM_MODE_CAP1_OFFSCREEN) ==
  12.438 -        PgVM_MODE_CAP1_OFFSCREEN) {
  12.439 -        /* this is a special test for drivers which tries to lie about offscreen capability */
  12.440 -        if (hwcaps.currently_available_video_ram != 0) {
  12.441 -            this->info.hw_available = 1;
  12.442 -        } else {
  12.443 -            this->info.hw_available = 0;
  12.444 -        }
  12.445 -    } else {
  12.446 -        this->info.hw_available = 0;
  12.447 -    }
  12.448 -
  12.449 -    if ((vmode.mode_capabilities2 & PgVM_MODE_CAP2_RECTANGLE) ==
  12.450 -        PgVM_MODE_CAP2_RECTANGLE) {
  12.451 -        this->info.blit_fill = 1;
  12.452 -    } else {
  12.453 -        this->info.blit_fill = 0;
  12.454 -    }
  12.455 -
  12.456 -    if ((vmode.mode_capabilities2 & PgVM_MODE_CAP2_BITBLT) ==
  12.457 -        PgVM_MODE_CAP2_BITBLT) {
  12.458 -        this->info.blit_hw = 1;
  12.459 -    } else {
  12.460 -        this->info.blit_hw = 0;
  12.461 -    }
  12.462 -
  12.463 -    if ((vmode.mode_capabilities2 & PgVM_MODE_CAP2_ALPHA_BLEND) ==
  12.464 -        PgVM_MODE_CAP2_ALPHA_BLEND) {
  12.465 -        this->info.blit_hw_A = 1;
  12.466 -    } else {
  12.467 -        this->info.blit_hw_A = 0;
  12.468 -    }
  12.469 -
  12.470 -    if ((vmode.mode_capabilities2 & PgVM_MODE_CAP2_CHROMA) ==
  12.471 -        PgVM_MODE_CAP2_CHROMA) {
  12.472 -        this->info.blit_hw_CC = 1;
  12.473 -    } else {
  12.474 -        this->info.blit_hw_CC = 0;
  12.475 -    }
  12.476 -
  12.477 -    return 0;
  12.478 -}
  12.479 -
  12.480 -int
  12.481 -ph_SetupUpdateFunction(_THIS, SDL_Surface * screen, Uint32 flags)
  12.482 -{
  12.483 -    int setupresult = -1;
  12.484 -
  12.485 -    ph_DestroyImage(this, screen);
  12.486 -
  12.487 -#if SDL_VIDEO_OPENGL
  12.488 -    if (flags & SDL_INTERNALOPENGL) {
  12.489 -        setupresult = ph_SetupOpenGLImage(this, screen);
  12.490 -    } else {
  12.491 -#endif
  12.492 -        if ((flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) {
  12.493 -            setupresult = ph_SetupFullScreenImage(this, screen);
  12.494 -        } else {
  12.495 -            if ((flags & SDL_HWSURFACE) == SDL_HWSURFACE) {
  12.496 -                setupresult = ph_SetupOCImage(this, screen);
  12.497 -            } else {
  12.498 -                setupresult = ph_SetupImage(this, screen);
  12.499 -            }
  12.500 -        }
  12.501 -#if SDL_VIDEO_OPENGL
  12.502 -    }
  12.503 -#endif
  12.504 -    if (setupresult != -1) {
  12.505 -        ph_UpdateHWInfo(this);
  12.506 -    }
  12.507 -
  12.508 -    return setupresult;
  12.509 -}
  12.510 -
  12.511 -int
  12.512 -ph_AllocHWSurface(_THIS, SDL_Surface * surface)
  12.513 -{
  12.514 -    PgHWCaps_t hwcaps;
  12.515 -
  12.516 -    if (surface->hwdata != NULL) {
  12.517 -        SDL_SetError("ph_AllocHWSurface(): hwdata already exists!\n");
  12.518 -        return -1;
  12.519 -    }
  12.520 -    surface->hwdata = SDL_malloc(sizeof(struct private_hwdata));
  12.521 -    SDL_memset(surface->hwdata, 0x00, sizeof(struct private_hwdata));
  12.522 -    surface->hwdata->offscreenctx =
  12.523 -        PdCreateOffscreenContext(0, surface->w, surface->h,
  12.524 -                                 Pg_OSC_MEM_PAGE_ALIGN);
  12.525 -    if (surface->hwdata->offscreenctx == NULL) {
  12.526 -        SDL_SetError
  12.527 -            ("ph_AllocHWSurface(): PdCreateOffscreenContext() function failed !\n");
  12.528 -        return -1;
  12.529 -    }
  12.530 -    surface->pixels = PdGetOffscreenContextPtr(surface->hwdata->offscreenctx);
  12.531 -    if (surface->pixels == NULL) {
  12.532 -        PhDCRelease(surface->hwdata->offscreenctx);
  12.533 -        SDL_SetError
  12.534 -            ("ph_AllocHWSurface(): PdGetOffscreenContextPtr() function failed !\n");
  12.535 -        return -1;
  12.536 -    }
  12.537 -    surface->pitch = surface->hwdata->offscreenctx->pitch;
  12.538 -    surface->flags |= SDL_HWSURFACE;
  12.539 -    surface->flags |= SDL_PREALLOC;
  12.540 -
  12.541 -#if 0                           /* FIXME */
  12.542 -    /* create simple offscreen lock */
  12.543 -    surface->hwdata->crlockparam.flags = 0;
  12.544 -    if (PdCreateOffscreenLock
  12.545 -        (surface->hwdata->offscreenctx, &surface->hwdata->crlockparam) != EOK)
  12.546 -    {
  12.547 -        PhDCRelease(surface->hwdata->offscreenctx);
  12.548 -        SDL_SetError("ph_AllocHWSurface(): Can't create offscreen lock !\n");
  12.549 -        return -1;
  12.550 -    }
  12.551 -#endif /* 0 */
  12.552 -
  12.553 -    /* Update video ram amount */
  12.554 -    if (PgGetGraphicsHWCaps(&hwcaps) < 0) {
  12.555 -        PdDestroyOffscreenLock(surface->hwdata->offscreenctx);
  12.556 -        PhDCRelease(surface->hwdata->offscreenctx);
  12.557 -        SDL_SetError
  12.558 -            ("ph_AllocHWSurface(): GetGraphicsHWCaps() function failed !\n");
  12.559 -        return -1;
  12.560 -    }
  12.561 -    this->info.video_mem = hwcaps.currently_available_video_ram / 1024;
  12.562 -
  12.563 -    return 0;
  12.564 -}
  12.565 -
  12.566 -void
  12.567 -ph_FreeHWSurface(_THIS, SDL_Surface * surface)
  12.568 -{
  12.569 -    PgHWCaps_t hwcaps;
  12.570 -
  12.571 -    if (surface->hwdata == NULL) {
  12.572 -        SDL_SetError("ph_FreeHWSurface(): no hwdata!\n");
  12.573 -        return;
  12.574 -    }
  12.575 -    if (surface->hwdata->offscreenctx == NULL) {
  12.576 -        SDL_SetError("ph_FreeHWSurface(): no offscreen context to delete!\n");
  12.577 -        return;
  12.578 -    }
  12.579 -#if 0                           /* FIXME */
  12.580 -    /* unlock the offscreen context if it has been locked before destroy it */
  12.581 -    if (PdIsOffscreenLocked(surface->hwdata->offscreenctx) == Pg_OSC_LOCKED) {
  12.582 -        PdUnlockOffscreen(surface->hwdata->offscreenctx);
  12.583 -    }
  12.584 -
  12.585 -    PdDestroyOffscreenLock(surface->hwdata->offscreenctx);
  12.586 -#endif /* 0 */
  12.587 -
  12.588 -    PhDCRelease(surface->hwdata->offscreenctx);
  12.589 -
  12.590 -    SDL_free(surface->hwdata);
  12.591 -    surface->hwdata = NULL;
  12.592 -
  12.593 -    /* Update video ram amount */
  12.594 -    if (PgGetGraphicsHWCaps(&hwcaps) < 0) {
  12.595 -        SDL_SetError
  12.596 -            ("ph_FreeHWSurface(): GetGraphicsHWCaps() function failed !\n");
  12.597 -        return;
  12.598 -    }
  12.599 -    this->info.video_mem = hwcaps.currently_available_video_ram / 1024;
  12.600 -
  12.601 -    return;
  12.602 -}
  12.603 -
  12.604 -int
  12.605 -ph_CheckHWBlit(_THIS, SDL_Surface * src, SDL_Surface * dst)
  12.606 -{
  12.607 -    if ((src->hwdata == NULL) && (src != this->screen)) {
  12.608 -        SDL_SetError
  12.609 -            ("ph_CheckHWBlit(): Source surface haven't hardware specific data.\n");
  12.610 -        src->flags &= ~SDL_HWACCEL;
  12.611 -        return -1;
  12.612 -    }
  12.613 -    if ((src->flags & SDL_HWSURFACE) != SDL_HWSURFACE) {
  12.614 -        SDL_SetError
  12.615 -            ("ph_CheckHWBlit(): Source surface isn't a hardware surface.\n");
  12.616 -        src->flags &= ~SDL_HWACCEL;
  12.617 -        return -1;
  12.618 -    }
  12.619 -
  12.620 -    if ((src->flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY) {
  12.621 -        if (this->info.blit_hw_CC != 1) {
  12.622 -            src->flags &= ~SDL_HWACCEL;
  12.623 -            src->map->hw_blit = NULL;
  12.624 -            return -1;
  12.625 -        }
  12.626 -    }
  12.627 -
  12.628 -    if ((src->flags & SDL_SRCALPHA) == SDL_SRCALPHA) {
  12.629 -        if (this->info.blit_hw_A != 1) {
  12.630 -            src->flags &= ~SDL_HWACCEL;
  12.631 -            src->map->hw_blit = NULL;
  12.632 -            return -1;
  12.633 -        }
  12.634 -    }
  12.635 -
  12.636 -    src->flags |= SDL_HWACCEL;
  12.637 -    src->map->hw_blit = ph_HWAccelBlit;
  12.638 -
  12.639 -    return 1;
  12.640 -}
  12.641 -
  12.642 -PgColor_t
  12.643 -ph_ExpandColor(_THIS, SDL_Surface * surface, Uint32 color)
  12.644 -{
  12.645 -    Uint32 truecolor;
  12.646 -
  12.647 -    /* Photon API accepts true colors only during hw filling operations */
  12.648 -    switch (surface->format->BitsPerPixel) {
  12.649 -    case 8:
  12.650 -        {
  12.651 -            if ((surface->format->palette)
  12.652 -                && (color <= surface->format->palette->ncolors)) {
  12.653 -                truecolor =
  12.654 -                    PgRGB(surface->format->palette->colors[color].r,
  12.655 -                          surface->format->palette->colors[color].g,
  12.656 -                          surface->format->palette->colors[color].b);
  12.657 -            } else {
  12.658 -                SDL_SetError
  12.659 -                    ("ph_ExpandColor(): Color out of range for the 8bpp mode !\n");
  12.660 -                return 0xFFFFFFFFUL;
  12.661 -            }
  12.662 -        }
  12.663 -        break;
  12.664 -    case 15:
  12.665 -        {
  12.666 -            truecolor = ((color & 0x00007C00UL) << 9) | /* R */
  12.667 -                ((color & 0x000003E0UL) << 6) | /* G */
  12.668 -                ((color & 0x0000001FUL) << 3) | /* B */
  12.669 -                ((color & 0x00007000UL) << 4) | /* R compensation */
  12.670 -                ((color & 0x00000380UL) << 1) | /* G compensation */
  12.671 -                ((color & 0x0000001CUL) >> 2);  /* B compensation */
  12.672 -        }
  12.673 -        break;
  12.674 -    case 16:
  12.675 -        {
  12.676 -            truecolor = ((color & 0x0000F800UL) << 8) | /* R */
  12.677 -                ((color & 0x000007E0UL) << 5) | /* G */
  12.678 -                ((color & 0x0000001FUL) << 3) | /* B */
  12.679 -                ((color & 0x0000E000UL) << 3) | /* R compensation */
  12.680 -                ((color & 0x00000600UL) >> 1) | /* G compensation */
  12.681 -                ((color & 0x0000001CUL) >> 2);  /* B compensation */
  12.682 -
  12.683 -        }
  12.684 -        break;
  12.685 -    case 24:
  12.686 -        {
  12.687 -            truecolor = color & 0x00FFFFFFUL;
  12.688 -        }
  12.689 -        break;
  12.690 -    case 32:
  12.691 -        {
  12.692 -            truecolor = color;
  12.693 -        }
  12.694 -        break;
  12.695 -    default:
  12.696 -        {
  12.697 -            SDL_SetError
  12.698 -                ("ph_ExpandColor(): Unsupported depth for the hardware operations !\n");
  12.699 -            return 0xFFFFFFFFUL;
  12.700 -        }
  12.701 -    }
  12.702 -
  12.703 -    return truecolor;
  12.704 -}
  12.705 -
  12.706 -int
  12.707 -ph_FillHWRect(_THIS, SDL_Surface * surface, SDL_Rect * rect, Uint32 color)
  12.708 -{
  12.709 -    PgColor_t oldcolor;
  12.710 -    Uint32 truecolor;
  12.711 -    int ydisp = 0;
  12.712 -
  12.713 -    if (this->info.blit_fill != 1) {
  12.714 -        return -1;
  12.715 -    }
  12.716 -
  12.717 -    truecolor = ph_ExpandColor(this, surface, color);
  12.718 -    if (truecolor == 0xFFFFFFFFUL) {
  12.719 -        return -1;
  12.720 -    }
  12.721 -
  12.722 -    oldcolor = PgSetFillColor(truecolor);
  12.723 -
  12.724 -    /* 640x400 videomode emulation */
  12.725 -    if (videomode_emulatemode == 1) {
  12.726 -        ydisp += 40;
  12.727 -    }
  12.728 -
  12.729 -    PgDrawIRect(rect->x, rect->y + ydisp, rect->w + rect->x - 1,
  12.730 -                rect->h + rect->y + ydisp - 1, Pg_DRAW_FILL);
  12.731 -    PgSetFillColor(oldcolor);
  12.732 -    PgFlush();
  12.733 -    PgWaitHWIdle();
  12.734 -
  12.735 -    return 0;
  12.736 -}
  12.737 -
  12.738 -int
  12.739 -ph_FlipHWSurface(_THIS, SDL_Surface * screen)
  12.740 -{
  12.741 -    PhArea_t farea;
  12.742 -
  12.743 -    if ((screen->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) {
  12.744 -        /* flush all drawing ops before blitting */
  12.745 -        PgFlush();
  12.746 -        PgWaitHWIdle();
  12.747 -
  12.748 -        farea.pos.x = 0;
  12.749 -        farea.pos.y = 0;
  12.750 -        farea.size.w = screen->w;
  12.751 -        farea.size.h = screen->h;
  12.752 -
  12.753 -        /* emulate 640x400 videomode */
  12.754 -        if (videomode_emulatemode == 1) {
  12.755 -            farea.pos.y += 40;
  12.756 -        }
  12.757 -
  12.758 -        PgContextBlitArea(OCImage.offscreen_context, &farea,
  12.759 -                          OCImage.offscreen_backcontext, &farea);
  12.760 -
  12.761 -        /* flush the blitting */
  12.762 -        PgFlush();
  12.763 -        PgWaitHWIdle();
  12.764 -    }
  12.765 -    return 0;
  12.766 -}
  12.767 -
  12.768 -int
  12.769 -ph_LockHWSurface(_THIS, SDL_Surface * surface)
  12.770 -{
  12.771 -
  12.772 -#if 0                           /* FIXME */
  12.773 -    int lockresult;
  12.774 -
  12.775 -    if (surface->hwdata == NULL) {
  12.776 -        return;
  12.777 -    }
  12.778 -
  12.779 -    surface->hwdata->lockparam.flags = 0;
  12.780 -    surface->hwdata->lockparam.time_out = NULL;
  12.781 -    lockresult =
  12.782 -        PdLockOffscreen(surface->hwdata->offscreenctx,
  12.783 -                        &surface->hwdata->lockparam);
  12.784 -
  12.785 -    switch (lockresult) {
  12.786 -    case EOK:
  12.787 -        break;
  12.788 -    case Pg_OSC_LOCK_DEADLOCK:
  12.789 -        SDL_SetError("ph_LockHWSurface(): Deadlock detected !\n");
  12.790 -        return -1;
  12.791 -    case Pg_OSC_LOCK_INVALID:
  12.792 -        SDL_SetError("ph_LockHWSurface(): Lock invalid !\n");
  12.793 -        return -1;
  12.794 -    default:
  12.795 -        SDL_SetError("ph_LockHWSurface(): Can't lock the surface !\n");
  12.796 -        return -1;
  12.797 -    }
  12.798 -#endif /* 0 */
  12.799 -
  12.800 -    return 0;
  12.801 -}
  12.802 -
  12.803 -void
  12.804 -ph_UnlockHWSurface(_THIS, SDL_Surface * surface)
  12.805 -{
  12.806 -
  12.807 -#if 0                           /* FIXME */
  12.808 -    int unlockresult;
  12.809 -
  12.810 -    if ((surface == NULL) || (surface->hwdata == NULL)) {
  12.811 -        return;
  12.812 -    }
  12.813 -
  12.814 -    if (PdIsOffscreenLocked(surface->hwdata->offscreenctx) == Pg_OSC_LOCKED) {
  12.815 -        unlockresult = PdUnlockOffscreen(surface->hwdata->offscreenctx);
  12.816 -    }
  12.817 -#endif /* 0 */
  12.818 -
  12.819 -    return;
  12.820 -}
  12.821 -
  12.822 -int
  12.823 -ph_HWAccelBlit(SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst,
  12.824 -               SDL_Rect * dstrect)
  12.825 -{
  12.826 -    SDL_VideoDevice *this = current_video;
  12.827 -    PhArea_t srcarea;
  12.828 -    PhArea_t dstarea;
  12.829 -    int ydisp = 0;
  12.830 -
  12.831 -    /* 640x400 videomode emulation */
  12.832 -    if (videomode_emulatemode == 1) {
  12.833 -        ydisp += 40;
  12.834 -    }
  12.835 -
  12.836 -    srcarea.pos.x = srcrect->x;
  12.837 -    srcarea.pos.y = srcrect->y;
  12.838 -    srcarea.size.w = srcrect->w;
  12.839 -    srcarea.size.h = srcrect->h;
  12.840 -
  12.841 -    dstarea.pos.x = dstrect->x;
  12.842 -    dstarea.pos.y = dstrect->y;
  12.843 -    dstarea.size.w = dstrect->w;
  12.844 -    dstarea.size.h = dstrect->h;
  12.845 -
  12.846 -    if (((src == this->screen) || (src->hwdata != NULL))
  12.847 -        && ((dst == this->screen) || (dst->hwdata != NULL))) {
  12.848 -        if ((src->flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY) {
  12.849 -            ph_SetHWColorKey(this, src, src->format->colorkey);
  12.850 -            PgChromaOn();
  12.851 -        }
  12.852 -
  12.853 -        if ((src->flags & SDL_SRCALPHA) == SDL_SRCALPHA) {
  12.854 -            ph_SetHWAlpha(this, src, src->format->alpha);
  12.855 -            PgAlphaOn();
  12.856 -        }
  12.857 -
  12.858 -        if (dst == this->screen) {
  12.859 -            if (src == this->screen) {
  12.860 -                /* blitting from main screen to main screen */
  12.861 -                dstarea.pos.y += ydisp;
  12.862 -                srcarea.pos.y += ydisp;
  12.863 -                PgContextBlitArea(OCImage.offscreen_context, &srcarea,
  12.864 -                                  OCImage.offscreen_context, &dstarea);
  12.865 -            } else {
  12.866 -                /* blitting from offscreen to main screen */
  12.867 -                dstarea.pos.y += ydisp;
  12.868 -                PgContextBlitArea(src->hwdata->offscreenctx, &srcarea,
  12.869 -                                  OCImage.offscreen_context, &dstarea);
  12.870 -            }
  12.871 -        } else {
  12.872 -            if (src == this->screen) {
  12.873 -                /* blitting from main screen to offscreen */
  12.874 -                srcarea.pos.y += ydisp;
  12.875 -                PgContextBlitArea(OCImage.offscreen_context, &srcarea,
  12.876 -                                  dst->hwdata->offscreenctx, &dstarea);
  12.877 -            } else {
  12.878 -                /* blitting offscreen to offscreen */
  12.879 -                PgContextBlitArea(src->hwdata->offscreenctx, &srcarea,
  12.880 -                                  dst->hwdata->offscreenctx, &dstarea);
  12.881 -            }
  12.882 -        }
  12.883 -
  12.884 -        if ((src->flags & SDL_SRCALPHA) == SDL_SRCALPHA) {
  12.885 -            PgAlphaOff();
  12.886 -        }
  12.887 -
  12.888 -        if ((src->flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY) {
  12.889 -            PgChromaOff();
  12.890 -        }
  12.891 -    } else {
  12.892 -        SDL_SetError
  12.893 -            ("ph_HWAccelBlit(): Source or target surface is not a hardware surface !\n");
  12.894 -        return -1;
  12.895 -    }
  12.896 -
  12.897 -    PgFlush();
  12.898 -    PgWaitHWIdle();
  12.899 -
  12.900 -    return 0;
  12.901 -}
  12.902 -
  12.903 -int
  12.904 -ph_SetHWColorKey(_THIS, SDL_Surface * surface, Uint32 key)
  12.905 -{
  12.906 -    if (this->info.blit_hw_CC != 1) {
  12.907 -        return -1;
  12.908 -    }
  12.909 -
  12.910 -    if (surface->hwdata != NULL) {
  12.911 -        surface->hwdata->colorkey = ph_ExpandColor(this, surface, key);
  12.912 -        if (surface->hwdata->colorkey == 0xFFFFFFFFUL) {
  12.913 -            return -1;
  12.914 -        }
  12.915 -    }
  12.916 -    PgSetChroma(surface->hwdata->colorkey,
  12.917 -                Pg_CHROMA_SRC_MATCH | Pg_CHROMA_NODRAW);
  12.918 -
  12.919 -    return 0;
  12.920 -}
  12.921 -
  12.922 -int
  12.923 -ph_SetHWAlpha(_THIS, SDL_Surface * surface, Uint8 alpha)
  12.924 -{
  12.925 -    if (this->info.blit_hw_A != 1) {
  12.926 -        return -1;
  12.927 -    }
  12.928 -
  12.929 -    PgSetAlphaBlend(NULL, alpha);
  12.930 -
  12.931 -    return 0;
  12.932 -}
  12.933 -
  12.934 -#if SDL_VIDEO_OPENGL
  12.935 -void
  12.936 -ph_OpenGLUpdate(_THIS, int numrects, SDL_Rect * rects)
  12.937 -{
  12.938 -    this->GL_SwapBuffers(this);
  12.939 -
  12.940 -    return;
  12.941 -}
  12.942 -#endif /* SDL_VIDEO_OPENGL */
  12.943 -
  12.944 -void
  12.945 -ph_NormalUpdate(_THIS, int numrects, SDL_Rect * rects)
  12.946 -{
  12.947 -    PhPoint_t ph_pos;
  12.948 -    PhRect_t ph_rect;
  12.949 -    int i;
  12.950 -
  12.951 -    for (i = 0; i < numrects; ++i) {
  12.952 -        if (rects[i].w == 0) {  /* Clipped? dunno why but this occurs sometime. */
  12.953 -            continue;
  12.954 -        }
  12.955 -
  12.956 -        if (rects[i].h == 0) {  /* Clipped? dunno why but this occurs sometime. */
  12.957 -            continue;
  12.958 -        }
  12.959 -
  12.960 -        ph_pos.x = rects[i].x;
  12.961 -        ph_pos.y = rects[i].y;
  12.962 -        ph_rect.ul.x = rects[i].x;
  12.963 -        ph_rect.ul.y = rects[i].y;
  12.964 -        ph_rect.lr.x = rects[i].x + rects[i].w;
  12.965 -        ph_rect.lr.y = rects[i].y + rects[i].h;
  12.966 -
  12.967 -        if (PgDrawPhImageRectmx(&ph_pos, SDL_Image, &ph_rect, 0) < 0) {
  12.968 -            SDL_SetError("ph_NormalUpdate(): PgDrawPhImageRectmx failed!\n");
  12.969 -            return;
  12.970 -        }
  12.971 -    }
  12.972 -
  12.973 -    if (PgFlush() < 0) {
  12.974 -        SDL_SetError("ph_NormalUpdate(): PgFlush() function failed!\n");
  12.975 -    }
  12.976 -}
  12.977 -
  12.978 -void
  12.979 -ph_OCUpdate(_THIS, int numrects, SDL_Rect * rects)
  12.980 -{
  12.981 -    int i;
  12.982 -
  12.983 -    PhPoint_t zero = { 0, 0 };
  12.984 -    PhArea_t src_rect;
  12.985 -    PhArea_t dest_rect;
  12.986 -
  12.987 -    PgSetTranslation(&zero, 0);
  12.988 -    PgSetRegion(PtWidgetRid(window));
  12.989 -    PgSetClipping(0, NULL);
  12.990 -
  12.991 -    PgFlush();
  12.992 -    PgWaitHWIdle();
  12.993 -
  12.994 -    for (i = 0; i < numrects; ++i) {
  12.995 -        if (rects[i].w == 0) {  /* Clipped? */
  12.996 -            continue;
  12.997 -        }
  12.998 -
  12.999 -        if (rects[i].h == 0) {  /* Clipped? */
 12.1000 -            continue;
 12.1001 -        }
 12.1002 -
 12.1003 -        src_rect.pos.x = rects[i].x;
 12.1004 -        src_rect.pos.y = rects[i].y;
 12.1005 -        dest_rect.pos.x = rects[i].x;
 12.1006 -        dest_rect.pos.y = rects[i].y;
 12.1007 -
 12.1008 -        src_rect.size.w = rects[i].w;
 12.1009 -        src_rect.size.h = rects[i].h;
 12.1010 -        dest_rect.size.w = rects[i].w;
 12.1011 -        dest_rect.size.h = rects[i].h;
 12.1012 -
 12.1013 -        PgContextBlitArea(OCImage.offscreen_context, &src_rect, NULL,
 12.1014 -                          &dest_rect);
 12.1015 -    }
 12.1016 -
 12.1017 -    if (PgFlush() < 0) {
 12.1018 -        SDL_SetError("ph_OCUpdate(): PgFlush failed.\n");
 12.1019 -    }
 12.1020 -}
 12.1021 -
 12.1022 -void
 12.1023 -ph_OCDCUpdate(_THIS, int numrects, SDL_Rect * rects)
 12.1024 -{
 12.1025 -    PgWaitHWIdle();
 12.1026 -
 12.1027 -    if (PgFlush() < 0) {
 12.1028 -        SDL_SetError("ph_OCDCUpdate(): PgFlush failed.\n");
 12.1029 -    }
 12.1030 -}
 12.1031 -
 12.1032 -/* vi: set ts=4 sw=4 expandtab: */
    13.1 --- a/src/video/photon/SDL_ph_image_c.h	Fri Feb 27 09:51:55 2009 +0000
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,62 +0,0 @@
    13.4 -/*
    13.5 -    SDL - Simple DirectMedia Layer
    13.6 -    Copyright (C) 1997-2009 Sam Lantinga
    13.7 -
    13.8 -    This library is free software; you can redistribute it and/or
    13.9 -    modify it under the terms of the GNU Lesser General Public
   13.10 -    License as published by the Free Software Foundation; either
   13.11 -    version 2.1 of the License, or (at your option) any later version.
   13.12 -
   13.13 -    This library is distributed in the hope that it will be useful,
   13.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   13.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   13.16 -    Lesser General Public License for more details.
   13.17 -
   13.18 -    You should have received a copy of the GNU Lesser General Public
   13.19 -    License along with this library; if not, write to the Free Software
   13.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   13.21 -
   13.22 -    Sam Lantinga
   13.23 -    slouken@libsdl.org
   13.24 -*/
   13.25 -#include "SDL_config.h"
   13.26 -
   13.27 -#ifndef __SDL_PH_IMAGE_H__
   13.28 -#define __SDL_PH_IMAGE_H__
   13.29 -
   13.30 -#include "../../events/SDL_events_c.h"
   13.31 -#include "SDL_ph_video.h"
   13.32 -
   13.33 -struct private_hwdata
   13.34 -{
   13.35 -    PdOffscreenContext_t *offscreenctx;
   13.36 -    PdOSCCreateLockParams_t crlockparam;
   13.37 -    PdOSCLockParams_t lockparam;
   13.38 -    Uint32 colorkey;
   13.39 -};
   13.40 -
   13.41 -extern int ph_SetupImage(_THIS, SDL_Surface * screen);
   13.42 -extern void ph_DestroyImage(_THIS, SDL_Surface * screen);
   13.43 -extern int ph_SetupUpdateFunction(_THIS, SDL_Surface * screen, Uint32 flags);
   13.44 -
   13.45 -extern int ph_AllocHWSurface(_THIS, SDL_Surface * surface);
   13.46 -extern void ph_FreeHWSurface(_THIS, SDL_Surface * surface);
   13.47 -extern int ph_CheckHWBlit(_THIS, SDL_Surface * src, SDL_Surface * dst);
   13.48 -extern int ph_FillHWRect(_THIS, SDL_Surface * surface, SDL_Rect * rect,
   13.49 -                         Uint32 color);
   13.50 -extern int ph_LockHWSurface(_THIS, SDL_Surface * surface);
   13.51 -extern void ph_UnlockHWSurface(_THIS, SDL_Surface * surface);
   13.52 -extern int ph_FlipHWSurface(_THIS, SDL_Surface * surface);
   13.53 -extern int ph_SetHWColorKey(_THIS, SDL_Surface * surface, Uint32 key);
   13.54 -extern int ph_SetHWAlpha(_THIS, SDL_Surface * surface, Uint8 alpha);
   13.55 -extern int ph_HWAccelBlit(SDL_Surface * src, SDL_Rect * srcrect,
   13.56 -                          SDL_Surface * dst, SDL_Rect * dstrect);
   13.57 -extern int ph_UpdateHWInfo(_THIS);
   13.58 -
   13.59 -extern void ph_NormalUpdate(_THIS, int numrects, SDL_Rect * rects);
   13.60 -extern void ph_OCUpdate(_THIS, int numrects, SDL_Rect * rects);
   13.61 -extern void ph_OCDCUpdate(_THIS, int numrects, SDL_Rect * rects);
   13.62 -extern void ph_OpenGLUpdate(_THIS, int numrects, SDL_Rect * rects);
   13.63 -
   13.64 -#endif /* __SDL_PH_IMAGE_H__ */
   13.65 -/* vi: set ts=4 sw=4 expandtab: */
    14.1 --- a/src/video/photon/SDL_ph_modes.c	Fri Feb 27 09:51:55 2009 +0000
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,357 +0,0 @@
    14.4 -/*
    14.5 -    SDL - Simple DirectMedia Layer
    14.6 -    Copyright (C) 1997-2009 Sam Lantinga
    14.7 -
    14.8 -    This library is free software; you can redistribute it and/or
    14.9 -    modify it under the terms of the GNU Lesser General Public
   14.10 -    License as published by the Free Software Foundation; either
   14.11 -    version 2.1 of the License, or (at your option) any later version.
   14.12 -
   14.13 -    This library is distributed in the hope that it will be useful,
   14.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   14.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   14.16 -    Lesser General Public License for more details.
   14.17 -
   14.18 -    You should have received a copy of the GNU Lesser General Public
   14.19 -    License along with this library; if not, write to the Free Software
   14.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   14.21 -
   14.22 -    Sam Lantinga
   14.23 -    slouken@libsdl.org
   14.24 -*/
   14.25 -#include "SDL_config.h"
   14.26 -
   14.27 -#include "SDL_ph_modes_c.h"
   14.28 -
   14.29 -static PgVideoModeInfo_t mode_info;
   14.30 -static PgVideoModes_t mode_list;
   14.31 -
   14.32 -/* The current list of available video modes */
   14.33 -SDL_Rect SDL_modelist[PH_MAX_VIDEOMODES];
   14.34 -SDL_Rect *SDL_modearray[PH_MAX_VIDEOMODES];
   14.35 -
   14.36 -static int
   14.37 -compare_modes_by_res(const void *mode1, const void *mode2)
   14.38 -{
   14.39 -    PgVideoModeInfo_t mode1_info;
   14.40 -    PgVideoModeInfo_t mode2_info;
   14.41 -
   14.42 -    if (PgGetVideoModeInfo(*(unsigned short *) mode1, &mode1_info) < 0) {
   14.43 -        return 0;
   14.44 -    }
   14.45 -
   14.46 -    if (PgGetVideoModeInfo(*(unsigned short *) mode2, &mode2_info) < 0) {
   14.47 -        return 0;
   14.48 -    }
   14.49 -
   14.50 -    if (mode1_info.width == mode2_info.width) {
   14.51 -        return mode2_info.height - mode1_info.height;
   14.52 -    } else {
   14.53 -        return mode2_info.width - mode1_info.width;
   14.54 -    }
   14.55 -}
   14.56 -
   14.57 -SDL_Rect **
   14.58 -ph_ListModes(_THIS, SDL_PixelFormat * format, Uint32 flags)
   14.59 -{
   14.60 -    int i = 0;
   14.61 -    int j = 0;
   14.62 -    SDL_Rect Amodelist[PH_MAX_VIDEOMODES];
   14.63 -
   14.64 -    for (i = 0; i < PH_MAX_VIDEOMODES; i++) {
   14.65 -        SDL_modearray[i] = &SDL_modelist[i];
   14.66 -    }
   14.67 -
   14.68 -    if (PgGetVideoModeList(&mode_list) < 0) {
   14.69 -        SDL_SetError
   14.70 -            ("ph_ListModes(): PgGetVideoModeList() function failed !\n");
   14.71 -        return NULL;
   14.72 -    }
   14.73 -
   14.74 -    mode_info.bits_per_pixel = 0;
   14.75 -
   14.76 -    for (i = 0; i < mode_list.num_modes; i++) {
   14.77 -        if (PgGetVideoModeInfo(mode_list.modes[i], &mode_info) < 0) {
   14.78 -            SDL_SetError
   14.79 -                ("ph_ListModes(): PgGetVideoModeInfo() function failed on mode: 0x%X.\n",
   14.80 -                 mode_list.modes[i]);
   14.81 -            return NULL;
   14.82 -        }
   14.83 -        if (mode_info.bits_per_pixel == format->BitsPerPixel) {
   14.84 -            Amodelist[j].w = mode_info.width;
   14.85 -            Amodelist[j].h = mode_info.height;
   14.86 -            Amodelist[j].x = 0;
   14.87 -            Amodelist[j].y = 0;
   14.88 -            j++;
   14.89 -        }
   14.90 -    }
   14.91 -
   14.92 -    /* reorder biggest for smallest, assume width dominates */
   14.93 -
   14.94 -    for (i = 0; i < j; i++) {
   14.95 -        SDL_modelist[i].w = Amodelist[j - i - 1].w;
   14.96 -        SDL_modelist[i].h = Amodelist[j - i - 1].h;
   14.97 -        SDL_modelist[i].x = Amodelist[j - i - 1].x;
   14.98 -        SDL_modelist[i].y = Amodelist[j - i - 1].y;
   14.99 -    }
  14.100 -    SDL_modearray[j] = NULL;
  14.101 -
  14.102 -    return SDL_modearray;
  14.103 -}
  14.104 -
  14.105 -void
  14.106 -ph_FreeVideoModes(_THIS)
  14.107 -{
  14.108 -    return;
  14.109 -}
  14.110 -
  14.111 -/* return the mode associated with width, height and bpp */
  14.112 -/* if there is no mode then zero is returned             */
  14.113 -int
  14.114 -ph_GetVideoMode(int width, int height, int bpp)
  14.115 -{
  14.116 -    int i;
  14.117 -    int modestage = 0;
  14.118 -    int closestmode = 0;
  14.119 -
  14.120 -    if (PgGetVideoModeList(&mode_list) < 0) {
  14.121 -        return -1;
  14.122 -    }
  14.123 -
  14.124 -    /* special case for the double-sized 320x200 mode */
  14.125 -    if ((width == 640) && (height == 400)) {
  14.126 -        modestage = 1;
  14.127 -    }
  14.128 -
  14.129 -    /* search list for exact match */
  14.130 -    for (i = 0; i < mode_list.num_modes; i++) {
  14.131 -        if (PgGetVideoModeInfo(mode_list.modes[i], &mode_info) < 0) {
  14.132 -            return 0;
  14.133 -        }
  14.134 -
  14.135 -        if ((mode_info.width == width) && (mode_info.height == height) &&
  14.136 -            (mode_info.bits_per_pixel == bpp)) {
  14.137 -            return mode_list.modes[i];
  14.138 -        } else {
  14.139 -            if ((modestage) && (mode_info.width == width)
  14.140 -                && (mode_info.height == height + 80)
  14.141 -                && (mode_info.bits_per_pixel == bpp)) {
  14.142 -                modestage = 2;
  14.143 -                closestmode = mode_list.modes[i];
  14.144 -            }
  14.145 -        }
  14.146 -    }
  14.147 -
  14.148 -    /* if we are here, then no 640x400xbpp mode found and we'll emulate it via 640x480xbpp mode */
  14.149 -    if (modestage == 2) {
  14.150 -        return closestmode;
  14.151 -    }
  14.152 -
  14.153 -    return (i == mode_list.num_modes) ? 0 : mode_list.modes[i];
  14.154 -}
  14.155 -
  14.156 -/* return the mode associated with width, height and bpp               */
  14.157 -/* if requested bpp is not found the mode with closest bpp is returned */
  14.158 -int
  14.159 -get_mode_any_format(int width, int height, int bpp)
  14.160 -{
  14.161 -    int i, closest, delta, min_delta;
  14.162 -
  14.163 -    if (PgGetVideoModeList(&mode_list) < 0) {
  14.164 -        return -1;
  14.165 -    }
  14.166 -
  14.167 -    SDL_qsort(mode_list.modes, mode_list.num_modes, sizeof(unsigned short),
  14.168 -              compare_modes_by_res);
  14.169 -
  14.170 -    for (i = 0; i < mode_list.num_modes; i++) {
  14.171 -        if (PgGetVideoModeInfo(mode_list.modes[i], &mode_info) < 0) {
  14.172 -            return 0;
  14.173 -        }
  14.174 -        if ((mode_info.width == width) && (mode_info.height == height)) {
  14.175 -            break;
  14.176 -        }
  14.177 -    }
  14.178 -
  14.179 -    if (i < mode_list.num_modes) {
  14.180 -        /* get closest bpp */
  14.181 -        closest = i++;
  14.182 -        if (mode_info.bits_per_pixel == bpp) {
  14.183 -            return mode_list.modes[closest];
  14.184 -        }
  14.185 -
  14.186 -        min_delta = abs(mode_info.bits_per_pixel - bpp);
  14.187 -
  14.188 -        while (1) {
  14.189 -            if (PgGetVideoModeInfo(mode_list.modes[i], &mode_info) < 0) {
  14.190 -                return 0;
  14.191 -            }
  14.192 -
  14.193 -            if ((mode_info.width != width)
  14.194 -                || (mode_info.height != height)) {
  14.195 -                break;
  14.196 -            } else {
  14.197 -                if (mode_info.bits_per_pixel == bpp) {
  14.198 -                    closest = i;
  14.199 -                    break;
  14.200 -                } else {
  14.201 -                    delta = abs(mode_info.bits_per_pixel - bpp);
  14.202 -                    if (delta < min_delta) {
  14.203 -                        closest = i;
  14.204 -                        min_delta = delta;
  14.205 -                    }
  14.206 -                    i++;
  14.207 -                }
  14.208 -            }
  14.209 -        }
  14.210 -        return mode_list.modes[closest];
  14.211 -    }
  14.212 -
  14.213 -    return 0;
  14.214 -}
  14.215 -
  14.216 -int
  14.217 -ph_ToggleFullScreen(_THIS, int on)
  14.218 -{
  14.219 -    return -1;
  14.220 -}
  14.221 -
  14.222 -int
  14.223 -ph_EnterFullScreen(_THIS, SDL_Surface * screen, int fmode)
  14.224 -{
  14.225 -    PgDisplaySettings_t settings;
  14.226 -    int mode;
  14.227 -    char *refreshrate;
  14.228 -    int refreshratenum;
  14.229 -
  14.230 -    if (!currently_fullscreen) {
  14.231 -        /* Get the video mode and set it */
  14.232 -        if (screen->flags & SDL_ANYFORMAT) {
  14.233 -            if ((mode =
  14.234 -                 get_mode_any_format(screen->w, screen->h,
  14.235 -                                     screen->format->BitsPerPixel)) == 0) {
  14.236 -                SDL_SetError
  14.237 -                    ("ph_EnterFullScreen(): can't find appropriate video mode !\n");
  14.238 -                return 0;
  14.239 -            }
  14.240 -        } else {
  14.241 -            if ((mode =
  14.242 -                 ph_GetVideoMode(screen->w, screen->h,
  14.243 -                                 screen->format->BitsPerPixel)) == 0) {
  14.244 -                SDL_SetError
  14.245 -                    ("ph_EnterFullScreen(): can't find appropriate video mode !\n");
  14.246 -                return 0;
  14.247 -            }
  14.248 -            if (PgGetVideoModeInfo(mode, &mode_info) < 0) {
  14.249 -                SDL_SetError
  14.250 -                    ("ph_EnterFullScreen(): can't get video mode capabilities !\n");
  14.251 -                return 0;
  14.252 -            }
  14.253 -            if (mode_info.height != screen->h) {
  14.254 -                if ((mode_info.height == 480) && (screen->h == 400)) {
  14.255 -                    videomode_emulatemode = 1;
  14.256 -                }
  14.257 -            } else {
  14.258 -                videomode_emulatemode = 0;
  14.259 -            }
  14.260 -        }
  14.261 -
  14.262 -        /* save old video mode caps */
  14.263 -        PgGetVideoMode(&settings);
  14.264 -        old_video_mode = settings.mode;
  14.265 -        old_refresh_rate = settings.refresh;
  14.266 -
  14.267 -        /* setup new video mode */
  14.268 -        settings.mode = mode;
  14.269 -        settings.refresh = 0;
  14.270 -        settings.flags = 0;
  14.271 -
  14.272 -        refreshrate = SDL_getenv("SDL_PHOTON_FULLSCREEN_REFRESH");
  14.273 -        if (refreshrate != NULL) {
  14.274 -            if (SDL_sscanf(refreshrate, "%d", &refreshratenum) == 1) {
  14.275 -                settings.refresh = refreshratenum;
  14.276 -            }
  14.277 -        }
  14.278 -
  14.279 -        if (PgSetVideoMode(&settings) < 0) {
  14.280 -            SDL_SetError
  14.281 -                ("ph_EnterFullScreen(): PgSetVideoMode() call failed !\n");
  14.282 -            return 0;
  14.283 -        }
  14.284 -
  14.285 -        if (this->screen) {
  14.286 -            if (this->screen->flags & SDL_INTERNALOPENGL) {
  14.287 -#if !SDL_VIDEO_OPENGL || (_NTO_VERSION < 630)
  14.288 -                return 0;       /* 6.3.0 */
  14.289 -#endif
  14.290 -            }
  14.291 -        }
  14.292 -
  14.293 -        if (fmode == 0) {
  14.294 -            if (OCImage.direct_context == NULL) {
  14.295 -                OCImage.direct_context =
  14.296 -                    (PdDirectContext_t *) PdCreateDirectContext();
  14.297 -                if (!OCImage.direct_context) {
  14.298 -                    SDL_SetError
  14.299 -                        ("ph_EnterFullScreen(): Can't create direct context !\n");
  14.300 -                    ph_LeaveFullScreen(this);
  14.301 -                    return 0;
  14.302 -                }
  14.303 -            }
  14.304 -            OCImage.oldDC = PdDirectStart(OCImage.direct_context);
  14.305 -        }
  14.306 -
  14.307 -        currently_fullscreen = 1;
  14.308 -    }
  14.309 -    PgFlush();
  14.310 -
  14.311 -    return 1;
  14.312 -}
  14.313 -
  14.314 -int
  14.315 -ph_LeaveFullScreen(_THIS)
  14.316 -{
  14.317 -    PgDisplaySettings_t oldmode_settings;
  14.318 -
  14.319 -    if (currently_fullscreen) {
  14.320 -        if ((this->screen) && (this->screen->flags & SDL_INTERNALOPENGL)) {
  14.321 -#if !SDL_VIDEO_OPENGL || (_NTO_VERSION < 630)
  14.322 -            return 0;
  14.323 -#endif
  14.324 -        }
  14.325 -
  14.326 -        /* release routines starts here */
  14.327 -        {
  14.328 -            if (OCImage.direct_context) {
  14.329 -                PdDirectStop(OCImage.direct_context);
  14.330 -                PdReleaseDirectContext(OCImage.direct_context);
  14.331 -                OCImage.direct_context = NULL;
  14.332 -            }
  14.333 -            if (OCImage.oldDC) {
  14.334 -                PhDCSetCurrent(OCImage.oldDC);
  14.335 -                OCImage.oldDC = NULL;
  14.336 -            }
  14.337 -
  14.338 -            currently_fullscreen = 0;
  14.339 -
  14.340 -            /* Restore old video mode */
  14.341 -            if (old_video_mode != -1) {
  14.342 -                oldmode_settings.mode = (unsigned short) old_video_mode;
  14.343 -                oldmode_settings.refresh = (unsigned short) old_refresh_rate;
  14.344 -                oldmode_settings.flags = 0;
  14.345 -
  14.346 -                if (PgSetVideoMode(&oldmode_settings) < 0) {
  14.347 -                    SDL_SetError
  14.348 -                        ("Ph_LeaveFullScreen(): PgSetVideoMode() function failed !\n");
  14.349 -                    return 0;
  14.350 -                }
  14.351 -            }
  14.352 -
  14.353 -            old_video_mode = -1;
  14.354 -            old_refresh_rate = -1;
  14.355 -        }
  14.356 -    }
  14.357 -    return 1;
  14.358 -}
  14.359 -
  14.360 -/* vi: set ts=4 sw=4 expandtab: */
    15.1 --- a/src/video/photon/SDL_ph_modes_c.h	Fri Feb 27 09:51:55 2009 +0000
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,44 +0,0 @@
    15.4 -/*
    15.5 -    SDL - Simple DirectMedia Layer
    15.6 -    Copyright (C) 1997-2009 Sam Lantinga
    15.7 -
    15.8 -    This library is free software; you can redistribute it and/or
    15.9 -    modify it under the terms of the GNU Lesser General Public
   15.10 -    License as published by the Free Software Foundation; either
   15.11 -    version 2.1 of the License, or (at your option) any later version.
   15.12 -
   15.13 -    This library is distributed in the hope that it will be useful,
   15.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   15.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   15.16 -    Lesser General Public License for more details.
   15.17 -
   15.18 -    You should have received a copy of the GNU Lesser General Public
   15.19 -    License along with this library; if not, write to the Free Software
   15.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   15.21 -
   15.22 -    Sam Lantinga
   15.23 -    slouken@libsdl.org
   15.24 -*/
   15.25 -#include "SDL_config.h"
   15.26 -
   15.27 -#ifndef __SDL_PH_MODES_H__
   15.28 -#define __SDL_PH_MODES_H__
   15.29 -
   15.30 -#include "SDL_ph_video.h"
   15.31 -
   15.32 -#define PH_MAX_VIDEOMODES 127
   15.33 -
   15.34 -#define PH_ENTER_DIRECTMODE  0
   15.35 -#define PH_IGNORE_DIRECTMODE 1
   15.36 -
   15.37 -extern SDL_Rect **ph_ListModes(_THIS, SDL_PixelFormat * format, Uint32 flags);
   15.38 -extern void ph_FreeVideoModes(_THIS);
   15.39 -extern int ph_ResizeFullScreen(_THIS);
   15.40 -extern int ph_EnterFullScreen(_THIS, SDL_Surface * screen, int fmode);
   15.41 -extern int ph_LeaveFullScreen(_THIS);
   15.42 -extern int ph_GetVideoMode(int width, int height, int bpp);
   15.43 -extern int get_mode_any_format(int width, int height, int bpp);
   15.44 -extern int ph_ToggleFullScreen(_THIS, int on);
   15.45 -
   15.46 -#endif /* __SDL_PH_MODES_H__ */
   15.47 -/* vi: set ts=4 sw=4 expandtab: */
    16.1 --- a/src/video/photon/SDL_ph_mouse.c	Fri Feb 27 09:51:55 2009 +0000
    16.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.3 @@ -1,218 +0,0 @@
    16.4 -/*
    16.5 -    SDL - Simple DirectMedia Layer
    16.6 -    Copyright (C) 1997-2009 Sam Lantinga
    16.7 -
    16.8 -    This library is free software; you can redistribute it and/or
    16.9 -    modify it under the terms of the GNU Lesser General Public
   16.10 -    License as published by the Free Software Foundation; either
   16.11 -    version 2.1 of the License, or (at your option) any later version.
   16.12 -
   16.13 -    This library is distributed in the hope that it will be useful,
   16.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   16.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   16.16 -    Lesser General Public License for more details.
   16.17 -
   16.18 -    You should have received a copy of the GNU Lesser General Public
   16.19 -    License along with this library; if not, write to the Free Software
   16.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   16.21 -
   16.22 -    Sam Lantinga
   16.23 -    slouken@libsdl.org
   16.24 -*/
   16.25 -#include "SDL_config.h"
   16.26 -
   16.27 -#include "SDL_mouse.h"
   16.28 -#include "../../events/SDL_events_c.h"
   16.29 -#include "../SDL_cursor_c.h"
   16.30 -#include "SDL_ph_mouse_c.h"
   16.31 -
   16.32 -struct WMcursor
   16.33 -{
   16.34 -    PhCursorDef_t *ph_cursor;
   16.35 -};
   16.36 -
   16.37 -void
   16.38 -ph_FreeWMCursor(_THIS, WMcursor * cursor)
   16.39 -{
   16.40 -    if (window != NULL) {
   16.41 -        SDL_Lock_EventThread();
   16.42 -
   16.43 -        if (PtSetResource(window, Pt_ARG_CURSOR_TYPE, Ph_CURSOR_INHERIT, 0)
   16.44 -            < 0) {
   16.45 -            /* TODO: output error msg */
   16.46 -        }
   16.47 -
   16.48 -        SDL_Unlock_EventThread();
   16.49 -    }
   16.50 -
   16.51 -    SDL_free(cursor);
   16.52 -}
   16.53 -
   16.54 -WMcursor *
   16.55 -ph_CreateWMCursor(_THIS, Uint8 * data, Uint8 * mask, int w, int h, int hot_x,
   16.56 -                  int hot_y)
   16.57 -{
   16.58 -    WMcursor *cursor;
   16.59 -    int clen, i;
   16.60 -    unsigned char bit, databit, maskbit;
   16.61 -
   16.62 -    /* Allocate and initialize the cursor memory */
   16.63 -    if ((cursor = (WMcursor *) SDL_malloc(sizeof(WMcursor))) == NULL) {
   16.64 -        SDL_OutOfMemory();
   16.65 -        return (NULL);
   16.66 -    }
   16.67 -    SDL_memset(cursor, 0, sizeof(WMcursor));
   16.68 -
   16.69 -    cursor->ph_cursor =
   16.70 -        (PhCursorDef_t *) SDL_malloc(sizeof(PhCursorDef_t) + 32 * 4 * 2);
   16.71 -
   16.72 -    if (cursor->ph_cursor == NULL) {
   16.73 -        SDL_SetError("ph_CreateWMCursor(): cursor malloc failed !\n");
   16.74 -        return NULL;
   16.75 -    }
   16.76 -
   16.77 -    SDL_memset(cursor->ph_cursor, 0, (sizeof(PhCursorDef_t) + 32 * 4 * 2));
   16.78 -
   16.79 -    cursor->ph_cursor->hdr.type = Ph_RDATA_CURSOR;
   16.80 -    cursor->ph_cursor->size1.x = (short) w;
   16.81 -    cursor->ph_cursor->size1.y = (short) h;
   16.82 -    cursor->ph_cursor->offset1.x = (short) hot_x;
   16.83 -    cursor->ph_cursor->offset1.y = (short) hot_y;
   16.84 -    cursor->ph_cursor->bytesperline1 = (char) w / 8;
   16.85 -    cursor->ph_cursor->color1 = Pg_WHITE;
   16.86 -    cursor->ph_cursor->size2.x = (short) w;
   16.87 -    cursor->ph_cursor->size2.y = (short) h;
   16.88 -    cursor->ph_cursor->offset2.x = (short) hot_x;
   16.89 -    cursor->ph_cursor->offset2.y = (short) hot_y;
   16.90 -    cursor->ph_cursor->bytesperline2 = (char) w / 8;
   16.91 -    cursor->ph_cursor->color2 = Pg_BLACK;
   16.92 -
   16.93 -    clen = (w / 8) * h;
   16.94 -
   16.95 -    /* Copy the mask and the data to different bitmap planes */
   16.96 -    for (i = 0; i < clen; ++i) {
   16.97 -        for (bit = 0; bit < 8; bit++) {
   16.98 -            databit = data[i] & (1 << bit);
   16.99 -            maskbit = mask[i] & (1 << bit);
  16.100 -
  16.101 -            cursor->ph_cursor->images[i] |= (databit == 0) ? maskbit : 0;
  16.102 -            /* If the databit != 0, treat it as a black pixel and
  16.103 -             * ignore the maskbit (can't do an inverted color) */
  16.104 -            cursor->ph_cursor->images[i + clen] |= databit;
  16.105 -        }
  16.106 -    }
  16.107 -
  16.108 -    /* #bytes following the hdr struct */
  16.109 -    cursor->ph_cursor->hdr.len =
  16.110 -        sizeof(PhCursorDef_t) + clen * 2 - sizeof(PhRegionDataHdr_t);
  16.111 -
  16.112 -    return (cursor);
  16.113 -}
  16.114 -
  16.115 -PhCursorDef_t
  16.116 -ph_GetWMPhCursor(WMcursor * cursor)
  16.117 -{
  16.118 -    return (*cursor->ph_cursor);
  16.119 -}
  16.120 -
  16.121 -int
  16.122 -ph_ShowWMCursor(_THIS, WMcursor * cursor)
  16.123 -{
  16.124 -    PtArg_t args[3];
  16.125 -    int nargs = 0;
  16.126 -
  16.127 -    /* Don't do anything if the display is gone */
  16.128 -    if (window == NULL) {
  16.129 -        return (0);
  16.130 -    }
  16.131 -
  16.132 -    /* looks like photon can't draw mouse cursor in direct mode */
  16.133 -    if (this->screen->flags & SDL_FULLSCREEN) {
  16.134 -        /* disable the fake mouse in the fullscreen OpenGL mode */
  16.135 -        if (this->screen->flags & SDL_INTERNALOPENGL) {
  16.136 -            cursor = NULL;
  16.137 -        } else {
  16.138 -            return (0);
  16.139 -        }
  16.140 -    }
  16.141 -
  16.142 -    /* Set the photon cursor, or blank if cursor is NULL */
  16.143 -    if (cursor != NULL) {
  16.144 -        PtSetArg(&args[0], Pt_ARG_CURSOR_TYPE, Ph_CURSOR_BITMAP, 0);
  16.145 -        /* Could set next to any PgColor_t value */
  16.146 -        PtSetArg(&args[1], Pt_ARG_CURSOR_COLOR, Ph_CURSOR_DEFAULT_COLOR, 0);
  16.147 -        PtSetArg(&args[2], Pt_ARG_BITMAP_CURSOR, cursor->ph_cursor,
  16.148 -                 (cursor->ph_cursor->hdr.len + sizeof(PhRegionDataHdr_t)));
  16.149 -        nargs = 3;
  16.150 -    } else {                    /* Ph_CURSOR_NONE */
  16.151 -
  16.152 -        PtSetArg(&args[0], Pt_ARG_CURSOR_TYPE, Ph_CURSOR_NONE, 0);
  16.153 -        nargs = 1;
  16.154 -    }
  16.155 -
  16.156 -    SDL_Lock_EventThread();
  16.157 -
  16.158 -    if (PtSetResources(window, nargs, args) < 0) {
  16.159 -        return (0);
  16.160 -    }
  16.161 -
  16.162 -    SDL_Unlock_EventThread();
  16.163 -
  16.164 -    return (1);
  16.165 -}
  16.166 -
  16.167 -
  16.168 -void
  16.169 -ph_WarpWMCursor(_THIS, Uint16 x, Uint16 y)
  16.170 -{
  16.171 -    short abs_x, abs_y;
  16.172 -
  16.173 -    SDL_Lock_EventThread();
  16.174 -    PtGetAbsPosition(window, &abs_x, &abs_y);
  16.175 -    PhMoveCursorAbs(PhInputGroup(NULL), x + abs_x, y + abs_y);
  16.176 -    SDL_Unlock_EventThread();
  16.177 -}
  16.178 -
  16.179 -
  16.180 -void
  16.181 -ph_CheckMouseMode(_THIS)
  16.182 -{
  16.183 -    /* If the mouse is hidden and input is grabbed, we use relative mode */
  16.184 -    if (!(SDL_cursorstate & CURSOR_VISIBLE)
  16.185 -        && (this->input_grab != SDL_GRAB_OFF)) {
  16.186 -        mouse_relative = 1;
  16.187 -    } else {
  16.188 -        mouse_relative = 0;
  16.189 -    }
  16.190 -}
  16.191 -
  16.192 -
  16.193 -void
  16.194 -ph_UpdateMouse(_THIS)
  16.195 -{
  16.196 -    PhCursorInfo_t phcursor;
  16.197 -    short abs_x;
  16.198 -    short abs_y;
  16.199 -
  16.200 -    /* Lock the event thread, in multi-threading environments */
  16.201 -    SDL_Lock_EventThread();
  16.202 -
  16.203 -    /* synchronizing photon mouse cursor position and SDL mouse position, if cursor appears over window. */
  16.204 -    PtGetAbsPosition(window, &abs_x, &abs_y);
  16.205 -    PhQueryCursor(PhInputGroup(NULL), &phcursor);
  16.206 -    if (((phcursor.pos.x >= abs_x)
  16.207 -         && (phcursor.pos.x <= abs_x + this->screen->w))
  16.208 -        && ((phcursor.pos.y >= abs_y)
  16.209 -            && (phcursor.pos.y <= abs_y + this->screen->h))) {
  16.210 -        SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
  16.211 -        SDL_PrivateMouseMotion(0, 0, phcursor.pos.x - abs_x,
  16.212 -                               phcursor.pos.y - abs_y);
  16.213 -    } else {
  16.214 -        SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS);
  16.215 -    }
  16.216 -
  16.217 -    /* Unlock the event thread, in multi-threading environments */
  16.218 -    SDL_Unlock_EventThread();
  16.219 -}
  16.220 -
  16.221 -/* vi: set ts=4 sw=4 expandtab: */
    17.1 --- a/src/video/photon/SDL_ph_mouse_c.h	Fri Feb 27 09:51:55 2009 +0000
    17.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.3 @@ -1,41 +0,0 @@
    17.4 -/*
    17.5 -    SDL - Simple DirectMedia Layer
    17.6 -    Copyright (C) 1997-2009 Sam Lantinga
    17.7 -
    17.8 -    This library is free software; you can redistribute it and/or
    17.9 -    modify it under the terms of the GNU Lesser General Public
   17.10 -    License as published by the Free Software Foundation; either
   17.11 -    version 2.1 of the License, or (at your option) any later version.
   17.12 -
   17.13 -    This library is distributed in the hope that it will be useful,
   17.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   17.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   17.16 -    Lesser General Public License for more details.
   17.17 -
   17.18 -    You should have received a copy of the GNU Lesser General Public
   17.19 -    License along with this library; if not, write to the Free Software
   17.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   17.21 -
   17.22 -    Sam Lantinga
   17.23 -    slouken@libsdl.org
   17.24 -*/
   17.25 -#include "SDL_config.h"
   17.26 -
   17.27 -#ifndef __SDL_PH_MOUSE_H__
   17.28 -#define __SDL_PH_MOUSE_H__
   17.29 -
   17.30 -#include "SDL_ph_video.h"
   17.31 -
   17.32 -/* Functions to be exported */
   17.33 -extern void ph_FreeWMCursor(_THIS, WMcursor * cursor);
   17.34 -extern WMcursor *ph_CreateWMCursor(_THIS,
   17.35 -                                   Uint8 * data, Uint8 * mask, int w, int h,
   17.36 -                                   int hot_x, int hot_y);
   17.37 -extern PhCursorDef_t ph_GetWMPhCursor(WMcursor * cursor);
   17.38 -extern int ph_ShowWMCursor(_THIS, WMcursor * cursor);
   17.39 -extern void ph_WarpWMCursor(_THIS, Uint16 x, Uint16 y);
   17.40 -extern void ph_CheckMouseMode(_THIS);
   17.41 -extern void ph_UpdateMouse(_THIS);
   17.42 -
   17.43 -#endif /* __SDL_PH_MOUSE_H__ */
   17.44 -/* vi: set ts=4 sw=4 expandtab: */
    18.1 --- a/src/video/photon/SDL_ph_video.c	Fri Feb 27 09:51:55 2009 +0000
    18.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.3 @@ -1,629 +0,0 @@
    18.4 -/*
    18.5 -    SDL - Simple DirectMedia Layer
    18.6 -    Copyright (C) 1997-2009 Sam Lantinga
    18.7 -
    18.8 -    This library is free software; you can redistribute it and/or
    18.9 -    modify it under the terms of the GNU Lesser General Public
   18.10 -    License as published by the Free Software Foundation; either
   18.11 -    version 2.1 of the License, or (at your option) any later version.
   18.12 -
   18.13 -    This library is distributed in the hope that it will be useful,
   18.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   18.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   18.16 -    Lesser General Public License for more details.
   18.17 -
   18.18 -    You should have received a copy of the GNU Lesser General Public
   18.19 -    License along with this library; if not, write to the Free Software
   18.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   18.21 -
   18.22 -    Sam Lantinga
   18.23 -    slouken@libsdl.org
   18.24 -*/
   18.25 -#include "SDL_config.h"
   18.26 -
   18.27 -#include <unistd.h>
   18.28 -#include <sys/ioctl.h>
   18.29 -
   18.30 -#include "SDL_endian.h"
   18.31 -#include "SDL_timer.h"
   18.32 -#include "SDL_thread.h"
   18.33 -#include "SDL_video.h"
   18.34 -#include "SDL_mouse.h"
   18.35 -#include "../SDL_sysvideo.h"
   18.36 -#include "../SDL_pixels_c.h"
   18.37 -#include "../../events/SDL_events_c.h"
   18.38 -#include "SDL_ph_video.h"
   18.39 -#include "SDL_ph_modes_c.h"
   18.40 -#include "SDL_ph_image_c.h"
   18.41 -#include "SDL_ph_events_c.h"
   18.42 -#include "SDL_ph_mouse_c.h"
   18.43 -#include "SDL_ph_wm_c.h"
   18.44 -#include "SDL_ph_gl.h"
   18.45 -#include "SDL_phyuv_c.h"
   18.46 -#include "../blank_cursor.h"
   18.47 -
   18.48 -static int ph_VideoInit(_THIS, SDL_PixelFormat * vformat);
   18.49 -static SDL_Surface *ph_SetVideoMode(_THIS, SDL_Surface * current, int width,
   18.50 -                                    int height, int bpp, Uint32 flags);
   18.51 -static int ph_SetColors(_THIS, int firstcolor, int ncolors,
   18.52 -                        SDL_Color * colors);
   18.53 -static void ph_VideoQuit(_THIS);
   18.54 -static void ph_DeleteDevice(SDL_VideoDevice * device);
   18.55 -
   18.56 -static int phstatus = -1;
   18.57 -
   18.58 -static int
   18.59 -ph_Available(void)
   18.60 -{
   18.61 -    if (phstatus != 0) {
   18.62 -        phstatus = PtInit(NULL);
   18.63 -        if (phstatus == 0) {
   18.64 -            return 1;
   18.65 -        } else {
   18.66 -            return 0;
   18.67 -        }
   18.68 -    }
   18.69 -    return 1;
   18.70 -}
   18.71 -
   18.72 -static SDL_VideoDevice *
   18.73 -ph_CreateDevice(int devindex)
   18.74 -{
   18.75 -    SDL_VideoDevice *device;
   18.76 -
   18.77 -    /* Initialize all variables that we clean on shutdown */
   18.78 -    device = (SDL_VideoDevice *) SDL_malloc(sizeof(SDL_VideoDevice));
   18.79 -    if (device) {
   18.80 -        SDL_memset(device, 0, (sizeof *device));
   18.81 -        device->hidden = (struct SDL_PrivateVideoData *)
   18.82 -            SDL_malloc((sizeof *device->hidden));
   18.83 -        device->gl_data = NULL;
   18.84 -    }
   18.85 -    if ((device == NULL) || (device->hidden == NULL)) {
   18.86 -        SDL_OutOfMemory();
   18.87 -        ph_DeleteDevice(device);
   18.88 -        return NULL;
   18.89 -    }
   18.90 -    SDL_memset(device->hidden, 0, (sizeof *device->hidden));
   18.91 -
   18.92 -    /* Set the driver flags */
   18.93 -    device->handles_any_size = 1;
   18.94 -
   18.95 -    /* Set the function pointers */
   18.96 -    device->CreateYUVOverlay = ph_CreateYUVOverlay;
   18.97 -    device->VideoInit = ph_VideoInit;
   18.98 -    device->ListModes = ph_ListModes;
   18.99 -    device->SetVideoMode = ph_SetVideoMode;
  18.100 -    device->ToggleFullScreen = ph_ToggleFullScreen;
  18.101 -    device->UpdateMouse = ph_UpdateMouse;
  18.102 -    device->SetColors = ph_SetColors;
  18.103 -    device->UpdateRects = NULL; /* set up in ph_SetupUpdateFunction */
  18.104 -    device->VideoQuit = ph_VideoQuit;
  18.105 -    device->AllocHWSurface = ph_AllocHWSurface;
  18.106 -    device->CheckHWBlit = ph_CheckHWBlit;
  18.107 -    device->FillHWRect = ph_FillHWRect;
  18.108 -    device->SetHWColorKey = ph_SetHWColorKey;
  18.109 -    device->SetHWAlpha = ph_SetHWAlpha;
  18.110 -    device->LockHWSurface = ph_LockHWSurface;
  18.111 -    device->UnlockHWSurface = ph_UnlockHWSurface;
  18.112 -    device->FlipHWSurface = ph_FlipHWSurface;
  18.113 -    device->FreeHWSurface = ph_FreeHWSurface;
  18.114 -    device->SetCaption = ph_SetCaption;
  18.115 -    device->SetIcon = NULL;
  18.116 -    device->IconifyWindow = ph_IconifyWindow;
  18.117 -    device->GrabInput = ph_GrabInput;
  18.118 -    device->GetWMInfo = ph_GetWMInfo;
  18.119 -    device->FreeWMCursor = ph_FreeWMCursor;
  18.120 -    device->CreateWMCursor = ph_CreateWMCursor;
  18.121 -    device->ShowWMCursor = ph_ShowWMCursor;
  18.122 -    device->WarpWMCursor = ph_WarpWMCursor;
  18.123 -    device->MoveWMCursor = NULL;
  18.124 -    device->CheckMouseMode = ph_CheckMouseMode;
  18.125 -    device->InitOSKeymap = ph_InitOSKeymap;
  18.126 -    device->PumpEvents = ph_PumpEvents;
  18.127 -
  18.128 -    /* OpenGL support. */
  18.129 -#if SDL_VIDEO_OPENGL
  18.130 -    device->GL_MakeCurrent = ph_GL_MakeCurrent;
  18.131 -    device->GL_SwapBuffers = ph_GL_SwapBuffers;
  18.132 -    device->GL_GetAttribute = ph_GL_GetAttribute;
  18.133 -    device->GL_LoadLibrary = ph_GL_LoadLibrary;
  18.134 -    device->GL_GetProcAddress = ph_GL_GetProcAddress;
  18.135 -#endif /* SDL_VIDEO_OPENGL */
  18.136 -
  18.137 -    device->free = ph_DeleteDevice;
  18.138 -
  18.139 -    return device;
  18.140 -}
  18.141 -
  18.142 -VideoBootStrap ph_bootstrap = {
  18.143 -    "photon", "QNX Photon video output",
  18.144 -    ph_Available, ph_CreateDevice
  18.145 -};
  18.146 -
  18.147 -static void
  18.148 -ph_DeleteDevice(SDL_VideoDevice * device)
  18.149 -{
  18.150 -    if (device) {
  18.151 -        if (device->hidden) {
  18.152 -            SDL_free(device->hidden);
  18.153 -            device->hidden = NULL;
  18.154 -        }
  18.155 -        if (device->gl_data) {
  18.156 -            SDL_free(device->gl_data);
  18.157 -            device->gl_data = NULL;
  18.158 -        }
  18.159 -        SDL_free(device);
  18.160 -        device = NULL;
  18.161 -    }
  18.162 -}
  18.163 -
  18.164 -static PtWidget_t *
  18.165 -ph_CreateWindow(_THIS)
  18.166 -{
  18.167 -    PtWidget_t *widget;
  18.168 -
  18.169 -    widget = PtCreateWidget(PtWindow, NULL, 0, NULL);
  18.170 -
  18.171 -    return widget;
  18.172 -}
  18.173 -
  18.174 -static int
  18.175 -ph_SetupWindow(_THIS, int w, int h, int flags)
  18.176 -{
  18.177 -    PtArg_t args[32];
  18.178 -    PhPoint_t pos = { 0, 0 };
  18.179 -    PhDim_t *olddim;
  18.180 -    PhDim_t dim = { w, h };
  18.181 -    PhRect_t desktopextent;
  18.182 -    int nargs = 0;
  18.183 -    const char *windowpos;
  18.184 -    const char *iscentered;
  18.185 -    int x, y;
  18.186 -
  18.187 -    /* check if window size has been changed by Window Manager */
  18.188 -    PtGetResource(window, Pt_ARG_DIM, &olddim, 0);
  18.189 -    if ((olddim->w != w) || (olddim->h != h)) {
  18.190 -        PtSetArg(&args[nargs++], Pt_ARG_DIM, &dim, 0);
  18.191 -    }
  18.192 -
  18.193 -    if ((flags & SDL_RESIZABLE) == SDL_RESIZABLE) {
  18.194 -        PtSetArg(&args[nargs++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_FALSE,
  18.195 -                 Ph_WM_CLOSE);
  18.196 -        PtSetArg(&args[nargs++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_TRUE,
  18.197 -                 Ph_WM_MAX | Ph_WM_RESTORE | Ph_WM_RESIZE);
  18.198 -        PtSetArg(&args[nargs++], Pt_ARG_WINDOW_NOTIFY_FLAGS, Pt_TRUE,
  18.199 -                 Ph_WM_RESIZE | Ph_WM_MOVE | Ph_WM_CLOSE | Ph_WM_MAX |
  18.200 -                 Ph_WM_RESTORE);
  18.201 -        PtSetArg(&args[nargs++], Pt_ARG_WINDOW_RENDER_FLAGS, Pt_TRUE,
  18.202 -                 Ph_WM_RENDER_RESIZE | Ph_WM_RENDER_MAX |
  18.203 -                 Ph_WM_RENDER_COLLAPSE | Ph_WM_RENDER_RETURN);
  18.204 -        PtSetArg(&args[nargs++], Pt_ARG_RESIZE_FLAGS, Pt_TRUE,
  18.205 -                 Pt_RESIZE_XY_AS_REQUIRED);
  18.206 -    } else {
  18.207 -        PtSetArg(&args[nargs++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_FALSE,
  18.208 -                 Ph_WM_RESIZE | Ph_WM_MAX | Ph_WM_RESTORE | Ph_WM_CLOSE);
  18.209 -        PtSetArg(&args[nargs++], Pt_ARG_WINDOW_NOTIFY_FLAGS, Pt_FALSE,
  18.210 -                 Ph_WM_RESIZE | Ph_WM_MAX | Ph_WM_RESTORE);
  18.211 -        PtSetArg(&args[nargs++], Pt_ARG_WINDOW_NOTIFY_FLAGS, Pt_TRUE,
  18.212 -                 Ph_WM_MOVE | Ph_WM_CLOSE);
  18.213 -        PtSetArg(&args[nargs++], Pt_ARG_WINDOW_RENDER_FLAGS, Pt_FALSE,
  18.214 -                 Ph_WM_RENDER_RESIZE | Ph_WM_RENDER_MAX |
  18.215 -                 Ph_WM_RENDER_COLLAPSE | Ph_WM_RENDER_RETURN);
  18.216 -        PtSetArg(&args[nargs++], Pt_ARG_RESIZE_FLAGS, Pt_FALSE,
  18.217 -                 Pt_RESIZE_XY_AS_REQUIRED);
  18.218 -    }
  18.219 -
  18.220 -    if (((flags & SDL_NOFRAME) == SDL_NOFRAME)
  18.221 -        || ((flags & SDL_FULLSCREEN) == SDL_FULLSCREEN)) {
  18.222 -        if ((flags & SDL_RESIZABLE) != SDL_RESIZABLE) {
  18.223 -            PtSetArg(&args[nargs++], Pt_ARG_WINDOW_RENDER_FLAGS,
  18.224 -                     Pt_FALSE, Pt_TRUE);
  18.225 -        } else {
  18.226 -            PtSetArg(&args[nargs++], Pt_ARG_WINDOW_RENDER_FLAGS,
  18.227 -                     Pt_FALSE, Pt_TRUE);
  18.228 -            PtSetArg(&args[nargs++], Pt_ARG_WINDOW_RENDER_FLAGS, Pt_TRUE,
  18.229 -                     Ph_WM_RENDER_RESIZE | Ph_WM_RENDER_BORDER);
  18.230 -        }
  18.231 -    } else {
  18.232 -        PtSetArg(&args[nargs++], Pt_ARG_WINDOW_RENDER_FLAGS, Pt_TRUE,
  18.233 -                 Ph_WM_RENDER_BORDER | Ph_WM_RENDER_TITLE |
  18.234 -                 Ph_WM_RENDER_CLOSE | Ph_WM_RENDER_MENU | Ph_WM_RENDER_MIN);
  18.235 -    }
  18.236 -
  18.237 -    if ((flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) {
  18.238 -        PtSetArg(&args[nargs++], Pt_ARG_POS, &pos, 0);
  18.239 -        PtSetArg(&args[nargs++], Pt_ARG_BASIC_FLAGS, Pt_TRUE,
  18.240 -                 Pt_BASIC_PREVENT_FILL);
  18.241 -        PtSetArg(&args[nargs++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_TRUE,
  18.242 -                 Ph_WM_FFRONT | Ph_WM_MAX | Ph_WM_TOFRONT | Ph_WM_CONSWITCH);
  18.243 -        PtSetArg(&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_TRUE,
  18.244 -                 Ph_WM_STATE_ISFRONT | Ph_WM_STATE_ISFOCUS |
  18.245 -                 Ph_WM_STATE_ISALTKEY);
  18.246 -    } else {
  18.247 -        PtSetArg(&args[nargs++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_FALSE,
  18.248 -                 Ph_WM_FFRONT | Ph_WM_CONSWITCH);
  18.249 -        PtSetArg(&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_FALSE,
  18.250 -                 Ph_WM_STATE_ISFRONT);
  18.251 -        PtSetArg(&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_TRUE,
  18.252 -                 Ph_WM_STATE_ISALTKEY);
  18.253 -
  18.254 -        if ((flags & SDL_HWSURFACE) == SDL_HWSURFACE) {
  18.255 -            PtSetArg(&args[nargs++], Pt_ARG_BASIC_FLAGS, Pt_TRUE,
  18.256 -                     Pt_BASIC_PREVENT_FILL);
  18.257 -        } else {
  18.258 -            PtSetArg(&args[nargs++], Pt_ARG_FILL_COLOR, Pg_BLACK, 0);
  18.259 -        }
  18.260 -        if (!currently_maximized) {
  18.261 -            windowpos = SDL_getenv("SDL_VIDEO_WINDOW_POS");
  18.262 -            iscentered = SDL_getenv("SDL_VIDEO_CENTERED");
  18.263 -
  18.264 -            if ((iscentered)
  18.265 -                || ((windowpos)
  18.266 -                    && (SDL_strcmp(windowpos, "center") == 0))) {
  18.267 -                PhWindowQueryVisible(Ph_QUERY_CONSOLE, 0, 0, &desktopextent);
  18.268 -                if (desktop_mode.width > w) {
  18.269 -                    pos.x = (desktop_mode.width - w) / 2;
  18.270 -                }
  18.271 -                if (desktop_mode.height > h) {
  18.272 -                    pos.y = (desktop_mode.height - h) / 2;
  18.273 -                }
  18.274 -
  18.275 -                pos.x += desktopextent.ul.x;
  18.276 -                pos.y += desktopextent.ul.y;
  18.277 -                PtSetArg(&args[nargs++], Pt_ARG_POS, &pos, 0);
  18.278 -            } else {
  18.279 -                if (windowpos) {
  18.280 -                    if (SDL_sscanf(windowpos, "%d,%d", &x, &y) == 2) {
  18.281 -                        if ((x < desktop_mode.width)
  18.282 -                            && (y < desktop_mode.height)) {
  18.283 -                            PhWindowQueryVisible
  18.284 -                                (Ph_QUERY_CONSOLE, 0, 0, &desktopextent);
  18.285 -                            pos.x = x + desktopextent.ul.x;
  18.286 -                            pos.y = y + desktopextent.ul.y;
  18.287 -                        }
  18.288 -                        PtSetArg(&args[nargs++], Pt_ARG_POS, &pos, 0);
  18.289 -                    }
  18.290 -                }
  18.291 -            }
  18.292 -        }
  18.293 -
  18.294 -        /* if window is maximized render it as maximized */
  18.295 -        if (currently_maximized) {
  18.296 -            PtSetArg(&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_TRUE,
  18.297 -                     Ph_WM_STATE_ISMAX);
  18.298 -        } else {
  18.299 -            PtSetArg(&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_FALSE,
  18.300 -                     Ph_WM_STATE_ISMAX);
  18.301 -        }
  18.302 -
  18.303 -        /* do not grab the keyboard by default */
  18.304 -        PtSetArg(&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_FALSE,
  18.305 -                 Ph_WM_STATE_ISALTKEY);
  18.306 -
  18.307 -        /* bring the focus to the window */
  18.308 -        PtSetArg(&args[nargs++], Pt_ARG_WINDOW_STATE, Pt_TRUE,
  18.309 -                 Ph_WM_STATE_ISFOCUS);
  18.310 -
  18.311 -        /* allow to catch hide event */
  18.312 -        PtSetArg(&args[nargs++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_TRUE,
  18.313 -                 Ph_WM_HIDE);
  18.314 -        PtSetArg(&args[nargs++], Pt_ARG_WINDOW_NOTIFY_FLAGS, Pt_TRUE,
  18.315 -                 Ph_WM_HIDE);
  18.316 -    }
  18.317 -
  18.318 -    PtSetResources(window, nargs, args);
  18.319 -    PtRealizeWidget(window);
  18.320 -    PtWindowToFront(window);
  18.321 -
  18.322 -#if 0                           /* FIXME */
  18.323 -    PtGetResource(window, Pt_ARG_POS, &olddim, 0);
  18.324 -    fprintf(stderr, "POSITION: %d, %d\n", olddim->w, olddim->h);
  18.325 -#endif
  18.326 -
  18.327 -    return 0;
  18.328 -}
  18.329 -
  18.330 -static const struct ColourMasks *
  18.331 -ph_GetColourMasks(int bpp)
  18.332 -{
  18.333 -    /* The alpha mask doesn't appears to be needed */
  18.334 -    static const struct ColourMasks phColorMasks[5] = {
  18.335 -        /*  8 bit      */ {0, 0, 0, 0, 8},
  18.336 -        /* 15 bit ARGB */ {0x7C00, 0x03E0, 0x001F, 0x8000, 15},
  18.337 -        /* 16 bit  RGB */ {0xF800, 0x07E0, 0x001F, 0x0000, 16},
  18.338 -        /* 24 bit  RGB */ {0xFF0000, 0x00FF00, 0x0000FF, 0x000000, 24},
  18.339 -        /* 32 bit ARGB */ {0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000,
  18.340 -                           32},
  18.341 -    };
  18.342 -
  18.343 -    switch (bpp) {
  18.344 -    case 8:
  18.345 -        return &phColorMasks[0];
  18.346 -    case 15:
  18.347 -        return &phColorMasks[1];
  18.348 -    case 16:
  18.349 -        return &phColorMasks[2];
  18.350 -    case 24:
  18.351 -        return &phColorMasks[3];
  18.352 -    case 32:
  18.353 -        return &phColorMasks[4];
  18.354 -    }
  18.355 -    return NULL;
  18.356 -}
  18.357 -
  18.358 -static int
  18.359 -ph_VideoInit(_THIS, SDL_PixelFormat * vformat)
  18.360 -{
  18.361 -    PgHWCaps_t hwcaps;
  18.362 -    int i;
  18.363 -
  18.364 -    window = NULL;
  18.365 -    desktoppal = SDLPH_PAL_NONE;
  18.366 -
  18.367 -#if SDL_VIDEO_OPENGL
  18.368 -    oglctx = NULL;
  18.369 -    oglbuffers = NULL;
  18.370 -    oglflags = 0;
  18.371 -    oglbpp = 0;
  18.372 -#endif
  18.373 -
  18.374 -    old_video_mode = -1;
  18.375 -    old_refresh_rate = -1;
  18.376 -
  18.377 -    if (NULL == (phevent = SDL_malloc(EVENT_SIZE))) {
  18.378 -        SDL_OutOfMemory();
  18.379 -        return -1;
  18.380 -    }
  18.381 -    SDL_memset(phevent, 0x00, EVENT_SIZE);
  18.382 -
  18.383 -    window = ph_CreateWindow(this);
  18.384 -    if (window == NULL) {
  18.385 -        SDL_SetError("ph_VideoInit(): Couldn't create video window !\n");
  18.386 -        return -1;
  18.387 -    }
  18.388 -
  18.389 -    /* Create the blank cursor */
  18.390 -    SDL_BlankCursor = this->CreateWMCursor(this, blank_cdata, blank_cmask,
  18.391 -                                           (int) BLANK_CWIDTH,
  18.392 -                                           (int) BLANK_CHEIGHT,
  18.393 -                                           (int) BLANK_CHOTX,
  18.394 -                                           (int) BLANK_CHOTY);
  18.395 -
  18.396 -    if (SDL_BlankCursor == NULL) {
  18.397 -        return -1;
  18.398 -    }
  18.399 -
  18.400 -    if (PgGetGraphicsHWCaps(&hwcaps) < 0) {
  18.401 -        SDL_SetError("ph_VideoInit(): GetGraphicsHWCaps function failed !\n");
  18.402 -        this->FreeWMCursor(this, SDL_BlankCursor);
  18.403 -        return -1;
  18.404 -    }
  18.405 -
  18.406 -    if (PgGetVideoModeInfo(hwcaps.current_video_mode, &desktop_mode) < 0) {
  18.407 -        SDL_SetError
  18.408 -            ("ph_VideoInit(): PgGetVideoModeInfo function failed !\n");
  18.409 -        this->FreeWMCursor(this, SDL_BlankCursor);
  18.410 -        return -1;
  18.411 -    }
  18.412 -
  18.413 -    /* Determine the current screen size */
  18.414 -    this->info.current_w = desktop_mode.width;
  18.415 -    this->info.current_h = desktop_mode.height;
  18.416 -
  18.417 -    /* We need to return BytesPerPixel as it in used by CreateRGBsurface */
  18.418 -    vformat->BitsPerPixel = desktop_mode.bits_per_pixel;
  18.419 -    vformat->BytesPerPixel =
  18.420 -        desktop_mode.bytes_per_scanline / desktop_mode.width;
  18.421 -    desktopbpp = desktop_mode.bits_per_pixel;
  18.422 -
  18.423 -    /* save current palette */
  18.424 -    if (desktopbpp == 8) {
  18.425 -        PgGetPalette(savedpal);
  18.426 -        PgGetPalette(syspalph);
  18.427 -    } else {
  18.428 -        for (i = 0; i < _Pg_MAX_PALETTE; i++) {
  18.429 -            savedpal[i] = PgRGB(0, 0, 0);
  18.430 -            syspalph[i] = PgRGB(0, 0, 0);
  18.431 -        }
  18.432 -    }
  18.433 -
  18.434 -    currently_fullscreen = 0;
  18.435 -    currently_hided = 0;
  18.436 -    currently_maximized = 0;
  18.437 -    current_overlay = NULL;
  18.438 -
  18.439 -    OCImage.direct_context = NULL;
  18.440 -    OCImage.offscreen_context = NULL;
  18.441 -    OCImage.offscreen_backcontext = NULL;
  18.442 -    OCImage.oldDC = NULL;
  18.443 -    OCImage.CurrentFrameData = NULL;
  18.444 -    OCImage.FrameData0 = NULL;
  18.445 -    OCImage.FrameData1 = NULL;
  18.446 -    videomode_emulatemode = 0;
  18.447 -
  18.448 -    this->info.wm_available = 1;
  18.449 -
  18.450 -    ph_UpdateHWInfo(this);
  18.451 -
  18.452 -    return 0;
  18.453 -}
  18.454 -
  18.455 -static SDL_Surface *
  18.456 -ph_SetVideoMode(_THIS, SDL_Surface * current, int width, int height, int bpp,
  18.457 -                Uint32 flags)
  18.458 -{
  18.459 -    const struct ColourMasks *mask;
  18.460 -
  18.461 -    /* Lock the event thread, in multi-threading environments */
  18.462 -    SDL_Lock_EventThread();
  18.463 -
  18.464 -    current->flags = flags;
  18.465 -
  18.466 -    /* if we do not have desired fullscreen mode, then fallback into window mode */
  18.467 -    if (((current->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN)
  18.468 -        && (ph_GetVideoMode(width, height, bpp) == 0)) {
  18.469 -        current->flags &= ~SDL_FULLSCREEN;
  18.470 -        current->flags &= ~SDL_NOFRAME;
  18.471 -        current->flags &= ~SDL_RESIZABLE;
  18.472 -    }
  18.473 -
  18.474 -    ph_SetupWindow(this, width, height, current->flags);
  18.475 -
  18.476 -    mask = ph_GetColourMasks(bpp);
  18.477 -    if (mask != NULL) {
  18.478 -        SDL_ReallocFormat(current, mask->bpp, mask->red, mask->green,
  18.479 -                          mask->blue, 0);
  18.480 -    } else {
  18.481 -        SDL_SetError
  18.482 -            ("ph_SetVideoMode(): desired bpp is not supported by photon !\n");
  18.483 -        return NULL;
  18.484 -    }
  18.485 -
  18.486 -    if (current->flags & SDL_INTERNALOPENGL) {
  18.487 -#if !SDL_VIDEO_OPENGL
  18.488 -        /* if no built-in OpenGL support */
  18.489 -        SDL_SetError
  18.490 -            ("ph_SetVideoMode(): no OpenGL support, you need to recompile SDL.\n");
  18.491 -        current->flags &= ~SDL_INTERNALOPENGL;
  18.492 -        return NULL;
  18.493 -#endif /* SDL_VIDEO_OPENGL */
  18.494 -    } else {
  18.495 -        /* Initialize internal variables */
  18.496 -        if ((current->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) {
  18.497 -            if (bpp == 8) {
  18.498 -                desktoppal = SDLPH_PAL_SYSTEM;
  18.499 -            }
  18.500 -
  18.501 -            current->flags &= ~SDL_RESIZABLE;   /* no resize for Direct Context */
  18.502 -            current->flags |= SDL_HWSURFACE;
  18.503 -        } else {
  18.504 -            /* remove this if we'll have support for the non-fullscreen sw/hw+doublebuf one day */
  18.505 -            current->flags &= ~SDL_DOUBLEBUF;
  18.506 -
  18.507 -            /* Use offscreen memory if SDL_HWSURFACE flag is set */
  18.508 -            if ((current->flags & SDL_HWSURFACE) == SDL_HWSURFACE) {
  18.509 -                if (desktopbpp != bpp) {
  18.510 -                    current->flags &= ~SDL_HWSURFACE;
  18.511 -                }
  18.512 -            }
  18.513 -
  18.514 -            /* using palette emulation code in window mode */
  18.515 -            if (bpp == 8) {
  18.516 -                if (desktopbpp >= 15) {
  18.517 -                    desktoppal = SDLPH_PAL_EMULATE;
  18.518 -                } else {
  18.519 -                    desktoppal = SDLPH_PAL_SYSTEM;
  18.520 -                }
  18.521 -            } else {
  18.522 -                desktoppal = SDLPH_PAL_NONE;
  18.523 -            }
  18.524 -        }
  18.525 -    }
  18.526 -
  18.527 -    current->w = width;
  18.528 -    current->h = height;
  18.529 -
  18.530 -    if (desktoppal == SDLPH_PAL_SYSTEM) {
  18.531 -        current->flags |= SDL_HWPALETTE;
  18.532 -    }
  18.533 -
  18.534 -    /* Must call at least once for setup image planes */
  18.535 -    if (ph_SetupUpdateFunction(this, current, current->flags) == -1) {
  18.536 -        /* Error string was filled in the ph_SetupUpdateFunction() */
  18.537 -        return NULL;
  18.538 -    }
  18.539 -
  18.540 -    /* finish window drawing, if we are not in fullscreen, of course */
  18.541 -    if ((current->flags & SDL_FULLSCREEN) != SDL_FULLSCREEN) {
  18.542 -        PtFlush();
  18.543 -    } else {
  18.544 -        PgFlush();
  18.545 -    }
  18.546 -
  18.547 -    visualbpp = bpp;
  18.548 -
  18.549 -    ph_UpdateHWInfo(this);
  18.550 -
  18.551 -    SDL_Unlock_EventThread();
  18.552 -
  18.553 -    /* We've done! */
  18.554 -    return (current);
  18.555 -}
  18.556 -
  18.557 -static void
  18.558 -ph_VideoQuit(_THIS)
  18.559 -{
  18.560 -    /* restore palette */
  18.561 -    if (desktopbpp == 8) {
  18.562 -        PgSetPalette(syspalph, 0, -1, 0, 0, 0);
  18.563 -        PgSetPalette(savedpal, 0, 0, _Pg_MAX_PALETTE,
  18.564 -                     Pg_PALSET_GLOBAL | Pg_PALSET_FORCE_EXPOSE, 0);
  18.565 -        PgFlush();
  18.566 -    }
  18.567 -
  18.568 -    ph_DestroyImage(this, SDL_VideoSurface);
  18.569 -
  18.570 -    if (window) {
  18.571 -        PtUnrealizeWidget(window);
  18.572 -        PtDestroyWidget(window);
  18.573 -        window = NULL;
  18.574 -    }
  18.575 -
  18.576 -    if (phevent != NULL) {
  18.577 -        SDL_free(phevent);
  18.578 -        phevent = NULL;
  18.579 -    }
  18.580 -}
  18.581 -
  18.582 -static int
  18.583 -ph_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color * colors)
  18.584 -{
  18.585 -    int i;
  18.586 -    SDL_Rect updaterect;
  18.587 -
  18.588 -    updaterect.x = updaterect.y = 0;
  18.589 -    updaterect.w = this->screen->w;
  18.590 -    updaterect.h = this->screen->h;
  18.591 -
  18.592 -    /* palette emulation code, using palette of the PhImage_t struct */
  18.593 -    if (desktoppal == SDLPH_PAL_EMULATE) {
  18.594 -        if ((SDL_Image) && (SDL_Image->palette)) {
  18.595 -            for (i = firstcolor; i < firstcolor + ncolors; i++) {
  18.596 -                syspalph[i] =
  18.597 -                    PgRGB(colors[i - firstcolor].r,
  18.598 -                          colors[i - firstcolor].g, colors[i - firstcolor].b);
  18.599 -                SDL_Image->palette[i] = syspalph[i];
  18.600 -            }
  18.601 -
  18.602 -            /* image needs to be redrawn */
  18.603 -            this->UpdateRects(this, 1, &updaterect);
  18.604 -        }
  18.605 -    } else {
  18.606 -        if (desktoppal == SDLPH_PAL_SYSTEM) {
  18.607 -            for (i = firstcolor; i < firstcolor + ncolors; i++) {
  18.608 -                syspalph[i] =
  18.609 -                    PgRGB(colors[i - firstcolor].r,
  18.610 -                          colors[i - firstcolor].g, colors[i - firstcolor].b);
  18.611 -            }
  18.612 -
  18.613 -            if ((this->screen->flags & SDL_FULLSCREEN) != SDL_FULLSCREEN) {
  18.614 -                /* window mode must use soft palette */
  18.615 -                PgSetPalette(&syspalph[firstcolor], 0, firstcolor,
  18.616 -                             ncolors, Pg_PALSET_GLOBAL, 0);
  18.617 -                /* image needs to be redrawn */
  18.618 -                this->UpdateRects(this, 1, &updaterect);
  18.619 -            } else {
  18.620 -                /* fullscreen mode must use hardware palette */
  18.621 -                PgSetPalette(&syspalph[firstcolor], 0, firstcolor,
  18.622 -                             ncolors, Pg_PALSET_GLOBAL, 0);
  18.623 -            }
  18.624 -        } else {
  18.625 -            /* SDLPH_PAL_NONE do nothing */
  18.626 -        }
  18.627 -    }
  18.628 -
  18.629 -    return 1;
  18.630 -}
  18.631 -
  18.632 -/* vi: set ts=4 sw=4 expandtab: */
    19.1 --- a/src/video/photon/SDL_ph_video.h	Fri Feb 27 09:51:55 2009 +0000
    19.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.3 @@ -1,158 +0,0 @@
    19.4 -/*
    19.5 -    SDL - Simple DirectMedia Layer
    19.6 -    Copyright (C) 1997-2009 Sam Lantinga
    19.7 -
    19.8 -    This library is free software; you can redistribute it and/or
    19.9 -    modify it under the terms of the GNU Library General Public
   19.10 -    License as published by the Free Software Foundation; either
   19.11 -    version 2 of the License, or (at your option) any later version.
   19.12 -
   19.13 -    This library is distributed in the hope that it will be useful,
   19.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   19.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   19.16 -    Library General Public License for more details.
   19.17 -
   19.18 -    You should have received a copy of the GNU Library General Public
   19.19 -    License along with this library; if not, write to the Free
   19.20 -    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   19.21 -
   19.22 -    Sam Lantinga
   19.23 -    slouken@libsdl.org
   19.24 -*/
   19.25 -#include "SDL_config.h"
   19.26 -
   19.27 -#ifndef __SDL_PH_VIDEO_H__
   19.28 -#define __SDL_PH_VIDEO_H__
   19.29 -
   19.30 -#include "SDL_mouse.h"
   19.31 -#include "../SDL_sysvideo.h"
   19.32 -
   19.33 -#include <sys/neutrino.h>
   19.34 -
   19.35 -#include <Ph.h>
   19.36 -#include <Pt.h>
   19.37 -#include <photon/Pg.h>
   19.38 -#include <photon/PdDirect.h>
   19.39 -
   19.40 -#if SDL_VIDEO_OPENGL
   19.41 -#if (_NTO_VERSION < 630)
   19.42 -#include <photon/PdGL.h>
   19.43 -#else
   19.44 -#include <GL/qnxgl.h>
   19.45 -#include <GL/GLPh.h>
   19.46 -#endif /* 6.3.0 */
   19.47 -#endif /* SDL_VIDEO_OPENGL */
   19.48 -
   19.49 -/* Hidden "this" pointer for the video functions */
   19.50 -#define _THIS	SDL_VideoDevice* this
   19.51 -
   19.52 -#define PH_OGL_MAX_ATTRIBS 32
   19.53 -
   19.54 -#define SDLPH_PAL_NONE    0x00000000L
   19.55 -#define SDLPH_PAL_EMULATE 0x00000001L
   19.56 -#define SDLPH_PAL_SYSTEM  0x00000002L
   19.57 -
   19.58 -typedef struct
   19.59 -{
   19.60 -    unsigned char *Y;
   19.61 -    unsigned char *V;
   19.62 -    unsigned char *U;
   19.63 -} FRAMEDATA;
   19.64 -
   19.65 -/* Mask values for SDL_ReallocFormat() */
   19.66 -struct ColourMasks
   19.67 -{
   19.68 -    Uint32 red;
   19.69 -    Uint32 green;
   19.70 -    Uint32 blue;
   19.71 -    Uint32 alpha;
   19.72 -    Uint32 bpp;
   19.73 -};
   19.74 -
   19.75 -/* Private display data */
   19.76 -struct SDL_PrivateVideoData
   19.77 -{
   19.78 -    PgDisplaySettings_t mode_settings;
   19.79 -    PtWidget_t *Window;         /* used to handle input events */
   19.80 -    PhImage_t *image;           /* used to display image       */
   19.81 -#if SDL_VIDEO_OPENGL
   19.82 -#if (_NTO_VERSION < 630)
   19.83 -    PdOpenGLContext_t *OGLContext;      /* OpenGL context              */
   19.84 -    void *OGLBuffers;           /* OpenGL buffers (unused)     */
   19.85 -#else
   19.86 -    qnxglc_t *OGLContext;       /* OpenGL context for the 6.3  */
   19.87 -    qnxgl_bufs_t *OGLBuffers;   /* OpenGL buffers for the 6.3  */
   19.88 -#endif                          /* 630 */
   19.89 -
   19.90 -    Uint32 OGLFlags;            /* OpenGL flags                */
   19.91 -    Uint32 OGLBPP;              /* OpenGL bpp                  */
   19.92 -#endif                          /* SDL_VIDEO_OPENGL */
   19.93 -    PgColor_t savedpal[_Pg_MAX_PALETTE];
   19.94 -    PgColor_t syspalph[_Pg_MAX_PALETTE];
   19.95 -
   19.96 -    struct
   19.97 -    {
   19.98 -        PdDirectContext_t *direct_context;
   19.99 -        PdOffscreenContext_t *offscreen_context;
  19.100 -        PdOffscreenContext_t *offscreen_backcontext;
  19.101 -        PhDrawContext_t *oldDC;
  19.102 -        uint8_t *dc_ptr;
  19.103 -        unsigned char *CurrentFrameData;
  19.104 -        unsigned char *FrameData0;
  19.105 -        unsigned char *FrameData1;
  19.106 -        Uint32 current;
  19.107 -        Uint32 flags;
  19.108 -    } ocimage;
  19.109 -
  19.110 -    PgHWCaps_t graphics_card_caps;      /* Graphics card caps at the moment of start   */
  19.111 -    PgVideoModeInfo_t desktop_mode;     /* Current desktop video mode information      */
  19.112 -    int old_video_mode;         /* Stored mode before fullscreen switch        */
  19.113 -    int old_refresh_rate;       /* Stored refresh rate befor fullscreen switch */
  19.114 -
  19.115 -    int mouse_relative;
  19.116 -    WMcursor *BlankCursor;
  19.117 -    uint32_t videomode_emulatemode;
  19.118 -
  19.119 -    Uint32 visualbpp;           /* current visual bpp                          */
  19.120 -    Uint32 desktopbpp;          /* bpp of desktop at the moment of start       */
  19.121 -    Uint32 desktoppal;          /* palette mode emulation or system            */
  19.122 -
  19.123 -    int currently_fullscreen;
  19.124 -    int currently_hided;        /* 1 - window hided (minimazed), 0 - normal    */
  19.125 -    int currently_maximized;    /* 1 - window hided (minimazed), 0 - normal    */
  19.126 -
  19.127 -    PhEvent_t *event;
  19.128 -    SDL_Overlay *overlay;
  19.129 -};
  19.130 -
  19.131 -#define mode_settings         (this->hidden->mode_settings)
  19.132 -#define window	              (this->hidden->Window)
  19.133 -#define SDL_Image             (this->hidden->image)
  19.134 -#define OCImage               (this->hidden->ocimage)
  19.135 -#define old_video_mode        (this->hidden->old_video_mode)
  19.136 -#define old_refresh_rate      (this->hidden->old_refresh_rate)
  19.137 -#define graphics_card_caps    (this->hidden->graphics_card_caps)
  19.138 -#define desktopbpp            (this->hidden->desktopbpp)
  19.139 -#define visualbpp             (this->hidden->visualbpp)
  19.140 -#define desktoppal            (this->hidden->desktoppal)
  19.141 -#define savedpal              (this->hidden->savedpal)
  19.142 -#define syspalph              (this->hidden->syspalph)
  19.143 -#define currently_fullscreen  (this->hidden->currently_fullscreen)
  19.144 -#define currently_hided       (this->hidden->currently_hided)
  19.145 -#define currently_maximized   (this->hidden->currently_maximized)
  19.146 -#define phevent               (this->hidden->event)
  19.147 -#define current_overlay       (this->hidden->overlay)
  19.148 -#define desktop_mode          (this->hidden->desktop_mode)
  19.149 -#define mouse_relative        (this->hidden->mouse_relative)
  19.150 -#define SDL_BlankCursor       (this->hidden->BlankCursor)
  19.151 -#define videomode_emulatemode (this->hidden->videomode_emulatemode)
  19.152 -
  19.153 -#if SDL_VIDEO_OPENGL
  19.154 -#define oglctx               (this->hidden->OGLContext)
  19.155 -#define oglbuffers           (this->hidden->OGLBuffers)
  19.156 -#define oglflags             (this->hidden->OGLFlags)
  19.157 -#define oglbpp               (this->hidden->OGLBPP)
  19.158 -#endif /* SDL_VIDEO_OPENGL */
  19.159 -
  19.160 -#endif /* __SDL_PH_VIDEO_H__ */
  19.161 -/* vi: set ts=4 sw=4 expandtab: */
    20.1 --- a/src/video/photon/SDL_ph_wm.c	Fri Feb 27 09:51:55 2009 +0000
    20.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.3 @@ -1,123 +0,0 @@
    20.4 -/*
    20.5 -    SDL - Simple DirectMedia Layer
    20.6 -    Copyright (C) 1997-2009 Sam Lantinga
    20.7 -
    20.8 -    This library is free software; you can redistribute it and/or
    20.9 -    modify it under the terms of the GNU Lesser General Public
   20.10 -    License as published by the Free Software Foundation; either
   20.11 -    version 2.1 of the License, or (at your option) any later version.
   20.12 -
   20.13 -    This library is distributed in the hope that it will be useful,
   20.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   20.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   20.16 -    Lesser General Public License for more details.
   20.17 -
   20.18 -    You should have received a copy of the GNU Lesser General Public
   20.19 -    License along with this library; if not, write to the Free Software
   20.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   20.21 -
   20.22 -    Sam Lantinga
   20.23 -    slouken@libsdl.org
   20.24 -*/
   20.25 -#include "SDL_config.h"
   20.26 -
   20.27 -#include <Ph.h>
   20.28 -#include <photon/PpProto.h>
   20.29 -#include <photon/PhWm.h>
   20.30 -#include <photon/wmapi.h>
   20.31 -
   20.32 -#include "SDL_version.h"
   20.33 -#include "SDL_timer.h"
   20.34 -#include "SDL_video.h"
   20.35 -#include "SDL_syswm.h"
   20.36 -#include "../SDL_pixels_c.h"
   20.37 -#include "../../events/SDL_events_c.h"
   20.38 -#include "SDL_ph_modes_c.h"
   20.39 -#include "SDL_ph_wm_c.h"
   20.40 -
   20.41 -void
   20.42 -ph_SetIcon(_THIS, SDL_Surface * icon, Uint8 * mask)
   20.43 -{
   20.44 -    return;
   20.45 -}
   20.46 -
   20.47 -/* Set window caption */
   20.48 -void
   20.49 -ph_SetCaption(_THIS, const char *title, const char *icon)
   20.50 -{
   20.51 -    SDL_Lock_EventThread();
   20.52 -
   20.53 -    /* sanity check for set caption call before window init */
   20.54 -    if (window != NULL) {
   20.55 -        PtSetResource(window, Pt_ARG_WINDOW_TITLE, title, 0);
   20.56 -    }
   20.57 -
   20.58 -    SDL_Unlock_EventThread();
   20.59 -}
   20.60 -
   20.61 -/* Iconify current window */
   20.62 -int
   20.63 -ph_IconifyWindow(_THIS)
   20.64 -{
   20.65 -    PhWindowEvent_t windowevent;
   20.66 -
   20.67 -    SDL_Lock_EventThread();
   20.68 -
   20.69 -    SDL_memset(&windowevent, 0, sizeof(windowevent));
   20.70 -    windowevent.event_f = Ph_WM_HIDE;
   20.71 -    windowevent.event_state = Ph_WM_EVSTATE_HIDE;
   20.72 -    windowevent.rid = PtWidgetRid(window);
   20.73 -    PtForwardWindowEvent(&windowevent);
   20.74 -
   20.75 -    SDL_Unlock_EventThread();
   20.76 -
   20.77 -    return 0;
   20.78 -}
   20.79 -
   20.80 -SDL_GrabMode
   20.81 -ph_GrabInputNoLock(_THIS, SDL_GrabMode mode)
   20.82 -{
   20.83 -    short abs_x, abs_y;
   20.84 -
   20.85 -    if (mode == SDL_GRAB_OFF) {
   20.86 -        PtSetResource(window, Pt_ARG_WINDOW_STATE, Pt_FALSE,
   20.87 -                      Ph_WM_STATE_ISALTKEY);
   20.88 -    } else {
   20.89 -        PtSetResource(window, Pt_ARG_WINDOW_STATE, Pt_TRUE,
   20.90 -                      Ph_WM_STATE_ISALTKEY);
   20.91 -
   20.92 -        PtGetAbsPosition(window, &abs_x, &abs_y);
   20.93 -        PhMoveCursorAbs(PhInputGroup(NULL),
   20.94 -                        abs_x + SDL_VideoSurface->w / 2,
   20.95 -                        abs_y + SDL_VideoSurface->h / 2);
   20.96 -    }
   20.97 -
   20.98 -    SDL_Unlock_EventThread();
   20.99 -
  20.100 -    return (mode);
  20.101 -}
  20.102 -
  20.103 -SDL_GrabMode
  20.104 -ph_GrabInput(_THIS, SDL_GrabMode mode)
  20.105 -{
  20.106 -    SDL_Lock_EventThread();
  20.107 -    mode = ph_GrabInputNoLock(this, mode);
  20.108 -    SDL_Unlock_EventThread();
  20.109 -
  20.110 -    return (mode);
  20.111 -}
  20.112 -
  20.113 -
  20.114 -int
  20.115 -ph_GetWMInfo(_THIS, SDL_SysWMinfo * info)
  20.116 -{
  20.117 -    if (info->version.major <= SDL_MAJOR_VERSION) {
  20.118 -        return 1;
  20.119 -    } else {
  20.120 -        SDL_SetError("Application not compiled with SDL %d.%d\n",
  20.121 -                     SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
  20.122 -        return -1;
  20.123 -    }
  20.124 -}
  20.125 -
  20.126 -/* vi: set ts=4 sw=4 expandtab: */
    21.1 --- a/src/video/photon/SDL_ph_wm_c.h	Fri Feb 27 09:51:55 2009 +0000
    21.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.3 @@ -1,38 +0,0 @@
    21.4 -/*
    21.5 -    SDL - Simple DirectMedia Layer
    21.6 -    Copyright (C) 1997-2009 Sam Lantinga
    21.7 -
    21.8 -    This library is free software; you can redistribute it and/or
    21.9 -    modify it under the terms of the GNU Lesser General Public
   21.10 -    License as published by the Free Software Foundation; either
   21.11 -    version 2.1 of the License, or (at your option) any later version.
   21.12 -
   21.13 -    This library is distributed in the hope that it will be useful,
   21.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   21.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   21.16 -    Lesser General Public License for more details.
   21.17 -
   21.18 -    You should have received a copy of the GNU Lesser General Public
   21.19 -    License along with this library; if not, write to the Free Software
   21.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   21.21 -
   21.22 -    Sam Lantinga
   21.23 -    slouken@libsdl.org
   21.24 -*/
   21.25 -#include "SDL_config.h"
   21.26 -
   21.27 -#ifndef __SDL_PH_WM_H__
   21.28 -#define __SDL_PH_WM_H__
   21.29 -
   21.30 -#include "SDL_ph_video.h"
   21.31 -
   21.32 -/* Functions to be exported */
   21.33 -extern void ph_SetCaption(_THIS, const char *title, const char *icon);
   21.34 -extern void ph_SetIcon(_THIS, SDL_Surface * icon, Uint8 * mask);
   21.35 -extern int ph_IconifyWindow(_THIS);
   21.36 -extern SDL_GrabMode ph_GrabInputNoLock(_THIS, SDL_GrabMode mode);
   21.37 -extern SDL_GrabMode ph_GrabInput(_THIS, SDL_GrabMode mode);
   21.38 -extern int ph_GetWMInfo(_THIS, SDL_SysWMinfo * info);
   21.39 -
   21.40 -#endif /* __SDL_PH_WM_H__ */
   21.41 -/* vi: set ts=4 sw=4 expandtab: */
    22.1 --- a/src/video/photon/SDL_phyuv.c	Fri Feb 27 09:51:55 2009 +0000
    22.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.3 @@ -1,509 +0,0 @@
    22.4 -/*
    22.5 -    SDL - Simple DirectMedia Layer
    22.6 -    Copyright (C) 1997-2009 Sam Lantinga
    22.7 -
    22.8 -    This library is free software; you can redistribute it and/or
    22.9 -    modify it under the terms of the GNU Lesser General Public
   22.10 -    License as published by the Free Software Foundation; either
   22.11 -    version 2.1 of the License, or (at your option) any later version.
   22.12 -
   22.13 -    This library is distributed in the hope that it will be useful,
   22.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   22.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   22.16 -    Lesser General Public License for more details.
   22.17 -
   22.18 -    You should have received a copy of the GNU Lesser General Public
   22.19 -    License along with this library; if not, write to the Free Software
   22.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   22.21 -
   22.22 -    Sam Lantinga
   22.23 -    slouken@libsdl.org
   22.24 -*/
   22.25 -#include "SDL_config.h"
   22.26 -
   22.27 -/* This is the QNX Realtime Platform version of SDL YUV video overlays */
   22.28 -
   22.29 -#include <errno.h>
   22.30 -
   22.31 -#include <Ph.h>
   22.32 -#include <Pt.h>
   22.33 -
   22.34 -#include "SDL_video.h"
   22.35 -#include "SDL_phyuv_c.h"
   22.36 -#include "../SDL_yuvfuncs.h"
   22.37 -
   22.38 -#define OVERLAY_STATE_UNINIT 0
   22.39 -#define OVERLAY_STATE_ACTIVE 1
   22.40 -
   22.41 -/* The functions are used to manipulate software video overlays */
   22.42 -static struct private_yuvhwfuncs ph_yuvfuncs = {
   22.43 -    ph_LockYUVOverlay,
   22.44 -    ph_UnlockYUVOverlay,
   22.45 -    ph_DisplayYUVOverlay,
   22.46 -    ph_FreeYUVOverlay
   22.47 -};
   22.48 -
   22.49 -int
   22.50 -grab_ptrs2(PgVideoChannel_t * channel, FRAMEDATA * Frame0, FRAMEDATA * Frame1)
   22.51 -{
   22.52 -    int planes = 0;
   22.53 -
   22.54 -    /* Buffers have moved; re-obtain the pointers */
   22.55 -    Frame0->Y = (unsigned char *) PdGetOffscreenContextPtr(channel->yplane1);
   22.56 -    Frame1->Y = (unsigned char *) PdGetOffscreenContextPtr(channel->yplane2);
   22.57 -    Frame0->U = (unsigned char *) PdGetOffscreenContextPtr(channel->vplane1);
   22.58 -    Frame1->U = (unsigned char *) PdGetOffscreenContextPtr(channel->vplane2);
   22.59 -    Frame0->V = (unsigned char *) PdGetOffscreenContextPtr(channel->uplane1);
   22.60 -    Frame1->V = (unsigned char *) PdGetOffscreenContextPtr(channel->uplane2);
   22.61 -
   22.62 -    if (Frame0->Y)
   22.63 -        planes++;
   22.64 -
   22.65 -    if (Frame0->U)
   22.66 -        planes++;
   22.67 -
   22.68 -    if (Frame0->V)
   22.69 -        planes++;
   22.70 -
   22.71 -    return planes;
   22.72 -}
   22.73 -
   22.74 -SDL_Overlay *
   22.75 -ph_CreateYUVOverlay(_THIS, int width, int height, Uint32 format,
   22.76 -                    SDL_Surface * display)
   22.77 -{
   22.78 -    SDL_Overlay *overlay;
   22.79 -    struct private_yuvhwdata *hwdata;
   22.80 -    int vidport;
   22.81 -    int rtncode;
   22.82 -    int planes;
   22.83 -    int i = 0;
   22.84 -    PhPoint_t pos;
   22.85 -
   22.86 -    /* Create the overlay structure */
   22.87 -    overlay = SDL_calloc(1, sizeof(SDL_Overlay));
   22.88 -
   22.89 -    if (overlay == NULL) {
   22.90 -        SDL_OutOfMemory();
   22.91 -        return NULL;
   22.92 -    }
   22.93 -
   22.94 -    /* Fill in the basic members */
   22.95 -    overlay->format = format;
   22.96 -    overlay->w = width;
   22.97 -    overlay->h = height;
   22.98 -    overlay->hwdata = NULL;
   22.99 -
  22.100 -    /* Set up the YUV surface function structure */
  22.101 -    overlay->hwfuncs = &ph_yuvfuncs;
  22.102 -
  22.103 -    /* Create the pixel data and lookup tables */
  22.104 -    hwdata = SDL_calloc(1, sizeof(struct private_yuvhwdata));
  22.105 -
  22.106 -    if (hwdata == NULL) {
  22.107 -        SDL_OutOfMemory();
  22.108 -        SDL_FreeYUVOverlay(overlay);
  22.109 -        return NULL;
  22.110 -    }
  22.111 -
  22.112 -    overlay->hwdata = hwdata;
  22.113 -
  22.114 -    PhDCSetCurrent(0);
  22.115 -    if (overlay->hwdata->channel == NULL) {
  22.116 -        if ((overlay->hwdata->channel =
  22.117 -             PgCreateVideoChannel(Pg_VIDEO_CHANNEL_SCALER, 0)) == NULL) {
  22.118 -            SDL_SetError
  22.119 -                ("ph_CreateYUVOverlay(): Create channel failed: %s\n",
  22.120 -                 strerror(errno));
  22.121 -            SDL_FreeYUVOverlay(overlay);
  22.122 -            return NULL;
  22.123 -
  22.124 -        }
  22.125 -    }
  22.126 -
  22.127 -    overlay->hwdata->forcedredraw = 0;
  22.128 -
  22.129 -    PtGetAbsPosition(window, &pos.x, &pos.y);
  22.130 -    overlay->hwdata->CurrentWindowPos.x = pos.x;
  22.131 -    overlay->hwdata->CurrentWindowPos.y = pos.y;
  22.132 -    overlay->hwdata->CurrentViewPort.pos.x = 0;
  22.133 -    overlay->hwdata->CurrentViewPort.pos.y = 0;
  22.134 -    overlay->hwdata->CurrentViewPort.size.w = width;
  22.135 -    overlay->hwdata->CurrentViewPort.size.h = height;
  22.136 -    overlay->hwdata->State = OVERLAY_STATE_UNINIT;
  22.137 -    overlay->hwdata->FrameData0 =
  22.138 -        (FRAMEDATA *) SDL_calloc(1, sizeof(FRAMEDATA));
  22.139 -    overlay->hwdata->FrameData1 =
  22.140 -        (FRAMEDATA *) SDL_calloc(1, sizeof(FRAMEDATA));
  22.141 -
  22.142 -    vidport = -1;
  22.143 -    i = 0;
  22.144 -
  22.145 -    overlay->hwdata->ischromakey = 0;
  22.146 -
  22.147 -    do {
  22.148 -        SDL_memset(&overlay->hwdata->caps, 0x00, sizeof(PgScalerCaps_t));
  22.149 -        overlay->hwdata->caps.size = sizeof(PgScalerCaps_t);
  22.150 -        rtncode =
  22.151 -            PgGetScalerCapabilities(overlay->hwdata->channel, i,
  22.152 -                                    &overlay->hwdata->caps);
  22.153 -        if (rtncode == 0) {
  22.154 -            if (overlay->hwdata->caps.format == format) {
  22.155 -                if ((overlay->hwdata->
  22.156 -                     caps.flags & Pg_SCALER_CAP_DST_CHROMA_KEY) ==
  22.157 -                    Pg_SCALER_CAP_DST_CHROMA_KEY) {
  22.158 -                    overlay->hwdata->ischromakey = 1;
  22.159 -                }
  22.160 -                vidport = 1;
  22.161 -                break;
  22.162 -            }
  22.163 -        } else {
  22.164 -            break;
  22.165 -        }
  22.166 -        i++;
  22.167 -    } while (1);
  22.168 -
  22.169 -
  22.170 -    if (vidport == -1) {
  22.171 -        SDL_SetError("No available video ports for requested format\n");
  22.172 -        SDL_FreeYUVOverlay(overlay);
  22.173 -        return NULL;
  22.174 -    }
  22.175 -
  22.176 -    overlay->hwdata->format = format;
  22.177 -    overlay->hwdata->props.format = format;
  22.178 -    overlay->hwdata->props.size = sizeof(PgScalerProps_t);
  22.179 -    overlay->hwdata->props.src_dim.w = width;
  22.180 -    overlay->hwdata->props.src_dim.h = height;
  22.181 -
  22.182 -    /* overlay->hwdata->chromakey = PgGetOverlayChromaColor(); */
  22.183 -    overlay->hwdata->chromakey = PgRGB(12, 6, 12);      /* very dark pink color */
  22.184 -    overlay->hwdata->props.color_key = overlay->hwdata->chromakey;
  22.185 -
  22.186 -    PhAreaToRect(&overlay->hwdata->CurrentViewPort,
  22.187 -                 &overlay->hwdata->props.viewport);
  22.188 -
  22.189 -    overlay->hwdata->props.flags = Pg_SCALER_PROP_DOUBLE_BUFFER;
  22.190 -
  22.191 -    if ((overlay->hwdata->ischromakey) && (overlay->hwdata->chromakey)) {
  22.192 -        overlay->hwdata->props.flags |= Pg_SCALER_PROP_CHROMA_ENABLE;
  22.193 -        overlay->hwdata->props.flags |=
  22.194 -            Pg_SCALER_PROP_CHROMA_SPECIFY_KEY_MASK;
  22.195 -    } else {
  22.196 -        overlay->hwdata->props.flags &= ~Pg_SCALER_PROP_CHROMA_ENABLE;
  22.197 -    }
  22.198 -
  22.199 -    rtncode =
  22.200 -        PgConfigScalerChannel(overlay->hwdata->channel,
  22.201 -                              &overlay->hwdata->props);
  22.202 -
  22.203 -    switch (rtncode) {
  22.204 -    case -1:
  22.205 -        SDL_SetError("PgConfigScalerChannel failed\n");
  22.206 -        SDL_FreeYUVOverlay(overlay);
  22.207 -        return NULL;
  22.208 -    case 1:
  22.209 -    case 0:
  22.210 -    default:
  22.211 -        break;
  22.212 -    }
  22.213 -
  22.214 -    planes =
  22.215 -        grab_ptrs2(overlay->hwdata->channel, overlay->hwdata->FrameData0,
  22.216 -                   overlay->hwdata->FrameData1);
  22.217 -
  22.218 -    if (overlay->hwdata->channel->yplane1 != NULL)
  22.219 -        overlay->hwdata->YStride = overlay->hwdata->channel->yplane1->pitch;
  22.220 -    if (overlay->hwdata->channel->vplane1 != NULL)
  22.221 -        overlay->hwdata->UStride = overlay->hwdata->channel->vplane1->pitch;
  22.222 -    if (overlay->hwdata->channel->uplane1 != NULL)
  22.223 -        overlay->hwdata->VStride = overlay->hwdata->channel->uplane1->pitch;
  22.224 -
  22.225 -    /* check for the validness of all planes */
  22.226 -    if ((overlay->hwdata->channel->yplane1 == NULL) &&
  22.227 -        (overlay->hwdata->channel->uplane1 == NULL) &&
  22.228 -        (overlay->hwdata->channel->vplane1 == NULL)) {
  22.229 -        SDL_FreeYUVOverlay(overlay);
  22.230 -        SDL_SetError("PgConfigScaler() returns all planes equal NULL\n");
  22.231 -        return NULL;
  22.232 -    }
  22.233 -/*
  22.234 -    overlay->hwdata->current = PgNextVideoFrame(overlay->hwdata->channel);
  22.235 -
  22.236 -    if (overlay->hwdata->current==0)
  22.237 -    {
  22.238 -        overlay->hwdata->CurrentFrameData = overlay->hwdata->FrameData0;
  22.239 -    }
  22.240 -    else
  22.241 -    {
  22.242 -        overlay->hwdata->CurrentFrameData = overlay->hwdata->FrameData1;
  22.243 -    }
  22.244 -*/
  22.245 -    overlay->hwdata->CurrentFrameData = overlay->hwdata->FrameData0;
  22.246 -
  22.247 -/*
  22.248 -    overlay->hwdata->locked = 1;
  22.249 -*/
  22.250 -
  22.251 -    /* Find the pitch and offset values for the overlay */
  22.252 -    overlay->planes = planes;
  22.253 -    overlay->pitches = SDL_calloc(overlay->planes, sizeof(Uint16));
  22.254 -    overlay->pixels = SDL_calloc(overlay->planes, sizeof(Uint8 *));
  22.255 -    if (!overlay->pitches || !overlay->pixels) {
  22.256 -        SDL_OutOfMemory();
  22.257 -        SDL_FreeYUVOverlay(overlay);
  22.258 -        return (NULL);
  22.259 -    }
  22.260 -
  22.261 -    if (overlay->planes > 0) {
  22.262 -        overlay->pitches[0] = overlay->hwdata->channel->yplane1->pitch;
  22.263 -        overlay->pixels[0] = overlay->hwdata->CurrentFrameData->Y;
  22.264 -    }
  22.265 -    if (overlay->planes > 1) {
  22.266 -        overlay->pitches[1] = overlay->hwdata->channel->vplane1->pitch;
  22.267 -        overlay->pixels[1] = overlay->hwdata->CurrentFrameData->U;
  22.268 -    }
  22.269 -    if (overlay->planes > 2) {
  22.270 -        overlay->pitches[2] = overlay->hwdata->channel->uplane1->pitch;
  22.271 -        overlay->pixels[2] = overlay->hwdata->CurrentFrameData->V;
  22.272 -    }
  22.273 -
  22.274 -    overlay->hwdata->State = OVERLAY_STATE_ACTIVE;
  22.275 -    overlay->hwdata->scaler_on = 0;
  22.276 -    overlay->hw_overlay = 1;
  22.277 -
  22.278 -    current_overlay = overlay;
  22.279 -
  22.280 -    return overlay;
  22.281 -}
  22.282 -
  22.283 -int
  22.284 -ph_LockYUVOverlay(_THIS, SDL_Overlay * overlay)
  22.285 -{
  22.286 -    if (overlay == NULL) {
  22.287 -        return -1;
  22.288 -    }
  22.289 -
  22.290 -    overlay->hwdata->locked = 1;
  22.291 -
  22.292 -/*  overlay->hwdata->current = PgNextVideoFrame(overlay->hwdata->channel);
  22.293 -    if (overlay->hwdata->current == -1)
  22.294 -    {
  22.295 -        SDL_SetError("ph_LockYUVOverlay: PgNextFrame() failed, bailing out\n");
  22.296 -        SDL_FreeYUVOverlay(overlay);
  22.297 -        return 0;
  22.298 -    }
  22.299 -
  22.300 -    if (overlay->hwdata->current == 0)
  22.301 -    {
  22.302 -        overlay->hwdata->CurrentFrameData = overlay->hwdata->FrameData0;
  22.303 -    }
  22.304 -    else
  22.305 -    {
  22.306 -        overlay->hwdata->CurrentFrameData = overlay->hwdata->FrameData1;
  22.307 -    }
  22.308 -
  22.309 -    if (overlay->planes > 0)
  22.310 -    {
  22.311 -        overlay->pitches[0] = overlay->hwdata->channel->yplane1->pitch;
  22.312 -        overlay->pixels[0]  = overlay->hwdata->CurrentFrameData->Y;
  22.313 -    }
  22.314 -    if (overlay->planes > 1)
  22.315 -    {
  22.316 -        overlay->pitches[1] = overlay->hwdata->channel->uplane1->pitch;
  22.317 -        overlay->pixels[1]  = overlay->hwdata->CurrentFrameData->U;
  22.318 -    }
  22.319 -    if (overlay->planes > 2)
  22.320 -    {
  22.321 -        overlay->pitches[2] = overlay->hwdata->channel->vplane1->pitch;
  22.322 -        overlay->pixels[2]  = overlay->hwdata->CurrentFrameData->V;
  22.323 -    }
  22.324 -*/
  22.325 -
  22.326 -    return (0);
  22.327 -}
  22.328 -
  22.329 -void
  22.330 -ph_UnlockYUVOverlay(_THIS, SDL_Overlay * overlay)
  22.331 -{
  22.332 -    if (overlay == NULL) {
  22.333 -        return;
  22.334 -    }
  22.335 -
  22.336 -    overlay->hwdata->locked = 0;
  22.337 -}
  22.338 -
  22.339 -int
  22.340 -ph_DisplayYUVOverlay(_THIS, SDL_Overlay * overlay, SDL_Rect * src,
  22.341 -                     SDL_Rect * dst)
  22.342 -{
  22.343 -    int rtncode;
  22.344 -    PhPoint_t pos;
  22.345 -    SDL_Rect backrect;
  22.346 -    PhRect_t windowextent;
  22.347 -    int winchanged = 0;
  22.348 -
  22.349 -    if ((overlay == NULL) || (overlay->hwdata == NULL)) {
  22.350 -        return -1;
  22.351 -    }
  22.352 -
  22.353 -    if (overlay->hwdata->State == OVERLAY_STATE_UNINIT) {
  22.354 -        return -1;
  22.355 -    }
  22.356 -
  22.357 -    PtGetAbsPosition(window, &pos.x, &pos.y);
  22.358 -    if ((pos.x != overlay->hwdata->CurrentWindowPos.x) ||
  22.359 -        (pos.y != overlay->hwdata->CurrentWindowPos.y)) {
  22.360 -        winchanged = 1;
  22.361 -        overlay->hwdata->CurrentWindowPos.x = pos.x;
  22.362 -        overlay->hwdata->CurrentWindowPos.y = pos.y;
  22.363 -    }
  22.364 -
  22.365 -    /* If CurrentViewPort position/size has been changed, then move/resize the viewport */
  22.366 -    if ((overlay->hwdata->CurrentViewPort.pos.x != dst->x) ||
  22.367 -        (overlay->hwdata->CurrentViewPort.pos.y != dst->y) ||
  22.368 -        (overlay->hwdata->CurrentViewPort.size.w != dst->w) ||
  22.369 -        (overlay->hwdata->CurrentViewPort.size.h != dst->h) ||
  22.370 -        (overlay->hwdata->scaler_on == 0) || (winchanged == 1) ||
  22.371 -        (overlay->hwdata->forcedredraw == 1)) {
  22.372 -
  22.373 -        if (overlay->hwdata->ischromakey == 1) {
  22.374 -            /* restore screen behind the overlay/chroma color. */
  22.375 -            backrect.x = overlay->hwdata->CurrentViewPort.pos.x;
  22.376 -            backrect.y = overlay->hwdata->CurrentViewPort.pos.y;
  22.377 -            backrect.w = overlay->hwdata->CurrentViewPort.size.w;
  22.378 -            backrect.h = overlay->hwdata->CurrentViewPort.size.h;
  22.379 -            this->UpdateRects(this, 1, &backrect);
  22.380 -
  22.381 -            /* Draw the new rectangle of the chroma color at the viewport position */
  22.382 -            PgSetFillColor(overlay->hwdata->chromakey);
  22.383 -            PgDrawIRect(dst->x, dst->y, dst->x + dst->w - 1,
  22.384 -                        dst->y + dst->h - 1, Pg_DRAW_FILL);
  22.385 -            PgFlush();
  22.386 -        }
  22.387 -
  22.388 -        overlay->hwdata->props.flags |= Pg_SCALER_PROP_SCALER_ENABLE;
  22.389 -        overlay->hwdata->scaler_on = 1;
  22.390 -
  22.391 -        PhWindowQueryVisible(Ph_QUERY_CONSOLE, 0, PtWidgetRid(window),
  22.392 -                             &windowextent);
  22.393 -        overlay->hwdata->CurrentViewPort.pos.x =
  22.394 -            pos.x - windowextent.ul.x + dst->x;
  22.395 -        overlay->hwdata->CurrentViewPort.pos.y =
  22.396 -            pos.y - windowextent.ul.y + dst->y;
  22.397 -        overlay->hwdata->CurrentViewPort.size.w = dst->w;
  22.398 -        overlay->hwdata->CurrentViewPort.size.h = dst->h;
  22.399 -        PhAreaToRect(&overlay->hwdata->CurrentViewPort,
  22.400 -                     &overlay->hwdata->props.viewport);
  22.401 -        overlay->hwdata->CurrentViewPort.pos.x = dst->x;
  22.402 -        overlay->hwdata->CurrentViewPort.pos.y = dst->y;
  22.403 -
  22.404 -        rtncode =
  22.405 -            PgConfigScalerChannel(overlay->hwdata->channel,
  22.406 -                                  &(overlay->hwdata->props));
  22.407 -
  22.408 -        switch (rtncode) {
  22.409 -        case -1:
  22.410 -            SDL_SetError("PgConfigScalerChannel() function failed\n");
  22.411 -            SDL_FreeYUVOverlay(overlay);
  22.412 -            return -1;
  22.413 -        case 1:
  22.414 -            grab_ptrs2(overlay->hwdata->channel,
  22.415 -                       overlay->hwdata->FrameData0,
  22.416 -                       overlay->hwdata->FrameData1);
  22.417 -            break;
  22.418 -        case 0:
  22.419 -        default:
  22.420 -            break;
  22.421 -        }
  22.422 -    }
  22.423 -
  22.424 -
  22.425 -/*
  22.426 -    if (overlay->hwdata->locked==0)
  22.427 -    {
  22.428 -        overlay->hwdata->current = PgNextVideoFrame(overlay->hwdata->channel);
  22.429 -        if (overlay->hwdata->current == -1)
  22.430 -        {
  22.431 -            SDL_SetError("ph_LockYUVOverlay: PgNextFrame() failed, bailing out\n");
  22.432 -            SDL_FreeYUVOverlay(overlay);
  22.433 -            return 0;
  22.434 -        }
  22.435 -
  22.436 -        if (overlay->hwdata->current == 0)
  22.437 -        {
  22.438 -            overlay->hwdata->CurrentFrameData = overlay->hwdata->FrameData0;
  22.439 -        }
  22.440 -        else
  22.441 -        {
  22.442 -            overlay->hwdata->CurrentFrameData = overlay->hwdata->FrameData1;
  22.443 -        }
  22.444 -
  22.445 -        if (overlay->planes > 0)
  22.446 -        {
  22.447 -            overlay->pitches[0] = overlay->hwdata->channel->yplane1->pitch;
  22.448 -            overlay->pixels[0]  = overlay->hwdata->CurrentFrameData->Y;
  22.449 -        }
  22.450 -        if (overlay->planes > 1)
  22.451 -        {
  22.452 -            overlay->pitches[1] = overlay->hwdata->channel->uplane1->pitch;
  22.453 -            overlay->pixels[1]  = overlay->hwdata->CurrentFrameData->U;
  22.454 -        }
  22.455 -        if (overlay->planes > 2)
  22.456 -        {
  22.457 -            overlay->pitches[2] = overlay->hwdata->channel->vplane1->pitch;
  22.458 -            overlay->pixels[2]  = overlay->hwdata->CurrentFrameData->V;
  22.459 -        }
  22.460 -    }
  22.461 -*/
  22.462 -
  22.463 -    return 0;
  22.464 -}
  22.465 -
  22.466 -void
  22.467 -ph_FreeYUVOverlay(_THIS, SDL_Overlay * overlay)
  22.468 -{
  22.469 -    SDL_Rect backrect;
  22.470 -
  22.471 -    if (overlay == NULL) {
  22.472 -        return;
  22.473 -    }
  22.474 -
  22.475 -    if (overlay->hwdata == NULL) {
  22.476 -        return;
  22.477 -    }
  22.478 -
  22.479 -    current_overlay = NULL;
  22.480 -
  22.481 -    /* restore screen behind the overlay/chroma color. */
  22.482 -    backrect.x = overlay->hwdata->CurrentViewPort.pos.x;
  22.483 -    backrect.y = overlay->hwdata->CurrentViewPort.pos.y;
  22.484 -    backrect.w = overlay->hwdata->CurrentViewPort.size.w;
  22.485 -    backrect.h = overlay->hwdata->CurrentViewPort.size.h;
  22.486 -    this->UpdateRects(this, 1, &backrect);
  22.487 -
  22.488 -    /* it is need for some buggy drivers, that can't hide overlay before */
  22.489 -    /* freeing buffer, so we got trash on the srceen                     */
  22.490 -    overlay->hwdata->props.flags &= ~Pg_SCALER_PROP_SCALER_ENABLE;
  22.491 -    PgConfigScalerChannel(overlay->hwdata->channel,
  22.492 -                          &(overlay->hwdata->props));
  22.493 -
  22.494 -    overlay->hwdata->scaler_on = 0;
  22.495 -    overlay->hwdata->State = OVERLAY_STATE_UNINIT;
  22.496 -
  22.497 -    if (overlay->hwdata->channel != NULL) {
  22.498 -        PgDestroyVideoChannel(overlay->hwdata->channel);
  22.499 -        overlay->hwdata->channel = NULL;
  22.500 -        return;
  22.501 -    }
  22.502 -
  22.503 -    overlay->hwdata->CurrentFrameData = NULL;
  22.504 -
  22.505 -    SDL_free(overlay->hwdata->FrameData0);
  22.506 -    SDL_free(overlay->hwdata->FrameData1);
  22.507 -    overlay->hwdata->FrameData0 = NULL;
  22.508 -    overlay->hwdata->FrameData1 = NULL;
  22.509 -    SDL_free(overlay->hwdata);
  22.510 -}
  22.511 -
  22.512 -/* vi: set ts=4 sw=4 expandtab: */
    23.1 --- a/src/video/photon/SDL_phyuv_c.h	Fri Feb 27 09:51:55 2009 +0000
    23.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.3 @@ -1,65 +0,0 @@
    23.4 -/*
    23.5 -    SDL - Simple DirectMedia Layer
    23.6 -    Copyright (C) 1997-2009 Sam Lantinga
    23.7 -
    23.8 -    This library is free software; you can redistribute it and/or
    23.9 -    modify it under the terms of the GNU Lesser General Public
   23.10 -    License as published by the Free Software Foundation; either
   23.11 -    version 2.1 of the License, or (at your option) any later version.
   23.12 -
   23.13 -    This library is distributed in the hope that it will be useful,
   23.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   23.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   23.16 -    Lesser General Public License for more details.
   23.17 -
   23.18 -    You should have received a copy of the GNU Lesser General Public
   23.19 -    License along with this library; if not, write to the Free Software
   23.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   23.21 -
   23.22 -    Sam Lantinga
   23.23 -    slouken@libsdl.org
   23.24 -*/
   23.25 -#include "SDL_config.h"
   23.26 -
   23.27 -#ifndef __SDL_PH_YUV_H__
   23.28 -#define __SDL_PH_YUV_H__
   23.29 -
   23.30 -/* This is the photon implementation of YUV video overlays */
   23.31 -
   23.32 -#include "SDL_video.h"
   23.33 -#include "SDL_ph_video.h"
   23.34 -
   23.35 -struct private_yuvhwdata
   23.36 -{
   23.37 -    FRAMEDATA *CurrentFrameData;
   23.38 -    FRAMEDATA *FrameData0;
   23.39 -    FRAMEDATA *FrameData1;
   23.40 -    PgScalerProps_t props;
   23.41 -    PgScalerCaps_t caps;
   23.42 -    PgVideoChannel_t *channel;
   23.43 -    PhArea_t CurrentViewPort;
   23.44 -    PhPoint_t CurrentWindowPos;
   23.45 -    long format;
   23.46 -    int scaler_on;
   23.47 -    int current;
   23.48 -    long YStride;
   23.49 -    long VStride;
   23.50 -    long UStride;
   23.51 -    int ischromakey;
   23.52 -    long chromakey;
   23.53 -    int forcedredraw;
   23.54 -    unsigned long State;
   23.55 -    long flags;
   23.56 -    int locked;
   23.57 -};
   23.58 -
   23.59 -extern SDL_Overlay *ph_CreateYUVOverlay(_THIS, int width, int height,
   23.60 -                                        Uint32 format, SDL_Surface * display);
   23.61 -extern int ph_LockYUVOverlay(_THIS, SDL_Overlay * overlay);
   23.62 -extern void ph_UnlockYUVOverlay(_THIS, SDL_Overlay * overlay);
   23.63 -extern int ph_DisplayYUVOverlay(_THIS, SDL_Overlay * overlay, SDL_Rect * src,
   23.64 -                                SDL_Rect * dst);
   23.65 -extern void ph_FreeYUVOverlay(_THIS, SDL_Overlay * overlay);
   23.66 -
   23.67 -#endif /* __SDL_PH_YUV_H__ */
   23.68 -/* vi: set ts=4 sw=4 expandtab: */
    24.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.2 +++ b/src/video/qnxgf/SDL_qnxgf.c	Tue Mar 03 04:21:51 2009 +0000
    24.3 @@ -0,0 +1,35 @@
    24.4 +/*
    24.5 +    SDL - Simple DirectMedia Layer
    24.6 +    Copyright (C) 1997-2009 Sam Lantinga
    24.7 +
    24.8 +    This library is free software; you can redistribute it and/or
    24.9 +    modify it under the terms of the GNU Lesser General Public
   24.10 +    License as published by the Free Software Foundation; either
   24.11 +    version 2.1 of the License, or (at your option) any later version.
   24.12 +
   24.13 +    This library is distributed in the hope that it will be useful,
   24.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
   24.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   24.16 +    Lesser General Public License for more details.
   24.17 +
   24.18 +    You should have received a copy of the GNU Lesser General Public
   24.19 +    License along with this library; if not, write to the Free Software
   24.20 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   24.21 +
   24.22 +    Sam Lantinga
   24.23 +    slouken@libsdl.org
   24.24 +*/
   24.25 +
   24.26 +#include "SDL_config.h"
   24.27 +
   24.28 +#include "../SDL_sysvideo.h"
   24.29 +
   24.30 +VideoBootStrap qnxgf_bootstrap=
   24.31 +{
   24.32 +   "QNXGF",
   24.33 +   "QNX Graphics Framework",
   24.34 +   NULL,
   24.35 +   NULL
   24.36 +};
   24.37 +
   24.38 +/* vi: set ts=4 sw=4 expandtab: */