diff options
author | Stijn Buys <ingar@osirion.org> | 2009-06-05 21:09:28 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2009-06-05 21:09:28 +0000 |
commit | 5b94df1df2707b36401d91d80b92d0e4cdfd2277 (patch) | |
tree | ba18980848c5fcc6d768d35d6cba8c84547d37f1 /src | |
parent | a0cb9f0208b5ecdffdd9328d5305ed99e7cbd5e6 (diff) |
fix playerview keyboard events
Diffstat (limited to 'src')
-rw-r--r-- | src/client/input.cc | 8 | ||||
-rw-r--r-- | src/client/playerview.cc | 4 | ||||
-rw-r--r-- | src/client/worldview.cc | 1 |
3 files changed, 10 insertions, 3 deletions
diff --git a/src/client/input.cc b/src/client/input.cc index 943bed1..ee4a789 100644 --- a/src/client/input.cc +++ b/src/client/input.cc @@ -517,8 +517,6 @@ void key_pressed(Key *key) if (ui::root()->input_key(true, Keyboard::translate_keysym(key->sym(), keyboard_modifiers), keyboard_modifiers)) { - // work-around for the mouse release event FIXME - //key->key_pressed = 0; return; } else if (!core::localplayer()->view() && core::application()->connected() && core::localcontrol()) { @@ -687,6 +685,7 @@ void frame() SDL_Event event; Key *key = 0; bool pressed = false; + bool mouse_moved = false; if (last_key_time + 1.0f < client()->time()) { last_key = 0; @@ -706,8 +705,8 @@ void frame() case SDL_MOUSEMOTION: mouse_x = event.motion.x; mouse_y = event.motion.y; + mouse_moved = true; mouse_lastmoved = client()->time(); - ui::root()->input_mouse((float) mouse_x, (float) mouse_y); break; case SDL_MOUSEBUTTONDOWN: @@ -764,6 +763,9 @@ void frame() } } + if (mouse_moved) + ui::root()->input_mouse((float) mouse_x, (float) mouse_y); + /* -- handle key repeat --------------------------- */ float delay = 200.0f; // key delay time-out in milliseconds if (input_keydelay) { diff --git a/src/client/playerview.cc b/src/client/playerview.cc index ca1d47e..a37cd73 100644 --- a/src/client/playerview.cc +++ b/src/client/playerview.cc @@ -240,6 +240,10 @@ void PlayerView::draw() label_viewname->hide(); } + if (!map()->visible() && !chat()->visible()) { + view_hud->set_focus(); + } + view_hud->show(); view_lastentity = 0; } diff --git a/src/client/worldview.cc b/src/client/worldview.cc index cb46a17..7f13f45 100644 --- a/src/client/worldview.cc +++ b/src/client/worldview.cc @@ -108,6 +108,7 @@ void WorldView::draw() view_mapbutton->hide(); } else { view_playerview->show(); + view_playerview->set_focus(); if (core::localcontrol()->state() == core::Entity::Docked) { view_launchbutton->show(); |