src/video/photon/SDL_ph_events.c
changeset 266 c6abdda2f666
parent 252 e8157fcb3114
child 283 3d8b6b9f1e18
equal deleted inserted replaced
265:35d9c8a5aa10 266:c6abdda2f666
    53 
    53 
    54 /* Check to see if this is a repeated key.
    54 /* Check to see if this is a repeated key.
    55    (idea shamelessly lifted from GII -- thanks guys! :)
    55    (idea shamelessly lifted from GII -- thanks guys! :)
    56  */
    56  */
    57 
    57 
       
    58 /*
    58 static int ph_KeyRepeat(_THIS, PhKeyEvent_t* keyevent)
    59 static int ph_KeyRepeat(_THIS, PhKeyEvent_t* keyevent)
    59 {
    60 {
    60 	PhEvent_t* peekevent;
    61 //	PhEvent_t* peekevent;
    61 	PhKeyEvent_t* keyEvent;
    62 	PhKeyEvent_t* keyEvent;
    62 	int repeated;
    63 	int repeated;
    63 
    64 
    64 	repeated = 0;
    65 	repeated = 0;
    65 	switch (PhEventPeek( peekevent, EVENT_SIZE ))
    66 	switch (PhEventPeek( peekevent, EVENT_SIZE ))
    82 		case -1: {
    83 		case -1: {
    83 			perror( "PhEventPeek failed" );
    84 			perror( "PhEventPeek failed" );
    84 		}
    85 		}
    85 		break;
    86 		break;
    86 
    87 
    87 		default: /* no events pending */
    88 		default: // no events pending
    88 	}
    89 	}
    89 	return(repeated);
    90 	return(repeated);
    90 }
    91 }
       
    92 
       
    93 */
    91 
    94 
    92 /* Note:  The X server buffers and accumulates mouse motion events, so
    95 /* Note:  The X server buffers and accumulates mouse motion events, so
    93    the motion event generated by the warp may not appear exactly as we
    96    the motion event generated by the warp may not appear exactly as we
    94    expect it to.  We work around this (and improve performance) by only
    97    expect it to.  We work around this (and improve performance) by only
    95    warping the pointer when it reaches the edge, and then wait for it.
    98    warping the pointer when it reaches the edge, and then wait for it.
   116 
   119 
   117 	if ( (xevent->xmotion.x < MOUSE_FUDGE_FACTOR) ||
   120 	if ( (xevent->xmotion.x < MOUSE_FUDGE_FACTOR) ||
   118 	     (xevent->xmotion.x > (w-MOUSE_FUDGE_FACTOR)) ||
   121 	     (xevent->xmotion.x > (w-MOUSE_FUDGE_FACTOR)) ||
   119 	     (xevent->xmotion.y < MOUSE_FUDGE_FACTOR) ||
   122 	     (xevent->xmotion.y < MOUSE_FUDGE_FACTOR) ||
   120 	     (xevent->xmotion.y > (h-MOUSE_FUDGE_FACTOR)) ) {
   123 	     (xevent->xmotion.y > (h-MOUSE_FUDGE_FACTOR)) ) {
   121 		/* Get the events that have accumulated */
   124 		// Get the events that have accumulated
   122 /*		while ( XCheckTypedEvent(SDL_Display, MotionNotify, xevent) ) {
   125 /*		while ( XCheckTypedEvent(SDL_Display, MotionNotify, xevent) ) {
   123 			deltax = xevent->xmotion.x - mouse_last.x;
   126 			deltax = xevent->xmotion.x - mouse_last.x;
   124 			deltay = xevent->xmotion.y - mouse_last.y;
   127 			deltay = xevent->xmotion.y - mouse_last.y;
   125 #ifdef DEBUG_MOTION
   128 #ifdef DEBUG_MOTION
   126   printf("Extra mouse motion: %d,%d\n", deltax, deltay);
   129   printf("Extra mouse motion: %d,%d\n", deltax, deltay);
   159 }
   162 }
   160 */
   163 */
   161 
   164 
   162 /* Control which motion flags the window has set, a flags value of -1 sets
   165 /* Control which motion flags the window has set, a flags value of -1 sets
   163  * MOTION_BUTTON and MOTION_NOBUTTON */
   166  * MOTION_BUTTON and MOTION_NOBUTTON */
       
   167 
   164 static void set_motion_sensitivity(_THIS, unsigned int flags)
   168 static void set_motion_sensitivity(_THIS, unsigned int flags)
   165 {
   169 {
   166 	int rid, fields = Ph_EV_PTR_MOTION_BUTTON | Ph_EV_PTR_MOTION_NOBUTTON;
   170 	int rid, fields = Ph_EV_PTR_MOTION_BUTTON | Ph_EV_PTR_MOTION_NOBUTTON;
   167 	PhRegion_t region;
   171 	PhRegion_t region;
   168 
   172