mirror of
https://git.code.sf.net/p/quake/quakeforge-old
synced 2024-11-10 06:31:56 +00:00
Backport from main trunk:
Honor _windowed_mouse in addition to LibGGI's native Ctrl-Alt-m method. Requires current LibGII. Added support for numpad keys and some other ones missing.
This commit is contained in:
parent
47f1a075fd
commit
27528735bd
1 changed files with 54 additions and 34 deletions
|
@ -44,8 +44,8 @@ cvar_t m_filter = {"m_filter","0", true};
|
|||
static qboolean mouse_avail;
|
||||
static float mouse_x, mouse_y;
|
||||
static float old_mouse_x, old_mouse_y;
|
||||
static int p_mouse_x;
|
||||
static int p_mouse_y;
|
||||
static int p_mouse_x, p_mouse_y;
|
||||
static float old_windowed_mouse;
|
||||
|
||||
static ggi_visual_t ggivis = NULL;
|
||||
static ggi_mode mode;
|
||||
|
@ -683,35 +683,50 @@ static int XLateKey(ggi_key_event *ev)
|
|||
ev->label = GII_KVAL(ev->label);
|
||||
}
|
||||
switch(ev->label) {
|
||||
case GIIK_P9:
|
||||
case GIIK_P9: key = KP_PGUP; break;
|
||||
case GIIK_PageUp: key = K_PGUP; break;
|
||||
|
||||
case GIIK_P3:
|
||||
case GIIK_P3: key = KP_PGDN; break;
|
||||
case GIIK_PageDown: key = K_PGDN; break;
|
||||
|
||||
case GIIK_P7:
|
||||
case GIIK_P7: key = KP_HOME; break;
|
||||
case GIIK_Home: key = K_HOME; break;
|
||||
|
||||
case GIIK_P1:
|
||||
case GIIK_P1: key = KP_END; break;
|
||||
case GIIK_End: key = K_END; break;
|
||||
|
||||
case GIIK_P4:
|
||||
case GIIK_P4: key = KP_LEFTARROW; break;
|
||||
case GIIK_Left: key = K_LEFTARROW; break;
|
||||
|
||||
case GIIK_P6:
|
||||
case GIIK_P6: key = KP_RIGHTARROW; break;
|
||||
case GIIK_Right: key = K_RIGHTARROW; break;
|
||||
|
||||
case GIIK_P2:
|
||||
case GIIK_P2: key = KP_DOWNARROW; break;
|
||||
case GIIK_Down: key = K_DOWNARROW; break;
|
||||
|
||||
case GIIK_P8:
|
||||
case GIIK_P8: key = KP_UPARROW; break;
|
||||
case GIIK_Up: key = K_UPARROW; break;
|
||||
|
||||
case GIIUC_Escape: key = K_ESCAPE; break;
|
||||
case GIIK_P5: key = KP_5; break;
|
||||
case GIIK_PBegin: key = K_AUX32; break;
|
||||
|
||||
case GIIK_PEnter:
|
||||
case GIIK_P0: key = KP_INS; break;
|
||||
case GIIK_Insert: key = K_INS; break;
|
||||
|
||||
case GIIK_PSeparator:
|
||||
case GIIK_PDecimal: key = KP_DEL; break;
|
||||
case GIIUC_Delete: key = K_DEL; break;
|
||||
|
||||
case GIIK_PStar: key = KP_MULTIPLY; break;
|
||||
case GIIK_PPlus: key = KP_PLUS; break;
|
||||
case GIIK_PMinus: key = KP_MINUS; break;
|
||||
case GIIK_PSlash: key = KP_DIVIDE; break;
|
||||
|
||||
case GIIK_PEnter: key = KP_ENTER; break;
|
||||
case GIIUC_Return: key = K_ENTER; break;
|
||||
|
||||
case GIIUC_Escape: key = K_ESCAPE; break;
|
||||
|
||||
case GIIUC_Tab: key = K_TAB; break;
|
||||
|
||||
case GIIK_F1: key = K_F1; break;
|
||||
|
@ -729,36 +744,24 @@ static int XLateKey(ggi_key_event *ev)
|
|||
|
||||
case GIIUC_BackSpace: key = K_BACKSPACE; break;
|
||||
|
||||
case GIIK_PSeparator:
|
||||
case GIIK_PDecimal:
|
||||
case GIIUC_Delete: key = K_DEL; break;
|
||||
|
||||
case GIIK_Pause: key = K_PAUSE; break;
|
||||
|
||||
case GIIK_ShiftL:
|
||||
case GIIK_ShiftR: key = K_SHIFT; break;
|
||||
|
||||
case GIIK_Execute:
|
||||
case GIIK_CtrlL:
|
||||
case GIIK_Execute:
|
||||
case GIIK_CtrlL:
|
||||
case GIIK_CtrlR: key = K_CTRL; break;
|
||||
|
||||
case GIIK_AltL:
|
||||
case GIIK_MetaL:
|
||||
case GIIK_AltR:
|
||||
case GIIK_AltL:
|
||||
case GIIK_MetaL:
|
||||
case GIIK_AltR:
|
||||
case GIIK_MetaR:
|
||||
case GIIK_AltGr:
|
||||
case GIIK_ModeSwitch: key = K_ALT; break;
|
||||
|
||||
case GIIK_P5:
|
||||
case GIIK_PBegin: key = K_AUX32; break;
|
||||
|
||||
case GIIK_Insert:
|
||||
case GIIK_P0: key = K_INS; break;
|
||||
|
||||
case GIIK_PStar: key = '*'; break;
|
||||
case GIIK_PPlus: key = '+'; break;
|
||||
case GIIK_PMinus: key = '-'; break;
|
||||
case GIIK_PSlash: key = '/'; break;
|
||||
case GIIK_PrintScreen: key = K_PRNTSCR; break;
|
||||
case GIIK_ScrollLock: key = K_SCRLCK; break;
|
||||
case GIIK_Pause: key = K_PAUSE; break;
|
||||
case GIIK_NumLock: key = KP_NUMLCK; break;
|
||||
|
||||
case GIIUC_Comma: case GIIUC_Minus: case GIIUC_Period:
|
||||
key = ev->label;
|
||||
|
@ -869,6 +872,8 @@ void Sys_SendKeyEvents(void)
|
|||
|
||||
void IN_Init(void)
|
||||
{
|
||||
Cvar_RegisterVariable(&_windowed_mouse);
|
||||
old_windowed_mouse = -1; /* Force update */
|
||||
Cvar_RegisterVariable(&m_filter);
|
||||
if (COM_CheckParm ("-nomouse")) return;
|
||||
|
||||
|
@ -883,7 +888,22 @@ void IN_Shutdown(void)
|
|||
|
||||
void IN_Commands(void)
|
||||
{
|
||||
/* Mouse buttons are sent from GetEvent() */
|
||||
/* Only supported by LibGII 0.7 or later. */
|
||||
#ifdef GII_CMDCODE_PREFER_RELPTR
|
||||
if (old_windowed_mouse != _windowed_mouse.value) {
|
||||
gii_event ev;
|
||||
|
||||
old_windowed_mouse = _windowed_mouse.value;
|
||||
|
||||
ev.cmd.size = sizeof(gii_cmd_nodata_event);
|
||||
ev.cmd.type = evCommand;
|
||||
ev.cmd.target = GII_EV_TARGET_ALL;
|
||||
ev.cmd.code = (int)_windowed_mouse.value ? GII_CMDCODE_PREFER_RELPTR
|
||||
: GII_CMDCODE_PREFER_ABSPTR;
|
||||
|
||||
ggiEventSend(ggivis, &ev);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void IN_Move(usercmd_t *cmd)
|
||||
|
|
Loading…
Reference in a new issue