Skip to content

Commit

Permalink
Fixed|BindContext|PlayerImpulse: PlayerImpulse double-click binding a…
Browse files Browse the repository at this point in the history
…ctivation

Symbolic events have no device identifier, they are referenced by
name and context only. Also fixed a recent refactoring oversight when
passing the generated name via ddevent_t to InputSystem::postEvent()
  • Loading branch information
danij-deng committed Nov 8, 2014
1 parent 389cdc5 commit f1a8681
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions doomsday/client/src/ui/bindcontext.cpp
Expand Up @@ -450,12 +450,13 @@ static void substituteInCommand(String const &command, ddevent_t const &event, d
static Action *commandActionFor(BindContext const &context, CommandBinding const &bind,
ddevent_t const &event, bool respectHigherContexts)
{
if(bind.deviceId != event.device) return nullptr;
if(bind.type != event.type) return nullptr;
if(bind.type != event.type) return nullptr;

InputDevice const *dev = nullptr;
if(event.type != E_SYMBOLIC)
{
if(bind.deviceId != event.device) return nullptr;

dev = inputSys().devicePtr(bind.deviceId);
if(!dev || !dev->isActive())
{
Expand Down
7 changes: 4 additions & 3 deletions doomsday/client/src/ui/playerimpulse.cpp
Expand Up @@ -136,7 +136,7 @@ DENG2_PIMPL_NOREF(PlayerImpulse)
db.triggered = true;

// Compose the name of the symbolic event.
String symbolicName = "sym-";
String symbolicName;
switch(newState)
{
case DoubleClick::Positive: symbolicName += "control-doubleclick-positive-"; break;
Expand All @@ -152,13 +152,14 @@ DENG2_PIMPL_NOREF(PlayerImpulse)
<< name << (localPlayer + 1) << newState << (nowTime - db.previousClickTime)
<< symbolicName;

Block symbolicNameUtf8 = symbolicName.toUtf8();
ddevent_t ev; de::zap(ev);
ev.device = uint(-1);
ev.type = E_SYMBOLIC;
ev.symbolic.id = playerNum;
ev.symbolic.name = symbolicName.toUtf8().constData();
ev.symbolic.name = symbolicNameUtf8.constData();

inputSys().postEvent(&ev);
inputSys().postEvent(&ev); // makes a copy.
}

db.previousClickTime = nowTime;
Expand Down

0 comments on commit f1a8681

Please sign in to comment.