Skip to content

Commit

Permalink
Fixed|Input: E_FOCUS events should never be echoed
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Oct 29, 2014
1 parent 29b482e commit caf12fe
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 20 deletions.
2 changes: 1 addition & 1 deletion doomsday/client/src/ui/b_command.cpp
Expand Up @@ -164,7 +164,7 @@ static dd_bool B_ParseEvent(evbinding_t *eb, char const *desc)
}
else if(!Str_CompareIgnoreCase(str, "sym"))
{
// It must be a symbolic event.
// A symbolic event.
eb->type = E_SYMBOLIC;
eb->device = 0;
eb->symbolicName = strdup(desc);
Expand Down
3 changes: 2 additions & 1 deletion doomsday/client/src/ui/b_main.cpp
Expand Up @@ -432,7 +432,8 @@ dd_bool B_Responder(ddevent_t *ev)
{
DENG2_ASSERT(ev);

if(symbolicEchoMode && ev->type != E_SYMBOLIC)
if(symbolicEchoMode &&
ev->type != E_SYMBOLIC && ev->type != E_FOCUS)
{
// Make an echo.
// Axis events need a bit of filtering.
Expand Down
3 changes: 2 additions & 1 deletion doomsday/client/src/ui/clientwindow.cpp
Expand Up @@ -464,7 +464,8 @@ DENG2_PIMPL(ClientWindow)
}

// Generate an event about this.
ddevent_t ev;
ddevent_t ev; de::zap(ev);
ev.device = uint(-1);
ev.type = E_FOCUS;
ev.focus.gained = hasFocus;
ev.focus.inWindow = 1; /// @todo Ask WindowSystem for an identifier number.
Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/src/ui/dd_input.cpp
Expand Up @@ -856,7 +856,7 @@ static void postToQueue(eventqueue_t *q, ddevent_t *ev)
/// @note Called by the I/O functions when input is detected.
void DD_PostEvent(ddevent_t *ev)
{
DENG2_ASSERT(ev && ev->device < NUM_INPUT_DEVICES);
DENG2_ASSERT(ev);// && ev->device < NUM_INPUT_DEVICES);

eventqueue_t *q = &queue;
if(useSharpInputEvents &&
Expand Down
26 changes: 10 additions & 16 deletions doomsday/client/src/ui/p_control.cpp
Expand Up @@ -294,23 +294,16 @@ void P_MaintainControlDoubleClicks(int playerNum, int control, float pos)
if(newState == db->previousClickState &&
nowTime - db->previousClickTime < (uint) MAX_OF(0, doubleClickThresholdMilliseconds))
{
ddevent_t event;
Str* symbolicName = Str_NewStd();
Str *symbolicName = Str_NewStd();

db->triggered = true;

switch(newState)
{
case DBCS_POSITIVE:
Str_Append(symbolicName, "control-doubleclick-positive-");
break;
case DBCS_POSITIVE: Str_Append(symbolicName, "control-doubleclick-positive-"); break;
case DBCS_NEGATIVE: Str_Append(symbolicName, "control-doubleclick-negative-"); break;

case DBCS_NEGATIVE:
Str_Append(symbolicName, "control-doubleclick-negative-");
break;

default:
break;
default: break;
}

// Compose the name of the symbolic event.
Expand All @@ -322,12 +315,13 @@ void P_MaintainControlDoubleClicks(int playerNum, int control, float pos)
<< playerNum << control << newState << nowTime - db->previousClickTime
<< Str_Text(symbolicName);

event.device = 0;
event.type = E_SYMBOLIC;
event.symbolic.id = playerNum;
event.symbolic.name = Str_Text(symbolicName);
ddevent_t ev; de::zap(ev);
ev.device = uint(-1);
ev.type = E_SYMBOLIC;
ev.symbolic.id = playerNum;
ev.symbolic.name = Str_Text(symbolicName);

DD_PostEvent(&event);
DD_PostEvent(&ev);

Str_Delete(symbolicName);
}
Expand Down

0 comments on commit caf12fe

Please sign in to comment.