annotate src/video/gem/SDL_gemmouse.c @ 4072:6930cd5ab933 SDL-1.2

Final fix for bug #373 ------- Comment #13 From Christian Walther 2007-07-15 10:04:56 [reply] ------- Created an attachment (id=229) [details] patch to reinstate the SDL cursor after an NSApplicationActivatedEvent Oops, you're right. My testcursor.c has diverged so far from the original that I missed that. In fact, now that I think about it, that issue isn't even addressed by the cursor rectangle patch - it is only concerned with windowed mode (and fixes the problem there as a side effect). The problem in fullscreen is still the same as before. How about the attachment for a fix? (I can confirm that [NSCursor set] doesn't seem to have any effect when called from QZ_DoActivate().)
author Sam Lantinga <slouken@libsdl.org>
date Sun, 15 Jul 2007 17:22:39 +0000
parents 0b4ebec67cad
children a1b03ba2fcd0
rev   line source
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1267
diff changeset
3 Copyright (C) 1997-2006 Sam Lantinga
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1267
diff changeset
6 modify it under the terms of the GNU Lesser General Public
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1267
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1267
diff changeset
13 Lesser General Public License for more details.
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1267
diff changeset
15 You should have received a copy of the GNU Lesser General Public
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1267
diff changeset
16 License along with this library; if not, write to the Free Software
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1267
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 Sam Lantinga
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 slouken@libsdl.org
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21 */
1402
d910939febfa Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents: 1361
diff changeset
22 #include "SDL_config.h"
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 /*
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25 * GEM Mouse manager
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26 *
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27 * Patrice Mandin
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28 */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30 #include <gem.h>
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32 #include "SDL_mouse.h"
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
33 #include "../../events/SDL_events_c.h"
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
34 #include "../SDL_cursor_c.h"
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35 #include "SDL_gemmouse_c.h"
1857
417f2af2bd52 Fix mouse cursor change
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
36 #include "SDL_gemvideo.h"
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
38 /* Defines */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 319
diff changeset
40 /*#define DEBUG_VIDEO_GEM 1*/
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 319
diff changeset
41
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42 #define MAXCURWIDTH 16
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43 #define MAXCURHEIGHT 16
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
44
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
45 void GEM_FreeWMCursor(_THIS, WMcursor *cursor)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
46 {
1857
417f2af2bd52 Fix mouse cursor change
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
47 #ifdef DEBUG_VIDEO_GEM
417f2af2bd52 Fix mouse cursor change
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
48 printf("sdl:video:gem: free cursor\n");
417f2af2bd52 Fix mouse cursor change
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
49 #endif
417f2af2bd52 Fix mouse cursor change
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
50
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
51 if (cursor == NULL)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
52 return;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
53
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54 graf_mouse(ARROW, NULL);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
55
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
56 if (cursor->mform_p != NULL)
1336
3692456e7b0f Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
57 SDL_free(cursor->mform_p);
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
58
1336
3692456e7b0f Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
59 SDL_free(cursor);
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
60 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
62 WMcursor *GEM_CreateWMCursor(_THIS,
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
63 Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
64 {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
65 WMcursor *cursor;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
66 MFORM *new_mform;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
67 int i;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
68
1857
417f2af2bd52 Fix mouse cursor change
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
69 #ifdef DEBUG_VIDEO_GEM
417f2af2bd52 Fix mouse cursor change
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
70 Uint16 *data1, *mask1;
417f2af2bd52 Fix mouse cursor change
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
71
417f2af2bd52 Fix mouse cursor change
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
72 printf("sdl:video:gem: create cursor\n");
417f2af2bd52 Fix mouse cursor change
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
73 #endif
417f2af2bd52 Fix mouse cursor change
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
74
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
75 /* Check the size */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
76 if ( (w > MAXCURWIDTH) || (h > MAXCURHEIGHT) ) {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
77 SDL_SetError("Only cursors of dimension (%dx%d) are allowed",
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
78 MAXCURWIDTH, MAXCURHEIGHT);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79 return(NULL);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
80 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
81
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
82 /* Allocate the cursor memory */
1336
3692456e7b0f Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
83 cursor = (WMcursor *)SDL_malloc(sizeof(WMcursor));
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
84 if ( cursor == NULL ) {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
85 SDL_OutOfMemory();
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
86 return(NULL);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
87 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
88
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
89 /* Allocate mform */
1336
3692456e7b0f Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
90 new_mform = (MFORM *)SDL_malloc(sizeof(MFORM));
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
91 if (new_mform == NULL) {
1336
3692456e7b0f Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
92 SDL_free(cursor);
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
93 SDL_OutOfMemory();
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94 return(NULL);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
95 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
96
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
97 cursor->mform_p = new_mform;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
98
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
99 new_mform->mf_xhot = hot_x;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
100 new_mform->mf_yhot = hot_y;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
101 new_mform->mf_nplanes = 1;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
102 new_mform->mf_fg = 0;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
103 new_mform->mf_bg = 1;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
104
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 319
diff changeset
105 for (i=0;i<MAXCURHEIGHT;i++) {
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
106 new_mform->mf_mask[i]=0;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
107 new_mform->mf_data[i]=0;
1857
417f2af2bd52 Fix mouse cursor change
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
108 #ifdef DEBUG_VIDEO_GEM
417f2af2bd52 Fix mouse cursor change
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
109 data1 = (Uint16 *) &data[i<<1];
417f2af2bd52 Fix mouse cursor change
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
110 mask1 = (Uint16 *) &mask[i<<1];
417f2af2bd52 Fix mouse cursor change
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
111 printf("sdl:video:gem: source: line %d: data=0x%04x, mask=0x%04x\n",
417f2af2bd52 Fix mouse cursor change
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
112 i, data1[i], mask1[i]);
417f2af2bd52 Fix mouse cursor change
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
113 #endif
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
114 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
115
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
116 if (w<=8) {
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 319
diff changeset
117 for (i=0;i<h;i++) {
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
118 new_mform->mf_mask[i]= mask[i]<<8;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
119 new_mform->mf_data[i]= data[i]<<8;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
120 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
121 } else {
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 319
diff changeset
122 for (i=0;i<h;i++) {
1857
417f2af2bd52 Fix mouse cursor change
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
123 new_mform->mf_mask[i]= (mask[i<<1]<<8) | mask[(i<<1)+1];
417f2af2bd52 Fix mouse cursor change
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
124 new_mform->mf_data[i]= (data[i<<1]<<8) | data[(i<<1)+1];
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
125 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
126 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
127
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 319
diff changeset
128 #ifdef DEBUG_VIDEO_GEM
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 319
diff changeset
129 for (i=0; i<h ;i++) {
1857
417f2af2bd52 Fix mouse cursor change
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
130 printf("sdl:video:gem: cursor: line %d: data=0x%04x, mask=0x%04x\n",
417f2af2bd52 Fix mouse cursor change
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
131 i, new_mform->mf_data[i], new_mform->mf_mask[i]);
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 319
diff changeset
132 }
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 319
diff changeset
133
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 319
diff changeset
134 printf("sdl:video:gem: CreateWMCursor(): done\n");
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 319
diff changeset
135 #endif
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 319
diff changeset
136
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
137 return cursor;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
138 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
139
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
140 int GEM_ShowWMCursor(_THIS, WMcursor *cursor)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
141 {
1857
417f2af2bd52 Fix mouse cursor change
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
142 GEM_cursor = cursor;
4060
0b4ebec67cad Call GEM_CheckMouseMode everytime something may change mouse form, and do it properly
Patrice Mandin <patmandin@gmail.com>
parents: 3859
diff changeset
143
0b4ebec67cad Call GEM_CheckMouseMode everytime something may change mouse form, and do it properly
Patrice Mandin <patmandin@gmail.com>
parents: 3859
diff changeset
144 GEM_CheckMouseMode(this);
1857
417f2af2bd52 Fix mouse cursor change
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
145
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 319
diff changeset
146 #ifdef DEBUG_VIDEO_GEM
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 319
diff changeset
147 printf("sdl:video:gem: ShowWMCursor(0x%08x)\n", (long) cursor);
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 319
diff changeset
148 #endif
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
149
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
150 return 1;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
151 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
152
319
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
153 #if 0
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
154 void GEM_WarpWMCursor(_THIS, Uint16 x, Uint16 y)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
155 {
319
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
156 /* This seems to work only on AES 3.4 (Falcon) */
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
157
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
158 EVNTREC warpevent;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
159
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
160 warpevent.ap_event = APPEVNT_MOUSE;
319
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
161 warpevent.ap_value = (x << 16) | y;
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
162
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
163 appl_tplay(&warpevent, 1, 1000);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
164 }
319
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
165 #endif
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
166
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
167 void GEM_CheckMouseMode(_THIS)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
168 {
4060
0b4ebec67cad Call GEM_CheckMouseMode everytime something may change mouse form, and do it properly
Patrice Mandin <patmandin@gmail.com>
parents: 3859
diff changeset
169 const Uint8 full_focus = (SDL_APPACTIVE|SDL_APPINPUTFOCUS|SDL_APPMOUSEFOCUS);
0b4ebec67cad Call GEM_CheckMouseMode everytime something may change mouse form, and do it properly
Patrice Mandin <patmandin@gmail.com>
parents: 3859
diff changeset
170 int set_system_cursor = 1, show_system_cursor = 1;
0b4ebec67cad Call GEM_CheckMouseMode everytime something may change mouse form, and do it properly
Patrice Mandin <patmandin@gmail.com>
parents: 3859
diff changeset
171
1857
417f2af2bd52 Fix mouse cursor change
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
172 #ifdef DEBUG_VIDEO_GEM
417f2af2bd52 Fix mouse cursor change
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
173 printf("sdl:video:gem: check mouse mode\n");
417f2af2bd52 Fix mouse cursor change
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
174 #endif
417f2af2bd52 Fix mouse cursor change
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
175
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
176 /* If the mouse is hidden and input is grabbed, we use relative mode */
4060
0b4ebec67cad Call GEM_CheckMouseMode everytime something may change mouse form, and do it properly
Patrice Mandin <patmandin@gmail.com>
parents: 3859
diff changeset
177 GEM_mouse_relative = (!(SDL_cursorstate & CURSOR_VISIBLE))
0b4ebec67cad Call GEM_CheckMouseMode everytime something may change mouse form, and do it properly
Patrice Mandin <patmandin@gmail.com>
parents: 3859
diff changeset
178 && (this->input_grab != SDL_GRAB_OFF)
0b4ebec67cad Call GEM_CheckMouseMode everytime something may change mouse form, and do it properly
Patrice Mandin <patmandin@gmail.com>
parents: 3859
diff changeset
179 && (SDL_GetAppState() & SDL_APPACTIVE);
0b4ebec67cad Call GEM_CheckMouseMode everytime something may change mouse form, and do it properly
Patrice Mandin <patmandin@gmail.com>
parents: 3859
diff changeset
180 SDL_AtariXbios_LockMousePosition(GEM_mouse_relative);
0b4ebec67cad Call GEM_CheckMouseMode everytime something may change mouse form, and do it properly
Patrice Mandin <patmandin@gmail.com>
parents: 3859
diff changeset
181
0b4ebec67cad Call GEM_CheckMouseMode everytime something may change mouse form, and do it properly
Patrice Mandin <patmandin@gmail.com>
parents: 3859
diff changeset
182 if (SDL_cursorstate & CURSOR_VISIBLE) {
0b4ebec67cad Call GEM_CheckMouseMode everytime something may change mouse form, and do it properly
Patrice Mandin <patmandin@gmail.com>
parents: 3859
diff changeset
183 /* Application defined cursor only over the application window */
0b4ebec67cad Call GEM_CheckMouseMode everytime something may change mouse form, and do it properly
Patrice Mandin <patmandin@gmail.com>
parents: 3859
diff changeset
184 if ((SDL_GetAppState() & full_focus) == full_focus) {
0b4ebec67cad Call GEM_CheckMouseMode everytime something may change mouse form, and do it properly
Patrice Mandin <patmandin@gmail.com>
parents: 3859
diff changeset
185 if (GEM_cursor) {
0b4ebec67cad Call GEM_CheckMouseMode everytime something may change mouse form, and do it properly
Patrice Mandin <patmandin@gmail.com>
parents: 3859
diff changeset
186 graf_mouse(USER_DEF, GEM_cursor->mform_p);
0b4ebec67cad Call GEM_CheckMouseMode everytime something may change mouse form, and do it properly
Patrice Mandin <patmandin@gmail.com>
parents: 3859
diff changeset
187 set_system_cursor = 0;
0b4ebec67cad Call GEM_CheckMouseMode everytime something may change mouse form, and do it properly
Patrice Mandin <patmandin@gmail.com>
parents: 3859
diff changeset
188 } else {
0b4ebec67cad Call GEM_CheckMouseMode everytime something may change mouse form, and do it properly
Patrice Mandin <patmandin@gmail.com>
parents: 3859
diff changeset
189 show_system_cursor = 0;
0b4ebec67cad Call GEM_CheckMouseMode everytime something may change mouse form, and do it properly
Patrice Mandin <patmandin@gmail.com>
parents: 3859
diff changeset
190 }
0b4ebec67cad Call GEM_CheckMouseMode everytime something may change mouse form, and do it properly
Patrice Mandin <patmandin@gmail.com>
parents: 3859
diff changeset
191 }
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
192 } else {
4060
0b4ebec67cad Call GEM_CheckMouseMode everytime something may change mouse form, and do it properly
Patrice Mandin <patmandin@gmail.com>
parents: 3859
diff changeset
193 /* Mouse cursor hidden only over the application window */
0b4ebec67cad Call GEM_CheckMouseMode everytime something may change mouse form, and do it properly
Patrice Mandin <patmandin@gmail.com>
parents: 3859
diff changeset
194 if ((SDL_GetAppState() & full_focus) == full_focus) {
0b4ebec67cad Call GEM_CheckMouseMode everytime something may change mouse form, and do it properly
Patrice Mandin <patmandin@gmail.com>
parents: 3859
diff changeset
195 set_system_cursor = 0;
0b4ebec67cad Call GEM_CheckMouseMode everytime something may change mouse form, and do it properly
Patrice Mandin <patmandin@gmail.com>
parents: 3859
diff changeset
196 show_system_cursor = 0;
0b4ebec67cad Call GEM_CheckMouseMode everytime something may change mouse form, and do it properly
Patrice Mandin <patmandin@gmail.com>
parents: 3859
diff changeset
197 }
0b4ebec67cad Call GEM_CheckMouseMode everytime something may change mouse form, and do it properly
Patrice Mandin <patmandin@gmail.com>
parents: 3859
diff changeset
198 }
0b4ebec67cad Call GEM_CheckMouseMode everytime something may change mouse form, and do it properly
Patrice Mandin <patmandin@gmail.com>
parents: 3859
diff changeset
199
0b4ebec67cad Call GEM_CheckMouseMode everytime something may change mouse form, and do it properly
Patrice Mandin <patmandin@gmail.com>
parents: 3859
diff changeset
200 graf_mouse(show_system_cursor ? M_ON : M_OFF, NULL);
0b4ebec67cad Call GEM_CheckMouseMode everytime something may change mouse form, and do it properly
Patrice Mandin <patmandin@gmail.com>
parents: 3859
diff changeset
201 if (set_system_cursor) {
0b4ebec67cad Call GEM_CheckMouseMode everytime something may change mouse form, and do it properly
Patrice Mandin <patmandin@gmail.com>
parents: 3859
diff changeset
202 graf_mouse(ARROW, NULL);
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
203 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
204 }