From 5b94df1df2707b36401d91d80b92d0e4cdfd2277 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Fri, 5 Jun 2009 21:09:28 +0000 Subject: fix playerview keyboard events --- osirion.kdevelop | 2 +- src/client/input.cc | 8 +++++--- src/client/playerview.cc | 4 ++++ src/client/worldview.cc | 1 + 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/osirion.kdevelop b/osirion.kdevelop index 65328ac..45c0f6b 100644 --- a/osirion.kdevelop +++ b/osirion.kdevelop @@ -21,7 +21,7 @@ - src/model/libmodel.la + src/core/libcore.la debug 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(); -- cgit v1.2.3