comparison src/video/photon/SDL_ph_mouse.c @ 701:aaf3b8af6616

Date: Sat, 30 Aug 2003 16:28:10 +0300 From: "Mike Gorchak" Subject: Re: SDL 1.2.6 - minor changes about shared library building under QNX6 into README.QNX - added forgotten libSDLmain.a into distribution, SDL.qpg.in - added header guards to the all headers. - fixed fullscreen double buffered mode. - fixed Photon crashes after/during using fullscreen OpenGL modes. - added GL_MakeCurrent function. - added SDL_VIDEOEXPOSE event, when OpenGL window have been resized - added more HAVE_OPENGL checks to avoid dead code compilation without using OpenGL - finished code reorganization (began into previous patches).
author Sam Lantinga <slouken@libsdl.org>
date Sat, 30 Aug 2003 17:07:59 +0000
parents 8bedd6d61642
children b8d311d90021
comparison
equal deleted inserted replaced
700:c35edafc84d1 701:aaf3b8af6616
118 return (cursor); 118 return (cursor);
119 } 119 }
120 120
121 PhCursorDef_t ph_GetWMPhCursor(WMcursor *cursor) 121 PhCursorDef_t ph_GetWMPhCursor(WMcursor *cursor)
122 { 122 {
123 return(*cursor->ph_cursor); 123 return (*cursor->ph_cursor);
124 } 124 }
125 125
126 int ph_ShowWMCursor(_THIS, WMcursor *cursor) 126 int ph_ShowWMCursor(_THIS, WMcursor* cursor)
127 { 127 {
128 PtArg_t args[3]; 128 PtArg_t args[3];
129 int nargs = 0; 129 int nargs = 0;
130 130
131 /* Don't do anything if the display is gone */ 131 /* Don't do anything if the display is gone */
135 } 135 }
136 136
137 /* looks like photon can't draw mouse cursor in direct mode */ 137 /* looks like photon can't draw mouse cursor in direct mode */
138 if ((this->screen->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) 138 if ((this->screen->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN)
139 { 139 {
140 return (0); 140 /* disable the fake mouse in the fullscreen OpenGL mode */
141 if ((this->screen->flags & SDL_OPENGL) == SDL_OPENGL)
142 {
143 cursor=NULL;
144 }
145 else
146 {
147 return (0);
148 }
141 } 149 }
142 150
143 /* Set the photon cursor, or blank if cursor is NULL */ 151 /* Set the photon cursor, or blank if cursor is NULL */
144 if (cursor!=NULL) 152 if (cursor!=NULL)
145 { 153 {
165 SDL_Unlock_EventThread(); 173 SDL_Unlock_EventThread();
166 174
167 return (1); 175 return (1);
168 } 176 }
169 177
178
170 void ph_WarpWMCursor(_THIS, Uint16 x, Uint16 y) 179 void ph_WarpWMCursor(_THIS, Uint16 x, Uint16 y)
171 { 180 {
172 short abs_x, abs_y; 181 short abs_x, abs_y;
173 182
174 SDL_Lock_EventThread(); 183 SDL_Lock_EventThread();
188 else 197 else
189 { 198 {
190 mouse_relative = 0; 199 mouse_relative = 0;
191 } 200 }
192 } 201 }
202
203
204 void ph_UpdateMouse(_THIS)
205 {
206 PhCursorInfo_t phcursor;
207 short abs_x;
208 short abs_y;
209
210 /* Lock the event thread, in multi-threading environments */
211 SDL_Lock_EventThread();
212
213 /* synchronizing photon mouse cursor position and SDL mouse position, if cursor appears over window. */
214 PtGetAbsPosition(window, &abs_x, &abs_y);
215 PhQueryCursor(PhInputGroup(NULL), &phcursor);
216 if (((phcursor.pos.x >= abs_x) && (phcursor.pos.x <= abs_x + this->screen->w)) &&
217 ((phcursor.pos.y >= abs_y) && (phcursor.pos.y <= abs_y + this->screen->h)))
218 {
219 SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
220 SDL_PrivateMouseMotion(0, 0, phcursor.pos.x-abs_x, phcursor.pos.y-abs_y);
221 }
222 else
223 {
224 SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS);
225 }
226
227 /* Unlock the event thread, in multi-threading environments */
228 SDL_Unlock_EventThread();
229 }