Mercurial > sdl-ios-xcode
annotate src/video/photon/SDL_ph_wm.c @ 571:8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
From: "Mike Gorchak"
Subject: All QNX patches
whole patches concerning QNX. Almost all code has been rewritten by Julian
and me. Added initial support for hw overlays in QNX and many many others
fixes.
P.S. This patches has been reviewed by Dave Rempel from QSSL and included in
SDL 1.2.5 distribution, which coming on 3rd party CD for newest 6.2.1
version of QNX, which will be available soon.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 20 Jan 2003 01:38:37 +0000 |
parents | 3333b6e68289 |
children | 8bedd6d61642 |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
297
f6ffac90895c
Updated copyright information for 2002
Sam Lantinga <slouken@libsdl.org>
parents:
291
diff
changeset
|
3 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga |
0 | 4 |
5 This library is free software; you can redistribute it and/or | |
6 modify it under the terms of the GNU Library General Public | |
7 License as published by the Free Software Foundation; either | |
8 version 2 of the License, or (at your option) any later version. | |
9 | |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 Library General Public License for more details. | |
14 | |
15 You should have received a copy of the GNU Library General Public | |
16 License along with this library; if not, write to the Free | |
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | |
19 Sam Lantinga | |
252
e8157fcb3114
Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents:
190
diff
changeset
|
20 slouken@libsdl.org |
0 | 21 */ |
22 | |
23 #ifdef SAVE_RCSID | |
24 static char rcsid = | |
25 "@(#) $Id$"; | |
26 #endif | |
27 | |
19
8cc4dbfab9ab
Date: Thu, 19 Apr 2001 08:36:54 +0300
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
28 #define DISABLE_X11 |
8cc4dbfab9ab
Date: Thu, 19 Apr 2001 08:36:54 +0300
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
29 |
0 | 30 #include <stdlib.h> |
31 #include <string.h> | |
32 #include <Ph.h> | |
19
8cc4dbfab9ab
Date: Thu, 19 Apr 2001 08:36:54 +0300
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
33 #include <photon/PpProto.h> |
8cc4dbfab9ab
Date: Thu, 19 Apr 2001 08:36:54 +0300
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
34 #include <photon/PhWm.h> |
8cc4dbfab9ab
Date: Thu, 19 Apr 2001 08:36:54 +0300
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
35 #include <photon/wmapi.h> |
0 | 36 #include "SDL_version.h" |
37 #include "SDL_error.h" | |
38 #include "SDL_timer.h" | |
39 #include "SDL_video.h" | |
40 #include "SDL_syswm.h" | |
41 #include "SDL_events_c.h" | |
42 #include "SDL_pixels_c.h" | |
43 #include "SDL_ph_modes_c.h" | |
44 #include "SDL_ph_wm_c.h" | |
45 | |
46 /* This is necessary for working properly with Enlightenment, etc. */ | |
47 #define USE_ICON_WINDOW | |
48 | |
49 void ph_SetIcon(_THIS, SDL_Surface *icon, Uint8 *mask) | |
50 { | |
315
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
51 return; |
0 | 52 } |
53 | |
19
8cc4dbfab9ab
Date: Thu, 19 Apr 2001 08:36:54 +0300
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
54 /* Set window caption */ |
0 | 55 void ph_SetCaption(_THIS, const char *title, const char *icon) |
56 { | |
315
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
57 SDL_Lock_EventThread(); |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
58 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
59 /* sanity check for set caption call before window init */ |
315
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
60 if (window!=NULL) |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
61 { |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
62 PtSetResource(window, Pt_ARG_WINDOW_TITLE, title, 0); |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
63 } |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
64 |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
65 SDL_Unlock_EventThread(); |
19
8cc4dbfab9ab
Date: Thu, 19 Apr 2001 08:36:54 +0300
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
66 } |
0 | 67 |
266
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
68 /* Iconify current window */ |
19
8cc4dbfab9ab
Date: Thu, 19 Apr 2001 08:36:54 +0300
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
69 int ph_IconifyWindow(_THIS) |
8cc4dbfab9ab
Date: Thu, 19 Apr 2001 08:36:54 +0300
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
70 { |
315
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
71 PhWindowEvent_t windowevent; |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
72 |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
73 SDL_Lock_EventThread(); |
0 | 74 |
315
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
75 memset( &windowevent, 0, sizeof (event) ); |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
76 windowevent.event_f = Ph_WM_HIDE; |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
77 windowevent.event_state = Ph_WM_EVSTATE_HIDE; |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
78 windowevent.rid = PtWidgetRid( window ); |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
79 PtForwardWindowEvent( &windowevent ); |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
80 SDL_Unlock_EventThread(); |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
81 |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
82 return 0; |
0 | 83 } |
84 | |
85 SDL_GrabMode ph_GrabInputNoLock(_THIS, SDL_GrabMode mode) | |
86 { | |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
87 short abs_x, abs_y; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
88 |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
89 if( mode == SDL_GRAB_OFF ) |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
90 { |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
91 PtSetResource(window, Pt_ARG_WINDOW_STATE, Pt_FALSE, Ph_WM_STATE_ISALTKEY); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
92 } |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
93 else |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
94 { |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
95 PtSetResource(window, Pt_ARG_WINDOW_STATE, Pt_TRUE, Ph_WM_STATE_ISALTKEY); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
96 |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
97 PtGetAbsPosition(window, &abs_x, &abs_y); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
98 PhMoveCursorAbs(PhInputGroup(NULL), abs_x + SDL_VideoSurface->w/2, abs_y + SDL_VideoSurface->h/2); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
99 } |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
100 |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
101 SDL_Unlock_EventThread(); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
102 |
315
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
103 return(mode); |
0 | 104 } |
105 | |
106 SDL_GrabMode ph_GrabInput(_THIS, SDL_GrabMode mode) | |
107 { | |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
108 SDL_Lock_EventThread(); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
109 mode = ph_GrabInputNoLock(this, mode); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
110 SDL_Unlock_EventThread(); |
283
3d8b6b9f1e18
Date: Mon, 18 Feb 2002 16:46:59 +1200
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
111 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
112 return(mode); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
113 } |
283
3d8b6b9f1e18
Date: Mon, 18 Feb 2002 16:46:59 +1200
Sam Lantinga <slouken@libsdl.org>
parents:
266
diff
changeset
|
114 |
0 | 115 |
116 int ph_GetWMInfo(_THIS, SDL_SysWMinfo *info) | |
117 { | |
315
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
118 if (info->version.major <= SDL_MAJOR_VERSION) |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
119 { |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
120 return 1; |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
121 } |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
122 else |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
123 { |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
124 SDL_SetError("Application not compiled with SDL %d.%d\n", |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
125 SDL_MAJOR_VERSION, SDL_MINOR_VERSION); |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
126 return -1; |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
127 } |
0 | 128 } |