src/video/x11/SDL_x11events.c
changeset 412 ac59b067815b
parent 297 f6ffac90895c
child 496 864a66f028d8
     1.1 --- a/src/video/x11/SDL_x11events.c	Thu Jun 13 16:54:26 2002 +0000
     1.2 +++ b/src/video/x11/SDL_x11events.c	Thu Jun 13 16:54:38 2002 +0000
     1.3 @@ -835,7 +835,7 @@
     1.4  void X11_SetKeyboardState(Display *display, const char *key_vec)
     1.5  {
     1.6  	char keys_return[32];
     1.7 -	int i, gen_event;
     1.8 +	int i;
     1.9  	KeyCode xcode[SDLK_LAST];
    1.10  	Uint8 new_kstate[SDLK_LAST];
    1.11  	Uint8 *kstate = SDL_GetKeyState(NULL);
    1.12 @@ -846,15 +846,8 @@
    1.13  
    1.14  	/* The first time the window is mapped, we initialize key state */
    1.15  	if ( ! key_vec ) {
    1.16 +		XQueryKeymap(display, keys_return);
    1.17  		key_vec = keys_return;
    1.18 -		XQueryKeymap(display, keys_return);
    1.19 -		gen_event = 0;
    1.20 -	} else {
    1.21 -#if 1 /* We no longer generate key down events, just update state */
    1.22 -		gen_event = 0;
    1.23 -#else
    1.24 -		gen_event = 1;
    1.25 -#endif
    1.26  	}
    1.27  
    1.28  	/* Get the keyboard modifier state */
    1.29 @@ -927,23 +920,7 @@
    1.30  					break;
    1.31  			}
    1.32  		}
    1.33 -		if ( kstate[i] == state )
    1.34 -			continue;
    1.35 -
    1.36 -		/*
    1.37 -		 * Send a fake keyboard event correcting the difference between
    1.38 -		 * SDL's keyboard state and the actual. Note that there is no
    1.39 -		 * way to find out the scancode for key releases, but since all
    1.40 -		 * keys are released when focus is lost only keypresses should
    1.41 -		 * be sent here
    1.42 -		 */
    1.43 -		if ( gen_event ) {
    1.44 -			SDL_keysym sk;
    1.45 -			memset(&sk, 0, sizeof(sk));
    1.46 -			sk.sym = i;
    1.47 -			sk.scancode = xcode[i];	/* only valid for key press */
    1.48 -			SDL_PrivateKeyboard(state, &sk);
    1.49 -		} else {
    1.50 +		if ( kstate[i] != state ) {
    1.51  			kstate[i] = state;
    1.52  		}
    1.53  	}