Skip to content

Commit

Permalink
Cleanup|Input|API: Deleted obsolete key repeater code, bumped B API
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed May 1, 2014
1 parent a510f8c commit cde9910
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 81 deletions.
2 changes: 0 additions & 2 deletions doomsday/api/api_event.h
Expand Up @@ -73,7 +73,6 @@ DENG_API_TYPEDEF(B)
int (*BindingsForCommand)(const char* cmd, char* buf, size_t bufSize);
int (*BindingsForControl)(int localPlayer, const char* controlName, int inverse, char* buf, size_t bufSize);

void (*ClearKeyRepeaters)(void);
int (*GetKeyCode)(const char* name);
}
DENG_API_T(B);
Expand All @@ -82,7 +81,6 @@ DENG_API_T(B);
#define B_SetContextFallback _api_B.SetContextFallback
#define B_BindingsForCommand _api_B.BindingsForCommand
#define B_BindingsForControl _api_B.BindingsForControl
#define DD_ClearKeyRepeaters _api_B.ClearKeyRepeaters
#define DD_GetKeyCode _api_B.GetKeyCode
#endif

Expand Down
3 changes: 2 additions & 1 deletion doomsday/api/apis.h
Expand Up @@ -63,7 +63,8 @@ enum {
DE_API_BASE = DE_API_BASE_v2,

DE_API_BINDING_v1 = 100, // 1.10
DE_API_BINDING = DE_API_BINDING_v1,
DE_API_BINDING_v2 = 101, // 1.15
DE_API_BINDING = DE_API_BINDING_v2,

DE_API_BUSY_v1 = 200, // 1.10
DE_API_BUSY_v2 = 201, // 1.13
Expand Down
2 changes: 0 additions & 2 deletions doomsday/client/include/ui/dd_input.h
Expand Up @@ -191,7 +191,6 @@ typedef struct inputdev_s {
} inputdev_t;

extern int repWait1, repWait2;
extern int keyRepeatDelay1, keyRepeatDelay2; // milliseconds
extern dd_bool shiftDown, altDown;

void DD_RegisterInput(void);
Expand All @@ -207,7 +206,6 @@ void DD_PostEvent(ddevent_t *ev);
void DD_ProcessEvents(timespan_t ticLength);
void DD_ProcessSharpEvents(timespan_t ticLength);
void DD_ClearEvents(void);
void DD_ClearKeyRepeaterForKey(int ddkey, int native);
byte DD_ModKey(byte key);

bool DD_ConvertEvent(ddevent_t const *ddEvent, event_t *ev);
Expand Down
5 changes: 0 additions & 5 deletions doomsday/client/src/ui/b_context.cpp
Expand Up @@ -213,7 +213,6 @@ void B_UpdateDeviceStateAssociations(void)
// No longer valid.
dev->keys[j].assoc.flags |= IDAF_EXPIRED;
dev->keys[j].assoc.flags &= ~IDAF_TRIGGERED; // Not any more.
DD_ClearKeyRepeaterForKey(j, -1);
}
}

Expand Down Expand Up @@ -912,15 +911,11 @@ void B_WriteContextToFile(const bcontext_t* bc, FILE* file)
// b_main.c
DENG_EXTERN_C int DD_GetKeyCode(const char* key);

// dd_input.c
DENG_EXTERN_C void DD_ClearKeyRepeaters(void);

DENG_DECLARE_API(B) =
{
{ DE_API_BINDING },
B_SetContextFallback,
B_BindingsForCommand,
B_BindingsForControl,
DD_ClearKeyRepeaters,
DD_GetKeyCode
};
71 changes: 0 additions & 71 deletions doomsday/client/src/ui/dd_input.cpp
Expand Up @@ -74,16 +74,13 @@ D_CMD(AxisPrintConfig);
D_CMD(AxisChangeOption);
D_CMD(AxisChangeValue);
#endif
D_CMD(DumpKeyMap);
D_CMD(KeyMap);
D_CMD(ListInputDevices);
D_CMD(ReleaseMouse);

static void postEventsFromInputDevices(void);

// The initial and secondary repeater delays (tics).
int repWait1 = 15, repWait2 = 3;
//int keyRepeatDelay1 = 430, keyRepeatDelay2 = 85; // milliseconds
unsigned int mouseFreq = 0;
dd_bool shiftDown = false, altDown = false;

Expand Down Expand Up @@ -112,8 +109,6 @@ static char defaultShiftTable[96] = // Contains characters 32 to 127.
/* 120 */ 'X', 'Y', 'Z', 0, 0, 0, 0, 0
};

//static repeater_t keyReps[MAX_DOWNKEYS];

static float oldPOV = IJOY_POV_CENTER;

static char* eventStrings[MAXEVENTS];
Expand All @@ -132,8 +127,6 @@ static byte devRendJoyState = false; ///< cvar
void DD_RegisterInput(void)
{
// Cvars
//C_VAR_INT("input-key-delay1", &keyRepeatDelay1, CVF_NO_MAX, 50, 0);
//C_VAR_INT("input-key-delay2", &keyRepeatDelay2, CVF_NO_MAX, 20, 0);
C_VAR_BYTE("input-sharp", &useSharpInputEvents, 0, 0, 1);

#if _DEBUG
Expand All @@ -143,10 +136,6 @@ void DD_RegisterInput(void)
#endif

// Ccmds
#if 0
C_CMD("dumpkeymap", "s", DumpKeyMap);
C_CMD("keymap", "s", KeyMap);
#endif
C_CMD("listinputdevices", "", ListInputDevices);

C_CMD("releasemouse", "", ReleaseMouse);
Expand Down Expand Up @@ -404,7 +393,6 @@ void I_DeviceReset(uint ident)
if(ident == IDEV_KEYBOARD)
{
altDown = shiftDown = false;
DD_ClearKeyRepeaters();
}
}

Expand Down Expand Up @@ -895,7 +883,6 @@ dd_bool DD_IgnoreInput(dd_bool ignore)
// Clear all the event buffers.
postEventsFromInputDevices();
DD_ClearEvents();
DD_ClearKeyRepeaters();
}
return old;
}
Expand Down Expand Up @@ -1238,42 +1225,6 @@ byte DD_ModKey(byte key)
return key;
}

/**
* Clears the repeaters array.
*/
#undef DD_ClearKeyRepeaters
DENG_EXTERN_C void DD_ClearKeyRepeaters(void)
{
//memset(keyReps, 0, sizeof(keyReps));
}

void DD_ClearKeyRepeaterForKey(int ddkey, int native)
{
/*
int k;
// Clear any repeaters with this key.
for(k = 0; k < MAX_DOWNKEYS; ++k)
{
// Check the native code first, if provided.
if(native >= 0)
{
if(native != keyReps[k].native)
continue;
}
else
{
if(keyReps[k].key != ddkey) continue;
}
// Clear this.
keyReps[k].native = -1;
keyReps[k].key = 0;
memset(keyReps[k].text, 0, sizeof(keyReps[k].text));
}
*/
}

/**
* Checks the current keyboard state, generates input events
* based on pressed/held keys and posts them.
Expand Down Expand Up @@ -1323,28 +1274,6 @@ void DD_ReadKeyboard(void)
LOG_INPUT_XVERBOSE("toggle.id: %i/%c [%s:%u]")
<< ev.toggle.id << ev.toggle.id << ev.toggle.text << strlen(ev.toggle.text);

#if 0
// Maintain the repeater table.
if(ev.toggle.state == ETOG_DOWN)
{
// Find an empty repeater.
for(k = 0; k < MAX_DOWNKEYS; ++k)
if(!keyReps[k].key)
{
keyReps[k].key = ev.toggle.id;
keyReps[k].native = ke->native;
memcpy(keyReps[k].text, ev.toggle.text, sizeof(ev.toggle.text));
keyReps[k].timer = sysTime;
keyReps[k].count = 0;
break;
}
}
else if(ev.toggle.state == ETOG_UP)
{
DD_ClearKeyRepeaterForKey(ev.toggle.id, ke->native);
}
#endif

// Post the event.
DD_PostEvent(&ev);
}
Expand Down

0 comments on commit cde9910

Please sign in to comment.