src/video/gem/SDL_gemevents.c
changeset 1067 f73b199bcd75
parent 1065 5d9947da7510
child 1073 6d3c1134cd19
equal deleted inserted replaced
1066:671bbd773c8a 1067:f73b199bcd75
   138 	
   138 	
   139 	for (;;)
   139 	for (;;)
   140 	{
   140 	{
   141 		int quit, resultat;
   141 		int quit, resultat;
   142 		short buffer[8], kc;
   142 		short buffer[8], kc;
       
   143 		short x2,y2,w2,h2;
   143 
   144 
   144 		quit = 0;
   145 		quit = 0;
   145 
   146 
       
   147 		event_mask = MU_MESAG|MU_TIMER|MU_KEYBD;
       
   148 		if (!GEM_fullscreen && (GEM_handle>=0)) {
       
   149 			wind_get (GEM_handle, WF_WORKXYWH, &x2, &y2, &w2, &h2);
       
   150 			event_mask |= MU_M1|MU_M2;
       
   151 		} else {
       
   152 			x2=y2=w2=h2=0;
       
   153 		}
       
   154 
   146 		resultat = evnt_multi(
   155 		resultat = evnt_multi(
   147 			MU_MESAG|MU_TIMER|MU_KEYBD,
   156 			event_mask,
   148 			0,0,0,
   157 			0,0,0,
   149 			0,0,0,0,0,
   158 			MO_ENTER,x2,y2,w2,h2,
   150 			0,0,0,0,0,
   159 			MO_LEAVE,x2,y2,w2,h2,
   151 			buffer,
   160 			buffer,
   152 			10,
   161 			10,
   153 			&dummy,&dummy,&dummy,&kstate,&kc,&dummy
   162 			&dummy,&dummy,&dummy,&kstate,&kc,&dummy
   154 		);
   163 		);
   155 
   164 
   162 			if ((prevkc != kc) || (prevks != kstate)) {
   171 			if ((prevkc != kc) || (prevks != kstate)) {
   163 				do_keyboard(kc,kstate);
   172 				do_keyboard(kc,kstate);
   164 			} else {
   173 			} else {
   165 				/* Avoid looping, if repeating same key */
   174 				/* Avoid looping, if repeating same key */
   166 				break;
   175 				break;
       
   176 			}
       
   177 		}
       
   178 
       
   179 		/* Mouse entering/leaving window */
       
   180 		if (resultat & MU_M1) {
       
   181 			if (this->input_grab == SDL_GRAB_OFF) {
       
   182 				SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
       
   183 			}
       
   184 		}
       
   185 		if (resultat & MU_M2) {
       
   186 			if (this->input_grab == SDL_GRAB_OFF) {
       
   187 				SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS);
   167 			}
   188 			}
   168 		}
   189 		}
   169 
   190 
   170 		/* Timer event ? */
   191 		/* Timer event ? */
   171 		if ((resultat & MU_TIMER) || quit)
   192 		if ((resultat & MU_TIMER) || quit)
   222 			wind_set(message[3],WF_CURRXYWH,message[4],message[5],message[6],message[7]);
   243 			wind_set(message[3],WF_CURRXYWH,message[4],message[5],message[6],message[7]);
   223 			break;
   244 			break;
   224 		case WM_TOPPED:
   245 		case WM_TOPPED:
   225 			wind_set(message[3],WF_TOP,message[4],0,0,0);
   246 			wind_set(message[3],WF_TOP,message[4],0,0,0);
   226 			SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS);
   247 			SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS);
   227 			if (this->input_grab == SDL_GRAB_OFF) {
       
   228 				SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
       
   229 			}
       
   230 			break;
   248 			break;
   231 		case WM_REDRAW:
   249 		case WM_REDRAW:
   232 			if (!GEM_lock_redraw) {
   250 			if (!GEM_lock_redraw) {
   233 				GEM_wind_redraw(this, message[3],&message[4]);
   251 				GEM_wind_redraw(this, message[3],&message[4]);
   234 			}
   252 			}
   287 			}
   305 			}
   288 			break;
   306 			break;
   289 		case WM_BOTTOMED:
   307 		case WM_BOTTOMED:
   290 		case WM_UNTOPPED:
   308 		case WM_UNTOPPED:
   291 			SDL_PrivateAppActive(0, SDL_APPINPUTFOCUS);
   309 			SDL_PrivateAppActive(0, SDL_APPINPUTFOCUS);
   292 			if (this->input_grab == SDL_GRAB_OFF) {
       
   293 				SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS);
       
   294 			}
       
   295 			break;
   310 			break;
   296 	}
   311 	}
   297 	
   312 	
   298 	return quit;
   313 	return quit;
   299 }
   314 }
   324 static void do_mouse(_THIS, short mx, short my, short mb, short ks)
   339 static void do_mouse(_THIS, short mx, short my, short mb, short ks)
   325 {
   340 {
   326 	static short prevmousex=0, prevmousey=0, prevmouseb=0;
   341 	static short prevmousex=0, prevmousey=0, prevmouseb=0;
   327 	short x2, y2, w2, h2;
   342 	short x2, y2, w2, h2;
   328 
   343 
       
   344 	/* Don't return mouse events if out of window */
       
   345 	if ((SDL_GetAppState() & SDL_APPMOUSEFOCUS)==0) {
       
   346 		return;
       
   347 	}
       
   348 
   329 	/* Retrieve window coords, and generate mouse events accordingly */
   349 	/* Retrieve window coords, and generate mouse events accordingly */
   330 	x2 = y2 = 0;
   350 	x2 = y2 = 0;
   331 	w2 = VDI_w;
   351 	w2 = VDI_w;
   332 	h2 = VDI_h;
   352 	h2 = VDI_h;
   333 	if ((!GEM_fullscreen) && (GEM_handle>=0)) {
   353 	if ((!GEM_fullscreen) && (GEM_handle>=0)) {