X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=vid_glx.c;h=9f142bb9a0caf34be92da7fe97f6611d3a111146;hb=4392c3a8e0dc8ad2b18e7c57545dda80d84738e0;hp=26b63dbacc1f5b0aaa5dd5cf4498fe588e388d7b;hpb=728afed30f0ce949a9a62ef996e47288d6013d19;p=xonotic%2Fdarkplaces.git diff --git a/vid_glx.c b/vid_glx.c index 26b63dba..9f142bb9 100644 --- a/vid_glx.c +++ b/vid_glx.c @@ -89,7 +89,7 @@ static Window win, root; static GLXContext ctx = NULL; static GC vidx11_gc = NULL; static XImage *vidx11_ximage[2] = { NULL, NULL }; -static int vidx11_ximage_pos; +static int vidx11_ximage_pos = 0; static XShmSegmentInfo vidx11_shminfo[2]; static int vidx11_shmevent = -1; static int vidx11_shmwait = 0; // number of frames outstanding @@ -278,7 +278,9 @@ static int XLateKey(XKeyEvent *ev, Uchar *ascii) case XK_KP_Subtract: key = K_KP_MINUS; break; case XK_KP_Divide: key = K_KP_SLASH; break; - case XK_section: key = '~'; break; + case XK_asciicircum: *ascii = key = '^'; break; // for some reason, XLookupString returns "" on this one for Grunt|2 + + case XK_section: *ascii = key = '~'; break; default: if (keysym < 32) @@ -829,9 +831,10 @@ void *GL_GetProcAddress(const char *name) void VID_Shutdown(void) { - if (!ctx || !vidx11_display) + if (!vidx11_display) return; + VID_EnableJoystick(false); VID_SetMouse(false, false, false); VID_RestoreSystemGamma(); @@ -849,6 +852,7 @@ void VID_Shutdown(void) if (vid.softdepthpixels) free(vid.softdepthpixels); + vid.softdepthpixels = NULL; if (win) XDestroyWindow(vidx11_display, win); @@ -921,6 +925,7 @@ void VID_Finish (void) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: + case RENDERPATH_GLES1: case RENDERPATH_GLES2: if (vid_usingvsync != vid_usevsync) { @@ -1668,8 +1673,34 @@ void Sys_SendKeyEvents(void) HandleEvents(); } +void VID_BuildJoyState(vid_joystate_t *joystate) +{ + VID_Shared_BuildJoyState_Begin(joystate); + VID_Shared_BuildJoyState_Finish(joystate); +} + +void VID_EnableJoystick(qboolean enable) +{ + int index = joy_enable.integer > 0 ? joy_index.integer : -1; + qboolean success = false; + int sharedcount = 0; + sharedcount = VID_Shared_SetJoystick(index); + if (index >= 0 && index < sharedcount) + success = true; + + // update cvar containing count of XInput joysticks + if (joy_detected.integer != sharedcount) + Cvar_SetValueQuick(&joy_detected, sharedcount); + + Cvar_SetValueQuick(&joy_active, success ? 1 : 0); +} + void IN_Move (void) { + vid_joystate_t joystate; + VID_EnableJoystick(true); + VID_BuildJoyState(&joystate); + VID_ApplyJoyState(&joystate); } size_t VID_ListModes(vid_mode_t *modes, size_t maxcount)