comparison src/video/photon/SDL_ph_wm.c @ 283:3d8b6b9f1e18

Date: Mon, 18 Feb 2002 16:46:59 +1200 From: Julian Kinraid <jkinraid@clear.net.nz> Subject: Patches for photon port of SDL Hi, A couple more patches for photon and the nto audio. Adds mouse grabbing support, fixed cursor images, unicode keyboard events (though no unicode data on kye release, is that a problem?), hopefully fixing some audio lag problems, and a few other fixes. Thanks, Julian Kinraid
author Sam Lantinga <slouken@libsdl.org>
date Wed, 20 Feb 2002 01:05:51 +0000
parents c6abdda2f666
children 68a8a8237c09
comparison
equal deleted inserted replaced
282:b42d80e73896 283:3d8b6b9f1e18
231 } 231 }
232 232
233 /* Iconify current window */ 233 /* Iconify current window */
234 int ph_IconifyWindow(_THIS) 234 int ph_IconifyWindow(_THIS)
235 { 235 {
236 WmApiContext_t context=WmCreateContext(); 236 PhWindowEvent_t windowevent;
237 WmWindowDefinition_t **wininfo=malloc(sizeof(WmWindowDefinition_t)*2); 237
238 int num; 238 SDL_Lock_EventThread();
239 239 memset( &windowevent, 0, sizeof (event) );
240 SDL_Lock_EventThread(); 240 windowevent.event_f = Ph_WM_HIDE;
241 WmGetFocusList(context,2,&num,wininfo); 241 windowevent.event_state = Ph_WM_EVSTATE_HIDE;
242 WmPerformFrameAction(context, wininfo[0]->rid,Pt_ACTION_MIN); 242 windowevent.rid = PtWidgetRid( window );
243 243 PtForwardWindowEvent( &windowevent );
244 WmDestroyContext (context); 244 SDL_Unlock_EventThread();
245 SDL_Unlock_EventThread();
246 free(wininfo);
247
248 return (0);
249 } 245 }
250 246
251 SDL_GrabMode ph_GrabInputNoLock(_THIS, SDL_GrabMode mode) 247 SDL_GrabMode ph_GrabInputNoLock(_THIS, SDL_GrabMode mode)
252 { 248 {
253 return(mode); 249 return(mode);
254 } 250 }
255 251
256 SDL_GrabMode ph_GrabInput(_THIS, SDL_GrabMode mode) 252 SDL_GrabMode ph_GrabInput(_THIS, SDL_GrabMode mode)
257 { 253 {
258 return(mode); 254 short abs_x, abs_y;
255
256 SDL_Lock_EventThread();
257 /* mode = ph_GrabInputNoLock(this, mode);*/
258
259 if( mode == SDL_GRAB_OFF )
260 {
261 PtSetResource(window, Pt_ARG_WINDOW_STATE, Pt_FALSE,
262 Ph_WM_STATE_ISALTKEY );
263 }
264 else
265 {
266 PtSetResource(window, Pt_ARG_WINDOW_STATE, Pt_TRUE,
267 Ph_WM_STATE_ISALTKEY );
268
269 PtGetAbsPosition( window, &abs_x, &abs_y );
270 PhMoveCursorAbs( PhInputGroup( NULL ),
271 abs_x + SDL_VideoSurface->w/2,
272 abs_y + SDL_VideoSurface->h/2 );
273 }
274
275 SDL_Unlock_EventThread();
276 return(mode);
259 } 277 }
260 278
261 int ph_GetWMInfo(_THIS, SDL_SysWMinfo *info) 279 int ph_GetWMInfo(_THIS, SDL_SysWMinfo *info)
262 { 280 {
263 if (info->version.major <= SDL_MAJOR_VERSION) 281 if (info->version.major <= SDL_MAJOR_VERSION)