annotate src/video/photon/SDL_photon.c @ 3108:aa1897bee1e9

Continue working on QNX Photon with OpenGL ES support
author Mike Gorchak <lestat@i.com.ua>
date Tue, 28 Apr 2009 04:30:52 +0000
parents cad1aefa2ed9
children 1102a3305928
rev   line source
3087
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
3 Copyright (C) 1997-2009 Sam Lantinga
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
6 modify it under the terms of the GNU Lesser General Public
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
13 Lesser General Public License for more details.
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
15 You should have received a copy of the GNU Lesser General Public
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
16 License along with this library; if not, write to the Free Software
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 Sam Lantinga
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 slouken@libsdl.org
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
21
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
22 QNX Photon GUI SDL driver
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
23 Copyright (C) 2009 Mike Gorchak
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
24 (mike@malva.ua, lestat@i.com.ua)
3087
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25 */
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
27 /* SDL internals */
3087
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28 #include "SDL_config.h"
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29 #include "../SDL_sysvideo.h"
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
30 #include "SDL_version.h"
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
31 #include "SDL_syswm.h"
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
32 #include "SDL_loadso.h"
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
33 #include "SDL_events.h"
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
34 #include "../../events/SDL_mouse_c.h"
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
35 #include "../../events/SDL_keyboard_c.h"
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
36
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
37 /* Photon declarations */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
38 #include "SDL_photon.h"
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
39
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
40 /* Pixel format conversion routines */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
41 #include "SDL_photon_pixelfmt.h"
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
42
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
43 /* Use GF's pixel format functions for OpenGL ES context creation */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
44 #if defined(SDL_VIDEO_OPENGL_ES)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
45 #include "../qnxgf/SDL_gf_pixelfmt.h"
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
46
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
47 /* If GF driver is not compiled in, include some of usefull functions */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
48 #if !defined(SDL_VIDEO_DRIVER_QNXGF)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
49 #include "../qnxgf/SDL_gf_pixelfmt.c"
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
50 #endif /* SDL_VIDEO_DRIVER_QNXGF */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
51 #endif /* SDL_VIDEO_OPENGL_ES */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
52
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
53 /* Use GF's OpenGL ES 1.1 functions emulation */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
54 #if defined(SDL_VIDEO_OPENGL_ES)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
55 #include "../qnxgf/SDL_gf_opengles.h"
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
56
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
57 /* If GF driver is not compiled in, include some of usefull functions */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
58 #if !defined(SDL_VIDEO_DRIVER_QNXGF)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
59 #include "../qnxgf/SDL_gf_opengles.c"
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
60 #endif /* SDL_VIDEO_DRIVER_QNXGF */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
61 #endif /* SDL_VIDEO_OPENGL_ES */
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
62
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
63 /* Low level device graphics driver names, which they are reporting */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
64 Photon_DeviceCaps photon_devicename[]=
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
65 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
66 /* ATI Rage 128 graphics driver (devg-ati_rage128) */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
67 {"ati_rage128", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D},
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
68 /* Fujitsu Carmine graphics driver (devg-carmine.so) */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
69 {"carmine", SDL_PHOTON_ACCELERATED | SDL_PHOTON_ACCELERATED_3D},
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
70 /* C&T graphics driver (devg-chips.so) */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
71 {"chips", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D},
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
72 /* Fujitsu Coral graphics driver (devg-coral.so) */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
73 {"coral", SDL_PHOTON_ACCELERATED | SDL_PHOTON_ACCELERATED_3D},
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
74 /* Intel integrated graphics driver (devg-extreme2.so) */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
75 {"extreme2", SDL_PHOTON_ACCELERATED | SDL_PHOTON_ACCELERATED_3D},
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
76 /* Unaccelerated FB driver (devg-flat.so) */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
77 {"flat", SDL_PHOTON_UNACCELERATED | SDL_PHOTON_UNACCELERATED_3D},
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
78 /* NS Geode graphics driver (devg-geode.so) */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
79 {"geode", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D},
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
80 /* Geode LX graphics driver (devg-geodelx.so) */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
81 {"geodelx", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D},
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
82 /* Intel integrated graphics driver (devg-gma9xx.so) */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
83 {"gma", SDL_PHOTON_ACCELERATED | SDL_PHOTON_ACCELERATED_3D},
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
84 /* Intel integrated graphics driver (devg-i810.so) */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
85 {"i810", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D},
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
86 /* Intel integrated graphics driver (devg-i830.so) */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
87 {"i830", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D},
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
88 /* Geode LX graphics driver (devg-lx800.so) */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
89 {"lx800", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D},
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
90 /* Matrox Gxx graphics driver (devg-matroxg.so) */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
91 {"matroxg", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D},
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
92 /* Intel Poulsbo graphics driver (devg-poulsbo.so) */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
93 {"poulsbo", SDL_PHOTON_ACCELERATED | SDL_PHOTON_ACCELERATED_3D},
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
94 /* ATI Radeon driver (devg-radeon.so) */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
95 {"radeon", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D},
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
96 /* ATI Rage driver (devg-rage.so) */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
97 {"rage", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D},
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
98 /* S3 Savage graphics driver (devg-s3_savage.so) */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
99 {"s3_savage", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D},
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
100 /* SiS630 integrated graphics driver (devg-sis630.so) */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
101 {"sis630", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D},
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
102 /* PowerVR SGX 535 graphics driver (devg-poulsbo.so) */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
103 {"sgx", SDL_PHOTON_ACCELERATED | SDL_PHOTON_ACCELERATED_3D},
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
104 /* SM Voyager GX graphics driver (devg-smi5xx.so) */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
105 {"smi5xx", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D},
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
106 /* Silicon Motion graphics driver (devg-smi7xx.so) */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
107 {"smi7xx", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D},
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
108 /* SVGA unaccelerated gfx driver (devg-svga.so) */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
109 {"svga", SDL_PHOTON_UNACCELERATED | SDL_PHOTON_UNACCELERATED_3D},
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
110 /* nVidia TNT graphics driver (devg-tnt.so) */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
111 {"tnt", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D},
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
112 /* VIA integrated graphics driver (devg-tvia.so) */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
113 {"tvia", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D},
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
114 /* VIA UniChrome graphics driver (devg-unichrome.so) */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
115 {"unichrome", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D},
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
116 /* VESA unaccelerated gfx driver (devg-vesa.so) */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
117 {"vesa", SDL_PHOTON_UNACCELERATED | SDL_PHOTON_UNACCELERATED_3D},
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
118 /* VmWare graphics driver (devg-volari.so) */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
119 {"vmware", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D},
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
120 /* XGI XP10 graphics driver (devg-volari.so), OpenGL 1.5*/
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
121 {"volari", SDL_PHOTON_ACCELERATED | SDL_PHOTON_UNACCELERATED_3D},
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
122 /* End of list */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
123 {NULL, 0x00000000}
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
124 };
3087
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
125
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
126 static SDL_bool photon_initialized=SDL_FALSE;
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
127
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
128 static int photon_available(void)
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
129 {
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
130 int status;
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
131
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
132 /* Check if Photon was initialized before */
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
133 if (photon_initialized==SDL_FALSE)
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
134 {
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
135 /* Initialize Photon widget library and open channel to Photon */
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
136 status=PtInit(NULL);
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
137 if (status==0)
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
138 {
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
139 photon_initialized=SDL_TRUE;
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
140 return 1;
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
141 }
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
142 else
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
143 {
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
144 photon_initialized=SDL_FALSE;
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
145 return 0;
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
146 }
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
147 }
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
148
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
149 return 1;
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
150 }
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
151
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
152 static void photon_destroy(SDL_VideoDevice* device)
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
153 {
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
154 SDL_VideoData* phdata=(SDL_VideoData*) device->driverdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
155
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
156 #if defined(SDL_VIDEO_OPENGL_ES)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
157 if (phdata->gfinitialized!=SDL_FALSE)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
158 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
159 gf_dev_detach(phdata->gfdev);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
160 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
161 #endif /* SDL_VIDEO_OPENGL_ES */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
162
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
163 if (device->driverdata!=NULL)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
164 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
165 device->driverdata=NULL;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
166 }
3087
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
167 }
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
168
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
169 static SDL_VideoDevice* photon_create(int devindex)
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
170 {
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
171 SDL_VideoDevice* device;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
172 SDL_VideoData* phdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
173 int status;
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
174
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
175 /* Check if photon could be initialized */
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
176 status=photon_available();
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
177 if (status==0)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
178 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
179 /* Photon could not be used */
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
180 return NULL;
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
181 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
182
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
183 /* Photon agregates all video devices to one with multiple heads */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
184 if (devindex!=0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
185 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
186 /* devindex could be zero only in Photon SDL driver */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
187 return NULL;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
188 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
189
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
190 /* Initialize SDL_VideoDevice structure */
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
191 device=(SDL_VideoDevice*)SDL_calloc(1, sizeof(SDL_VideoDevice));
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
192 if (device==NULL)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
193 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
194 SDL_OutOfMemory();
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
195 return NULL;
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
196 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
197
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
198 /* Initialize internal photon specific data */
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
199 phdata=(SDL_VideoData*)SDL_calloc(1, sizeof(SDL_VideoData));
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
200 if (phdata==NULL)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
201 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
202 SDL_OutOfMemory();
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
203 SDL_free(device);
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
204 return NULL;
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
205 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
206 device->driverdata=phdata;
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
207
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
208 /* Get all photon display devices */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
209 phdata->avail_rids=PdGetDevices(&phdata->rid[0], SDL_VIDEO_PHOTON_MAX_RIDS);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
210 if (phdata->avail_rids>SDL_VIDEO_PHOTON_MAX_RIDS)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
211 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
212 phdata->avail_rids=SDL_VIDEO_PHOTON_MAX_RIDS;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
213 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
214
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
215 #if defined(SDL_VIDEO_OPENGL_ES)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
216 /* TODO: add real device detection versus multiple heads */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
217 status=gf_dev_attach(&phdata->gfdev, GF_DEVICE_INDEX(0), &phdata->gfdev_info);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
218 if (status!=GF_ERR_OK)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
219 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
220 /* Do not fail right now, if GF can't be attached */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
221 phdata->gfinitialized=SDL_FALSE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
222 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
223 else
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
224 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
225 phdata->gfinitialized=SDL_TRUE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
226 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
227 #endif /* SDL_VIDEO_OPENGL_ES */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
228
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
229 /* Set default target device */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
230 status=PdSetTargetDevice(NULL, phdata->rid[0]);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
231 if (status==-1)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
232 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
233 SDL_SetError("Photon: Can't set default target device");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
234 #if defined(SDL_VIDEO_OPENGL_ES)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
235 gf_dev_detach(phdata->gfdev);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
236 #endif /* SDL_VIDEO_OPENGL_ES */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
237 SDL_free(phdata);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
238 SDL_free(device);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
239 return NULL;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
240 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
241 phdata->current_device_id=0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
242
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
243 /* Setup amount of available displays and current display */
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
244 device->num_displays=0;
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
245 device->current_display=0;
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
246
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
247 /* Set device free function */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
248 device->free=photon_destroy;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
249
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
250 /* Setup all functions which we can handle */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
251 device->VideoInit=photon_videoinit;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
252 device->VideoQuit=photon_videoquit;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
253 device->GetDisplayModes=photon_getdisplaymodes;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
254 device->SetDisplayMode=photon_setdisplaymode;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
255 device->SetDisplayPalette=photon_setdisplaypalette;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
256 device->GetDisplayPalette=photon_getdisplaypalette;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
257 device->SetDisplayGammaRamp=photon_setdisplaygammaramp;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
258 device->GetDisplayGammaRamp=photon_getdisplaygammaramp;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
259 device->CreateWindow=photon_createwindow;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
260 device->CreateWindowFrom=photon_createwindowfrom;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
261 device->SetWindowTitle=photon_setwindowtitle;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
262 device->SetWindowIcon=photon_setwindowicon;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
263 device->SetWindowPosition=photon_setwindowposition;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
264 device->SetWindowSize=photon_setwindowsize;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
265 device->ShowWindow=photon_showwindow;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
266 device->HideWindow=photon_hidewindow;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
267 device->RaiseWindow=photon_raisewindow;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
268 device->MaximizeWindow=photon_maximizewindow;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
269 device->MinimizeWindow=photon_minimizewindow;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
270 device->RestoreWindow=photon_restorewindow;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
271 device->SetWindowGrab=photon_setwindowgrab;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
272 device->DestroyWindow=photon_destroywindow;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
273 device->GetWindowWMInfo=photon_getwindowwminfo;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
274 device->GL_LoadLibrary=photon_gl_loadlibrary;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
275 device->GL_GetProcAddress=photon_gl_getprocaddres;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
276 device->GL_UnloadLibrary=photon_gl_unloadlibrary;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
277 device->GL_CreateContext=photon_gl_createcontext;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
278 device->GL_MakeCurrent=photon_gl_makecurrent;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
279 device->GL_SetSwapInterval=photon_gl_setswapinterval;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
280 device->GL_GetSwapInterval=photon_gl_getswapinterval;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
281 device->GL_SwapWindow=photon_gl_swapwindow;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
282 device->GL_DeleteContext=photon_gl_deletecontext;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
283 device->PumpEvents=photon_pumpevents;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
284 device->SuspendScreenSaver=photon_suspendscreensaver;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
285
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
286 return device;
3087
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
287 }
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
288
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
289 VideoBootStrap photon_bootstrap=
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
290 {
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
291 "photon",
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
292 "SDL QNX Photon video driver",
3087
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
293 photon_available,
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
294 photon_create
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
295 };
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
296
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
297 /*****************************************************************************/
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
298 /* SDL Video and Display initialization/handling functions */
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
299 /*****************************************************************************/
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
300 int photon_videoinit(_THIS)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
301 {
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
302 SDL_VideoData* phdata=(SDL_VideoData*)_this->driverdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
303 PgHWCaps_t hwcaps;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
304 PgVideoModeInfo_t modeinfo;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
305 int32_t status;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
306 SDL_VideoDisplay display;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
307 SDL_DisplayMode current_mode;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
308 SDL_DisplayData* didata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
309 uint32_t it;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
310 uint32_t jt;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
311 char* override;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
312
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
313 /* By default Photon do not uses swap on VSYNC */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
314 phdata->swapinterval=0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
315
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
316 for (it=0; it<phdata->avail_rids; it++)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
317 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
318 didata=(SDL_DisplayData*)SDL_calloc(1, sizeof(SDL_DisplayData));
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
319 if (didata==NULL)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
320 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
321 /* memory allocation error */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
322 SDL_OutOfMemory();
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
323 return -1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
324 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
325
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
326 /* Allocate two cursors with SDL_VIDEO_PHOTON_MAX_CURSOR_SIZE size */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
327 /* and 128 bytes of spare place */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
328 didata->cursor_size=((SDL_VIDEO_PHOTON_MAX_CURSOR_SIZE*4)>>3)+128;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
329 didata->cursor=(PhCursorDef_t*)SDL_calloc(1, didata->cursor_size);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
330 if (didata->cursor==NULL)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
331 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
332 /* memory allocation error */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
333 SDL_OutOfMemory();
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
334 SDL_free(didata);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
335 return -1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
336 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
337
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
338 /* Initialize GF in case of OpenGL ES support is compiled in */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
339 #if defined(SDL_VIDEO_OPENGL_ES)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
340 /* TODO: add real device detection versus multiple heads */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
341 if (phdata->gfinitialized==SDL_TRUE)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
342 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
343 status=gf_display_attach(&didata->display, phdata->gfdev, it, &didata->display_info);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
344 if (status!=GF_ERR_OK)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
345 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
346 /* Just shutdown GF, do not fail */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
347 gf_dev_detach(phdata->gfdev);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
348 phdata->gfinitialized=SDL_FALSE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
349 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
350 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
351 #endif /* SDL_VIDEO_OPENGL_ES */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
352
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
353 /* Check if current device is not the same as target */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
354 if (phdata->current_device_id!=it)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
355 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
356 /* Set target device as default for Pd and Pg functions */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
357 status=PdSetTargetDevice(NULL, phdata->rid[it]);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
358 if (status!=0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
359 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
360 SDL_SetError("Photon: Can't set default target device\n");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
361 SDL_free(didata->cursor);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
362 SDL_free(didata);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
363 return -1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
364 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
365 phdata->current_device_id=it;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
366 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
367
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
368 /* Store device id */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
369 didata->device_id=it;
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
370
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
371 /* Query photon about graphics hardware caps and current video mode */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
372 status=PgGetGraphicsHWCaps(&hwcaps);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
373 if (status!=0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
374 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
375 SDL_SetError("Photon: Can't get graphics capabilities");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
376 SDL_free(didata->cursor);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
377 SDL_free(didata);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
378 return -1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
379 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
380
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
381 /* Get current video mode details */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
382 status=PgGetVideoModeInfo(hwcaps.current_video_mode, &modeinfo);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
383 if (status!=0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
384 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
385 SDL_SetError("Photon: Can't get current video mode information");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
386 SDL_free(didata->cursor);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
387 SDL_free(didata);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
388 return -1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
389 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
390
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
391 /* Setup current desktop mode for SDL */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
392 SDL_zero(current_mode);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
393 current_mode.w=modeinfo.width;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
394 current_mode.h=modeinfo.height;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
395 current_mode.refresh_rate=hwcaps.current_rrate;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
396 current_mode.format=photon_image_to_sdl_pixelformat(modeinfo.type);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
397 current_mode.driverdata=NULL;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
398
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
399 /* Copy device name */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
400 SDL_strlcpy(didata->description, hwcaps.chip_name, SDL_VIDEO_PHOTON_DEVICENAME_MAX-1);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
401
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
402 /* Search device capabilities and possible workarounds */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
403 jt=0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
404 do {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
405 if (photon_devicename[jt].name==NULL)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
406 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
407 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
408 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
409 if (SDL_strncmp(photon_devicename[jt].name, didata->description, SDL_strlen(photon_devicename[jt].name))==0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
410 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
411 didata->caps=photon_devicename[jt].caps;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
412 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
413 jt++;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
414 } while(1);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
415
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
416 /* Initialize display structure */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
417 SDL_zero(display);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
418 display.desktop_mode=current_mode;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
419 display.current_mode=current_mode;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
420 display.driverdata=didata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
421 didata->current_mode=current_mode;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
422 SDL_AddVideoDisplay(&display);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
423
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
424 /* Check for environment variables which could override some SDL settings */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
425 didata->custom_refresh=0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
426 override=SDL_getenv("SDL_VIDEO_PHOTON_REFRESH_RATE");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
427 if (override!=NULL)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
428 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
429 if (SDL_sscanf(override, "%u", &didata->custom_refresh)!=1)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
430 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
431 didata->custom_refresh=0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
432 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
433 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
434 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
435
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
436 /* Add photon input devices */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
437 status=photon_addinputdevices(_this);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
438 if (status!=0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
439 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
440 /* SDL error is set by photon_addinputdevices() function */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
441 return -1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
442 }
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
443
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
444 /* Add photon renderer to SDL */
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
445 photon_addrenderdriver(_this);
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
446
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
447 /* video has been initialized successfully */
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
448 return 1;
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
449 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
450
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
451 void photon_videoquit(_THIS)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
452 {
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
453 SDL_VideoData* phdata=(SDL_VideoData*)_this->driverdata;
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
454 SDL_DisplayData* didata;
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
455 uint32_t it;
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
456
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
457 /* SDL will restore our desktop mode on exit */
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
458 for(it=0; it<_this->num_displays; it++)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
459 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
460 didata=_this->displays[it].driverdata;
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
461
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
462 if (didata->cursor!=NULL)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
463 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
464 SDL_free(didata->cursor);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
465 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
466
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
467 #if defined(SDL_VIDEO_OPENGL_ES)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
468 if (phdata->gfinitialized==SDL_TRUE)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
469 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
470 /* Detach GF display */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
471 gf_display_detach(didata->display);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
472 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
473 #endif /* SDL_VIDEO_OPENGL_ES */
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
474 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
475 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
476
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
477 void photon_getdisplaymodes(_THIS)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
478 {
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
479 SDL_VideoData* phdata=(SDL_VideoData*)_this->driverdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
480 SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
481 SDL_DisplayMode mode;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
482 PgVideoModes_t modes;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
483 PgVideoModeInfo_t modeinfo;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
484 int32_t status;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
485 uint32_t it;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
486 uint32_t jt;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
487
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
488 /* Check if current device is not the same as target */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
489 if (phdata->current_device_id!=didata->device_id)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
490 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
491 /* Set target device as default for Pd and Pg functions */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
492 status=PdSetTargetDevice(NULL, phdata->rid[didata->device_id]);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
493 if (status!=0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
494 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
495 SDL_SetError("Photon: Can't set default target device\n");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
496 return;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
497 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
498 phdata->current_device_id=didata->device_id;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
499 }
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
500
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
501 /* Get array of available video modes */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
502 status=PgGetVideoModeList(&modes);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
503 if (status!=0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
504 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
505 SDL_SetError("Photon: Can't get video mode list");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
506 return;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
507 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
508
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
509 for (it=0; it<modes.num_modes; it++)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
510 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
511 status=PgGetVideoModeInfo(modes.modes[it], &modeinfo);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
512 if (status!=0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
513 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
514 /* Maybe something wrong with this particular mode, skip it */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
515 continue;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
516 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
517
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
518 jt=0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
519 do {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
520 if (modeinfo.refresh_rates[jt]!=0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
521 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
522 mode.w=modeinfo.width;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
523 mode.h=modeinfo.height;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
524 mode.refresh_rate=modeinfo.refresh_rates[jt];
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
525 mode.format=photon_image_to_sdl_pixelformat(modeinfo.type);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
526 mode.driverdata=NULL;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
527 SDL_AddDisplayMode(_this->current_display, &mode);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
528 jt++;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
529 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
530 else
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
531 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
532 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
533 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
534 } while(1);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
535 }
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
536 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
537
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
538 int photon_setdisplaymode(_THIS, SDL_DisplayMode* mode)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
539 {
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
540 SDL_VideoData* phdata=(SDL_VideoData*)_this->driverdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
541 SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
542 PgVideoModes_t modes;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
543 PgVideoModeInfo_t modeinfo;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
544 PgDisplaySettings_t modesettings;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
545 uint32_t refresh_rate=0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
546 int32_t status;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
547 uint32_t it;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
548
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
549 /* Check if current device is not the same as target */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
550 if (phdata->current_device_id!=didata->device_id)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
551 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
552 /* Set target device as default for Pd and Pg functions */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
553 status=PdSetTargetDevice(NULL, phdata->rid[didata->device_id]);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
554 if (status!=0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
555 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
556 SDL_SetError("Photon: Can't set default target device\n");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
557 return;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
558 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
559 phdata->current_device_id=didata->device_id;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
560 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
561
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
562 /* Get array of available video modes */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
563 status=PgGetVideoModeList(&modes);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
564 if (status!=0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
565 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
566 SDL_SetError("Photon: Can't get video mode list");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
567 return;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
568 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
569
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
570 /* Current display dimensions and bpp are no more valid */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
571 didata->current_mode.format=SDL_PIXELFORMAT_UNKNOWN;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
572 didata->current_mode.w=0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
573 didata->current_mode.h=0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
574
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
575 /* Check if custom refresh rate requested */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
576 if (didata->custom_refresh!=0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
577 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
578 refresh_rate=didata->custom_refresh;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
579 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
580 else
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
581 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
582 refresh_rate=mode->refresh_rate;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
583 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
584
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
585 /* Check if SDL GF driver needs to find appropriate refresh rate itself */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
586 if (refresh_rate==0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
587 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
588 SDL_DisplayMode tempmode;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
589
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
590 /* Clear display mode structure */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
591 SDL_memset(&tempmode, 0x00, sizeof(SDL_DisplayMode));
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
592 tempmode.refresh_rate=0x0000FFFF;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
593
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
594 /* Check if window width and height matches one of our modes */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
595 for (it=0; it<SDL_CurrentDisplay.num_display_modes; it++)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
596 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
597 if ((SDL_CurrentDisplay.display_modes[it].w==mode->w) &&
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
598 (SDL_CurrentDisplay.display_modes[it].h==mode->h) &&
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
599 (SDL_CurrentDisplay.display_modes[it].format==mode->format))
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
600 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
601 /* Find the lowest refresh rate available */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
602 if (tempmode.refresh_rate>SDL_CurrentDisplay.display_modes[it].refresh_rate)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
603 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
604 tempmode=SDL_CurrentDisplay.display_modes[it];
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
605 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
606 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
607 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
608 if (tempmode.refresh_rate!=0x0000FFFF)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
609 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
610 refresh_rate=tempmode.refresh_rate;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
611 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
612 else
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
613 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
614 /* Let video driver decide what to do with this */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
615 refresh_rate=0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
616 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
617 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
618
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
619 /* Check if SDL GF driver needs to check custom refresh rate */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
620 if (didata->custom_refresh!=0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
621 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
622 SDL_DisplayMode tempmode;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
623
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
624 /* Clear display mode structure */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
625 SDL_memset(&tempmode, 0x00, sizeof(SDL_DisplayMode));
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
626 tempmode.refresh_rate=0x0000FFFF;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
627
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
628 /* Check if window width and height matches one of our modes */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
629 for (it=0; it<SDL_CurrentDisplay.num_display_modes; it++)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
630 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
631 if ((SDL_CurrentDisplay.display_modes[it].w==mode->w) &&
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
632 (SDL_CurrentDisplay.display_modes[it].h==mode->h) &&
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
633 (SDL_CurrentDisplay.display_modes[it].format==mode->format))
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
634 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
635 /* Find the lowest refresh rate available */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
636 if (tempmode.refresh_rate>SDL_CurrentDisplay.display_modes[it].refresh_rate)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
637 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
638 tempmode=SDL_CurrentDisplay.display_modes[it];
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
639 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
640
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
641 /* Check if requested refresh rate found */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
642 if (refresh_rate==SDL_CurrentDisplay.display_modes[it].refresh_rate)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
643 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
644 tempmode=SDL_CurrentDisplay.display_modes[it];
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
645 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
646 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
647 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
648 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
649 if (tempmode.refresh_rate!=0x0000FFFF)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
650 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
651 refresh_rate=tempmode.refresh_rate;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
652 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
653 else
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
654 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
655 /* Let video driver decide what to do with this */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
656 refresh_rate=0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
657 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
658 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
659
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
660 /* Find photon's video mode number */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
661 for (it=0; it<modes.num_modes; it++)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
662 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
663 uint32_t jt;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
664 uint32_t foundrefresh;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
665
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
666 /* Get current video mode details */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
667 status=PgGetVideoModeInfo(modes.modes[it], &modeinfo);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
668 if (status!=0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
669 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
670 /* Maybe something wrong with this particular mode, skip it */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
671 continue;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
672 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
673 if ((modeinfo.width==mode->w) && (modeinfo.height==mode->h) &&
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
674 (modeinfo.type==photon_sdl_to_image_pixelformat(mode->format)))
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
675 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
676 /* Mode is found, find requested refresh rate, this case is for */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
677 /* video drivers, which provide non-generic video modes. */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
678 jt=0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
679 foundrefresh=0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
680 do {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
681 if (modeinfo.refresh_rates[jt]!=0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
682 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
683 if (modeinfo.refresh_rates[jt]==refresh_rate)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
684 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
685 foundrefresh=1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
686 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
687 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
688 jt++;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
689 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
690 else
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
691 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
692 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
693 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
694 } while(1);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
695 if (foundrefresh!=0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
696 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
697 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
698 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
699 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
700 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
701
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
702 /* Check if video mode has not been found */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
703 if (it==modes.num_modes)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
704 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
705 SDL_SetError("Photon: Can't find appropriate video mode");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
706 return -1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
707 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
708
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
709 /* Fill mode settings */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
710 modesettings.flags=0x00000000;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
711 modesettings.mode=modes.modes[it];
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
712 modesettings.refresh=refresh_rate;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
713
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
714 /* Finally set new video mode */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
715 status=PgSetVideoMode(&modesettings);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
716 if (status!=0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
717 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
718 SDL_SetError("Photon: Can't set new video mode");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
719 return -1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
720 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
721
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
722 /* Store new video mode parameters */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
723 didata->current_mode=*mode;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
724 didata->current_mode.refresh_rate=refresh_rate;
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
725
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
726 return 0;
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
727 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
728
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
729 int photon_setdisplaypalette(_THIS, SDL_Palette* palette)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
730 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
731 SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
732
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
733 /* Setting display palette operation has been failed */
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
734 return -1;
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
735 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
736
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
737 int photon_getdisplaypalette(_THIS, SDL_Palette* palette)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
738 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
739 SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
740
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
741 /* Getting display palette operation has been failed */
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
742 return -1;
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
743 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
744
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
745 int photon_setdisplaygammaramp(_THIS, Uint16* ramp)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
746 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
747 SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
748
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
749 /* Setting display gamma ramp operation has been failed */
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
750 return -1;
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
751 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
752
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
753 int photon_getdisplaygammaramp(_THIS, Uint16* ramp)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
754 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
755 /* Getting display gamma ramp operation has been failed */
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
756 return -1;
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
757 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
758
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
759 int photon_createwindow(_THIS, SDL_Window* window)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
760 {
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
761 SDL_VideoData* phdata=(SDL_VideoData*)_this->driverdata;
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
762 SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
763 SDL_WindowData* wdata;
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
764 PhDim_t winsize;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
765 PhPoint_t winpos;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
766 PtArg_t winargs[32];
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
767 uint32_t winargc=0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
768 int32_t status;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
769 PhRegion_t wregion;
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
770
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
771 /* Allocate window internal data */
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
772 wdata=(SDL_WindowData*)SDL_calloc(1, sizeof(SDL_WindowData));
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
773 if (wdata==NULL)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
774 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
775 SDL_OutOfMemory();
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
776 return -1;
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
777 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
778
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
779 /* Setup driver data for this window */
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
780 window->driverdata=wdata;
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
781
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
782 /* Set initial window title */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
783 if (window->title!=NULL)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
784 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
785 PtSetArg(&winargs[winargc++], Pt_ARG_WINDOW_TITLE, window->title, 0);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
786 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
787 else
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
788 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
789 PtSetArg(&winargs[winargc++], Pt_ARG_WINDOW_TITLE, "", 0);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
790 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
791
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
792 /* TODO: handle SDL_WINDOW_INPUT_GRABBED */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
793
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
794 /* Disable default window filling on redraw */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
795 PtSetArg(&winargs[winargc++], Pt_ARG_BASIC_FLAGS, Pt_TRUE, Pt_BASIC_PREVENT_FILL);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
796
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
797 /* Set default maximum and minimum window sizes */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
798 winsize.w=0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
799 winsize.h=0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
800 PtSetArg(&winargs[winargc++], Pt_ARG_MAX_HEIGHT, 0, 0);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
801 PtSetArg(&winargs[winargc++], Pt_ARG_MAX_WIDTH, 0, 0);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
802 PtSetArg(&winargs[winargc++], Pt_ARG_MIN_HEIGHT, 0, 0);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
803 PtSetArg(&winargs[winargc++], Pt_ARG_MIN_WIDTH, 0, 0);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
804 PtSetArg(&winargs[winargc++], Pt_ARG_MAXIMUM_DIM, &winsize, 0);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
805 PtSetArg(&winargs[winargc++], Pt_ARG_MINIMUM_DIM, &winsize, 0);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
806
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
807 /* Reset default managed events to disable */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
808 PtSetArg(&winargs[winargc++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_FALSE,
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
809 Ph_WM_APP_DEF_MANAGED);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
810 /* Set which events we will not handle, let WM to handle them */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
811 PtSetArg(&winargs[winargc++], Pt_ARG_WINDOW_MANAGED_FLAGS, Pt_TRUE,
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
812 Ph_WM_BACKDROP | Ph_WM_TOFRONT | Ph_WM_COLLAPSE | Ph_WM_FFRONT |
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
813 Ph_WM_FOCUS | Ph_WM_HELP | Ph_WM_HIDE | Ph_WM_MAX |
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
814 Ph_WM_MENU | Ph_WM_MOVE | Ph_WM_RESIZE | Ph_WM_RESTORE |
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
815 Ph_WM_TASKBAR | Ph_WM_TOBACK);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
816
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
817 /* Reset default notify events to disable */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
818 PtSetArg(&winargs[winargc++], Pt_ARG_WINDOW_NOTIFY_FLAGS, Pt_FALSE,
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
819 Ph_WM_RESIZE | Ph_WM_CLOSE | Ph_WM_HELP);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
820 /* Set which events we will handle */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
821 PtSetArg(&winargs[winargc++], Pt_ARG_WINDOW_NOTIFY_FLAGS, Pt_TRUE,
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
822 Ph_WM_CLOSE | Ph_WM_COLLAPSE | Ph_WM_FOCUS | Ph_WM_MAX |
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
823 Ph_WM_MOVE | Ph_WM_RESIZE | Ph_WM_RESTORE | Ph_WM_HIDE);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
824
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
825 /* Borderless window can't be resizeable */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
826 if ((window->flags & SDL_WINDOW_BORDERLESS)==SDL_WINDOW_BORDERLESS)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
827 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
828 window->flags&=~(SDL_WINDOW_RESIZABLE);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
829 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
830
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
831 /* Reset all default decorations */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
832 PtSetArg(&winargs[winargc++], Pt_ARG_WINDOW_RENDER_FLAGS, Pt_FALSE, Ph_WM_APP_DEF_RENDER);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
833
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
834 /* Fullscreen window has its own decorations */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
835 if ((window->flags & SDL_WINDOW_FULLSCREEN)==SDL_WINDOW_FULLSCREEN)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
836 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
837 window->flags|=SDL_WINDOW_BORDERLESS;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
838 window->flags&=~(SDL_WINDOW_RESIZABLE);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
839 PtSetArg(&winargs[winargc++], Pt_ARG_WINDOW_RENDER_FLAGS, Pt_TRUE,
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
840 Ph_WM_RENDER_CLOSE | Ph_WM_RENDER_TITLE);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
841 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
842 else
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
843 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
844 uint32_t decorations=Ph_WM_RENDER_CLOSE | Ph_WM_RENDER_MENU | Ph_WM_RENDER_MIN |
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
845 Ph_WM_RENDER_TITLE | Ph_WM_RENDER_MOVE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
846
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
847 if ((window->flags & SDL_WINDOW_RESIZABLE)==SDL_WINDOW_RESIZABLE)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
848 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
849 decorations|=Ph_WM_RENDER_BORDER | Ph_WM_RENDER_RESIZE | Ph_WM_RENDER_MAX;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
850 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
851 if ((window->flags & SDL_WINDOW_BORDERLESS)!=SDL_WINDOW_BORDERLESS)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
852 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
853 decorations|=Ph_WM_RENDER_BORDER;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
854 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
855 PtSetArg(&winargs[winargc++], Pt_ARG_WINDOW_RENDER_FLAGS, Pt_TRUE, decorations);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
856 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
857
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
858 /* Set initial window state */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
859 PtSetArg(&winargs[winargc++], Pt_ARG_WINDOW_STATE, Pt_FALSE, Ph_WM_STATE_ISFOCUS);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
860 PtSetArg(&winargs[winargc++], Pt_ARG_WINDOW_STATE, Pt_TRUE, Ph_WM_STATE_ISALTKEY);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
861
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
862 /* Set window dimensions */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
863 winsize.w=window->w;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
864 winsize.h=window->h;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
865 PtSetArg(&winargs[winargc++], Pt_ARG_DIM, &winsize, 0);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
866
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
867 /* Check if upper level requests WM to position window */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
868 if ((window->x==SDL_WINDOWPOS_UNDEFINED) && (window->y==SDL_WINDOWPOS_UNDEFINED))
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
869 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
870 /* Do not set widget position, let WM to set it */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
871 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
872 else
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
873 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
874 if (window->x==SDL_WINDOWPOS_UNDEFINED)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
875 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
876 window->x=0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
877 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
878 if (window->y==SDL_WINDOWPOS_UNDEFINED)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
879 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
880 window->y=0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
881 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
882 if (window->x==SDL_WINDOWPOS_CENTERED)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
883 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
884 window->x=(didata->current_mode.w-window->w)/2;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
885 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
886 if (window->y==SDL_WINDOWPOS_CENTERED)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
887 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
888 window->y=(didata->current_mode.h-window->h)/2;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
889 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
890
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
891 /* Now set window position */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
892 winpos.x=window->x;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
893 winpos.y=window->y;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
894 PtSetArg(&winargs[winargc++], Pt_ARG_POS, &winpos, 0);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
895 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
896
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
897 /* Add SDL window id as user data */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
898 PtSetArg(&winargs[winargc++], Pt_ARG_POINTER, (void*)window->id, 0);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
899
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
900 /* Check if window must support OpenGL ES rendering */
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
901 if ((window->flags & SDL_WINDOW_OPENGL)==SDL_WINDOW_OPENGL)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
902 {
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
903 #if defined(SDL_VIDEO_OPENGL_ES)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
904 EGLBoolean initstatus;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
905
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
906 /* Check if GF was initialized correctly */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
907 if (phdata->gfinitialized==SDL_FALSE)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
908 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
909 SDL_SetError("Photon: GF initialization failed, no OpenGL ES support");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
910 return -1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
911 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
912
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
913 /* Mark this window as OpenGL ES compatible */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
914 wdata->uses_gles=SDL_TRUE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
915
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
916 /* Create connection to OpenGL ES */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
917 if (phdata->egldisplay==EGL_NO_DISPLAY)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
918 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
919 phdata->egldisplay=eglGetDisplay(phdata->gfdev);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
920 if (phdata->egldisplay==EGL_NO_DISPLAY)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
921 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
922 SDL_SetError("Photon: Can't get connection to OpenGL ES");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
923 return -1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
924 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
925
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
926 /* Initialize OpenGL ES library, ignore EGL version */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
927 initstatus=eglInitialize(phdata->egldisplay, NULL, NULL);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
928 if (initstatus!=EGL_TRUE)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
929 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
930 SDL_SetError("Photon: Can't init OpenGL ES library");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
931 return -1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
932 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
933 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
934
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
935 /* Increment GL ES reference count usage */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
936 phdata->egl_refcount++;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
937 #else
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
938 SDL_SetError("Photon: OpenGL ES support is not compiled in");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
939 return -1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
940 #endif /* SDL_VIDEO_OPENGL_ES */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
941 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
942
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
943 /* Finally create the window */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
944 wdata->window=PtCreateWidget(PtWindow, Pt_NO_PARENT, winargc, winargs);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
945 if (wdata->window==NULL)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
946 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
947 SDL_SetError("Photon: Can't create window widget");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
948 SDL_free(wdata);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
949 return -1;
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
950 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
951
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
952 /* Show widget */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
953 status=PtRealizeWidget(wdata->window);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
954 if (status!=0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
955 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
956 SDL_SetError("Photon: Can't realize window widget");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
957 PtDestroyWidget(wdata->window);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
958 SDL_free(wdata);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
959 return;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
960 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
961
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
962 /* Just created SDL window always gets focus */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
963 window->flags|=SDL_WINDOW_INPUT_FOCUS;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
964
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
965 /* Create window-specific cursor after creation */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
966 if (didata->cursor_visible==SDL_TRUE)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
967 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
968 /* Setup cursor type. shape and default color */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
969 PtSetResource(wdata->window, Pt_ARG_CURSOR_COLOR, Ph_CURSOR_DEFAULT_COLOR, 0);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
970 PtSetResource(wdata->window, Pt_ARG_CURSOR_TYPE, Ph_CURSOR_BITMAP, 0);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
971 PtSetResource(wdata->window, Pt_ARG_BITMAP_CURSOR, didata->cursor, didata->cursor->hdr.len+sizeof(PhRegionDataHdr_t));
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
972 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
973 else
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
974 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
975 PtSetResource(wdata->window, Pt_ARG_CURSOR_TYPE, Ph_CURSOR_NONE, 0);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
976 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
977
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
978 /* Set window region sensible to mouse motion events */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
979 status=PhRegionQuery(PtWidgetRid(wdata->window), &wregion, NULL, NULL, 0);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
980 if (status!=0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
981 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
982 SDL_SetError("Photon: Can't set region sensivity to mouse motion events");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
983 PtDestroyWidget(wdata->window);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
984 SDL_free(wdata);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
985 return -1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
986 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
987 wregion.events_sense|=Ph_EV_PTR_MOTION_BUTTON | Ph_EV_PTR_MOTION_NOBUTTON;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
988 status=PhRegionChange(Ph_REGION_EV_SENSE, 0, &wregion, NULL, NULL);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
989 if (status<0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
990 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
991 SDL_SetError("Photon: Can't change region sensivity");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
992 PtDestroyWidget(wdata->window);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
993 SDL_free(wdata);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
994 return -1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
995 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
996
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
997 /* Flush all widget operations again */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
998 PtFlush();
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
999
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1000 /* By default last created window got a input focus */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1001 SDL_SetKeyboardFocus(0, window->id);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1002
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1003 /* Window has been successfully created */
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1004 return 0;
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1005 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1006
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1007 int photon_createwindowfrom(_THIS, SDL_Window* window, const void* data)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1008 {
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1009 /* TODO: it is possible */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1010
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1011 /* Failed to create window from another window */
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1012 return -1;
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1013 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1014
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1015 void photon_setwindowtitle(_THIS, SDL_Window* window)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1016 {
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1017 SDL_WindowData* wdata=(SDL_WindowData*)window->driverdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1018 int32_t status;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1019
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1020 /* Set window title */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1021 if (window->title!=NULL)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1022 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1023 status=PtSetResource(wdata->window, Pt_ARG_WINDOW_TITLE, window->title, 0);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1024 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1025 else
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1026 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1027 status=PtSetResource(wdata->window, Pt_ARG_WINDOW_TITLE, "", 0);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1028 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1029
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1030 if (status!=0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1031 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1032 SDL_SetError("Photon: Can't set window title");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1033 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1034
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1035 /* Flush all widget operations */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1036 PtFlush();
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1037 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1038
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1039 void photon_setwindowicon(_THIS, SDL_Window* window, SDL_Surface* icon)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1040 {
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1041 SDL_WindowData* wdata=(SDL_WindowData*)window->driverdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1042 int32_t status;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1043
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1044 /* TODO: Use iconify ? */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1045
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1046 /* Flush all widget operations */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1047 PtFlush();
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1048 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1049
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1050 void photon_setwindowposition(_THIS, SDL_Window* window)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1051 {
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1052 SDL_WindowData* wdata=(SDL_WindowData*)window->driverdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1053 SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1054 PhPoint_t winpos;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1055 int32_t status;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1056
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1057 /* Check if upper level requests WM to position window */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1058 if ((window->x==SDL_WINDOWPOS_UNDEFINED) && (window->y==SDL_WINDOWPOS_UNDEFINED))
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1059 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1060 /* Do not set widget position, let WM to set it */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1061 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1062 else
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1063 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1064 if (window->x==SDL_WINDOWPOS_UNDEFINED)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1065 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1066 window->x=0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1067 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1068 if (window->y==SDL_WINDOWPOS_UNDEFINED)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1069 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1070 window->y=0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1071 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1072 if (window->x==SDL_WINDOWPOS_CENTERED)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1073 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1074 window->x=(didata->current_mode.w-window->w)/2;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1075 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1076 if (window->y==SDL_WINDOWPOS_CENTERED)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1077 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1078 window->y=(didata->current_mode.h-window->h)/2;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1079 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1080
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1081 /* Now set window position */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1082 winpos.x=window->x;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1083 winpos.y=window->y;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1084 status=PtSetResource(wdata->window, Pt_ARG_POS, &winpos, 0);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1085 if (status!=0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1086 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1087 SDL_SetError("Photon: Can't set window position");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1088 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1089 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1090
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1091 /* Flush all widget operations */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1092 PtFlush();
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1093 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1094
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1095 void photon_setwindowsize(_THIS, SDL_Window* window)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1096 {
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1097 SDL_WindowData* wdata=(SDL_WindowData*)window->driverdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1098 PhDim_t winsize;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1099 int32_t status;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1100
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1101 winsize.w=window->w;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1102 winsize.h=window->h;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1103
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1104 status=PtSetResource(wdata->window, Pt_ARG_DIM, &winsize, 0);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1105 if (status!=0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1106 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1107 SDL_SetError("Photon: Can't set window size");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1108 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1109
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1110 /* Flush all widget operations */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1111 PtFlush();
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1112 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1113
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1114 void photon_showwindow(_THIS, SDL_Window* window)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1115 {
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1116 SDL_WindowData* wdata=(SDL_WindowData*)window->driverdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1117 int32_t status;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1118
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1119 /* Bring focus to window and put it in front of others */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1120 PtWindowToFront(wdata->window);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1121
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1122 /* Flush all widget operations */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1123 PtFlush();
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1124 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1125
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1126 void photon_hidewindow(_THIS, SDL_Window* window)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1127 {
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1128 SDL_WindowData* wdata=(SDL_WindowData*)window->driverdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1129 PhWindowEvent_t winevent;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1130 int32_t status;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1131
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1132 SDL_memset(&winevent, 0x00, sizeof(PhWindowEvent_t));
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1133 winevent.event_f=Ph_WM_HIDE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1134 winevent.rid=PtWidgetRid(wdata->window);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1135 winevent.event_state=Ph_WM_EVSTATE_HIDE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1136
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1137 status=PtForwardWindowEvent(&winevent);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1138 if (status!=0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1139 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1140 SDL_SetError("Photon: Can't hide window");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1141 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1142
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1143 /* Flush all widget operations */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1144 PtFlush();
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1145 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1146
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1147 void photon_raisewindow(_THIS, SDL_Window* window)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1148 {
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1149 SDL_WindowData* wdata=(SDL_WindowData*)window->driverdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1150 PhWindowEvent_t winevent;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1151 int32_t status;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1152
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1153 SDL_memset(&winevent, 0x00, sizeof(PhWindowEvent_t));
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1154 winevent.event_f=Ph_WM_HIDE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1155 winevent.rid=PtWidgetRid(wdata->window);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1156 winevent.event_state=Ph_WM_EVSTATE_UNHIDE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1157
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1158 status=PtForwardWindowEvent(&winevent);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1159 if (status!=0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1160 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1161 SDL_SetError("Photon: Can't hide window");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1162 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1163
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1164 /* Flush all widget operations */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1165 PtFlush();
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1166 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1167
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1168 void photon_maximizewindow(_THIS, SDL_Window* window)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1169 {
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1170 SDL_WindowData* wdata=(SDL_WindowData*)window->driverdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1171 PhWindowEvent_t winevent;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1172 int32_t status;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1173
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1174 /* Flush all widget operations */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1175 PtFlush();
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1176 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1177
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1178 void photon_minimizewindow(_THIS, SDL_Window* window)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1179 {
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1180 SDL_WindowData* wdata=(SDL_WindowData*)window->driverdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1181 PhWindowEvent_t winevent;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1182 int32_t status;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1183
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1184 SDL_memset(&winevent, 0x00, sizeof(PhWindowEvent_t));
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1185 winevent.event_f=Ph_WM_HIDE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1186 winevent.rid=PtWidgetRid(wdata->window);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1187 winevent.event_state=Ph_WM_EVSTATE_HIDE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1188
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1189 status=PtForwardWindowEvent(&winevent);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1190 if (status!=0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1191 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1192 SDL_SetError("Photon: Can't hide window");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1193 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1194
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1195 /* Flush all widget operations */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1196 PtFlush();
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1197 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1198
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1199 void photon_restorewindow(_THIS, SDL_Window* window)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1200 {
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1201 SDL_WindowData* wdata=(SDL_WindowData*)window->driverdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1202 PhWindowEvent_t winevent;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1203 int32_t status;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1204
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1205 /* Flush all widget operations */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1206 PtFlush();
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1207 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1208
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1209 void photon_setwindowgrab(_THIS, SDL_Window* window)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1210 {
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1211 SDL_WindowData* wdata=(SDL_WindowData*)window->driverdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1212 PhWindowEvent_t winevent;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1213 int32_t status;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1214
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1215 /* Flush all widget operations */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1216 PtFlush();
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1217 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1218
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1219 void photon_destroywindow(_THIS, SDL_Window* window)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1220 {
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1221 SDL_VideoData* phdata=(SDL_VideoData*)_this->driverdata;
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1222 SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1223 SDL_WindowData* wdata=(SDL_WindowData*)window->driverdata;
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1224 int32_t status;
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1225
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1226 if (wdata!=NULL)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1227 {
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1228 status=PtDestroyWidget(wdata->window);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1229 if (status!=0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1230 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1231 SDL_SetError("Photon: Can't destroy window widget");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1232 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1233 wdata->window=NULL;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1234
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1235 #if defined(SDL_VIDEO_OPENGL_ES)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1236 if (phdata->gfinitialized==SDL_TRUE)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1237 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1238 /* Destroy OpenGL ES surface if it was created */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1239 if (wdata->gles_surface!=EGL_NO_SURFACE)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1240 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1241 eglDestroySurface(phdata->egldisplay, wdata->gles_surface);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1242 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1243
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1244 /* Free OpenGL ES target surface */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1245 if (wdata->gfsurface!=NULL)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1246 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1247 gf_surface_free(wdata->gfsurface);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1248 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1249
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1250 phdata->egl_refcount--;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1251 if (phdata->egl_refcount==0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1252 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1253 /* Terminate connection to OpenGL ES */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1254 if (phdata->egldisplay!=EGL_NO_DISPLAY)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1255 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1256 eglTerminate(phdata->egldisplay);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1257 phdata->egldisplay=EGL_NO_DISPLAY;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1258 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1259 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1260 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1261 #endif /* SDL_VIDEO_OPENGL_ES */
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1262 }
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1263
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1264 /* Flush all widget operations */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1265 PtFlush();
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1266 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1267
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1268 /*****************************************************************************/
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1269 /* SDL Window Manager function */
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1270 /*****************************************************************************/
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1271 SDL_bool photon_getwindowwminfo(_THIS, SDL_Window* window, struct SDL_SysWMinfo* info)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1272 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1273 if (info->version.major<=SDL_MAJOR_VERSION)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1274 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1275 return SDL_TRUE;
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1276 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1277 else
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1278 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1279 SDL_SetError("application not compiled with SDL %d.%d\n", SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1280 return SDL_FALSE;
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1281 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1282
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1283 /* Failed to get window manager information */
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1284 return SDL_FALSE;
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1285 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1286
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1287 /*****************************************************************************/
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1288 /* SDL OpenGL/OpenGL ES functions */
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1289 /*****************************************************************************/
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1290 int photon_gl_loadlibrary(_THIS, const char* path)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1291 {
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1292 #if defined(SDL_VIDEO_OPENGL_ES)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1293 SDL_VideoData* phdata=(SDL_VideoData*)_this->driverdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1294
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1295 if (phdata->gfinitialized!=SDL_TRUE)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1296 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1297 SDL_SetError("Photon: GF initialization failed, no OpenGL ES support");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1298 return NULL;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1299 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1300
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1301 /* Check if OpenGL ES library is specified for GF driver */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1302 if (path==NULL)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1303 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1304 path=SDL_getenv("SDL_OPENGL_LIBRARY");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1305 if (path==NULL)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1306 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1307 path=SDL_getenv("SDL_OPENGLES_LIBRARY");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1308 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1309 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1310
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1311 /* Check if default library loading requested */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1312 if (path==NULL)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1313 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1314 /* Already linked with GF library which provides egl* subset of */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1315 /* functions, use Common profile of OpenGL ES library by default */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1316 path="/usr/lib/libGLES_CM.so.1";
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1317 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1318
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1319 /* Load dynamic library */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1320 _this->gl_config.dll_handle=SDL_LoadObject(path);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1321 if (!_this->gl_config.dll_handle)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1322 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1323 /* Failed to load new GL ES library */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1324 SDL_SetError("Photon: Failed to locate OpenGL ES library");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1325 return -1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1326 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1327
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1328 /* Store OpenGL ES library path and name */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1329 SDL_strlcpy(_this->gl_config.driver_path, path, SDL_arraysize(_this->gl_config.driver_path));
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1330
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1331 /* New OpenGL ES library is loaded */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1332 return 0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1333 #else
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1334 SDL_SetError("Photon: OpenGL ES support is not compiled in");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1335 return -1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1336 #endif /* SDL_VIDEO_OPENGL_ES */
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1337 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1338
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1339 void* photon_gl_getprocaddres(_THIS, const char* proc)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1340 {
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1341 #if defined(SDL_VIDEO_OPENGL_ES)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1342 SDL_VideoData* phdata=(SDL_VideoData*)_this->driverdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1343 void* function_address;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1344
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1345 if (phdata->gfinitialized!=SDL_TRUE)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1346 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1347 SDL_SetError("Photon: GF initialization failed, no OpenGL ES support");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1348 return NULL;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1349 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1350
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1351 /* Try to get function address through the egl interface */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1352 function_address=eglGetProcAddress(proc);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1353 if (function_address!=NULL)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1354 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1355 return function_address;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1356 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1357
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1358 /* Then try to get function in the OpenGL ES library */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1359 if (_this->gl_config.dll_handle)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1360 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1361 function_address=SDL_LoadFunction(_this->gl_config.dll_handle, proc);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1362 if (function_address!=NULL)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1363 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1364 return function_address;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1365 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1366 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1367
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1368 /* Add emulated OpenGL ES 1.1 functions */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1369 if (SDL_strcmp(proc, "glTexParameteri")==0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1370 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1371 return glTexParameteri;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1372 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1373 if (SDL_strcmp(proc, "glTexParameteriv")==0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1374 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1375 return glTexParameteriv;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1376 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1377 if (SDL_strcmp(proc, "glColor4ub")==0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1378 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1379 return glColor4ub;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1380 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1381
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1382 /* Failed to get GL ES function address pointer */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1383 SDL_SetError("Photon: Cannot locate OpenGL ES function name");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1384 return NULL;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1385 #else
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1386 SDL_SetError("Photon: OpenGL ES support is not compiled in");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1387 return NULL;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1388 #endif /* SDL_VIDEO_OPENGL_ES */
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1389 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1390
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1391 void photon_gl_unloadlibrary(_THIS)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1392 {
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1393 #if defined(SDL_VIDEO_OPENGL_ES)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1394 SDL_VideoData* phdata=(SDL_VideoData*)_this->driverdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1395
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1396 if (phdata->gfinitialized==SDL_TRUE)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1397 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1398 /* Unload OpenGL ES library */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1399 if (_this->gl_config.dll_handle)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1400 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1401 SDL_UnloadObject(_this->gl_config.dll_handle);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1402 _this->gl_config.dll_handle=NULL;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1403 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1404 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1405 else
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1406 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1407 SDL_SetError("Photon: GF initialization failed, no OpenGL ES support");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1408 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1409 #else
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1410 SDL_SetError("Photon: OpenGL ES support is not compiled in");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1411 return;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1412 #endif /* SDL_VIDEO_OPENGL_ES */
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1413 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1414
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1415 SDL_GLContext photon_gl_createcontext(_THIS, SDL_Window* window)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1416 {
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1417 #if defined(SDL_VIDEO_OPENGL_ES)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1418 SDL_VideoData* phdata=(SDL_VideoData*)_this->driverdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1419 SDL_WindowData* wdata=(SDL_WindowData*)window->driverdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1420 SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1421 EGLBoolean status;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1422 int32_t gfstatus;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1423 EGLint configs;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1424 uint32_t attr_pos;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1425 EGLint attr_value;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1426 EGLint cit;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1427
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1428 /* Check if GF was initialized */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1429 if (phdata->gfinitialized!=SDL_TRUE)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1430 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1431 SDL_SetError("Photon: GF initialization failed, no OpenGL ES support");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1432 return NULL;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1433 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1434
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1435 /* Prepare attributes list to pass them to OpenGL ES */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1436 attr_pos=0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1437 wdata->gles_attributes[attr_pos++]=EGL_NATIVE_VISUAL_ID;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1438 wdata->gles_attributes[attr_pos++]=qnxgf_sdl_to_gf_pixelformat(didata->current_mode.format);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1439 wdata->gles_attributes[attr_pos++]=EGL_RED_SIZE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1440 wdata->gles_attributes[attr_pos++]=_this->gl_config.red_size;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1441 wdata->gles_attributes[attr_pos++]=EGL_GREEN_SIZE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1442 wdata->gles_attributes[attr_pos++]=_this->gl_config.green_size;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1443 wdata->gles_attributes[attr_pos++]=EGL_BLUE_SIZE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1444 wdata->gles_attributes[attr_pos++]=_this->gl_config.blue_size;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1445 wdata->gles_attributes[attr_pos++]=EGL_ALPHA_SIZE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1446
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1447 /* Setup alpha size in bits */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1448 if (_this->gl_config.alpha_size)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1449 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1450 wdata->gles_attributes[attr_pos++]=_this->gl_config.alpha_size;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1451 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1452 else
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1453 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1454 wdata->gles_attributes[attr_pos++]=EGL_DONT_CARE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1455 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1456
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1457 /* Setup color buffer size */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1458 if (_this->gl_config.buffer_size)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1459 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1460 wdata->gles_attributes[attr_pos++]=EGL_BUFFER_SIZE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1461 wdata->gles_attributes[attr_pos++]=_this->gl_config.buffer_size;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1462 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1463 else
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1464 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1465 wdata->gles_attributes[attr_pos++]=EGL_BUFFER_SIZE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1466 wdata->gles_attributes[attr_pos++]=EGL_DONT_CARE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1467 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1468
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1469 /* Setup depth buffer bits */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1470 wdata->gles_attributes[attr_pos++]=EGL_DEPTH_SIZE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1471 wdata->gles_attributes[attr_pos++]=_this->gl_config.depth_size;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1472
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1473 /* Setup stencil bits */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1474 if (_this->gl_config.stencil_size)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1475 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1476 wdata->gles_attributes[attr_pos++]=EGL_STENCIL_SIZE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1477 wdata->gles_attributes[attr_pos++]=_this->gl_config.buffer_size;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1478 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1479 else
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1480 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1481 wdata->gles_attributes[attr_pos++]=EGL_STENCIL_SIZE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1482 wdata->gles_attributes[attr_pos++]=EGL_DONT_CARE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1483 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1484
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1485 /* Set number of samples in multisampling */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1486 if (_this->gl_config.multisamplesamples)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1487 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1488 wdata->gles_attributes[attr_pos++]=EGL_SAMPLES;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1489 wdata->gles_attributes[attr_pos++]=_this->gl_config.multisamplesamples;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1490 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1491
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1492 /* Multisample buffers, OpenGL ES 1.0 spec defines 0 or 1 buffer */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1493 if (_this->gl_config.multisamplebuffers)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1494 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1495 wdata->gles_attributes[attr_pos++]=EGL_SAMPLE_BUFFERS;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1496 wdata->gles_attributes[attr_pos++]=_this->gl_config.multisamplebuffers;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1497 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1498
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1499 /* Finish attributes list */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1500 wdata->gles_attributes[attr_pos]=EGL_NONE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1501
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1502 /* Request first suitable framebuffer configuration */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1503 status=eglChooseConfig(phdata->egldisplay, wdata->gles_attributes,
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1504 wdata->gles_configs, SDL_VIDEO_GF_OPENGLES_CONFS, &configs);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1505 if (status!=EGL_TRUE)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1506 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1507 SDL_SetError("Photon: Can't find closest configuration for OpenGL ES");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1508 return NULL;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1509 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1510
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1511 /* Check if nothing has been found, try "don't care" settings */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1512 if (configs==0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1513 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1514 int32_t it;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1515 int32_t jt;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1516 GLint depthbits[4]={32, 24, 16, EGL_DONT_CARE};
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1517
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1518 for (it=0; it<4; it++)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1519 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1520 for (jt=16; jt>=0; jt--)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1521 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1522 /* Don't care about color buffer bits, use what exist */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1523 /* Replace previous set data with EGL_DONT_CARE */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1524 attr_pos=0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1525 wdata->gles_attributes[attr_pos++]=EGL_NATIVE_VISUAL_ID;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1526 wdata->gles_attributes[attr_pos++]=qnxgf_sdl_to_gf_pixelformat(didata->current_mode.format);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1527 wdata->gles_attributes[attr_pos++]=EGL_RED_SIZE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1528 wdata->gles_attributes[attr_pos++]=EGL_DONT_CARE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1529 wdata->gles_attributes[attr_pos++]=EGL_GREEN_SIZE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1530 wdata->gles_attributes[attr_pos++]=EGL_DONT_CARE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1531 wdata->gles_attributes[attr_pos++]=EGL_BLUE_SIZE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1532 wdata->gles_attributes[attr_pos++]=EGL_DONT_CARE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1533 wdata->gles_attributes[attr_pos++]=EGL_ALPHA_SIZE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1534 wdata->gles_attributes[attr_pos++]=EGL_DONT_CARE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1535 wdata->gles_attributes[attr_pos++]=EGL_BUFFER_SIZE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1536 wdata->gles_attributes[attr_pos++]=EGL_DONT_CARE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1537
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1538 /* Try to find requested or smallest depth */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1539 if (_this->gl_config.depth_size)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1540 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1541 wdata->gles_attributes[attr_pos++]=EGL_DEPTH_SIZE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1542 wdata->gles_attributes[attr_pos++]=depthbits[it];
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1543 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1544 else
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1545 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1546 wdata->gles_attributes[attr_pos++]=EGL_DEPTH_SIZE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1547 wdata->gles_attributes[attr_pos++]=EGL_DONT_CARE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1548 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1549
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1550 if (_this->gl_config.stencil_size)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1551 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1552 wdata->gles_attributes[attr_pos++]=EGL_STENCIL_SIZE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1553 wdata->gles_attributes[attr_pos++]=jt;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1554 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1555 else
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1556 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1557 wdata->gles_attributes[attr_pos++]=EGL_STENCIL_SIZE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1558 wdata->gles_attributes[attr_pos++]=EGL_DONT_CARE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1559 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1560
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1561 wdata->gles_attributes[attr_pos++]=EGL_SAMPLES;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1562 wdata->gles_attributes[attr_pos++]=EGL_DONT_CARE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1563 wdata->gles_attributes[attr_pos++]=EGL_SAMPLE_BUFFERS;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1564 wdata->gles_attributes[attr_pos++]=EGL_DONT_CARE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1565 wdata->gles_attributes[attr_pos]=EGL_NONE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1566
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1567 /* Request first suitable framebuffer configuration */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1568 status=eglChooseConfig(phdata->egldisplay, wdata->gles_attributes,
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1569 wdata->gles_configs, SDL_VIDEO_GF_OPENGLES_CONFS, &configs);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1570 if (status!=EGL_TRUE)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1571 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1572 SDL_SetError("Photon: Can't find closest configuration for OpenGL ES");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1573 return NULL;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1574 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1575 if (configs!=0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1576 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1577 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1578 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1579 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1580 if (configs!=0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1581 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1582 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1583 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1584 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1585
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1586 /* No available configs */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1587 if (configs==0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1588 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1589 SDL_SetError("Photon: Can't find any configuration for OpenGL ES");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1590 return NULL;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1591 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1592 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1593
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1594 /* Initialize config index */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1595 wdata->gles_config=0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1596
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1597 /* Now check each configuration to find out the best */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1598 for (cit=0; cit<configs; cit++)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1599 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1600 uint32_t stencil_found;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1601 uint32_t depth_found;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1602
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1603 stencil_found=0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1604 depth_found=0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1605
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1606 if (_this->gl_config.stencil_size)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1607 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1608 status=eglGetConfigAttrib(phdata->egldisplay, wdata->gles_configs[cit], EGL_STENCIL_SIZE, &attr_value);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1609 if (status==EGL_TRUE)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1610 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1611 if (attr_value!=0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1612 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1613 stencil_found=1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1614 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1615 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1616 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1617 else
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1618 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1619 stencil_found=1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1620 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1621
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1622 if (_this->gl_config.depth_size)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1623 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1624 status=eglGetConfigAttrib(phdata->egldisplay, wdata->gles_configs[cit], EGL_DEPTH_SIZE, &attr_value);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1625 if (status==EGL_TRUE)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1626 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1627 if (attr_value!=0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1628 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1629 depth_found=1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1630 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1631 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1632 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1633 else
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1634 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1635 depth_found=1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1636 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1637
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1638 /* Exit from loop if found appropriate configuration */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1639 if ((depth_found!=0) && (stencil_found!=0))
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1640 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1641 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1642 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1643 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1644
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1645 /* If best could not be found, use first */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1646 if (cit==configs)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1647 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1648 cit=0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1649 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1650 wdata->gles_config=cit;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1651
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1652 /* Create OpenGL ES context */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1653 wdata->gles_context=eglCreateContext(phdata->egldisplay, wdata->gles_configs[wdata->gles_config], EGL_NO_CONTEXT, NULL);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1654 if (wdata->gles_context==EGL_NO_CONTEXT)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1655 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1656 SDL_SetError("Photon: OpenGL ES context creation has been failed");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1657 return NULL;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1658 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1659
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1660 /* Check if surface is exist */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1661 if (wdata->gfsurface!=NULL)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1662 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1663 gf_surface_free(wdata->gfsurface);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1664 wdata->gfsurface=NULL;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1665 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1666
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1667 /* Create GF surface */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1668 gfstatus=gf_surface_create(&wdata->gfsurface, phdata->gfdev, window->w, window->h,
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1669 qnxgf_sdl_to_gf_pixelformat(didata->current_mode.format), NULL,
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1670 GF_SURFACE_CREATE_2D_ACCESSIBLE | GF_SURFACE_CREATE_3D_ACCESSIBLE |
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1671 GF_SURFACE_CREATE_SHAREABLE);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1672 if (gfstatus!=GF_ERR_OK)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1673 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1674 eglDestroyContext(phdata->egldisplay, wdata->gles_context);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1675 wdata->gles_context=EGL_NO_CONTEXT;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1676 SDL_SetError("Photon: Can't create GF 3D surface (%08X)", gfstatus);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1677 return NULL;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1678 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1679
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1680 /* Create pixmap 3D target surface */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1681 wdata->gles_surface=eglCreatePixmapSurface(phdata->egldisplay, wdata->gles_configs[wdata->gles_config], wdata->gfsurface, NULL);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1682 if (wdata->gles_surface==EGL_NO_SURFACE)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1683 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1684 gf_surface_free(wdata->gfsurface);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1685 eglDestroyContext(phdata->egldisplay, wdata->gles_context);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1686 wdata->gles_context=EGL_NO_CONTEXT;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1687 SDL_SetError("Photon: Can't create EGL pixmap surface");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1688 return NULL;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1689 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1690
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1691 /* Make just created context current */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1692 status=eglMakeCurrent(phdata->egldisplay, wdata->gles_surface, wdata->gles_surface, wdata->gles_context);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1693 if (status!=EGL_TRUE)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1694 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1695 /* Destroy OpenGL ES surface */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1696 eglDestroySurface(phdata->egldisplay, wdata->gles_surface);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1697 gf_surface_free(wdata->gfsurface);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1698 eglDestroyContext(phdata->egldisplay, wdata->gles_context);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1699 wdata->gles_context=EGL_NO_CONTEXT;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1700 SDL_SetError("Photon: Can't set OpenGL ES context on creation");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1701 return NULL;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1702 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1703
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1704 /* Setup into SDL internals state of OpenGL ES: */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1705 /* it is accelerated or not */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1706 if ((didata->caps & SDL_PHOTON_ACCELERATED_3D)==SDL_PHOTON_ACCELERATED_3D)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1707 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1708 _this->gl_config.accelerated=1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1709 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1710 else
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1711 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1712 _this->gl_config.accelerated=0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1713 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1714
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1715 /* Always clear stereo enable, since OpenGL ES do not supports stereo */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1716 _this->gl_config.stereo=0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1717
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1718 /* Get back samples and samplebuffers configurations. Rest framebuffer */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1719 /* parameters could be obtained through the OpenGL ES API */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1720 status=eglGetConfigAttrib(phdata->egldisplay, wdata->gles_configs[wdata->gles_config], EGL_SAMPLES, &attr_value);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1721 if (status==EGL_TRUE)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1722 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1723 _this->gl_config.multisamplesamples=attr_value;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1724 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1725 status=eglGetConfigAttrib(phdata->egldisplay, wdata->gles_configs[wdata->gles_config], EGL_SAMPLE_BUFFERS, &attr_value);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1726 if (status==EGL_TRUE)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1727 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1728 _this->gl_config.multisamplebuffers=attr_value;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1729 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1730
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1731 /* Get back stencil and depth buffer sizes */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1732 status=eglGetConfigAttrib(phdata->egldisplay, wdata->gles_configs[wdata->gles_config], EGL_DEPTH_SIZE, &attr_value);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1733 if (status==EGL_TRUE)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1734 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1735 _this->gl_config.depth_size=attr_value;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1736 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1737 status=eglGetConfigAttrib(phdata->egldisplay, wdata->gles_configs[wdata->gles_config], EGL_STENCIL_SIZE, &attr_value);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1738 if (status==EGL_TRUE)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1739 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1740 _this->gl_config.stencil_size=attr_value;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1741 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1742
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1743 /* Under Photon OpenGL ES output can't be double buffered */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1744 _this->gl_config.double_buffer=0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1745
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1746 /* Check if current device is not the same as target */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1747 if (phdata->current_device_id!=didata->device_id)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1748 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1749 /* Set target device as default for Pd and Pg functions */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1750 status=PdSetTargetDevice(NULL, phdata->rid[didata->device_id]);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1751 if (status!=0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1752 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1753 /* Destroy OpenGL ES surface */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1754 eglDestroySurface(phdata->egldisplay, wdata->gles_surface);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1755 gf_surface_free(wdata->gfsurface);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1756 eglDestroyContext(phdata->egldisplay, wdata->gles_context);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1757 wdata->gles_context=EGL_NO_CONTEXT;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1758 SDL_SetError("Photon: Can't set default target device\n");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1759 return NULL;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1760 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1761 phdata->current_device_id=didata->device_id;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1762 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1763
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1764 wdata->phsurface=PdCreateOffscreenContextGF(wdata->gfsurface);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1765 if (wdata->phsurface==NULL)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1766 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1767 /* Destroy OpenGL ES surface */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1768 eglDestroySurface(phdata->egldisplay, wdata->gles_surface);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1769 gf_surface_free(wdata->gfsurface);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1770 eglDestroyContext(phdata->egldisplay, wdata->gles_context);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1771 wdata->gles_context=EGL_NO_CONTEXT;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1772 SDL_SetError("Photon: Can't bind GF surface to Photon\n");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1773 return NULL;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1774 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1775
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1776 /* GL ES context was successfully created */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1777 return wdata->gles_context;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1778 #else
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1779 SDL_SetError("Photon: OpenGL ES support is not compiled in");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1780 return NULL;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1781 #endif /* SDL_VIDEO_OPENGL_ES */
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1782 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1783
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1784 int photon_gl_makecurrent(_THIS, SDL_Window* window, SDL_GLContext context)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1785 {
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1786 #if defined(SDL_VIDEO_OPENGL_ES)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1787 SDL_VideoData* phdata=(SDL_VideoData*)_this->driverdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1788 SDL_WindowData* wdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1789 EGLBoolean status;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1790
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1791 if (phdata->gfinitialized!=SDL_TRUE)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1792 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1793 SDL_SetError("Photon: GF initialization failed, no OpenGL ES support");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1794 return -1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1795 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1796
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1797 if ((window==NULL) && (context==NULL))
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1798 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1799 status=eglMakeCurrent(phdata->egldisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1800 if (status!=EGL_TRUE)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1801 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1802 /* Failed to set current GL ES context */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1803 SDL_SetError("Photon: Can't set OpenGL ES context");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1804 return -1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1805 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1806 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1807 else
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1808 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1809 wdata=(SDL_WindowData*)window->driverdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1810 if (wdata->gles_surface==EGL_NO_SURFACE)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1811 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1812 SDL_SetError("Photon: OpenGL ES surface is not initialized for this window");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1813 return -1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1814 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1815 if (wdata->gles_context==EGL_NO_CONTEXT)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1816 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1817 SDL_SetError("Photon: OpenGL ES context is not initialized for this window");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1818 return -1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1819 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1820 if (wdata->gles_context!=context)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1821 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1822 SDL_SetError("Photon: OpenGL ES context is not belong to this window");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1823 return -1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1824 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1825 status=eglMakeCurrent(phdata->egldisplay, wdata->gles_surface, wdata->gles_surface, wdata->gles_context);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1826 if (status!=EGL_TRUE)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1827 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1828 /* Failed to set current GL ES context */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1829 SDL_SetError("Photon: Can't set OpenGL ES context");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1830 return -1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1831 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1832 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1833
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1834 return 0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1835 #else
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1836 SDL_SetError("Photon: OpenGL ES support is not compiled in");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1837 return -1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1838 #endif /* SDL_VIDEO_OPENGL_ES */
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1839 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1840
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1841 int photon_gl_setswapinterval(_THIS, int interval)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1842 {
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1843 #if defined(SDL_VIDEO_OPENGL_ES)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1844 SDL_VideoData* phdata=(SDL_VideoData*)_this->driverdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1845 EGLBoolean status;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1846
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1847 if (phdata->gfinitialized!=SDL_TRUE)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1848 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1849 SDL_SetError("Photon: GF initialization failed, no OpenGL ES support");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1850 return -1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1851 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1852
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1853 /* Check if OpenGL ES connection has been initialized */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1854 if (phdata->egldisplay!=EGL_NO_DISPLAY)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1855 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1856 /* Set swap OpenGL ES interval */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1857 status=eglSwapInterval(phdata->egldisplay, interval);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1858 if (status==EGL_TRUE)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1859 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1860 /* Return success to upper level */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1861 phdata->swapinterval=interval;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1862 return 0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1863 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1864 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1865
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1866 /* Failed to set swap interval */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1867 SDL_SetError("Photon: Cannot set swap interval");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1868 return -1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1869 #else
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1870 SDL_SetError("Photon: OpenGL ES support is not compiled in");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1871 return -1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1872 #endif /* SDL_VIDEO_OPENGL_ES */
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1873 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1874
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1875 int photon_gl_getswapinterval(_THIS)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1876 {
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1877 #if defined(SDL_VIDEO_OPENGL_ES)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1878 SDL_VideoData* phdata=(SDL_VideoData*)_this->driverdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1879
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1880 if (phdata->gfinitialized!=SDL_TRUE)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1881 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1882 SDL_SetError("Photon: GF initialization failed, no OpenGL ES support");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1883 return -1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1884 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1885
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1886 /* Return default swap interval value */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1887 return phdata->swapinterval;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1888 #else
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1889 SDL_SetError("Photon: OpenGL ES support is not compiled in");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1890 return -1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1891 #endif /* SDL_VIDEO_OPENGL_ES */
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1892 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1893
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1894 void photon_gl_swapwindow(_THIS, SDL_Window* window)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1895 {
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1896 #if defined(SDL_VIDEO_OPENGL_ES)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1897 SDL_VideoData* phdata=(SDL_VideoData*)_this->driverdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1898 SDL_WindowData* wdata=(SDL_WindowData*)window->driverdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1899 SDL_DisplayData* didata=(SDL_DisplayData*)SDL_CurrentDisplay.driverdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1900 PhRect_t* dst_rect;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1901 PhRect_t src_rect;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1902
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1903 if (phdata->gfinitialized!=SDL_TRUE)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1904 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1905 SDL_SetError("Photon: GF initialization failed, no OpenGL ES support");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1906 return;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1907 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1908
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1909 /* Many applications do not uses glFinish(), so we call it for them */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1910 glFinish();
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1911
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1912 /* Wait until OpenGL ES rendering is completed */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1913 eglWaitGL();
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1914
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1915 /* Wait for VSYNC manually, if it was enabled */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1916 if (phdata->swapinterval!=0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1917 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1918 /* Wait for VSYNC, we use GF function, since Photon requires */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1919 /* to enter to the Direct mode to call PgWaitVSync() */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1920 gf_display_wait_vsync(didata->display);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1921 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1922
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1923 /* Set blit area */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1924 dst_rect=PtGetCanvas(wdata->window);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1925 src_rect.ul.x=0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1926 src_rect.ul.y=0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1927 src_rect.lr.x=window->w-1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1928 src_rect.lr.y=window->h-1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1929
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1930 /* Blit OpenGL ES pixmap surface directly to window region */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1931 PgFFlush(Ph_START_DRAW);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1932 PgSetRegionCx(PhDCGetCurrent(), PtWidgetRid(wdata->window));
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1933 PgClearTranslationCx(PgGetGCCx(PhDCGetCurrent()));
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1934 PgContextBlit(wdata->phsurface, &src_rect, NULL, dst_rect);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1935 PgFFlush(Ph_DONE_DRAW);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1936 PgWaitHWIdle();
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1937
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1938 eglSwapBuffers(phdata->egldisplay, wdata->gles_surface);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1939 #else
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1940 SDL_SetError("Photon: OpenGL ES support is not compiled in");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1941 return;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1942 #endif /* SDL_VIDEO_OPENGL_ES */
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1943 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1944
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1945 void photon_gl_deletecontext(_THIS, SDL_GLContext context)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1946 {
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1947 #if defined(SDL_VIDEO_OPENGL_ES)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1948 SDL_VideoData* phdata=(SDL_VideoData*)_this->driverdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1949 EGLBoolean status;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1950
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1951 if (phdata->gfinitialized!=SDL_TRUE)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1952 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1953 SDL_SetError("Photon: GF initialization failed, no OpenGL ES support");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1954 return;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1955 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1956
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1957 /* Check if OpenGL ES connection has been initialized */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1958 if (phdata->egldisplay!=EGL_NO_DISPLAY)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1959 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1960 if (context!=EGL_NO_CONTEXT)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1961 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1962 status=eglDestroyContext(phdata->egldisplay, context);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1963 if (status!=EGL_TRUE)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1964 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1965 /* Error during OpenGL ES context destroying */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1966 SDL_SetError("Photon: OpenGL ES context destroy error");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1967 return;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1968 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1969 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1970 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1971
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1972 return;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1973 #else
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1974 SDL_SetError("Photon: OpenGL ES support is not compiled in");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1975 return;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1976 #endif /* SDL_VIDEO_OPENGL_ES */
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1977 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1978
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1979 /*****************************************************************************/
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1980 /* SDL Event handling function */
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1981 /*****************************************************************************/
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1982 void photon_pumpevents(_THIS)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
1983 {
3108
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1984 uint8_t eventbuffer[SDL_VIDEO_PHOTON_EVENT_SIZE];
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1985 PhEvent_t* event=(PhEvent_t*)eventbuffer;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1986 int32_t status;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1987 uint32_t finish=0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1988 uint32_t it;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1989 SDL_Window* window;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1990 SDL_WindowData* wdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1991
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1992 do {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1993 status=PhEventPeek(event, SDL_VIDEO_PHOTON_EVENT_SIZE);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1994 switch (status)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1995 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1996 case Ph_RESIZE_MSG:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1997 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1998 SDL_SetError("Photon: Event size too much for buffer");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
1999 return;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2000 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2001 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2002 case Ph_EVENT_MSG:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2003 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2004 /* Find a window, to which this handle destinated */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2005 status=0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2006 for (it=0; it<SDL_CurrentDisplay.num_windows; it++)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2007 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2008 wdata=(SDL_WindowData*)SDL_CurrentDisplay.windows[it].driverdata;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2009
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2010 /* Find the proper window */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2011 if (wdata->window!=NULL)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2012 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2013 if (PtWidgetRid(wdata->window)==event->collector.rid)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2014 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2015 window=(SDL_Window*)&SDL_CurrentDisplay.windows[it];
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2016 status=1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2017 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2018 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2019 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2020 else
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2021 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2022 continue;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2023 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2024 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2025 if (status==0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2026 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2027 window=NULL;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2028 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2029
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2030 /* Event is ready */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2031 switch(event->type)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2032 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2033 case Ph_EV_BOUNDARY:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2034 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2035 switch(event->subtype)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2036 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2037 case Ph_EV_PTR_ENTER:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2038 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2039 /* Mouse cursor over handled window */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2040 if (window!=NULL)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2041 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2042 SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_ENTER, 0, 0);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2043 SDL_SetMouseFocus(0, window->id);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2044 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2045 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2046 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2047 case Ph_EV_PTR_LEAVE:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2048 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2049 /* Mouse cursor out of handled window */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2050 if (window!=NULL)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2051 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2052 SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_LEAVE, 0, 0);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2053 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2054 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2055 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2056 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2057 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2058 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2059 case Ph_EV_PTR_MOTION_BUTTON:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2060 case Ph_EV_PTR_MOTION_NOBUTTON:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2061 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2062 PhPointerEvent_t* pevent=NULL;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2063 PhRect_t* prects=NULL;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2064
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2065 /* Get event data */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2066 pevent=PhGetData(event);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2067 /* Get associated event rectangles */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2068 prects=PhGetRects(event);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2069 if ((pevent!=NULL) && (prects!=NULL))
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2070 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2071 SDL_SendMouseMotion(0, 0, prects->ul.x, prects->ul.y, 0);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2072 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2073 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2074 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2075 case Ph_EV_BUT_PRESS:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2076 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2077 /* Button press event */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2078 PhPointerEvent_t* pevent=NULL;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2079 uint32_t sdlbutton=0x00000000;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2080
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2081 /* Get event data */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2082 pevent=PhGetData(event);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2083 if (pevent!=NULL)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2084 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2085 for (it=0; it<sizeof(pevent->buttons)*8; it++)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2086 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2087 if ((pevent->buttons&(0x0001<<it))==(0x0001<<it))
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2088 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2089 switch (it)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2090 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2091 case 0:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2092 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2093 sdlbutton=SDL_BUTTON_RIGHT;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2094 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2095 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2096 case 1:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2097 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2098 sdlbutton=SDL_BUTTON_MIDDLE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2099 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2100 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2101 case 2:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2102 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2103 sdlbutton=SDL_BUTTON_LEFT;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2104 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2105 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2106 default:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2107 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2108 sdlbutton=it+1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2109 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2110 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2111 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2112 SDL_SendMouseButton(0, SDL_PRESSED, sdlbutton);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2113 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2114 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2115 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2116 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2117 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2118 case Ph_EV_BUT_RELEASE:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2119 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2120 /* Button press event */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2121 PhPointerEvent_t* pevent=NULL;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2122 uint32_t sdlbutton=0x00000000;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2123
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2124 /* Get event data */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2125 pevent=PhGetData(event);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2126 if (pevent!=NULL)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2127 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2128 for (it=0; it<sizeof(pevent->buttons)*8; it++)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2129 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2130 if ((pevent->buttons&(0x0001<<it))==(0x0001<<it))
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2131 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2132 switch (it)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2133 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2134 case 0:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2135 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2136 sdlbutton=SDL_BUTTON_RIGHT;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2137 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2138 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2139 case 1:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2140 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2141 sdlbutton=SDL_BUTTON_MIDDLE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2142 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2143 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2144 case 2:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2145 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2146 sdlbutton=SDL_BUTTON_LEFT;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2147 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2148 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2149 default:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2150 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2151 sdlbutton=it+1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2152 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2153 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2154 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2155 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2156 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2157 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2158
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2159 switch(event->subtype)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2160 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2161 case Ph_EV_RELEASE_REAL:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2162 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2163 /* Real release button event */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2164 SDL_SendMouseButton(0, SDL_RELEASED, sdlbutton);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2165 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2166 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2167 case Ph_EV_RELEASE_PHANTOM:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2168 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2169 /* We will get phantom button release */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2170 /* event in case if it was unpressed */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2171 /* outside of window */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2172 if (window!=NULL)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2173 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2174 if ((window->flags & SDL_WINDOW_MOUSE_FOCUS)!=SDL_WINDOW_MOUSE_FOCUS)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2175 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2176 /* Send phantom button release */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2177 SDL_SendMouseButton(0, SDL_RELEASED, sdlbutton);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2178 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2179 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2180 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2181 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2182 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2183 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2184 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2185 case Ph_EV_EXPOSE:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2186 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2187 switch(event->subtype)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2188 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2189 case Ph_NORMAL_EXPOSE:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2190 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2191 PhRect_t* rects=NULL;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2192
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2193 /* Get array of rectangles to be updated */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2194 rects=PhGetRects(event);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2195 if (rects==NULL)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2196 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2197 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2198 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2199
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2200 /* Cycle through each rectangle */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2201 for (it=0; it<event->num_rects; it++)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2202 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2203 /* TODO: update the damaged rectangles */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2204 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2205
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2206 /* Flush all blittings */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2207 PgFlush();
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2208 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2209 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2210 case Ph_CAPTURE_EXPOSE:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2211 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2212 /* We need to redraw entire screen */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2213 PgFFlush(Ph_START_DRAW);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2214
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2215 /* TODO: redraw the whole screen */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2216
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2217 PgFFlush(Ph_DONE_DRAW);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2218 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2219 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2220 case Ph_GRAPHIC_EXPOSE:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2221 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2222 /* TODO: What this event means ? */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2223 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2224 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2225 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2226 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2227 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2228 case Ph_EV_INFO:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2229 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2230 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2231 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2232 case Ph_EV_KEY:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2233 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2234 PhKeyEvent_t* keyevent=NULL;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2235 SDL_scancode scancode=SDL_SCANCODE_UNKNOWN;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2236 SDL_bool pressed=SDL_FALSE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2237
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2238 keyevent=PhGetData(event);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2239 if (keyevent==NULL)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2240 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2241 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2242 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2243
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2244 /* Check if key is repeated */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2245 if ((keyevent->key_flags & Pk_KF_Key_Repeat)==Pk_KF_Key_Repeat)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2246 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2247 /* Ignore such events */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2248 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2249 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2250
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2251 /* Check if key has its own scancode */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2252 if ((keyevent->key_flags & Pk_KF_Scan_Valid)==Pk_KF_Scan_Valid)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2253 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2254 if ((keyevent->key_flags & Pk_KF_Key_Down)==Pk_KF_Key_Down)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2255 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2256 pressed=SDL_TRUE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2257 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2258 else
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2259 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2260 pressed=SDL_FALSE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2261 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2262 scancode=photon_to_sdl_keymap(keyevent->key_scan);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2263
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2264 /* Add details for the pressed key */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2265 if ((keyevent->key_flags & Pk_KF_Cap_Valid)==Pk_KF_Cap_Valid)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2266 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2267 switch(keyevent->key_cap)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2268 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2269 case Pk_Hyper_R: /* Right windows flag key */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2270 scancode=SDL_SCANCODE_RGUI;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2271 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2272 case Pk_Control_R: /* Right Ctrl key */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2273 scancode=SDL_SCANCODE_RCTRL;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2274 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2275 case Pk_Alt_R: /* Right Alt key */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2276 scancode=SDL_SCANCODE_RALT;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2277 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2278 case Pk_Up: /* Up key but with invalid scan */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2279 if (scancode!=SDL_SCANCODE_UP)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2280 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2281 /* This is a mouse wheel event */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2282 SDL_SendMouseWheel(0, 0, 1);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2283 return;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2284 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2285 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2286 case Pk_KP_8: /* Up arrow or 8 on keypad */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2287 scancode=SDL_SCANCODE_KP_8;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2288 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2289 case Pk_Down: /* Down key but with invalid scan */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2290 if (scancode!=SDL_SCANCODE_DOWN)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2291 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2292 /* This is a mouse wheel event */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2293 SDL_SendMouseWheel(0, 0, -1);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2294 return;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2295 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2296 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2297 case Pk_KP_2: /* Down arrow or 2 on keypad */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2298 scancode=SDL_SCANCODE_KP_2;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2299 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2300 case Pk_Left: /* Left arrow key */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2301 scancode=SDL_SCANCODE_LEFT;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2302 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2303 case Pk_KP_4: /* Left arrow or 4 on keypad */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2304 scancode=SDL_SCANCODE_KP_4;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2305 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2306 case Pk_Right: /* Right arrow key */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2307 scancode=SDL_SCANCODE_RIGHT;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2308 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2309 case Pk_KP_6: /* Right arrow or 6 on keypad */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2310 scancode=SDL_SCANCODE_KP_6;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2311 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2312 case Pk_Insert: /* Insert key */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2313 scancode=SDL_SCANCODE_INSERT;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2314 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2315 case Pk_KP_0: /* Insert or 0 on keypad */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2316 scancode=SDL_SCANCODE_KP_0;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2317 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2318 case Pk_Home: /* Home key */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2319 scancode=SDL_SCANCODE_HOME;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2320 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2321 case Pk_KP_7: /* Home or 7 on keypad */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2322 scancode=SDL_SCANCODE_KP_7;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2323 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2324 case Pk_Pg_Up: /* PageUp key */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2325 scancode=SDL_SCANCODE_PAGEUP;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2326 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2327 case Pk_KP_9: /* PgUp or 9 on keypad */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2328 scancode=SDL_SCANCODE_KP_9;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2329 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2330 case Pk_Delete: /* Delete key */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2331 scancode=SDL_SCANCODE_DELETE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2332 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2333 case Pk_KP_Decimal: /* Del or . on keypad */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2334 scancode=SDL_SCANCODE_KP_PERIOD;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2335 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2336 case Pk_End: /* End key */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2337 scancode=SDL_SCANCODE_END;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2338 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2339 case Pk_KP_1: /* End or 1 on keypad */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2340 scancode=SDL_SCANCODE_KP_1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2341 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2342 case Pk_Pg_Down: /* PageDown key */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2343 scancode=SDL_SCANCODE_PAGEDOWN;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2344 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2345 case Pk_KP_3: /* PgDn or 3 on keypad */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2346 scancode=SDL_SCANCODE_KP_3;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2347 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2348 case Pk_KP_5: /* 5 on keypad */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2349 scancode=SDL_SCANCODE_KP_5;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2350 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2351 case Pk_KP_Enter:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2352 scancode=SDL_SCANCODE_KP_ENTER;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2353 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2354 case Pk_KP_Add:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2355 scancode=SDL_SCANCODE_KP_PLUS;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2356 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2357 case Pk_KP_Subtract:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2358 scancode=SDL_SCANCODE_KP_MINUS;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2359 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2360 case Pk_KP_Multiply:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2361 scancode=SDL_SCANCODE_KP_MULTIPLY;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2362 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2363 case Pk_KP_Divide:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2364 scancode=SDL_SCANCODE_KP_DIVIDE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2365 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2366 case Pk_Pause:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2367 scancode=SDL_SCANCODE_PAUSE;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2368 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2369 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2370 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2371
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2372 /* Finally check if scancode has been decoded */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2373 if (scancode==SDL_SCANCODE_UNKNOWN)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2374 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2375 /* Something was pressed, which is not supported */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2376 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2377 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2378
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2379 /* Report pressed/released key to SDL */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2380 if (pressed==SDL_TRUE)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2381 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2382 SDL_SendKeyboardKey(0, SDL_PRESSED, scancode);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2383 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2384 else
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2385 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2386 SDL_SendKeyboardKey(0, SDL_RELEASED, scancode);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2387 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2388
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2389 /* Photon doesn't send a release event for PrnScr key */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2390 if ((scancode==SDL_SCANCODE_PRINTSCREEN) && (pressed))
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2391 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2392 SDL_SendKeyboardKey(0, SDL_RELEASED, scancode);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2393 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2394 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2395 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2396 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2397 case Ph_EV_SERVICE:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2398 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2399 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2400 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2401 case Ph_EV_SYSTEM:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2402 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2403 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2404 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2405 case Ph_EV_WM:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2406 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2407 PhWindowEvent_t* wmevent=NULL;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2408
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2409 /* Get associated event data */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2410 wmevent=PhGetData(event);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2411 if (wmevent==NULL)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2412 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2413 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2414 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2415
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2416 switch(wmevent->event_f)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2417 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2418 case Ph_WM_CLOSE:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2419 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2420 if (window!=NULL)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2421 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2422 SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_CLOSE, 0, 0);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2423 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2424 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2425 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2426 case Ph_WM_FOCUS:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2427 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2428 if (wmevent->event_state==Ph_WM_EVSTATE_FOCUS)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2429 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2430 if (window!=NULL)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2431 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2432 PhRegion_t wregion;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2433
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2434 SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2435 SDL_SetKeyboardFocus(0, window->id);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2436
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2437 /* Set window region sensible to mouse motion events */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2438 PhRegionQuery(PtWidgetRid(wdata->window), &wregion, NULL, NULL, 0);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2439 wregion.events_sense|=Ph_EV_PTR_MOTION_BUTTON | Ph_EV_PTR_MOTION_NOBUTTON;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2440 PhRegionChange(Ph_REGION_EV_SENSE, 0, &wregion, NULL, NULL);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2441 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2442 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2443 if (wmevent->event_state==Ph_WM_EVSTATE_FOCUSLOST)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2444 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2445 if (window!=NULL)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2446 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2447 PhRegion_t wregion;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2448
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2449 SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2450
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2451 /* Set window region ignore mouse motion events */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2452 PhRegionQuery(PtWidgetRid(wdata->window), &wregion, NULL, NULL, 0);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2453 wregion.events_sense&=~(Ph_EV_PTR_MOTION_BUTTON | Ph_EV_PTR_MOTION_NOBUTTON);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2454 PhRegionChange(Ph_REGION_EV_SENSE, 0, &wregion, NULL, NULL);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2455 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2456 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2457 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2458 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2459 case Ph_WM_MOVE:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2460 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2461 if (window!=NULL)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2462 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2463 SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_MOVED, wmevent->pos.x, wmevent->pos.y);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2464 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2465 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2466 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2467 case Ph_WM_RESIZE:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2468 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2469 if (window!=NULL)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2470 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2471 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2472 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2473 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2474 case Ph_WM_HIDE:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2475 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2476 if (window!=NULL)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2477 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2478 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2479 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2480 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2481 case Ph_WM_MAX:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2482 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2483 if (window!=NULL)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2484 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2485 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2486 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2487 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2488 case Ph_WM_RESTORE:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2489 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2490 if (window!=NULL)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2491 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2492 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2493 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2494 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2495 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2496 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2497 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2498 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2499 PtEventHandler(event);
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2500 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2501 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2502 case 0:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2503 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2504 /* All events are read */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2505 finish=1;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2506 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2507 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2508 case -1:
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2509 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2510 /* Error occured in event reading */
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2511 SDL_SetError("Photon: Can't read event");
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2512 return;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2513 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2514 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2515 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2516 if (finish!=0)
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2517 {
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2518 break;
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2519 }
aa1897bee1e9 Continue working on QNX Photon with OpenGL ES support
Mike Gorchak <lestat@i.com.ua>
parents: 3092
diff changeset
2520 } while(1);
3092
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
2521 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
2522
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
2523 /*****************************************************************************/
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
2524 /* SDL screen saver related functions */
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
2525 /*****************************************************************************/
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
2526 void photon_suspendscreensaver(_THIS)
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
2527 {
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
2528 /* There is no screensaver in pure console, it may exist when running */
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
2529 /* GF under Photon, but I do not know, how to disable screensaver */
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
2530 }
cad1aefa2ed9 Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 3087
diff changeset
2531
3087
0b6f51c29267 Date: Wed, 4 Mar 2009 15:38:22 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2532 /* vi: set ts=4 sw=4 expandtab: */