Date: Tue, 14 Dec 2004 12:08:30 +0100
authorSam Lantinga <slouken@libsdl.org>
Tue, 14 Dec 2004 18:23:27 +0000
changeset 1013a649064a3215
parent 1012 f14e3059e138
child 1014 cfcb2e1c36eb
Date: Tue, 14 Dec 2004 12:08:30 +0100
From: Marcin Konicki
Subject: Re: [SDL] SDL 1.2.8 Prerelease

I'm sending small fix for BeOS, which prevents filling up SDL's message
queue too fast.
Without it, SDL receives "key down" messages from BeOS code, for each key
repeat (BeOS handles key repeats itself, and application can check if
received "key down" message from BeOS is first time key down, or if it's
repeat, and which repeat it is). Since there is no way for "sdl driver" to
turn off "default" SDL's key-repeat mechanism, they were working both at
the same time (and queue could be filled up very fast).
So this patch removes handling "key down" message from BeOS if it's
key_repeat "type".
src/video/bwindow/SDL_BWin.h
     1.1 --- a/src/video/bwindow/SDL_BWin.h	Tue Dec 14 06:20:49 2004 +0000
     1.2 +++ b/src/video/bwindow/SDL_BWin.h	Tue Dec 14 18:23:27 2004 +0000
     1.3 @@ -425,11 +425,13 @@
     1.4  			{
     1.5  				/*	mouse up doesn't give which button was released,
     1.6  					only state of buttons (after release, so it's always = 0),
     1.7 -					which is is not what we need ;]
     1.8 +					which is not what we need ;]
     1.9  					So we need to store button in mouse down, and restore
    1.10  					in mouse up :(
    1.11 -					mouse up is (similarly to mouse down) send only when
    1.12 -					no more buttons are down */
    1.13 +					mouse up is (similarly to mouse down) send only for
    1.14 +					first button down (ie. it's no send if we click another button
    1.15 +					without releasing previous one first) - but that's probably
    1.16 +					because of how drivers are written?, not BeOS itself. */
    1.17  				int32 buttons;
    1.18  				int sdl_buttons = 0;
    1.19  				if (msg->FindInt32("buttons", &buttons) == B_OK) {
    1.20 @@ -471,6 +473,11 @@
    1.21  			{
    1.22  				int32 key;
    1.23  				int32 modifiers;
    1.24 +				int32 key_repeat;
    1.25 +				/* Workaround for SDL message queue being filled too fast because of BeOS own key-repeat mechanism */
    1.26 +				if (msg->FindInt32("be:key_repeat", &key_repeat) == B_OK && key_repeat > 0)
    1.27 +					break;
    1.28 +
    1.29  				if (msg->FindInt32("key", &key) == B_OK && msg->FindInt32("modifiers", &modifiers) == B_OK) {
    1.30  					SDL_keysym keysym;
    1.31  					keysym.scancode = key;