Mercurial > sdl-ios-xcode
annotate src/video/quartz/SDL_QuartzWM.m @ 683:5d2f027b3349
Date: Sat, 9 Aug 2003 20:14:06 -0400
From: Darrell Walisser
Subject: Re: Updated projects?
>> Did you get a chance to look at my "Custom Cocoa" demo? I have a few
>> minor patches that enable SDL/Cocoa integration, and a project
>> template.
>
> I didn't yet, but go ahead and send me the patches. :)
>
I updated the patch for current CVS. There are a lot of changes, but I
don't think I've broken anything. This patch also improves the behavior
of window minimize/deminimize.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 10 Aug 2003 07:21:43 +0000 |
parents | 7ec821f3cbd0 |
children | c5b2b6d2d1fe |
rev | line source |
---|---|
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
1 /* |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
297
f6ffac90895c
Updated copyright information for 2002
Sam Lantinga <slouken@libsdl.org>
parents:
273
diff
changeset
|
3 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
4 |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Library General Public |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
8 version 2 of the License, or (at your option) any later version. |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
9 |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
13 Library General Public License for more details. |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
14 |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Library General Public |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
18 |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
19 Sam Lantinga |
252
e8157fcb3114
Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents:
168
diff
changeset
|
20 slouken@libsdl.org |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
21 */ |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
22 |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
23 static void QZ_ChangeGrabState (_THIS, int action); |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
24 |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
25 struct WMcursor { |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
26 Cursor curs; |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
27 }; |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
28 |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
29 static void QZ_FreeWMCursor (_THIS, WMcursor *cursor) { |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
30 |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
31 if ( cursor != NULL ) |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
32 free (cursor); |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
33 } |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
34 |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
35 /* Use the Carbon cursor routines for now */ |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
36 static WMcursor* QZ_CreateWMCursor (_THIS, Uint8 *data, Uint8 *mask, |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
324
diff
changeset
|
37 int w, int h, int hot_x, int hot_y) { |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
324
diff
changeset
|
38 WMcursor *cursor; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
324
diff
changeset
|
39 int row, bytes; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
324
diff
changeset
|
40 |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
324
diff
changeset
|
41 /* Allocate the cursor memory */ |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
324
diff
changeset
|
42 cursor = (WMcursor *)malloc(sizeof(WMcursor)); |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
324
diff
changeset
|
43 if ( cursor == NULL ) { |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
324
diff
changeset
|
44 SDL_OutOfMemory(); |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
324
diff
changeset
|
45 return(NULL); |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
324
diff
changeset
|
46 } |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
324
diff
changeset
|
47 memset(cursor, 0, sizeof(*cursor)); |
168
e92aa316c517
Added Max's patches for building MacOS X apps on command line
Sam Lantinga <slouken@libsdl.org>
parents:
158
diff
changeset
|
48 |
e92aa316c517
Added Max's patches for building MacOS X apps on command line
Sam Lantinga <slouken@libsdl.org>
parents:
158
diff
changeset
|
49 if (w > 16) |
e92aa316c517
Added Max's patches for building MacOS X apps on command line
Sam Lantinga <slouken@libsdl.org>
parents:
158
diff
changeset
|
50 w = 16; |
e92aa316c517
Added Max's patches for building MacOS X apps on command line
Sam Lantinga <slouken@libsdl.org>
parents:
158
diff
changeset
|
51 |
e92aa316c517
Added Max's patches for building MacOS X apps on command line
Sam Lantinga <slouken@libsdl.org>
parents:
158
diff
changeset
|
52 if (h > 16) |
e92aa316c517
Added Max's patches for building MacOS X apps on command line
Sam Lantinga <slouken@libsdl.org>
parents:
158
diff
changeset
|
53 h = 16; |
e92aa316c517
Added Max's patches for building MacOS X apps on command line
Sam Lantinga <slouken@libsdl.org>
parents:
158
diff
changeset
|
54 |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
324
diff
changeset
|
55 bytes = (w+7)/8; |
168
e92aa316c517
Added Max's patches for building MacOS X apps on command line
Sam Lantinga <slouken@libsdl.org>
parents:
158
diff
changeset
|
56 |
390
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
324
diff
changeset
|
57 for ( row=0; row<h; ++row ) { |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
324
diff
changeset
|
58 memcpy(&cursor->curs.data[row], data, bytes); |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
324
diff
changeset
|
59 data += bytes; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
324
diff
changeset
|
60 } |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
324
diff
changeset
|
61 for ( row=0; row<h; ++row ) { |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
324
diff
changeset
|
62 memcpy(&cursor->curs.mask[row], mask, bytes); |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
324
diff
changeset
|
63 mask += bytes; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
324
diff
changeset
|
64 } |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
324
diff
changeset
|
65 cursor->curs.hotSpot.h = hot_x; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
324
diff
changeset
|
66 cursor->curs.hotSpot.v = hot_y; |
19e73568a75c
Date: Sat, 1 Jun 2002 17:56:45 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
324
diff
changeset
|
67 |
168
e92aa316c517
Added Max's patches for building MacOS X apps on command line
Sam Lantinga <slouken@libsdl.org>
parents:
158
diff
changeset
|
68 return(cursor); |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
69 } |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
70 |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
71 static int QZ_ShowWMCursor (_THIS, WMcursor *cursor) { |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
72 |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
73 if ( cursor == NULL) { |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
74 if ( cursor_visible ) { |
615
7ec821f3cbd0
Date: Thu, 17 Apr 2003 23:27:34 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
592
diff
changeset
|
75 if (!cursor_hidden) { |
7ec821f3cbd0
Date: Thu, 17 Apr 2003 23:27:34 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
592
diff
changeset
|
76 HideCursor (); |
7ec821f3cbd0
Date: Thu, 17 Apr 2003 23:27:34 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
592
diff
changeset
|
77 cursor_hidden = YES; |
7ec821f3cbd0
Date: Thu, 17 Apr 2003 23:27:34 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
592
diff
changeset
|
78 } |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
79 cursor_visible = NO; |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
80 QZ_ChangeGrabState (this, QZ_HIDECURSOR); |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
81 } |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
82 } |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
83 else { |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
84 SetCursor(&cursor->curs); |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
85 if ( ! cursor_visible ) { |
615
7ec821f3cbd0
Date: Thu, 17 Apr 2003 23:27:34 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
592
diff
changeset
|
86 if (cursor_hidden) { |
7ec821f3cbd0
Date: Thu, 17 Apr 2003 23:27:34 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
592
diff
changeset
|
87 ShowCursor (); |
7ec821f3cbd0
Date: Thu, 17 Apr 2003 23:27:34 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
592
diff
changeset
|
88 cursor_hidden = NO; |
7ec821f3cbd0
Date: Thu, 17 Apr 2003 23:27:34 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
592
diff
changeset
|
89 } |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
90 cursor_visible = YES; |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
91 QZ_ChangeGrabState (this, QZ_SHOWCURSOR); |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
92 } |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
93 } |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
94 |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
95 return 1; |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
96 } |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
97 |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
98 /* |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
99 Coordinate conversion functions, for convenience |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
100 Cocoa sets the origin at the lower left corner of the window/screen |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
101 SDL, CoreGraphics/WindowServer, and QuickDraw use the origin at the upper left corner |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
102 The routines were written so they could be called before SetVideoMode() has finished; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
103 this might have limited usefulness at the moment, but the extra cost is trivial. |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
104 */ |
272
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
105 |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
106 /* Convert Cocoa screen coordinate to Cocoa window coordinate */ |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
107 static void QZ_PrivateGlobalToLocal (_THIS, NSPoint *p) { |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
108 |
272
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
109 *p = [ qz_window convertScreenToBase:*p ]; |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
110 } |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
111 |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
112 |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
113 /* Convert Cocoa window coordinate to Cocoa screen coordinate */ |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
114 static void QZ_PrivateLocalToGlobal (_THIS, NSPoint *p) { |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
115 |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
116 *p = [ qz_window convertBaseToScreen:*p ]; |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
117 } |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
118 |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
119 /* Convert SDL coordinate to Cocoa coordinate */ |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
120 static void QZ_PrivateSDLToCocoa (_THIS, NSPoint *p) { |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
121 |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
122 if ( CGDisplayIsCaptured (display_id) ) { /* capture signals fullscreen */ |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
123 |
683
5d2f027b3349
Date: Sat, 9 Aug 2003 20:14:06 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
615
diff
changeset
|
124 p->y = CGDisplayPixelsHigh (display_id) - p->y - 1; |
272
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
125 } |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
126 else { |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
127 |
683
5d2f027b3349
Date: Sat, 9 Aug 2003 20:14:06 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
615
diff
changeset
|
128 NSPoint newPoint; |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
129 |
683
5d2f027b3349
Date: Sat, 9 Aug 2003 20:14:06 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
615
diff
changeset
|
130 newPoint = [ window_view convertPoint:*p toView:[ qz_window contentView ] ]; |
5d2f027b3349
Date: Sat, 9 Aug 2003 20:14:06 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
615
diff
changeset
|
131 |
5d2f027b3349
Date: Sat, 9 Aug 2003 20:14:06 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
615
diff
changeset
|
132 *p = newPoint; |
272
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
133 } |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
134 } |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
135 |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
136 /* Convert Cocoa coordinate to SDL coordinate */ |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
137 static void QZ_PrivateCocoaToSDL (_THIS, NSPoint *p) { |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
138 |
683
5d2f027b3349
Date: Sat, 9 Aug 2003 20:14:06 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
615
diff
changeset
|
139 if ( CGDisplayIsCaptured (display_id) ) { /* capture signals fullscreen */ |
5d2f027b3349
Date: Sat, 9 Aug 2003 20:14:06 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
615
diff
changeset
|
140 |
5d2f027b3349
Date: Sat, 9 Aug 2003 20:14:06 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
615
diff
changeset
|
141 p->y = CGDisplayPixelsHigh (display_id) - p->y - 1; |
5d2f027b3349
Date: Sat, 9 Aug 2003 20:14:06 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
615
diff
changeset
|
142 } |
5d2f027b3349
Date: Sat, 9 Aug 2003 20:14:06 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
615
diff
changeset
|
143 else { |
5d2f027b3349
Date: Sat, 9 Aug 2003 20:14:06 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
615
diff
changeset
|
144 |
5d2f027b3349
Date: Sat, 9 Aug 2003 20:14:06 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
615
diff
changeset
|
145 NSPoint newPoint; |
5d2f027b3349
Date: Sat, 9 Aug 2003 20:14:06 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
615
diff
changeset
|
146 |
5d2f027b3349
Date: Sat, 9 Aug 2003 20:14:06 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
615
diff
changeset
|
147 newPoint = [ window_view convertPoint:*p fromView:[ qz_window contentView ] ]; |
5d2f027b3349
Date: Sat, 9 Aug 2003 20:14:06 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
615
diff
changeset
|
148 |
5d2f027b3349
Date: Sat, 9 Aug 2003 20:14:06 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
615
diff
changeset
|
149 *p = newPoint; |
5d2f027b3349
Date: Sat, 9 Aug 2003 20:14:06 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
615
diff
changeset
|
150 } |
272
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
151 } |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
152 |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
153 /* Convert SDL coordinate to window server (CoreGraphics) coordinate */ |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
154 static CGPoint QZ_PrivateSDLToCG (_THIS, NSPoint *p) { |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
155 |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
156 CGPoint cgp; |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
157 |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
158 if ( ! CGDisplayIsCaptured (display_id) ) { /* not captured => not fullscreen => local coord */ |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
159 |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
160 int height; |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
161 |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
162 QZ_PrivateSDLToCocoa (this, p); |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
163 QZ_PrivateLocalToGlobal (this, p); |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
164 |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
165 height = CGDisplayPixelsHigh (display_id); |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
166 p->y = height - p->y; |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
167 } |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
168 |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
169 cgp.x = p->x; |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
170 cgp.y = p->y; |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
171 |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
172 return cgp; |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
173 } |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
174 |
683
5d2f027b3349
Date: Sat, 9 Aug 2003 20:14:06 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
615
diff
changeset
|
175 #if 0 /* Dead code */ |
272
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
176 /* Convert window server (CoreGraphics) coordinate to SDL coordinate */ |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
177 static void QZ_PrivateCGToSDL (_THIS, NSPoint *p) { |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
178 |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
179 if ( ! CGDisplayIsCaptured (display_id) ) { /* not captured => not fullscreen => local coord */ |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
180 |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
181 int height; |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
182 |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
183 /* Convert CG Global to Cocoa Global */ |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
184 height = CGDisplayPixelsHigh (display_id); |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
185 p->y = height - p->y; |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
186 |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
187 QZ_PrivateGlobalToLocal (this, p); |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
188 QZ_PrivateCocoaToSDL (this, p); |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
189 } |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
190 } |
683
5d2f027b3349
Date: Sat, 9 Aug 2003 20:14:06 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
615
diff
changeset
|
191 #endif /* Dead code */ |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
192 |
272
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
193 static void QZ_PrivateWarpCursor (_THIS, int x, int y) { |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
194 |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
195 NSPoint p; |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
196 CGPoint cgp; |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
197 |
272
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
198 p = NSMakePoint (x, y); |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
199 cgp = QZ_PrivateSDLToCG (this, &p); |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
200 |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
201 /* this is the magic call that fixes cursor "freezing" after warp */ |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
202 CGSetLocalEventsSuppressionInterval (0.0); |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
203 CGWarpMouseCursorPosition (cgp); |
272
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
204 } |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
205 |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
206 static void QZ_WarpWMCursor (_THIS, Uint16 x, Uint16 y) { |
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
207 |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
208 /* Only allow warping when in foreground */ |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
209 if ( ! in_foreground ) |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
210 return; |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
211 |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
212 /* Do the actual warp */ |
272
d1447a846d80
Date: Sat, 19 Jan 2002 17:24:32 -0500 (EST)
Sam Lantinga <slouken@libsdl.org>
parents:
269
diff
changeset
|
213 QZ_PrivateWarpCursor (this, x, y); |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
214 |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
215 /* Generate the mouse moved event */ |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
216 SDL_PrivateMouseMotion (0, 0, x, y); |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
217 } |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
218 |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
219 static void QZ_MoveWMCursor (_THIS, int x, int y) { } |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
220 static void QZ_CheckMouseMode (_THIS) { } |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
221 |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
222 static void QZ_SetCaption (_THIS, const char *title, const char *icon) { |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
223 |
158
4382c38dfbee
Date: Tue, 21 Aug 2001 03:50:01 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
58
diff
changeset
|
224 if ( qz_window != nil ) { |
58
bd6b0a910a65
* Removed fullscreen menu option from the "Window" menu
Sam Lantinga <slouken@lokigames.com>
parents:
47
diff
changeset
|
225 NSString *string; |
bd6b0a910a65
* Removed fullscreen menu option from the "Window" menu
Sam Lantinga <slouken@lokigames.com>
parents:
47
diff
changeset
|
226 if ( title != NULL ) { |
bd6b0a910a65
* Removed fullscreen menu option from the "Window" menu
Sam Lantinga <slouken@lokigames.com>
parents:
47
diff
changeset
|
227 string = [ [ NSString alloc ] initWithCString:title ]; |
158
4382c38dfbee
Date: Tue, 21 Aug 2001 03:50:01 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
58
diff
changeset
|
228 [ qz_window setTitle:string ]; |
58
bd6b0a910a65
* Removed fullscreen menu option from the "Window" menu
Sam Lantinga <slouken@lokigames.com>
parents:
47
diff
changeset
|
229 [ string release ]; |
bd6b0a910a65
* Removed fullscreen menu option from the "Window" menu
Sam Lantinga <slouken@lokigames.com>
parents:
47
diff
changeset
|
230 } |
bd6b0a910a65
* Removed fullscreen menu option from the "Window" menu
Sam Lantinga <slouken@lokigames.com>
parents:
47
diff
changeset
|
231 if ( icon != NULL ) { |
bd6b0a910a65
* Removed fullscreen menu option from the "Window" menu
Sam Lantinga <slouken@lokigames.com>
parents:
47
diff
changeset
|
232 string = [ [ NSString alloc ] initWithCString:icon ]; |
158
4382c38dfbee
Date: Tue, 21 Aug 2001 03:50:01 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
58
diff
changeset
|
233 [ qz_window setMiniwindowTitle:string ]; |
58
bd6b0a910a65
* Removed fullscreen menu option from the "Window" menu
Sam Lantinga <slouken@lokigames.com>
parents:
47
diff
changeset
|
234 [ string release ]; |
bd6b0a910a65
* Removed fullscreen menu option from the "Window" menu
Sam Lantinga <slouken@lokigames.com>
parents:
47
diff
changeset
|
235 } |
bd6b0a910a65
* Removed fullscreen menu option from the "Window" menu
Sam Lantinga <slouken@lokigames.com>
parents:
47
diff
changeset
|
236 } |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
237 } |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
238 |
269
4125b9859c71
Added Quartz version of SDL_SetIcon() for MacOS X (thanks Bob)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
239 static void QZ_SetIcon (_THIS, SDL_Surface *icon, Uint8 *mask) |
4125b9859c71
Added Quartz version of SDL_SetIcon() for MacOS X (thanks Bob)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
240 { |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
241 NSBitmapImageRep *imgrep; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
242 NSImage *img; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
243 SDL_Surface *mergedSurface; |
592
1970e458070d
Fixed crash in SDL_SetIcon() under Quartz (thanks Darrell!)
Sam Lantinga <slouken@libsdl.org>
parents:
563
diff
changeset
|
244 int i,j; |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
245 NSAutoreleasePool *pool; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
246 SDL_Rect rrect; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
247 NSSize imgSize = {icon->w, icon->h}; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
248 |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
249 pool = [ [ NSAutoreleasePool alloc ] init ]; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
250 SDL_GetClipRect(icon, &rrect); |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
251 |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
252 /* create a big endian RGBA surface */ |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
253 mergedSurface = SDL_CreateRGBSurface(SDL_SWSURFACE|SDL_SRCALPHA, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
254 icon->w, icon->h, 32, 0xff<<24, 0xff<<16, 0xff<<8, 0xff<<0); |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
255 if (mergedSurface==NULL) { |
324
f25f666d609a
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
303
diff
changeset
|
256 NSLog(@"Error creating surface for merge"); |
f25f666d609a
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
303
diff
changeset
|
257 goto freePool; |
f25f666d609a
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
303
diff
changeset
|
258 } |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
259 |
592
1970e458070d
Fixed crash in SDL_SetIcon() under Quartz (thanks Darrell!)
Sam Lantinga <slouken@libsdl.org>
parents:
563
diff
changeset
|
260 if (mergedSurface->pitch != |
1970e458070d
Fixed crash in SDL_SetIcon() under Quartz (thanks Darrell!)
Sam Lantinga <slouken@libsdl.org>
parents:
563
diff
changeset
|
261 mergedSurface->format->BytesPerPixel * mergedSurface->w) { |
1970e458070d
Fixed crash in SDL_SetIcon() under Quartz (thanks Darrell!)
Sam Lantinga <slouken@libsdl.org>
parents:
563
diff
changeset
|
262 SDL_SetError ("merged surface has wrong format"); |
1970e458070d
Fixed crash in SDL_SetIcon() under Quartz (thanks Darrell!)
Sam Lantinga <slouken@libsdl.org>
parents:
563
diff
changeset
|
263 SDL_FreeSurface (mergedSurface); |
1970e458070d
Fixed crash in SDL_SetIcon() under Quartz (thanks Darrell!)
Sam Lantinga <slouken@libsdl.org>
parents:
563
diff
changeset
|
264 goto freePool; |
1970e458070d
Fixed crash in SDL_SetIcon() under Quartz (thanks Darrell!)
Sam Lantinga <slouken@libsdl.org>
parents:
563
diff
changeset
|
265 } |
1970e458070d
Fixed crash in SDL_SetIcon() under Quartz (thanks Darrell!)
Sam Lantinga <slouken@libsdl.org>
parents:
563
diff
changeset
|
266 |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
267 if (SDL_BlitSurface(icon,&rrect,mergedSurface,&rrect)) { |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
268 NSLog(@"Error blitting to mergedSurface"); |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
269 goto freePool; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
270 } |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
271 |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
272 if (mask) { |
592
1970e458070d
Fixed crash in SDL_SetIcon() under Quartz (thanks Darrell!)
Sam Lantinga <slouken@libsdl.org>
parents:
563
diff
changeset
|
273 |
1970e458070d
Fixed crash in SDL_SetIcon() under Quartz (thanks Darrell!)
Sam Lantinga <slouken@libsdl.org>
parents:
563
diff
changeset
|
274 Uint32 *pixels = mergedSurface->pixels; |
1970e458070d
Fixed crash in SDL_SetIcon() under Quartz (thanks Darrell!)
Sam Lantinga <slouken@libsdl.org>
parents:
563
diff
changeset
|
275 for (i = 0; i < mergedSurface->h; i++) { |
1970e458070d
Fixed crash in SDL_SetIcon() under Quartz (thanks Darrell!)
Sam Lantinga <slouken@libsdl.org>
parents:
563
diff
changeset
|
276 for (j = 0; j < mergedSurface->w; j++) { |
1970e458070d
Fixed crash in SDL_SetIcon() under Quartz (thanks Darrell!)
Sam Lantinga <slouken@libsdl.org>
parents:
563
diff
changeset
|
277 |
1970e458070d
Fixed crash in SDL_SetIcon() under Quartz (thanks Darrell!)
Sam Lantinga <slouken@libsdl.org>
parents:
563
diff
changeset
|
278 int index = i * mergedSurface->w + j; |
1970e458070d
Fixed crash in SDL_SetIcon() under Quartz (thanks Darrell!)
Sam Lantinga <slouken@libsdl.org>
parents:
563
diff
changeset
|
279 int mindex = index >> 3; |
1970e458070d
Fixed crash in SDL_SetIcon() under Quartz (thanks Darrell!)
Sam Lantinga <slouken@libsdl.org>
parents:
563
diff
changeset
|
280 int bindex = 7 - (index & 0x7); |
1970e458070d
Fixed crash in SDL_SetIcon() under Quartz (thanks Darrell!)
Sam Lantinga <slouken@libsdl.org>
parents:
563
diff
changeset
|
281 |
1970e458070d
Fixed crash in SDL_SetIcon() under Quartz (thanks Darrell!)
Sam Lantinga <slouken@libsdl.org>
parents:
563
diff
changeset
|
282 if (mask[mindex] & (1 << bindex)) |
1970e458070d
Fixed crash in SDL_SetIcon() under Quartz (thanks Darrell!)
Sam Lantinga <slouken@libsdl.org>
parents:
563
diff
changeset
|
283 pixels[index] |= 0x000000FF; |
1970e458070d
Fixed crash in SDL_SetIcon() under Quartz (thanks Darrell!)
Sam Lantinga <slouken@libsdl.org>
parents:
563
diff
changeset
|
284 else |
1970e458070d
Fixed crash in SDL_SetIcon() under Quartz (thanks Darrell!)
Sam Lantinga <slouken@libsdl.org>
parents:
563
diff
changeset
|
285 pixels[index] &= 0xFFFFFF00; |
1970e458070d
Fixed crash in SDL_SetIcon() under Quartz (thanks Darrell!)
Sam Lantinga <slouken@libsdl.org>
parents:
563
diff
changeset
|
286 } |
1970e458070d
Fixed crash in SDL_SetIcon() under Quartz (thanks Darrell!)
Sam Lantinga <slouken@libsdl.org>
parents:
563
diff
changeset
|
287 } |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
288 } |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
289 |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
290 imgrep = [ [ NSBitmapImageRep alloc] |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
291 initWithBitmapDataPlanes:(unsigned char **)&mergedSurface->pixels |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
292 pixelsWide:icon->w pixelsHigh:icon->h bitsPerSample:8 samplesPerPixel:4 |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
293 hasAlpha:YES isPlanar:NO colorSpaceName:NSDeviceRGBColorSpace |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
294 bytesPerRow:icon->w<<2 bitsPerPixel:32 ]; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
295 |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
296 img = [ [ NSImage alloc ] initWithSize:imgSize ]; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
297 |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
298 [ img addRepresentation: imgrep ]; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
299 [ NSApp setApplicationIconImage:img ]; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
300 |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
301 [ img release ]; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
302 [ imgrep release ]; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
303 SDL_FreeSurface(mergedSurface); |
269
4125b9859c71
Added Quartz version of SDL_SetIcon() for MacOS X (thanks Bob)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
304 freePool: |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
305 [pool release]; |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
306 } |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
307 |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
308 static int QZ_IconifyWindow (_THIS) { |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
309 |
158
4382c38dfbee
Date: Tue, 21 Aug 2001 03:50:01 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
58
diff
changeset
|
310 if ( ! [ qz_window isMiniaturized ] ) { |
4382c38dfbee
Date: Tue, 21 Aug 2001 03:50:01 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
58
diff
changeset
|
311 [ qz_window miniaturize:nil ]; |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
312 return 1; |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
313 } |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
314 else { |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
315 SDL_SetError ("window already iconified"); |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
316 return 0; |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
317 } |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
318 } |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
319 |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
320 /* |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
321 static int QZ_GetWMInfo (_THIS, SDL_SysWMinfo *info) { |
158
4382c38dfbee
Date: Tue, 21 Aug 2001 03:50:01 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
58
diff
changeset
|
322 info->nsWindowPtr = qz_window; |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
323 return 0; |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
324 }*/ |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
325 |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
326 static void QZ_ChangeGrabState (_THIS, int action) { |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
327 |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
328 /* |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
329 Figure out what the next state should be based on the action. |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
330 Ignore actions that can't change the current state. |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
331 */ |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
332 if ( grab_state == QZ_UNGRABBED ) { |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
333 if ( action == QZ_ENABLE_GRAB ) { |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
334 if ( cursor_visible ) |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
335 grab_state = QZ_VISIBLE_GRAB; |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
336 else |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
337 grab_state = QZ_INVISIBLE_GRAB; |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
338 } |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
339 } |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
340 else if ( grab_state == QZ_VISIBLE_GRAB ) { |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
341 if ( action == QZ_DISABLE_GRAB ) |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
342 grab_state = QZ_UNGRABBED; |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
343 else if ( action == QZ_HIDECURSOR ) |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
344 grab_state = QZ_INVISIBLE_GRAB; |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
345 } |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
346 else { |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
347 assert( grab_state == QZ_INVISIBLE_GRAB ); |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
348 |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
349 if ( action == QZ_DISABLE_GRAB ) |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
350 grab_state = QZ_UNGRABBED; |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
351 else if ( action == QZ_SHOWCURSOR ) |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
352 grab_state = QZ_VISIBLE_GRAB; |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
353 } |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
354 |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
355 /* now apply the new state */ |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
356 if (grab_state == QZ_UNGRABBED) { |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
357 |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
358 CGAssociateMouseAndMouseCursorPosition (1); |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
359 } |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
360 else if (grab_state == QZ_VISIBLE_GRAB) { |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
361 |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
362 CGAssociateMouseAndMouseCursorPosition (1); |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
363 } |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
364 else { |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
365 assert( grab_state == QZ_INVISIBLE_GRAB ); |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
366 |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
367 QZ_PrivateWarpCursor (this, SDL_VideoSurface->w / 2, SDL_VideoSurface->h / 2); |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
368 CGAssociateMouseAndMouseCursorPosition (0); |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
369 } |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
370 } |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
371 |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
372 static SDL_GrabMode QZ_GrabInput (_THIS, SDL_GrabMode grab_mode) { |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
373 |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
374 int doGrab = grab_mode & SDL_GRAB_ON; |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
375 /*int fullscreen = grab_mode & SDL_GRAB_FULLSCREEN;*/ |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
376 |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
377 if ( this->screen == NULL ) { |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
378 SDL_SetError ("QZ_GrabInput: screen is NULL"); |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
379 return SDL_GRAB_OFF; |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
380 } |
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
381 |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
382 if ( ! video_set ) { |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
383 /*SDL_SetError ("QZ_GrabInput: video is not set, grab will take effect on mode switch"); */ |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
384 current_grab_mode = grab_mode; |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
385 return grab_mode; /* Will be set later on mode switch */ |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
386 } |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
387 |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
388 if ( grab_mode != SDL_GRAB_QUERY ) { |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
389 if ( doGrab ) |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
390 QZ_ChangeGrabState (this, QZ_ENABLE_GRAB); |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
391 else |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
392 QZ_ChangeGrabState (this, QZ_DISABLE_GRAB); |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
393 |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
394 current_grab_mode = doGrab ? SDL_GRAB_ON : SDL_GRAB_OFF; |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
395 } |
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
396 |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
397 return current_grab_mode; |
47
45b1c4303f87
Added initial support for Quartz video (thanks Darrell!)
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
398 } |
501
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
399 |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
400 /* Resize icon, BMP format */ |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
401 static unsigned char QZ_ResizeIcon[] = { |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
402 0x42,0x4d,0x31,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x36,0x00,0x00,0x00,0x28,0x00, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
403 0x00,0x00,0x0d,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x01,0x00,0x18,0x00,0x00,0x00, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
404 0x00,0x00,0xfb,0x01,0x00,0x00,0x13,0x0b,0x00,0x00,0x13,0x0b,0x00,0x00,0x00,0x00, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
405 0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
406 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
407 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0b,0xff,0xff, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
408 0xff,0xda,0xda,0xda,0x87,0x87,0x87,0xe8,0xe8,0xe8,0xff,0xff,0xff,0xda,0xda,0xda, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
409 0x87,0x87,0x87,0xe8,0xe8,0xe8,0xff,0xff,0xff,0xda,0xda,0xda,0x87,0x87,0x87,0xe8, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
410 0xe8,0xe8,0xff,0xff,0xff,0x0b,0xff,0xff,0xff,0xff,0xff,0xff,0xda,0xda,0xda,0x87, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
411 0x87,0x87,0xe8,0xe8,0xe8,0xff,0xff,0xff,0xda,0xda,0xda,0x87,0x87,0x87,0xe8,0xe8, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
412 0xe8,0xff,0xff,0xff,0xda,0xda,0xda,0x87,0x87,0x87,0xff,0xff,0xff,0x0b,0xff,0xff, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
413 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xd5,0xd5,0xd5,0x87,0x87,0x87,0xe8,0xe8,0xe8, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
414 0xff,0xff,0xff,0xda,0xda,0xda,0x87,0x87,0x87,0xe8,0xe8,0xe8,0xff,0xff,0xff,0xda, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
415 0xda,0xda,0xff,0xff,0xff,0x0b,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
416 0xff,0xff,0xd7,0xd7,0xd7,0x87,0x87,0x87,0xe8,0xe8,0xe8,0xff,0xff,0xff,0xda,0xda, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
417 0xda,0x87,0x87,0x87,0xe8,0xe8,0xe8,0xff,0xff,0xff,0xff,0xff,0xff,0x0b,0xff,0xff, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
418 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xd7,0xd7,0xd7, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
419 0x87,0x87,0x87,0xe8,0xe8,0xe8,0xff,0xff,0xff,0xda,0xda,0xda,0x87,0x87,0x87,0xe8, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
420 0xe8,0xe8,0xff,0xff,0xff,0x0b,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
421 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xd7,0xd7,0xd7,0x87,0x87,0x87,0xe8,0xe8, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
422 0xe8,0xff,0xff,0xff,0xdc,0xdc,0xdc,0x87,0x87,0x87,0xff,0xff,0xff,0x0b,0xff,0xff, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
423 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
424 0xff,0xff,0xff,0xd9,0xd9,0xd9,0x87,0x87,0x87,0xe8,0xe8,0xe8,0xff,0xff,0xff,0xdc, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
425 0xdc,0xdc,0xff,0xff,0xff,0x0b,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
426 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xdb,0xdb, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
427 0xdb,0x87,0x87,0x87,0xe8,0xe8,0xe8,0xff,0xff,0xff,0xff,0xff,0xff,0x0b,0xff,0xff, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
428 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
429 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xdb,0xdb,0xdb,0x87,0x87,0x87,0xe8, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
430 0xe8,0xe8,0xff,0xff,0xff,0x0b,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
431 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
432 0xff,0xff,0xff,0xff,0xdc,0xdc,0xdc,0x87,0x87,0x87,0xff,0xff,0xff,0x0b,0xff,0xff, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
433 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
434 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xdc, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
435 0xdc,0xdc,0xff,0xff,0xff,0x0b,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
436 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
437 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0b |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
438 }; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
439 |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
440 static void QZ_DrawResizeIcon (_THIS, RgnHandle dirtyRegion) { |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
441 |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
442 /* Check if we should draw the resize icon */ |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
443 if (SDL_VideoSurface->flags & SDL_RESIZABLE) { |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
444 |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
445 Rect icon; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
446 SetRect (&icon, SDL_VideoSurface->w - 13, SDL_VideoSurface->h - 13, |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
447 SDL_VideoSurface->w, SDL_VideoSurface->h); |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
448 |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
449 if (RectInRgn (&icon, dirtyRegion)) { |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
450 |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
451 SDL_Rect icon_rect; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
452 |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
453 /* Create the icon image */ |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
454 if (resize_icon == NULL) { |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
455 |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
456 SDL_RWops *rw; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
457 SDL_Surface *tmp; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
458 |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
459 rw = SDL_RWFromMem (QZ_ResizeIcon, sizeof(QZ_ResizeIcon)); |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
460 tmp = SDL_LoadBMP_RW (rw, SDL_TRUE); |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
461 |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
462 resize_icon = SDL_ConvertSurface (tmp, SDL_VideoSurface->format, SDL_SRCCOLORKEY); |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
463 SDL_SetColorKey (resize_icon, SDL_SRCCOLORKEY, 0xFFFFFF); |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
464 |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
465 SDL_FreeSurface (tmp); |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
466 } |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
467 |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
468 icon_rect.x = SDL_VideoSurface->w - 13; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
469 icon_rect.y = SDL_VideoSurface->h - 13; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
470 icon_rect.w = 13; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
471 icon_rect.h = 13; |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
472 |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
473 SDL_BlitSurface (resize_icon, NULL, SDL_VideoSurface, &icon_rect); |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
474 } |
74262d2647ca
Lots of cleanups by Darrell, added the ability to resize Cocoa windows.
Sam Lantinga <slouken@libsdl.org>
parents:
390
diff
changeset
|
475 } |
563
04dcaf3da918
Massive Quartz input enhancements from Darrell Walisser. His email:
Ryan C. Gordon <icculus@icculus.org>
parents:
501
diff
changeset
|
476 } |