2 Copyright (C) 1996-1997 Id Software, Inc.
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 //#include <termios.h>
21 //#include <sys/ioctl.h>
22 //#include <sys/stat.h>
31 #include <X11/Xutil.h>
34 #include <X11/keysym.h>
35 #include <X11/cursorfont.h>
37 #include <X11/extensions/XShm.h>
38 #if !defined(__APPLE__) && !defined(__MACH__) && !defined(SUNOS)
39 #include <X11/extensions/xf86dga.h>
41 #include <X11/extensions/xf86vmode.h>
45 // Tell startup code that we have a client
46 int cl_available = true;
48 // note: if we used the XRandR extension we could support refresh rates
49 qboolean vid_supportrefreshrate = false;
52 XVisualInfo *(GLAPIENTRY *qglXChooseVisual)(Display *dpy, int screen, int *attribList);
53 GLXContext (GLAPIENTRY *qglXCreateContext)(Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct);
54 void (GLAPIENTRY *qglXDestroyContext)(Display *dpy, GLXContext ctx);
55 Bool (GLAPIENTRY *qglXMakeCurrent)(Display *dpy, GLXDrawable drawable, GLXContext ctx);
56 void (GLAPIENTRY *qglXSwapBuffers)(Display *dpy, GLXDrawable drawable);
57 const char *(GLAPIENTRY *qglXQueryExtensionsString)(Display *dpy, int screen);
59 //GLX_ARB_get_proc_address
60 void *(GLAPIENTRY *qglXGetProcAddressARB)(const GLubyte *procName);
62 static dllfunction_t getprocaddressfuncs[] =
64 {"glXGetProcAddressARB", (void **) &qglXGetProcAddressARB},
68 //GLX_SGI_swap_control
69 GLint (GLAPIENTRY *qglXSwapIntervalSGI)(GLint interval);
71 static dllfunction_t swapcontrolfuncs[] =
73 {"glXSwapIntervalSGI", (void **) &qglXSwapIntervalSGI},
77 static Display *vidx11_display = NULL;
78 static int vidx11_screen;
80 static GLXContext ctx = NULL;
82 Atom wm_delete_window_atom;
84 #define KEY_MASK (KeyPressMask | KeyReleaseMask)
85 #define MOUSE_MASK (ButtonPressMask | ButtonReleaseMask | \
86 PointerMotionMask | ButtonMotionMask)
87 #define X_MASK (KEY_MASK | MOUSE_MASK | VisibilityChangeMask | \
88 StructureNotifyMask | FocusChangeMask | EnterWindowMask | \
92 static qboolean mouse_avail = true;
93 static qboolean vid_usingmouse = false;
94 static qboolean vid_usingvsync = false;
95 static qboolean vid_usevsync = false;
96 static qboolean vid_x11_hardwaregammasupported = false;
97 static int vid_x11_gammarampsize = 0;
98 static float mouse_x, mouse_y;
99 static int p_mouse_x, p_mouse_y;
101 #if !defined(__APPLE__) && !defined(SUNOS)
102 // FIXME: vid_dga_mouseaccel is poorly named, it is actually the multiplier for mouse movement, not an acceleration (which would be a power function or something)
103 cvar_t vid_dga = {CVAR_SAVE, "vid_dga", "1", "make use of DGA mouse input"};
104 cvar_t vid_dga_mouseaccel = {0, "vid_dga_mouseaccel", "1", "speed of mouse when using DGA mouse input"};
107 qboolean vidmode_ext = false;
109 static int win_x, win_y;
111 static XF86VidModeModeInfo init_vidmode;
112 static qboolean vid_isfullscreen = false;
114 static Visual *vidx11_visual;
115 static Colormap vidx11_colormap;
117 /*-----------------------------------------------------------------------*/
119 static int XLateKey(XKeyEvent *ev, char *ascii)
123 KeySym keysym, shifted;
125 keysym = XLookupKeysym (ev, 0);
126 XLookupString(ev, buf, sizeof buf, &shifted, 0);
131 case XK_KP_Page_Up: key = K_KP_PGUP; break;
132 case XK_Page_Up: key = K_PGUP; break;
134 case XK_KP_Page_Down: key = K_KP_PGDN; break;
135 case XK_Page_Down: key = K_PGDN; break;
137 case XK_KP_Home: key = K_KP_HOME; break;
138 case XK_Home: key = K_HOME; break;
140 case XK_KP_End: key = K_KP_END; break;
141 case XK_End: key = K_END; break;
143 case XK_KP_Left: key = K_KP_LEFTARROW; break;
144 case XK_Left: key = K_LEFTARROW; break;
146 case XK_KP_Right: key = K_KP_RIGHTARROW; break;
147 case XK_Right: key = K_RIGHTARROW; break;
149 case XK_KP_Down: key = K_KP_DOWNARROW; break;
150 case XK_Down: key = K_DOWNARROW; break;
152 case XK_KP_Up: key = K_KP_UPARROW; break;
153 case XK_Up: key = K_UPARROW; break;
155 case XK_Escape: key = K_ESCAPE; break;
157 case XK_KP_Enter: key = K_KP_ENTER; break;
158 case XK_Return: key = K_ENTER; break;
160 case XK_Tab: key = K_TAB; break;
162 case XK_F1: key = K_F1; break;
164 case XK_F2: key = K_F2; break;
166 case XK_F3: key = K_F3; break;
168 case XK_F4: key = K_F4; break;
170 case XK_F5: key = K_F5; break;
172 case XK_F6: key = K_F6; break;
174 case XK_F7: key = K_F7; break;
176 case XK_F8: key = K_F8; break;
178 case XK_F9: key = K_F9; break;
180 case XK_F10: key = K_F10; break;
182 case XK_F11: key = K_F11; break;
184 case XK_F12: key = K_F12; break;
186 case XK_BackSpace: key = K_BACKSPACE; break;
188 case XK_KP_Delete: key = K_KP_DEL; break;
189 case XK_Delete: key = K_DEL; break;
191 case XK_Pause: key = K_PAUSE; break;
194 case XK_Shift_R: key = K_SHIFT; break;
198 case XK_Control_R: key = K_CTRL; break;
202 case XK_ISO_Level3_Shift:
204 case XK_Meta_R: key = K_ALT; break;
206 case XK_KP_Begin: key = K_KP_5; break;
208 case XK_Insert:key = K_INS; break;
209 case XK_KP_Insert: key = K_KP_INS; break;
211 case XK_KP_Multiply: key = '*'; break;
212 case XK_KP_Add: key = K_KP_PLUS; break;
213 case XK_KP_Subtract: key = K_KP_MINUS; break;
214 case XK_KP_Divide: key = K_KP_SLASH; break;
216 case XK_section: key = '~'; break;
222 if (keysym >= 'A' && keysym <= 'Z')
223 key = keysym - 'A' + 'a';
233 static Cursor CreateNullCursor(Display *display, Window root)
241 cursormask = XCreatePixmap(display, root, 1, 1, 1);
242 xgc.function = GXclear;
243 gc = XCreateGC(display, cursormask, GCFunction, &xgc);
244 XFillRectangle(display, cursormask, gc, 0, 0, 1, 1);
245 dummycolour.pixel = 0;
247 dummycolour.flags = 04;
248 cursor = XCreatePixmapCursor(display, cursormask, cursormask, &dummycolour,&dummycolour, 0,0);
249 XFreePixmap(display,cursormask);
254 static void IN_Activate (qboolean grab)
260 if (!vid_usingmouse && mouse_avail && win)
262 XWindowAttributes attribs_1;
263 XSetWindowAttributes attribs_2;
265 XGetWindowAttributes(vidx11_display, win, &attribs_1);
266 attribs_2.event_mask = attribs_1.your_event_mask | KEY_MASK | MOUSE_MASK;
267 XChangeWindowAttributes(vidx11_display, win, CWEventMask, &attribs_2);
270 XDefineCursor(vidx11_display, win, CreateNullCursor(vidx11_display, win));
272 XGrabPointer(vidx11_display, win, True, 0, GrabModeAsync, GrabModeAsync, win, None, CurrentTime);
274 #if !defined(__APPLE__) && !defined(SUNOS)
277 int MajorVersion, MinorVersion;
279 if (!XF86DGAQueryVersion(vidx11_display, &MajorVersion, &MinorVersion))
281 // unable to query, probably not supported
282 Con_Print( "Failed to detect XF86DGA Mouse\n" );
283 Cvar_SetValueQuick(&vid_dga, 0);
284 XWarpPointer(vidx11_display, None, win, 0, 0, 0, 0, vid.width / 2, vid.height / 2);
288 XF86DGADirectVideo(vidx11_display, DefaultScreen(vidx11_display), XF86DGADirectMouse);
289 XWarpPointer(vidx11_display, None, win, 0, 0, 0, 0, 0, 0);
294 XWarpPointer(vidx11_display, None, win, 0, 0, 0, 0, vid.width / 2, vid.height / 2);
296 XGrabKeyboard(vidx11_display, win, False, GrabModeAsync, GrabModeAsync, CurrentTime);
298 mouse_x = mouse_y = 0;
299 cl_ignoremousemove = true;
300 vid_usingmouse = true;
307 #if !defined(__APPLE__) && !defined(SUNOS)
309 XF86DGADirectVideo(vidx11_display, DefaultScreen(vidx11_display), 0);
312 XUngrabPointer(vidx11_display, CurrentTime);
313 XUngrabKeyboard(vidx11_display, CurrentTime);
317 XUndefineCursor(vidx11_display, win);
319 cl_ignoremousemove = true;
320 vid_usingmouse = false;
325 static keynum_t buttonremap[18] =
347 static void HandleEvents(void)
352 qboolean dowarp = false;
357 while (XPending(vidx11_display))
359 XNextEvent(vidx11_display, &event);
365 key = XLateKey (&event.xkey, &ascii);
366 Key_Event(key, ascii, true);
371 key = XLateKey (&event.xkey, &ascii);
372 Key_Event(key, ascii, false);
379 #if !defined(__APPLE__) && !defined(SUNOS)
380 if (vid_dga.integer == 1)
382 mouse_x += event.xmotion.x_root * vid_dga_mouseaccel.value;
383 mouse_y += event.xmotion.y_root * vid_dga_mouseaccel.value;
389 if (!event.xmotion.send_event)
391 mouse_x += event.xmotion.x - p_mouse_x;
392 mouse_y += event.xmotion.y - p_mouse_y;
393 if (abs(vid.width/2 - event.xmotion.x) > vid.width / 4 || abs(vid.height/2 - event.xmotion.y) > vid.height / 4)
396 p_mouse_x = event.xmotion.x;
397 p_mouse_y = event.xmotion.y;
401 // ui_mouseupdate(event.xmotion.x, event.xmotion.y);
405 // mouse button pressed
406 if (event.xbutton.button <= 18)
407 Key_Event(buttonremap[event.xbutton.button - 1], 0, true);
409 Con_Printf("HandleEvents: ButtonPress gave value %d, 1-18 expected\n", event.xbutton.button);
413 // mouse button released
414 if (event.xbutton.button <= 18)
415 Key_Event(buttonremap[event.xbutton.button - 1], 0, false);
417 Con_Printf("HandleEvents: ButtonRelease gave value %d, 1-18 expected\n", event.xbutton.button);
422 win_x = event.xcreatewindow.x;
423 win_y = event.xcreatewindow.y;
426 case ConfigureNotify:
427 // window changed size/location
428 win_x = event.xconfigure.x;
429 win_y = event.xconfigure.y;
432 // window has been destroyed
436 // window manager messages
437 if ((event.xclient.format == 32) && ((unsigned int)event.xclient.data.l[0] == wm_delete_window_atom))
443 vid_activewindow = false;
444 VID_RestoreSystemGamma();
447 // window iconified/rolledup/whatever
449 vid_activewindow = false;
450 VID_RestoreSystemGamma();
453 // window is now the input focus
454 vid_activewindow = true;
457 // window is no longer the input focus
458 vid_activewindow = false;
459 VID_RestoreSystemGamma();
462 // mouse entered window
472 /* move the mouse to the window center again */
473 p_mouse_x = vid.width / 2;
474 p_mouse_y = vid.height / 2;
475 XWarpPointer(vidx11_display, None, win, 0, 0, 0, 0, p_mouse_x, p_mouse_y);
479 static void *prjobj = NULL;
481 static void GL_CloseLibrary(void)
487 qglXGetProcAddressARB = NULL;
490 gl_platformextensions = "";
493 static int GL_OpenLibrary(const char *name)
495 Con_Printf("Loading OpenGL driver %s\n", name);
497 if (!(prjobj = dlopen(name, RTLD_LAZY)))
499 Con_Printf("Unable to open symbol list for %s\n", name);
502 strcpy(gl_driver, name);
506 void *GL_GetProcAddress(const char *name)
509 if (qglXGetProcAddressARB != NULL)
510 p = (void *) qglXGetProcAddressARB((GLubyte *)name);
512 p = (void *) dlsym(prjobj, name);
516 void VID_Shutdown(void)
518 if (!ctx || !vidx11_display)
524 VID_RestoreSystemGamma();
526 // FIXME: glXDestroyContext here?
527 if (vid_isfullscreen)
528 XF86VidModeSwitchToMode(vidx11_display, vidx11_screen, &init_vidmode);
530 XDestroyWindow(vidx11_display, win);
531 XCloseDisplay(vidx11_display);
534 vid_isfullscreen = false;
535 vidx11_display = NULL;
543 void signal_handler(int sig)
545 Con_Printf("Received signal %d, exiting...\n", sig);
546 VID_RestoreSystemGamma();
553 signal(SIGHUP, signal_handler);
554 signal(SIGINT, signal_handler);
555 signal(SIGQUIT, signal_handler);
556 signal(SIGILL, signal_handler);
557 signal(SIGTRAP, signal_handler);
558 signal(SIGIOT, signal_handler);
559 signal(SIGBUS, signal_handler);
560 signal(SIGFPE, signal_handler);
561 signal(SIGSEGV, signal_handler);
562 signal(SIGTERM, signal_handler);
565 void VID_Finish (qboolean allowmousegrab)
567 qboolean vid_usemouse;
569 vid_usevsync = vid_vsync.integer && !cls.timedemo && gl_videosyncavailable;
570 if (vid_usingvsync != vid_usevsync && gl_videosyncavailable)
572 vid_usingvsync = vid_usevsync;
573 if (qglXSwapIntervalSGI (vid_usevsync))
574 Con_Print("glXSwapIntervalSGI didn't accept the vid_vsync change, it will take effect on next vid_restart (GLX_SGI_swap_control does not allow turning off vsync)\n");
577 // handle the mouse state when windowed if that's changed
578 vid_usemouse = false;
579 if (allowmousegrab && vid_mouse.integer && !key_consoleactive && (key_dest != key_game || !cls.demoplayback))
581 if (!vid_activewindow)
582 vid_usemouse = false;
583 if (vid_isfullscreen)
585 IN_Activate(vid_usemouse);
587 if (r_render.integer)
590 if (r_speeds.integer || gl_finish.integer)
592 qglFinish();CHECKGLERROR
594 qglXSwapBuffers(vidx11_display, win);CHECKGLERROR
597 if (vid_x11_hardwaregammasupported)
598 VID_UpdateGamma(false, vid_x11_gammarampsize);
601 int VID_SetGamma(unsigned short *ramps, int rampsize)
603 return XF86VidModeSetGammaRamp(vidx11_display, vidx11_screen, rampsize, ramps, ramps + rampsize, ramps + rampsize*2);
606 int VID_GetGamma(unsigned short *ramps, int rampsize)
608 return XF86VidModeGetGammaRamp(vidx11_display, vidx11_screen, rampsize, ramps, ramps + rampsize, ramps + rampsize*2);
613 #if !defined(__APPLE__) && !defined(SUNOS)
614 Cvar_RegisterVariable (&vid_dga);
615 Cvar_RegisterVariable (&vid_dga_mouseaccel);
617 InitSig(); // trap evil signals
618 // COMMANDLINEOPTION: Input: -nomouse disables mouse support (see also vid_mouse cvar)
619 if (COM_CheckParm ("-nomouse") || COM_CheckParm("-safe"))
623 void VID_BuildGLXAttrib(int *attrib, int stencil)
625 *attrib++ = GLX_RGBA;
626 *attrib++ = GLX_RED_SIZE;*attrib++ = 1;
627 *attrib++ = GLX_GREEN_SIZE;*attrib++ = 1;
628 *attrib++ = GLX_BLUE_SIZE;*attrib++ = 1;
629 *attrib++ = GLX_DOUBLEBUFFER;
630 *attrib++ = GLX_DEPTH_SIZE;*attrib++ = 1;
631 // if stencil is enabled, ask for alpha too
634 *attrib++ = GLX_STENCIL_SIZE;*attrib++ = 8;
635 *attrib++ = GLX_ALPHA_SIZE;*attrib++ = 1;
640 int VID_InitMode(int fullscreen, int width, int height, int bpp, int refreshrate)
644 XSetWindowAttributes attr;
647 XVisualInfo *visinfo;
648 int MajorVersion, MinorVersion;
649 const char *drivername;
651 #if defined(__APPLE__) && defined(__MACH__)
652 drivername = "/usr/X11R6/lib/libGL.1.dylib";
654 drivername = "libGL.so.1";
656 // COMMANDLINEOPTION: Linux GLX: -gl_driver <drivername> selects a GL driver library, default is libGL.so.1, useful only for using fxmesa or similar, if you don't know what this is for, you don't need it
657 // COMMANDLINEOPTION: BSD GLX: -gl_driver <drivername> selects a GL driver library, default is libGL.so.1, useful only for using fxmesa or similar, if you don't know what this is for, you don't need it
658 // LordHavoc: although this works on MacOSX, it's useless there (as there is only one system libGL)
659 i = COM_CheckParm("-gl_driver");
660 if (i && i < com_argc - 1)
661 drivername = com_argv[i + 1];
662 if (!GL_OpenLibrary(drivername))
664 Con_Printf("Unable to load GL driver \"%s\"\n", drivername);
668 if (!(vidx11_display = XOpenDisplay(NULL)))
670 Con_Print("Couldn't open the X display\n");
674 vidx11_screen = DefaultScreen(vidx11_display);
675 root = RootWindow(vidx11_display, vidx11_screen);
677 // Get video mode list
678 MajorVersion = MinorVersion = 0;
679 if (!XF86VidModeQueryVersion(vidx11_display, &MajorVersion, &MinorVersion))
683 Con_DPrintf("Using XFree86-VidModeExtension Version %d.%d\n", MajorVersion, MinorVersion);
687 if ((qglXChooseVisual = (XVisualInfo *(GLAPIENTRY *)(Display *dpy, int screen, int *attribList))GL_GetProcAddress("glXChooseVisual")) == NULL
688 || (qglXCreateContext = (GLXContext (GLAPIENTRY *)(Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct))GL_GetProcAddress("glXCreateContext")) == NULL
689 || (qglXDestroyContext = (void (GLAPIENTRY *)(Display *dpy, GLXContext ctx))GL_GetProcAddress("glXDestroyContext")) == NULL
690 || (qglXMakeCurrent = (Bool (GLAPIENTRY *)(Display *dpy, GLXDrawable drawable, GLXContext ctx))GL_GetProcAddress("glXMakeCurrent")) == NULL
691 || (qglXSwapBuffers = (void (GLAPIENTRY *)(Display *dpy, GLXDrawable drawable))GL_GetProcAddress("glXSwapBuffers")) == NULL
692 || (qglXQueryExtensionsString = (const char *(GLAPIENTRY *)(Display *dpy, int screen))GL_GetProcAddress("glXQueryExtensionsString")) == NULL)
694 Con_Printf("glX functions not found in %s\n", gl_driver);
698 VID_BuildGLXAttrib(attrib, bpp == 32);
699 visinfo = qglXChooseVisual(vidx11_display, vidx11_screen, attrib);
702 Con_Print("Couldn't get an RGB, Double-buffered, Depth visual\n");
708 int best_fit, best_dist, dist, x, y;
710 // Are we going fullscreen? If so, let's change video mode
713 XF86VidModeModeLine *current_vidmode;
714 XF86VidModeModeInfo **vidmodes;
717 // This nice hack comes from the SDL source code
718 current_vidmode = (XF86VidModeModeLine*)((char*)&init_vidmode + sizeof(init_vidmode.dotclock));
719 XF86VidModeGetModeLine(vidx11_display, vidx11_screen, (int*)&init_vidmode.dotclock, current_vidmode);
721 XF86VidModeGetAllModeLines(vidx11_display, vidx11_screen, &num_vidmodes, &vidmodes);
725 for (i = 0; i < num_vidmodes; i++)
727 if (width > vidmodes[i]->hdisplay || height > vidmodes[i]->vdisplay)
730 x = width - vidmodes[i]->hdisplay;
731 y = height - vidmodes[i]->vdisplay;
732 dist = (x * x) + (y * y);
733 if (dist < best_dist)
742 // LordHavoc: changed from ActualWidth/ActualHeight =,
743 // to width/height =, so the window will take the full area of
745 width = vidmodes[best_fit]->hdisplay;
746 height = vidmodes[best_fit]->vdisplay;
748 // change to the mode
749 XF86VidModeSwitchToMode(vidx11_display, vidx11_screen, vidmodes[best_fit]);
750 vid_isfullscreen = true;
752 // Move the viewport to top left
753 XF86VidModeSetViewPort(vidx11_display, vidx11_screen, 0, 0);
762 // LordHavoc: save the visual for use in gamma ramp settings later
763 vidx11_visual = visinfo->visual;
765 /* window attributes */
766 attr.background_pixel = 0;
767 attr.border_pixel = 0;
768 // LordHavoc: save the colormap for later, too
769 vidx11_colormap = attr.colormap = XCreateColormap(vidx11_display, root, visinfo->visual, AllocNone);
770 attr.event_mask = X_MASK;
771 if (vid_isfullscreen)
773 mask = CWBackPixel | CWColormap | CWSaveUnder | CWBackingStore | CWEventMask | CWOverrideRedirect;
774 attr.override_redirect = True;
775 attr.backing_store = NotUseful;
776 attr.save_under = False;
779 mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
781 win = XCreateWindow(vidx11_display, root, 0, 0, width, height, 0, visinfo->depth, InputOutput, visinfo->visual, mask, &attr);
782 XStoreName(vidx11_display, win, gamename);
783 XMapWindow(vidx11_display, win);
785 // LordHavoc: making the close button on a window do the right thing
786 // seems to involve this mess, sigh...
787 wm_delete_window_atom = XInternAtom(vidx11_display, "WM_DELETE_WINDOW", false);
788 XSetWMProtocols(vidx11_display, win, &wm_delete_window_atom, 1);
790 if (vid_isfullscreen)
792 XMoveWindow(vidx11_display, win, 0, 0);
793 XRaiseWindow(vidx11_display, win);
794 XWarpPointer(vidx11_display, None, win, 0, 0, 0, 0, 0, 0);
795 XFlush(vidx11_display);
796 // Move the viewport to top left
797 XF86VidModeSetViewPort(vidx11_display, vidx11_screen, 0, 0);
800 //XSync(vidx11_display, False);
802 ctx = qglXCreateContext(vidx11_display, visinfo, NULL, True);
805 Con_Printf ("glXCreateContext failed\n");
809 if (!qglXMakeCurrent(vidx11_display, win, ctx))
811 Con_Printf ("glXMakeCurrent failed\n");
815 XSync(vidx11_display, False);
817 if ((qglGetString = (const GLubyte* (GLAPIENTRY *)(GLenum name))GL_GetProcAddress("glGetString")) == NULL)
819 Con_Printf ("glGetString not found in %s\n", gl_driver);
823 gl_renderer = (const char *)qglGetString(GL_RENDERER);
824 gl_vendor = (const char *)qglGetString(GL_VENDOR);
825 gl_version = (const char *)qglGetString(GL_VERSION);
826 gl_extensions = (const char *)qglGetString(GL_EXTENSIONS);
828 gl_platformextensions = qglXQueryExtensionsString(vidx11_display, vidx11_screen);
830 gl_videosyncavailable = false;
832 // COMMANDLINEOPTION: Linux GLX: -nogetprocaddress disables GLX_ARB_get_proc_address (not required, more formal method of getting extension functions)
833 // COMMANDLINEOPTION: BSD GLX: -nogetprocaddress disables GLX_ARB_get_proc_address (not required, more formal method of getting extension functions)
834 // COMMANDLINEOPTION: MacOSX GLX: -nogetprocaddress disables GLX_ARB_get_proc_address (not required, more formal method of getting extension functions)
835 GL_CheckExtension("GLX_ARB_get_proc_address", getprocaddressfuncs, "-nogetprocaddress", false);
836 // COMMANDLINEOPTION: Linux GLX: -novideosync disables GLX_SGI_swap_control
837 // COMMANDLINEOPTION: BSD GLX: -novideosync disables GLX_SGI_swap_control
838 // COMMANDLINEOPTION: MacOSX GLX: -novideosync disables GLX_SGI_swap_control
839 gl_videosyncavailable = GL_CheckExtension("GLX_SGI_swap_control", swapcontrolfuncs, "-novideosync", false);
841 vid_usingmouse = false;
842 vid_usingvsync = false;
844 vid_activewindow = true;
845 vid_x11_hardwaregammasupported = XF86VidModeGetGammaRampSize(vidx11_display, vidx11_screen, &vid_x11_gammarampsize) != 0;
850 void Sys_SendKeyEvents(void)
859 in_mouse_x = mouse_x;
860 in_mouse_y = mouse_y;