comparison src/video/bwindow/SDL_BWin.h @ 1013:a649064a3215

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".
author Sam Lantinga <slouken@libsdl.org>
date Tue, 14 Dec 2004 18:23:27 +0000
parents 3bd4d7a1ee04
children c9b51268668f
comparison
equal deleted inserted replaced
1012:f14e3059e138 1013:a649064a3215
423 423
424 case B_MOUSE_UP: 424 case B_MOUSE_UP:
425 { 425 {
426 /* mouse up doesn't give which button was released, 426 /* mouse up doesn't give which button was released,
427 only state of buttons (after release, so it's always = 0), 427 only state of buttons (after release, so it's always = 0),
428 which is is not what we need ;] 428 which is not what we need ;]
429 So we need to store button in mouse down, and restore 429 So we need to store button in mouse down, and restore
430 in mouse up :( 430 in mouse up :(
431 mouse up is (similarly to mouse down) send only when 431 mouse up is (similarly to mouse down) send only for
432 no more buttons are down */ 432 first button down (ie. it's no send if we click another button
433 without releasing previous one first) - but that's probably
434 because of how drivers are written?, not BeOS itself. */
433 int32 buttons; 435 int32 buttons;
434 int sdl_buttons = 0; 436 int sdl_buttons = 0;
435 if (msg->FindInt32("buttons", &buttons) == B_OK) { 437 if (msg->FindInt32("buttons", &buttons) == B_OK) {
436 /* Add any mouse button events */ 438 /* Add any mouse button events */
437 if ((buttons ^ B_PRIMARY_MOUSE_BUTTON) & last_buttons) { 439 if ((buttons ^ B_PRIMARY_MOUSE_BUTTON) & last_buttons) {
469 case B_KEY_DOWN: 471 case B_KEY_DOWN:
470 case B_UNMAPPED_KEY_DOWN: /* modifier keys are unmapped */ 472 case B_UNMAPPED_KEY_DOWN: /* modifier keys are unmapped */
471 { 473 {
472 int32 key; 474 int32 key;
473 int32 modifiers; 475 int32 modifiers;
476 int32 key_repeat;
477 /* Workaround for SDL message queue being filled too fast because of BeOS own key-repeat mechanism */
478 if (msg->FindInt32("be:key_repeat", &key_repeat) == B_OK && key_repeat > 0)
479 break;
480
474 if (msg->FindInt32("key", &key) == B_OK && msg->FindInt32("modifiers", &modifiers) == B_OK) { 481 if (msg->FindInt32("key", &key) == B_OK && msg->FindInt32("modifiers", &modifiers) == B_OK) {
475 SDL_keysym keysym; 482 SDL_keysym keysym;
476 keysym.scancode = key; 483 keysym.scancode = key;
477 if (key < 128) { 484 if (key < 128) {
478 keysym.sym = keymap[key]; 485 keysym.sym = keymap[key];