src/video/photon/SDL_ph_wm.c
changeset 283 3d8b6b9f1e18
parent 266 c6abdda2f666
child 291 68a8a8237c09
     1.1 --- a/src/video/photon/SDL_ph_wm.c	Wed Feb 20 01:02:33 2002 +0000
     1.2 +++ b/src/video/photon/SDL_ph_wm.c	Wed Feb 20 01:05:51 2002 +0000
     1.3 @@ -233,19 +233,15 @@
     1.4  /* Iconify current window */
     1.5  int ph_IconifyWindow(_THIS)
     1.6  {
     1.7 -   WmApiContext_t context=WmCreateContext();
     1.8 -   WmWindowDefinition_t **wininfo=malloc(sizeof(WmWindowDefinition_t)*2);
     1.9 -   int num;
    1.10 +	PhWindowEvent_t windowevent;
    1.11  
    1.12 -   SDL_Lock_EventThread();
    1.13 -   WmGetFocusList(context,2,&num,wininfo);
    1.14 -   WmPerformFrameAction(context, wininfo[0]->rid,Pt_ACTION_MIN);
    1.15 -
    1.16 -   WmDestroyContext (context);   
    1.17 -   SDL_Unlock_EventThread();	 
    1.18 -   free(wininfo);		   
    1.19 -
    1.20 -   return (0);   
    1.21 +	SDL_Lock_EventThread();
    1.22 +	memset( &windowevent, 0, sizeof (event) );
    1.23 +	windowevent.event_f = Ph_WM_HIDE;
    1.24 +	windowevent.event_state = Ph_WM_EVSTATE_HIDE;
    1.25 +	windowevent.rid = PtWidgetRid( window );
    1.26 +	PtForwardWindowEvent( &windowevent );
    1.27 +	SDL_Unlock_EventThread();
    1.28  }
    1.29  
    1.30  SDL_GrabMode ph_GrabInputNoLock(_THIS, SDL_GrabMode mode)
    1.31 @@ -255,7 +251,29 @@
    1.32  
    1.33  SDL_GrabMode ph_GrabInput(_THIS, SDL_GrabMode mode)
    1.34  {
    1.35 -   return(mode);
    1.36 +	short abs_x, abs_y;
    1.37 +
    1.38 +	SDL_Lock_EventThread();
    1.39 +/*	mode = ph_GrabInputNoLock(this, mode);*/
    1.40 +
    1.41 +	if( mode == SDL_GRAB_OFF )
    1.42 +	{
    1.43 +		PtSetResource(window, Pt_ARG_WINDOW_STATE, Pt_FALSE,
    1.44 +				Ph_WM_STATE_ISALTKEY );
    1.45 +	}
    1.46 +	else
    1.47 +	{
    1.48 +		PtSetResource(window, Pt_ARG_WINDOW_STATE, Pt_TRUE,
    1.49 +				Ph_WM_STATE_ISALTKEY );
    1.50 +
    1.51 +		PtGetAbsPosition( window, &abs_x, &abs_y );
    1.52 +		PhMoveCursorAbs( PhInputGroup( NULL ),
    1.53 +				abs_x + SDL_VideoSurface->w/2,
    1.54 +				abs_y + SDL_VideoSurface->h/2 );
    1.55 +	}
    1.56 +
    1.57 +	SDL_Unlock_EventThread();
    1.58 +	return(mode);
    1.59  }
    1.60  
    1.61  int ph_GetWMInfo(_THIS, SDL_SysWMinfo *info)